summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864>2008-11-09 23:34:25 +0000
committerNaram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864>2008-11-09 23:34:25 +0000
commit8cf37b7f2e57dc3e75dd7b15e66e3ae2e83e4718 (patch)
treefe25ed6dd34ab079efae2c526479185aeca33c53
parent805efb9900984a612aa3dc3f3a00c89b3a52fb12 (diff)
Added nicklen directive to networkinfo block in new config.
Added ValidateNickLen function for the above directive. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1621 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--data/example_new.conf13
-rw-r--r--src/config.c27
2 files changed, 24 insertions, 16 deletions
diff --git a/data/example_new.conf b/data/example_new.conf
index 2cd73f917..3d021c3bb 100644
--- a/data/example_new.conf
+++ b/data/example_new.conf
@@ -201,6 +201,14 @@ networkinfo {
* This is the name of the network that Services will be running on.
*/
networkname = "LocalNet"
+
+ /*
+ * Set this to the maximum allowed nick length on your network. Anope does not
+ * support values larger than 31. Be sure to set this correctly, as setting
+ * this wrong can result in Services being disconnected from the network.
+ * This directive is optional, but recommended.
+ */
+ nicklen = 31
}
/*
@@ -212,11 +220,6 @@ networkinfo {
*/
mail
{
-# UseMail [OPTIONAL]
-#
-# This option enables the mail commands in Services. You may choose
-# to disable it if you have no sendmail-compatible mailer installed.
-# This setting is [REQUIRED] if NSEmailReg is enabled.
/*
* If set, this option enables the mail commands in Services. You may choose
* to disable it if you have no sendmail-compatible mailer installed. While
diff --git a/src/config.c b/src/config.c
index 3e143818c..688db97e2 100644
--- a/src/config.c
+++ b/src/config.c
@@ -528,6 +528,21 @@ bool ValidateDefCon(ServerConfig *, const char *tag, const char *value, ValueIte
return true;
}
+bool ValidateNickLen(ServerConfig *, const char *, const char *, ValueItem &data)
+{
+ int nicklen = data.GetInteger();
+ if (!nicklen) {
+ alog("You have not defined the <networkinfo:nicklen> directive. It is strongly");
+ alog("adviced that you do configure this correctly in your services.conf");
+ data.Set(NICKMAX - 1);
+ }
+ else if (nicklen < 1 || nicklen >= NICKMAX) {
+ alog("<networkinfo:nicklen> has an invalid value; setting to %d", NICKMAX - 1);
+ data.Set(NICKMAX - 1);
+ }
+ return true;
+}
+
void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail)
{
alog("There were errors in your configuration file: %s", errormessage.c_str());
@@ -608,6 +623,7 @@ int ServerConfig::Read(bool bail)
{"networkinfo", "logchannel", "", new ValueContainerChar(&LogChannel), DT_CHARPTR, NoValidation},
{"networkinfo", "logbot", "no", new ValueContainerBool(&LogBot), DT_BOOLEAN, NoValidation},
{"networkinfo", "networkname", "", new ValueContainerChar(&NetworkName), DT_CHARPTR, ValidateNotEmpty},
+ {"networkinfo", "nicklen", "0", new ValueContainerInt(&NickLen), DT_INTEGER | DT_NORELOAD, ValidateNickLen},
{"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},
@@ -1324,7 +1340,6 @@ Directive directives[] = {
{"MysqlRetryGap", {{PARAM_POSINT, PARAM_RELOAD, &MysqlRetryGap}}},
{"ModuleAutoload", {{PARAM_STRING, PARAM_RELOAD, &Modules}}},
{"NewsCount", {{PARAM_POSINT, PARAM_RELOAD, &NewsCount}}},
- {"NickLen", {{PARAM_POSINT, 0, &NickLen}}},
{"NickRegDelay", {{PARAM_POSINT, PARAM_RELOAD, &NickRegDelay}}},
{"NoBackupOkay", {{PARAM_SET, PARAM_RELOAD, &NoBackupOkay}}},
{"ReadTimeout", {{PARAM_TIME, PARAM_RELOAD, &ReadTimeout}}},
@@ -1660,16 +1675,6 @@ int read_config(int reload)
retval = 0;
}
}
-
- if (NickLen == 0) {
- alog("You have not defined the NickLen configuration directive. It is strongly");
- alog("advised that you do configure this correctly in your services.conf");
- NickLen = NICKMAX - 1;
- } else if ((NickLen < 1) || (NickLen >= NICKMAX)) {
- alog("NickLen has an invalid value; setting to %d",
- (NICKMAX - 1));
- NickLen = NICKMAX - 1;
- }
}
CHECK(EncModule);