mirror of
https://github.com/anope/anope.git
synced 2026-07-05 06:53:12 +02:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
+16
-11
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user