1
0
mirror of https://github.com/anope/anope.git synced 2026-07-04 23:33:12 +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:
Adam
2010-08-17 19:27:37 -04:00
parent 2575008baa
commit e65d8b2f3d
195 changed files with 3133 additions and 3249 deletions
+12 -7
View File
@@ -22,26 +22,31 @@ class CommandOSReload : public Command
CommandReturn Execute(User *u, const std::vector<Anope::string> &params)
{
if (!read_config(1))
try
{
quitmsg = "Error during the reload of the configuration file!";
quitting = true;
ServerConfig *newconfig = new ServerConfig();
delete Config;
Config = newconfig;
FOREACH_MOD(I_OnReload, OnReload(false));
}
catch (const ConfigException &ex)
{
Alog() << "Error reloading configuration file: " << ex.GetReason();
}
FOREACH_MOD(I_OnReload, OnReload(false));
notice_lang(Config.s_OperServ, u, OPER_RELOAD);
notice_lang(Config->s_OperServ, u, OPER_RELOAD);
return MOD_CONT;
}
bool OnHelp(User *u, const Anope::string &subcommand)
{
notice_help(Config.s_OperServ, u, OPER_HELP_RELOAD);
notice_help(Config->s_OperServ, u, OPER_HELP_RELOAD);
return true;
}
void OnServHelp(User *u)
{
notice_lang(Config.s_OperServ, u, OPER_HELP_CMD_RELOAD);
notice_lang(Config->s_OperServ, u, OPER_HELP_CMD_RELOAD);
}
};