mirror of
https://github.com/anope/anope.git
synced 2026-07-07 00:43:14 +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:
@@ -35,12 +35,12 @@ class CommandOSChanKill : public Command
|
||||
last_param = 2;
|
||||
}
|
||||
|
||||
expires = !expiry.empty() ? dotime(expiry) : Config.ChankillExpiry;
|
||||
expires = !expiry.empty() ? dotime(expiry) : Config->ChankillExpiry;
|
||||
if (!expiry.empty() && isdigit(expiry[expiry.length() - 1]))
|
||||
expires *= 86400;
|
||||
if (expires && expires < 60)
|
||||
{
|
||||
notice_lang(Config.s_OperServ, u, BAD_EXPIRY_TIME);
|
||||
notice_lang(Config->s_OperServ, u, BAD_EXPIRY_TIME);
|
||||
return MOD_CONT;
|
||||
}
|
||||
else if (expires > 0)
|
||||
@@ -58,7 +58,7 @@ class CommandOSChanKill : public Command
|
||||
if (!reason.empty())
|
||||
{
|
||||
Anope::string realreason;
|
||||
if (Config.AddAkiller)
|
||||
if (Config->AddAkiller)
|
||||
realreason = "[" + u->nick + "] " + reason;
|
||||
else
|
||||
realreason = reason;
|
||||
@@ -75,29 +75,29 @@ class CommandOSChanKill : public Command
|
||||
SGLine->Add(OperServ, u, "*@" + uc->user->host, expires, realreason);
|
||||
SGLine->Check(uc->user);
|
||||
}
|
||||
if (Config.WallOSAkill)
|
||||
if (Config->WallOSAkill)
|
||||
ircdproto->SendGlobops(OperServ, "%s used CHANKILL on %s (%s)", u->nick.c_str(), channel.c_str(), realreason.c_str());
|
||||
}
|
||||
else
|
||||
notice_lang(Config.s_OperServ, u, CHAN_X_NOT_IN_USE, channel.c_str());
|
||||
notice_lang(Config->s_OperServ, u, CHAN_X_NOT_IN_USE, channel.c_str());
|
||||
}
|
||||
return MOD_CONT;
|
||||
}
|
||||
|
||||
bool OnHelp(User *u, const Anope::string &subcommand)
|
||||
{
|
||||
notice_help(Config.s_OperServ, u, OPER_HELP_CHANKILL);
|
||||
notice_help(Config->s_OperServ, u, OPER_HELP_CHANKILL);
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnSyntaxError(User *u, const Anope::string &subcommand)
|
||||
{
|
||||
syntax_error(Config.s_OperServ, u, "CHANKILL", OPER_CHANKILL_SYNTAX);
|
||||
syntax_error(Config->s_OperServ, u, "CHANKILL", OPER_CHANKILL_SYNTAX);
|
||||
}
|
||||
|
||||
void OnServHelp(User *u)
|
||||
{
|
||||
notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_CHANKILL);
|
||||
notice_lang(Config->s_OperServ, u, OPER_HELP_CMD_CHANKILL);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user