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 /modules/core/ns_sendpass.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 'modules/core/ns_sendpass.cpp')
-rw-r--r-- | modules/core/ns_sendpass.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/modules/core/ns_sendpass.cpp b/modules/core/ns_sendpass.cpp index 30783a5b6..e5695e37e 100644 --- a/modules/core/ns_sendpass.cpp +++ b/modules/core/ns_sendpass.cpp @@ -27,12 +27,12 @@ class CommandNSSendPass : public Command Anope::string nick = params[0]; NickAlias *na; - if (Config.RestrictMail && !u->Account()->HasCommand("nickserv/sendpass")) - notice_lang(Config.s_NickServ, u, ACCESS_DENIED); + if (Config->RestrictMail && !u->Account()->HasCommand("nickserv/sendpass")) + notice_lang(Config->s_NickServ, u, ACCESS_DENIED); else if (!(na = findnick(nick))) - notice_lang(Config.s_NickServ, u, NICK_X_NOT_REGISTERED, nick.c_str()); + notice_lang(Config->s_NickServ, u, NICK_X_NOT_REGISTERED, nick.c_str()); else if (na->HasFlag(NS_FORBIDDEN)) - notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, na->nick.c_str()); + notice_lang(Config->s_NickServ, u, NICK_X_FORBIDDEN, na->nick.c_str()); else { Anope::string tmp_pass; @@ -40,12 +40,12 @@ class CommandNSSendPass : public Command { if (SendPassMail(u, na, tmp_pass)) { - Alog() << Config.s_NickServ << ": " << u->GetMask() << " used SENDPASS on " << nick; - notice_lang(Config.s_NickServ, u, NICK_SENDPASS_OK, nick.c_str()); + Alog() << Config->s_NickServ << ": " << u->GetMask() << " used SENDPASS on " << nick; + notice_lang(Config->s_NickServ, u, NICK_SENDPASS_OK, nick.c_str()); } } else - notice_lang(Config.s_NickServ, u, NICK_SENDPASS_UNAVAILABLE); + notice_lang(Config->s_NickServ, u, NICK_SENDPASS_UNAVAILABLE); } return MOD_CONT; @@ -53,18 +53,18 @@ class CommandNSSendPass : public Command bool OnHelp(User *u, const Anope::string &subcommand) { - notice_help(Config.s_NickServ, u, NICK_HELP_SENDPASS); + notice_help(Config->s_NickServ, u, NICK_HELP_SENDPASS); return true; } void OnSyntaxError(User *u, const Anope::string &subcommand) { - syntax_error(Config.s_NickServ, u, "SENDPASS", NICK_SENDPASS_SYNTAX); + syntax_error(Config->s_NickServ, u, "SENDPASS", NICK_SENDPASS_SYNTAX); } void OnServHelp(User *u) { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SENDPASS); + notice_lang(Config->s_NickServ, u, NICK_HELP_CMD_SENDPASS); } }; @@ -75,7 +75,7 @@ class NSSendPass : public Module public: NSSendPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { - if (!Config.UseMail) + if (!Config->UseMail) throw ModuleException("Not using mail, whut."); Anope::string tmp_pass = "plain:tmp"; @@ -94,9 +94,9 @@ static bool SendPassMail(User *u, NickAlias *na, const Anope::string &pass) char subject[BUFSIZE], message[BUFSIZE]; snprintf(subject, sizeof(subject), getstring(na, NICK_SENDPASS_SUBJECT), na->nick.c_str()); - snprintf(message, sizeof(message), getstring(na, NICK_SENDPASS), na->nick.c_str(), pass.c_str(), Config.NetworkName.c_str()); + snprintf(message, sizeof(message), getstring(na, NICK_SENDPASS), na->nick.c_str(), pass.c_str(), Config->NetworkName.c_str()); - return Mail(u, na->nc, Config.s_NickServ, subject, message); + return Mail(u, na->nc, Config->s_NickServ, subject, message); } MODULE_INIT(NSSendPass) |