diff options
-rw-r--r-- | data/example_new.conf | 7 | ||||
-rw-r--r-- | src/config.c | 18 |
2 files changed, 21 insertions, 4 deletions
diff --git a/data/example_new.conf b/data/example_new.conf index 34ffca9f2..31c8d1cf0 100644 --- a/data/example_new.conf +++ b/data/example_new.conf @@ -417,6 +417,13 @@ options { * down/restarting. This directive is optional. */ #globaloncycle = yes + + /* + * This is the global message that will be sent when Services are being + * shutdown/restarted. This directive is only required if you enable + * globaloncycle above. + */ + globaloncycledown = "Services are restarting, they will be back shortly - please be good while we're gone" } /* diff --git a/src/config.c b/src/config.c index 85b2b0aee..67627fb7d 100644 --- a/src/config.c +++ b/src/config.c @@ -553,6 +553,17 @@ bool ValidateMail(ServerConfig *, const char *tag, const char *value, ValueItem return true; } +bool ValidateGlobalOnCycle(ServerConfig *, const char *tag, const char *value, ValueItem &data) +{ + if (GlobalOnCycle) { + if (!*data.GetString()) { + alog("<%s:%s> was undefined, disabling <options:globaloncycle>", tag, value); + GlobalOnCycle = false; + } + } + return true; +} + void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail) { alog("There were errors in your configuration file: %s", errormessage.c_str()); @@ -656,6 +667,7 @@ int ServerConfig::Read(bool bail) {"options", "logusers", "no", new ValueContainerBool(&LogUsers), DT_BOOLEAN, NoValidation}, {"options", "hidestatso", "no", new ValueContainerBool(&HideStatsO), DT_BOOLEAN, NoValidation}, {"options", "globaloncycle", "no", new ValueContainerBool(&GlobalOnCycle), DT_BOOLEAN, NoValidation}, + {"options", "globaloncycledown", "", new ValueContainerChar(&GlobalOnCycleMessage), DT_CHARPTR, ValidateGlobalOnCycle}, {"nickserv", "nick", "NickServ", new ValueContainerChar(&s_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, {"nickserv", "description", "Nickname Registration Service", new ValueContainerChar(&desc_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, {"nickserv", "database", "nick.db", new ValueContainerChar(&NickDBName), DT_CHARPTR, ValidateNotEmpty}, @@ -1389,8 +1401,6 @@ Directive directives[] = { {PARAM_STRING, 0, &RemotePassword3}}}, {"RestrictOperNicks", {{PARAM_SET, PARAM_RELOAD, &RestrictOperNicks}}}, {"AnonymousGlobal", {{PARAM_SET, PARAM_RELOAD, &AnonymousGlobal}}}, - {"GlobalOnCycleMessage", - {{PARAM_STRING, PARAM_RELOAD, &GlobalOnCycleMessage}}}, {"GlobalOnCycleUP", {{PARAM_STRING, PARAM_RELOAD, &GlobalOnCycleUP}}}, {"UseSVSHOLD", {{PARAM_SET, PARAM_RELOAD, &UseSVSHOLD}}}, {"UseTS6", {{PARAM_SET, 0, &UseTS6}}}, @@ -1906,8 +1916,8 @@ int read_config(int reload) } if (GlobalOnCycle) { - if (!GlobalOnCycleMessage && !GlobalOnCycleUP) { - alog("GlobalOnCycleMessage and GlobalOnCycleUP are not defined; disabling GlobalOnCycle"); + if (!GlobalOnCycleUP) { + alog("GlobalOnCycleUP are not defined; disabling GlobalOnCycle"); GlobalOnCycle = false; } } |