summaryrefslogtreecommitdiff
path: root/modules/core/ns_saset.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-08-17 19:27:37 -0400
committerAdam <Adam@anope.org>2010-08-17 19:27:37 -0400
commite65d8b2f3dfdb40858259b3bb48ef6998c31e62f (patch)
treefd845bdef5664d025ab19c262ae2c5e9d23d7bb2 /modules/core/ns_saset.cpp
parent2575008baa5c9d0ca789680da1a3b81dc74786f7 (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_saset.cpp')
-rw-r--r--modules/core/ns_saset.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/modules/core/ns_saset.cpp b/modules/core/ns_saset.cpp
index 6de0a66a7..73cb706b9 100644
--- a/modules/core/ns_saset.cpp
+++ b/modules/core/ns_saset.cpp
@@ -35,17 +35,17 @@ class CommandNSSASet : public Command
if (readonly)
{
- notice_lang(Config.s_NickServ, u, NICK_SASET_DISABLED);
+ notice_lang(Config->s_NickServ, u, NICK_SASET_DISABLED);
return MOD_CONT;
}
NickAlias *na = findnick(nick);
if (!na)
- notice_lang(Config.s_NickServ, u, NICK_SASET_BAD_NICK, nick.c_str());
+ notice_lang(Config->s_NickServ, u, NICK_SASET_BAD_NICK, 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 if (na->nc->HasFlag(NI_SUSPENDED))
- notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, na->nick.c_str());
+ notice_lang(Config->s_NickServ, u, NICK_X_SUSPENDED, na->nick.c_str());
else
{
Command *c = this->FindCommand(params[1]);
@@ -58,7 +58,7 @@ class CommandNSSASet : public Command
mod_run_cmd(NickServ, u, c, params[1], cmdparams);
}
else
- notice_lang(Config.s_NickServ, u, NICK_SASET_UNKNOWN_OPTION, cmd.c_str());
+ notice_lang(Config->s_NickServ, u, NICK_SASET_UNKNOWN_OPTION, cmd.c_str());
}
return MOD_CONT;
@@ -68,10 +68,10 @@ class CommandNSSASet : public Command
{
if (subcommand.empty())
{
- notice_help(Config.s_NickServ, u, NICK_HELP_SASET_HEAD);
+ notice_help(Config->s_NickServ, u, NICK_HELP_SASET_HEAD);
for (subcommand_map::iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it)
it->second->OnServHelp(u);
- notice_help(Config.s_NickServ, u, NICK_HELP_SASET_TAIL);
+ notice_help(Config->s_NickServ, u, NICK_HELP_SASET_TAIL);
return true;
}
else
@@ -87,12 +87,12 @@ class CommandNSSASet : public Command
void OnSyntaxError(User *u, const Anope::string &subcommand)
{
- syntax_error(Config.s_NickServ, u, "SASET", NICK_SASET_SYNTAX);
+ syntax_error(Config->s_NickServ, u, "SASET", NICK_SASET_SYNTAX);
}
void OnServHelp(User *u)
{
- notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET);
+ notice_lang(Config->s_NickServ, u, NICK_HELP_CMD_SASET);
}
bool AddSubcommand(Command *c)
@@ -132,30 +132,30 @@ class CommandNSSASetDisplay : public Command
NickAlias *na = findnick(params[1]);
if (!na || na->nc != nc)
{
- notice_lang(Config.s_NickServ, u, NICK_SASET_DISPLAY_INVALID, nc->display.c_str());
+ notice_lang(Config->s_NickServ, u, NICK_SASET_DISPLAY_INVALID, nc->display.c_str());
return MOD_CONT;
}
change_core_display(nc, params[1]);
- notice_lang(Config.s_NickServ, u, NICK_SASET_DISPLAY_CHANGED, nc->display.c_str());
+ notice_lang(Config->s_NickServ, u, NICK_SASET_DISPLAY_CHANGED, nc->display.c_str());
return MOD_CONT;
}
bool OnHelp(User *u, const Anope::string &)
{
- notice_help(Config.s_NickServ, u, NICK_HELP_SASET_DISPLAY);
+ notice_help(Config->s_NickServ, u, NICK_HELP_SASET_DISPLAY);
return true;
}
void OnSyntaxError(User *u, const Anope::string &)
{
// XXX
- syntax_error(Config.s_NickServ, u, "SASET", NICK_SASET_SYNTAX);
+ syntax_error(Config->s_NickServ, u, "SASET", NICK_SASET_SYNTAX);
}
void OnServHelp(User *u)
{
- notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_DISPLAY);
+ notice_lang(Config->s_NickServ, u, NICK_HELP_CMD_SASET_DISPLAY);
}
};
@@ -174,38 +174,38 @@ class CommandNSSASetPassword : public Command
size_t len = params[1].length();
- if (Config.NSSecureAdmins && u->Account() != nc && nc->IsServicesOper())
+ if (Config->NSSecureAdmins && u->Account() != nc && nc->IsServicesOper())
{
- notice_lang(Config.s_NickServ, u, ACCESS_DENIED);
+ notice_lang(Config->s_NickServ, u, ACCESS_DENIED);
return MOD_CONT;
}
- else if (nc->display.equals_ci(params[1]) || (Config.StrictPasswords && len < 5))
+ else if (nc->display.equals_ci(params[1]) || (Config->StrictPasswords && len < 5))
{
- notice_lang(Config.s_NickServ, u, MORE_OBSCURE_PASSWORD);
+ notice_lang(Config->s_NickServ, u, MORE_OBSCURE_PASSWORD);
return MOD_CONT;
}
- else if (len > Config.PassLen)
+ else if (len > Config->PassLen)
{
- notice_lang(Config.s_NickServ, u, PASSWORD_TOO_LONG);
+ notice_lang(Config->s_NickServ, u, PASSWORD_TOO_LONG);
return MOD_CONT;
}
if (enc_encrypt(params[1], nc->pass))
{
- Alog() << Config.s_NickServ << ": Failed to encrypt password for " << nc->display << " (saset)";
- notice_lang(Config.s_NickServ, u, NICK_SASET_PASSWORD_FAILED, nc->display.c_str());
+ Alog() << Config->s_NickServ << ": Failed to encrypt password for " << nc->display << " (saset)";
+ notice_lang(Config->s_NickServ, u, NICK_SASET_PASSWORD_FAILED, nc->display.c_str());
return MOD_CONT;
}
Anope::string tmp_pass;
if (enc_decrypt(nc->pass, tmp_pass) == 1)
- notice_lang(Config.s_NickServ, u, NICK_SASET_PASSWORD_CHANGED_TO, nc->display.c_str(), tmp_pass.c_str());
+ notice_lang(Config->s_NickServ, u, NICK_SASET_PASSWORD_CHANGED_TO, nc->display.c_str(), tmp_pass.c_str());
else
- notice_lang(Config.s_NickServ, u, NICK_SASET_PASSWORD_CHANGED, nc->display.c_str());
+ notice_lang(Config->s_NickServ, u, NICK_SASET_PASSWORD_CHANGED, nc->display.c_str());
- Alog() << Config.s_NickServ << ": " << u->GetMask() << " used SASET PASSWORD on " << nc->display << " (e-mail: "<< (!nc->email.empty() ? nc->email : "none") << ")";
+ Alog() << Config->s_NickServ << ": " << u->GetMask() << " used SASET PASSWORD on " << nc->display << " (e-mail: "<< (!nc->email.empty() ? nc->email : "none") << ")";
- if (Config.WallSetpass)
+ if (Config->WallSetpass)
ircdproto->SendGlobops(NickServ, "\2%s\2 used SASET PASSWORD on \2%s\2", u->nick.c_str(), nc->display.c_str());
return MOD_CONT;
@@ -213,18 +213,18 @@ class CommandNSSASetPassword : public Command
bool OnHelp(User *u, const Anope::string &)
{
- notice_help(Config.s_NickServ, u, NICK_HELP_SASET_PASSWORD);
+ notice_help(Config->s_NickServ, u, NICK_HELP_SASET_PASSWORD);
return true;
}
void OnSyntaxError(User *u, const Anope::string &)
{
- syntax_error(Config.s_NickServ, u, "SASET", NICK_SASET_SYNTAX);
+ syntax_error(Config->s_NickServ, u, "SASET", NICK_SASET_SYNTAX);
}
void OnServHelp(User *u)
{
- notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_PASSWORD);
+ notice_lang(Config->s_NickServ, u, NICK_HELP_CMD_SASET_PASSWORD);
}
};