mirror of
https://github.com/anope/anope.git
synced 2026-07-03 22:43: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:
@@ -38,21 +38,21 @@ class CommandCSBan : 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_BAN) : !check_access(u, ci, CA_BANME))
|
||||
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);
|
||||
/*
|
||||
* Dont ban/kick the user on channels where he is excepted
|
||||
* to prevent services <-> server wars.
|
||||
*/
|
||||
else if (ModeManager::FindChannelModeByName(CMODE_EXCEPT) && is_excepted(ci, u2))
|
||||
notice_lang(Config.s_ChanServ, u, CHAN_EXCEPTED, u2->nick.c_str(), ci->name.c_str());
|
||||
notice_lang(Config->s_ChanServ, u, CHAN_EXCEPTED, u2->nick.c_str(), ci->name.c_str());
|
||||
else if (u2->IsProtected())
|
||||
notice_lang(Config.s_ChanServ, u, ACCESS_DENIED);
|
||||
notice_lang(Config->s_ChanServ, u, ACCESS_DENIED);
|
||||
else
|
||||
{
|
||||
Anope::string mask;
|
||||
@@ -75,18 +75,18 @@ class CommandCSBan : public Command
|
||||
|
||||
bool OnHelp(User *u, const Anope::string &subcommand)
|
||||
{
|
||||
notice_help(Config.s_ChanServ, u, CHAN_HELP_BAN);
|
||||
notice_help(Config->s_ChanServ, u, CHAN_HELP_BAN);
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnSyntaxError(User *u, const Anope::string &subcommand)
|
||||
{
|
||||
syntax_error(Config.s_ChanServ, u, "BAN", CHAN_BAN_SYNTAX);
|
||||
syntax_error(Config->s_ChanServ, u, "BAN", CHAN_BAN_SYNTAX);
|
||||
}
|
||||
|
||||
void OnServHelp(User *u)
|
||||
{
|
||||
notice_lang(Config.s_ChanServ, u, CHAN_HELP_CMD_BAN);
|
||||
notice_lang(Config->s_ChanServ, u, CHAN_HELP_CMD_BAN);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user