mirror of
https://github.com/anope/anope.git
synced 2026-07-03 06:13:13 +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:
@@ -29,13 +29,13 @@ class CommandMSCancel : public Command
|
||||
MemoInfo *mi;
|
||||
|
||||
if (!u->IsRecognized())
|
||||
notice_lang(Config.s_MemoServ, u, NICK_IDENTIFY_REQUIRED, Config.s_NickServ.c_str());
|
||||
notice_lang(Config->s_MemoServ, u, NICK_IDENTIFY_REQUIRED, Config->s_NickServ.c_str());
|
||||
else if (!(mi = getmemoinfo(name, ischan, isforbid)))
|
||||
{
|
||||
if (isforbid)
|
||||
notice_lang(Config.s_MemoServ, u, ischan ? CHAN_X_FORBIDDEN : NICK_X_FORBIDDEN, name.c_str());
|
||||
notice_lang(Config->s_MemoServ, u, ischan ? CHAN_X_FORBIDDEN : NICK_X_FORBIDDEN, name.c_str());
|
||||
else
|
||||
notice_lang(Config.s_MemoServ, u, ischan ? CHAN_X_NOT_REGISTERED : NICK_X_NOT_REGISTERED, name.c_str());
|
||||
notice_lang(Config->s_MemoServ, u, ischan ? CHAN_X_NOT_REGISTERED : NICK_X_NOT_REGISTERED, name.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -46,29 +46,29 @@ class CommandMSCancel : public Command
|
||||
{
|
||||
FOREACH_MOD(I_OnMemoDel, OnMemoDel(findnick(name)->nc, mi, mi->memos[i]->number));
|
||||
delmemo(mi, mi->memos[i]->number);
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_CANCELLED, name.c_str());
|
||||
notice_lang(Config->s_MemoServ, u, MEMO_CANCELLED, name.c_str());
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_CANCEL_NONE);
|
||||
notice_lang(Config->s_MemoServ, u, MEMO_CANCEL_NONE);
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
bool OnHelp(User *u, const Anope::string &subcommand)
|
||||
{
|
||||
notice_help(Config.s_MemoServ, u, MEMO_HELP_CANCEL);
|
||||
notice_help(Config->s_MemoServ, u, MEMO_HELP_CANCEL);
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnSyntaxError(User *u, const Anope::string &subcommand)
|
||||
{
|
||||
syntax_error(Config.s_MemoServ, u, "CANCEL", MEMO_CANCEL_SYNTAX);
|
||||
syntax_error(Config->s_MemoServ, u, "CANCEL", MEMO_CANCEL_SYNTAX);
|
||||
}
|
||||
|
||||
void OnServHelp(User *u)
|
||||
{
|
||||
notice_lang(Config.s_MemoServ, u, MEMO_HELP_CMD_CANCEL);
|
||||
notice_lang(Config->s_MemoServ, u, MEMO_HELP_CMD_CANCEL);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user