mirror of
https://github.com/anope/anope.git
synced 2026-07-05 11:03:12 +02:00
Started defcon block in new config, added defaultlevel directive to it.
Added ValidateDefCon function to validate certain DefCon related directives. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1491 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -864,3 +864,20 @@ operserv
|
||||
*/
|
||||
opersonly = yes
|
||||
}
|
||||
|
||||
/*
|
||||
* [OPTIONAL] DefCon Config
|
||||
*
|
||||
* This section is used to set up the DefCon system of OperServ. The block is optional and can be
|
||||
* removed if you wish to disable DefCon in it's entirety. Unless specified otherwise, all directives
|
||||
* are required if you do wish to use DefCon.
|
||||
*/
|
||||
defcon
|
||||
{
|
||||
/*
|
||||
* Default DefCon level (1-5) to use when starting Services up. Level 5 constitutes normal operation
|
||||
* while level 1 constitutes the most restrictive operation. If this setting is left out or set to
|
||||
* 0, DefCon will be disabled and the rest of this block will be ignored.
|
||||
*/
|
||||
#defaultlevel = 5
|
||||
}
|
||||
|
||||
+13
-1
@@ -513,6 +513,18 @@ bool ValidateLimitSessions(ServerConfig *, const char *tag, const char *value, V
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateDefCon(ServerConfig *, const char *tag, const char *value, ValueItem &data)
|
||||
{
|
||||
if (static_cast<std::string>(value) == "defaultlevel") {
|
||||
int level = data.GetInteger();
|
||||
if (!level) return true;
|
||||
if (level > 5) throw ConfigException("The value for <defcon:defaultlevel> must be between 1 through 5 if you wish to use DefCon or 0 if you wish to disable it!");
|
||||
}
|
||||
else if (DefConLevel) {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail)
|
||||
{
|
||||
alog("There were errors in your configuration file: %s", errormessage.c_str());
|
||||
@@ -678,6 +690,7 @@ int ServerConfig::Read(bool bail)
|
||||
{"operserv", "sessionautokillexpiry", "0", new ValueContainerTime(&SessionAutoKillExpiry), DT_TIME, NoValidation},
|
||||
{"operserv", "addakiller", "no", new ValueContainerBool(&AddAkiller), DT_BOOLEAN, NoValidation},
|
||||
{"opserver", "opersonly", "no", new ValueContainerBool(&OSOpersOnly), DT_BOOLEAN, NoValidation},
|
||||
{"defcon", "defaultlevel", "0", new ValueContainerInt(&DefConLevel), DT_INTEGER, ValidateDefCon},
|
||||
{NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation}
|
||||
};
|
||||
/* These tags can occur multiple times, and therefore they have special code to read them
|
||||
@@ -1258,7 +1271,6 @@ Directive directives[] = {
|
||||
{"DontQuoteAddresses",
|
||||
{{PARAM_SET, PARAM_RELOAD, &DontQuoteAddresses}}},
|
||||
{"DumpCore", {{PARAM_SET, 0, &DumpCore}}},
|
||||
{"DefConLevel", {{PARAM_INT, PARAM_RELOAD, &DefConLevel}}},
|
||||
{"DefCon1", {{PARAM_INT, PARAM_RELOAD, &DefCon1}}},
|
||||
{"DefCon2", {{PARAM_INT, PARAM_RELOAD, &DefCon2}}},
|
||||
{"DefCon3", {{PARAM_INT, PARAM_RELOAD, &DefCon3}}},
|
||||
|
||||
Reference in New Issue
Block a user