mirror of
https://github.com/anope/anope.git
synced 2026-06-30 06:56:37 +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:
@@ -26,9 +26,9 @@ class CommandNSSetMessage : public Command
|
||||
if (!nc)
|
||||
throw CoreException("NULL nc in CommandNSSetMessage");
|
||||
|
||||
if (!Config.UsePrivmsg)
|
||||
if (!Config->UsePrivmsg)
|
||||
{
|
||||
notice_lang(Config.s_NickServ, u, NICK_SASET_OPTION_DISABLED, "MSG");
|
||||
notice_lang(Config->s_NickServ, u, NICK_SASET_OPTION_DISABLED, "MSG");
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
@@ -37,12 +37,12 @@ class CommandNSSetMessage : public Command
|
||||
if (param.equals_ci("ON"))
|
||||
{
|
||||
nc->SetFlag(NI_MSG);
|
||||
notice_lang(Config.s_NickServ, u, NICK_SASET_MSG_ON, nc->display.c_str());
|
||||
notice_lang(Config->s_NickServ, u, NICK_SASET_MSG_ON, nc->display.c_str());
|
||||
}
|
||||
else if (param.equals_ci("OFF"))
|
||||
{
|
||||
nc->UnsetFlag(NI_MSG);
|
||||
notice_lang(Config.s_NickServ, u, NICK_SASET_MSG_OFF, nc->display.c_str());
|
||||
notice_lang(Config->s_NickServ, u, NICK_SASET_MSG_OFF, nc->display.c_str());
|
||||
}
|
||||
else
|
||||
this->OnSyntaxError(u, "MSG");
|
||||
@@ -52,18 +52,18 @@ class CommandNSSetMessage : public Command
|
||||
|
||||
bool OnHelp(User *u, const Anope::string &)
|
||||
{
|
||||
notice_help(Config.s_NickServ, u, NICK_HELP_SET_MSG);
|
||||
notice_help(Config->s_NickServ, u, NICK_HELP_SET_MSG);
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnSyntaxError(User *u, const Anope::string &)
|
||||
{
|
||||
syntax_error(Config.s_NickServ, u, "SET MSG", NICK_SET_MSG_SYNTAX);
|
||||
syntax_error(Config->s_NickServ, u, "SET MSG", NICK_SET_MSG_SYNTAX);
|
||||
}
|
||||
|
||||
void OnServHelp(User *u)
|
||||
{
|
||||
notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_MSG);
|
||||
notice_lang(Config->s_NickServ, u, NICK_HELP_CMD_SET_MSG);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -76,18 +76,18 @@ class CommandNSSASetMessage : public CommandNSSetMessage
|
||||
|
||||
bool OnHelp(User *u, const Anope::string &)
|
||||
{
|
||||
notice_help(Config.s_NickServ, u, NICK_HELP_SASET_MSG);
|
||||
notice_help(Config->s_NickServ, u, NICK_HELP_SASET_MSG);
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnSyntaxError(User *u, const Anope::string &)
|
||||
{
|
||||
syntax_error(Config.s_NickServ, u, "SASET MSG", NICK_SASET_MSG_SYNTAX);
|
||||
syntax_error(Config->s_NickServ, u, "SASET MSG", NICK_SASET_MSG_SYNTAX);
|
||||
}
|
||||
|
||||
void OnServHelp(User *u)
|
||||
{
|
||||
notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_MSG);
|
||||
notice_lang(Config->s_NickServ, u, NICK_HELP_CMD_SASET_MSG);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user