diff options
Diffstat (limited to 'src/mail.cpp')
-rw-r--r-- | src/mail.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mail.cpp b/src/mail.cpp index ca6edcffa..3f24e3a54 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -16,13 +16,13 @@ Mail::Message::Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &a, const Anope::string &s, const Anope::string &m) : Thread() , sendmail_path(Config->GetBlock("mail")->Get<const Anope::string>("sendmailpath")) - , send_from(sf), mail_to(mailto) + , send_from(sf) + , mail_to(mailto) , addr(a) , subject(s) , message(m) , content_type(Config->GetBlock("mail")->Get<const Anope::string>("content_type", "text/plain; charset=UTF-8")) , dont_quote_addresses(Config->GetBlock("mail")->Get<bool>("dontquoteaddresses")) - , success(false) { } @@ -144,13 +144,15 @@ bool Mail::Validate(const Anope::string &email) return false; /* Check for forbidden characters in the name */ - for (unsigned i = 0, end = copy.length(); i < end; ++i) + for (auto chr : copy) { - if (copy[i] <= 31 || copy[i] >= 127) + if (chr <= 31 || chr >= 127) return false; - for (unsigned int j = 0; j < 13; ++j) - if (copy[i] == specials[j]) + for (auto special : specials) + { + if (chr == special) return false; + } } /* Check for forbidden characters in the domain */ @@ -158,9 +160,11 @@ bool Mail::Validate(const Anope::string &email) { if (domain[i] <= 31 || domain[i] >= 127) return false; - for (unsigned int j = 0; j < 13; ++j) - if (domain[i] == specials[j]) + for (auto special : specials) + { + if (domain[i] == special) return false; + } if (domain[i] == '.') { if (!i || i == end - 1) |