1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 13:16:38 +02:00

Added message directive to defcon block in new config.

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1499 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Naram Qashat cyberbotx@cyberbotx.com
2008-10-27 03:08:55 +00:00
parent 3d3b03fbc6
commit c59fccb7f9
2 changed files with 10 additions and 3 deletions
+6
View File
@@ -942,4 +942,10 @@ defcon
* changes. This directive is optional.
*/
#globalondefconmore = yes
/*
* Defines the message that will be sent on DefCon level changes when globalondefconmore is set.
* This directive is required only when globalondefconmore is set.
*/
#message = "Put your message to send your users here. Dont forget to uncomment globalondefconmore"
}
+4 -3
View File
@@ -523,6 +523,9 @@ bool ValidateDefCon(ServerConfig *, const char *tag, const char *value, ValueIte
if ((static_cast<std::string>(value).substr(0, 5) == "level" && isdigit(value[5])) || static_cast<std::string>(value) == "chanmodes") {
if (!*data.GetString()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> cannot be empty when DefCon is enabled!");
}
else if (static_cast<std::string>(value) == "message" && GlobalOnDefconMore) {
if (!*data.GetString()) throw ConfigException("The value for <defcon:message> cannot be empty when globalondefconmore is enabled!");
}
else if (static_cast<std::string>(value) == "sessionlimit" || static_cast<std::string>(value) == "akillexpire") {
if (!data.GetInteger()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> must be non-zero when DefCon is enabled!");
}
@@ -706,6 +709,7 @@ int ServerConfig::Read(bool bail)
{"defcon", "timeout", "0", new ValueContainerTime(&DefConTimeOut), DT_TIME, NoValidation},
{"defcon", "globalondefcon", "no", new ValueContainerBool(&GlobalOnDefcon), DT_BOOLEAN, NoValidation},
{"defcon", "globalondefconmore", "no", new ValueContainerBool(&GlobalOnDefconMore), DT_BOOLEAN, NoValidation},
{"defcon", "message", "", new ValueContainerChar(&DefconMessage), DT_CHARPTR, ValidateDefCon},
{NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation}
};
/* These tags can occur multiple times, and therefore they have special code to read them
@@ -1363,7 +1367,6 @@ Directive directives[] = {
{"UseTS6", {{PARAM_SET, 0, &UseTS6}}},
{"UnRestrictSAdmin", {{PARAM_SET, PARAM_RELOAD, &UnRestrictSAdmin}}},
{"WarningTimeout", {{PARAM_TIME, PARAM_RELOAD, &WarningTimeout}}},
{"DefconMessage", {{PARAM_STRING, PARAM_RELOAD, &DefconMessage}}},
{"UlineServers", {{PARAM_STRING, PARAM_RELOAD, &UlineServers}}},
};
@@ -1985,8 +1988,6 @@ int read_config(int reload)
CHECK(DefConChanModes);
}
}
if (GlobalOnDefconMore)
CHECK(DefconMessage);
}
/**