1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 03:43:12 +02:00

Rewrote the config reader to better handle invalid configs.

This prevents Anope from exploding when /os reload has errors.
This commit is contained in:
Adam
2010-08-17 19:27:37 -04:00
parent 2575008baa
commit e65d8b2f3d
195 changed files with 3133 additions and 3249 deletions
+14 -14
View File
@@ -31,47 +31,47 @@ class CommandNSGetPass : public Command
{
if ((nr = findrequestnick(nick)))
{
Alog() << Config.s_NickServ << ": " << u->GetMask() << " used GETPASS on " << nick;
if (Config.WallGetpass)
Alog() << Config->s_NickServ << ": " << u->GetMask() << " used GETPASS on " << nick;
if (Config->WallGetpass)
ircdproto->SendGlobops(NickServ, "\2%s\2 used GETPASS on \2%s\2", u->nick.c_str(), nick.c_str());
notice_lang(Config.s_NickServ, u, NICK_GETPASS_PASSCODE_IS, nick.c_str(), nr->passcode.c_str());
notice_lang(Config->s_NickServ, u, NICK_GETPASS_PASSCODE_IS, nick.c_str(), nr->passcode.c_str());
}
else
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());
else if (Config.NSSecureAdmins && na->nc->IsServicesOper())
notice_lang(Config.s_NickServ, u, ACCESS_DENIED);
notice_lang(Config->s_NickServ, u, NICK_X_FORBIDDEN, na->nick.c_str());
else if (Config->NSSecureAdmins && na->nc->IsServicesOper())
notice_lang(Config->s_NickServ, u, ACCESS_DENIED);
else
{
if (enc_decrypt(na->nc->pass, tmp_pass) == 1)
{
Alog() << Config.s_NickServ << ": " << u->GetMask() << " used GETPASS on " << nick;
if (Config.WallGetpass)
Alog() << Config->s_NickServ << ": " << u->GetMask() << " used GETPASS on " << nick;
if (Config->WallGetpass)
ircdproto->SendGlobops(NickServ, "\2%s\2 used GETPASS on \2%s\2", u->nick.c_str(), nick.c_str());
notice_lang(Config.s_NickServ, u, NICK_GETPASS_PASSWORD_IS, nick.c_str(), tmp_pass.c_str());
notice_lang(Config->s_NickServ, u, NICK_GETPASS_PASSWORD_IS, nick.c_str(), tmp_pass.c_str());
}
else
notice_lang(Config.s_NickServ, u, NICK_GETPASS_UNAVAILABLE);
notice_lang(Config->s_NickServ, u, NICK_GETPASS_UNAVAILABLE);
}
return MOD_CONT;
}
bool OnHelp(User *u, const Anope::string &subcommand)
{
notice_help(Config.s_NickServ, u, NICK_SERVADMIN_HELP_GETPASS);
notice_help(Config->s_NickServ, u, NICK_SERVADMIN_HELP_GETPASS);
return true;
}
void OnSyntaxError(User *u, const Anope::string &subcommand)
{
syntax_error(Config.s_NickServ, u, "GETPASS", NICK_GETPASS_SYNTAX);
syntax_error(Config->s_NickServ, u, "GETPASS", NICK_GETPASS_SYNTAX);
}
void OnServHelp(User *u)
{
notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_GETPASS);
notice_lang(Config->s_NickServ, u, NICK_HELP_CMD_GETPASS);
}
};