summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/example_new.conf6
-rw-r--r--src/config.c7
2 files changed, 10 insertions, 3 deletions
diff --git a/data/example_new.conf b/data/example_new.conf
index aae44c0eb..5387e54b8 100644
--- a/data/example_new.conf
+++ b/data/example_new.conf
@@ -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"
}
diff --git a/src/config.c b/src/config.c
index f822dbedb..acf0ce7d4 100644
--- a/src/config.c
+++ b/src/config.c
@@ -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);
}
/**