diff options
author | Adam <Adam@anope.org> | 2010-08-17 19:27:37 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-08-17 19:27:37 -0400 |
commit | e65d8b2f3dfdb40858259b3bb48ef6998c31e62f (patch) | |
tree | fd845bdef5664d025ab19c262ae2c5e9d23d7bb2 /src/mail.cpp | |
parent | 2575008baa5c9d0ca789680da1a3b81dc74786f7 (diff) |
Rewrote the config reader to better handle invalid configs.
This prevents Anope from exploding when /os reload has errors.
Diffstat (limited to 'src/mail.cpp')
-rw-r--r-- | src/mail.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mail.cpp b/src/mail.cpp index b5e2149f9..1cfdd6c09 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -11,13 +11,13 @@ MailThread::~MailThread() void MailThread::Run() { - FILE *pipe = popen(Config.SendMailPath.c_str(), "w"); + FILE *pipe = popen(Config->SendMailPath.c_str(), "w"); if (!pipe) return; - fprintf(pipe, "From: %s\n", Config.SendFrom.c_str()); - if (Config.DontQuoteAddresses) + fprintf(pipe, "From: %s\n", Config->SendFrom.c_str()); + if (Config->DontQuoteAddresses) fprintf(pipe, "To: %s <%s>\n", MailTo.c_str(), Addr.c_str()); else fprintf(pipe, "To: \"%s\" <%s>\n", MailTo.c_str(), Addr.c_str()); @@ -37,9 +37,9 @@ bool Mail(User *u, NickRequest *nr, const Anope::string &service, const Anope::s time_t t = time(NULL); - if (!Config.UseMail) + if (!Config->UseMail) notice_lang(service, u, MAIL_DISABLED); - else if (t - u->lastmail < Config.MailDelay) + else if (t - u->lastmail < Config->MailDelay) notice_lang(service, u, MAIL_DELAYED, t - u->lastmail); else if (nr->email.empty()) notice_lang(service, u, MAIL_INVALID, nr->nick.c_str()); @@ -60,9 +60,9 @@ bool Mail(User *u, NickCore *nc, const Anope::string &service, const Anope::stri time_t t = time(NULL); - if (!Config.UseMail) + if (!Config->UseMail) notice_lang(service, u, MAIL_DISABLED); - else if (t - u->lastmail < Config.MailDelay) + else if (t - u->lastmail < Config->MailDelay) notice_lang(service, u, MAIL_DELAYED, t - u->lastmail); else if (nc->email.empty()) notice_lang(service, u, MAIL_INVALID, nc->display.c_str()); @@ -78,7 +78,7 @@ bool Mail(User *u, NickCore *nc, const Anope::string &service, const Anope::stri bool Mail(NickCore *nc, const Anope::string &subject, const Anope::string &message) { - if (!Config.UseMail || !nc || nc->email.empty() || subject.empty() || message.empty()) + if (!Config->UseMail || !nc || nc->email.empty() || subject.empty() || message.empty()) return false; nc->lastmail = time(NULL); |