mirror of
https://github.com/anope/anope.git
synced 2026-07-01 15:26:39 +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:
@@ -38,17 +38,17 @@ class CommandCSKick : public Command
|
||||
ci = c->ci;
|
||||
|
||||
if (!c)
|
||||
notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan.c_str());
|
||||
notice_lang(Config->s_ChanServ, u, CHAN_X_NOT_IN_USE, chan.c_str());
|
||||
else if (is_same ? !(u2 = u) : !(u2 = finduser(target)))
|
||||
notice_lang(Config.s_ChanServ, u, NICK_X_NOT_IN_USE, target.c_str());
|
||||
notice_lang(Config->s_ChanServ, u, NICK_X_NOT_IN_USE, target.c_str());
|
||||
else if (!is_same ? !check_access(u, ci, CA_KICK) : !check_access(u, ci, CA_KICKME))
|
||||
notice_lang(Config.s_ChanServ, u, ACCESS_DENIED);
|
||||
notice_lang(Config->s_ChanServ, u, ACCESS_DENIED);
|
||||
else if (!is_same && (ci->HasFlag(CI_PEACE)) && get_access(u2, ci) >= get_access(u, ci))
|
||||
notice_lang(Config.s_ChanServ, u, ACCESS_DENIED);
|
||||
notice_lang(Config->s_ChanServ, u, ACCESS_DENIED);
|
||||
else if (u2->IsProtected())
|
||||
notice_lang(Config.s_ChanServ, u, ACCESS_DENIED);
|
||||
notice_lang(Config->s_ChanServ, u, ACCESS_DENIED);
|
||||
else if (!c->FindUser(u2))
|
||||
notice_lang(Config.s_ChanServ, u, NICK_X_NOT_ON_CHAN, u2->nick.c_str(), c->name.c_str());
|
||||
notice_lang(Config->s_ChanServ, u, NICK_X_NOT_ON_CHAN, u2->nick.c_str(), c->name.c_str());
|
||||
else
|
||||
{
|
||||
if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !check_access(u, ci, CA_SIGNKICK)))
|
||||
@@ -61,18 +61,18 @@ class CommandCSKick : public Command
|
||||
|
||||
bool OnHelp(User *u, const Anope::string &subcommand)
|
||||
{
|
||||
notice_help(Config.s_ChanServ, u, CHAN_HELP_KICK);
|
||||
notice_help(Config->s_ChanServ, u, CHAN_HELP_KICK);
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnSyntaxError(User *u, const Anope::string &subcommand)
|
||||
{
|
||||
syntax_error(Config.s_ChanServ, u, "KICK", CHAN_KICK_SYNTAX);
|
||||
syntax_error(Config->s_ChanServ, u, "KICK", CHAN_KICK_SYNTAX);
|
||||
}
|
||||
|
||||
void OnServHelp(User *u)
|
||||
{
|
||||
notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_KICK);
|
||||
notice_lang(Config->s_ChanServ, u, CHAN_HELP_CMD_KICK);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user