diff options
-rw-r--r-- | data/example_new.conf | 12 | ||||
-rw-r--r-- | src/config.c | 9 |
2 files changed, 20 insertions, 1 deletions
diff --git a/data/example_new.conf b/data/example_new.conf index 935e2aed5..5c3bbff2d 100644 --- a/data/example_new.conf +++ b/data/example_new.conf @@ -378,4 +378,16 @@ chanserv * recommended. If not set, the default is 14 days. */ expire = 14d + + /* + * The default ban type for newly registered channels (and when importing old databases). + * + * defbantype can be: + * + * 0: ban in the form of *!user@host + * 1: ban in the form of *!*user@host + * 2: ban in the form of *!*@host + * 3: ban in the form of *!*user@*.domain + */ + defbantype = 2 } diff --git a/src/config.c b/src/config.c index d0fce64e1..beebbead5 100644 --- a/src/config.c +++ b/src/config.c @@ -476,6 +476,13 @@ bool ValidateGuestPrefix(ServerConfig *conf, const char *tag, const char *value, return true; } +bool ValidateBantype(ServerConfig *, const char *, const char *, ValueItem &data) +{ + int bantype = data.GetInteger(); + if (bantype < 0 || bantype > 3) throw ConfigException("The value for <chanserv:defbantype> must be between 0 and 3!"); + return true; +} + void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail) { alog("There were errors in your configuration file: %s", errormessage.c_str()); @@ -578,6 +585,7 @@ int ServerConfig::Read(bool bail) {"chanserv", "defaults", "keetopic secure securefounder signkick", new ValueContainerString(&CSDefaults), DT_BOOLEAN, NoValidation}, {"chanserv", "maxregistered", "0", new ValueContainerInt(&CSMaxReg), DT_INTEGER, NoValidation}, {"chanserv", "expire", "14d", new ValueContainerTime(&CSExpire), DT_TIME, NoValidation}, + {"chanserv", "defbantype", "2", new ValueContainerInt(&CSDefBantype), DT_INTEGER, ValidateBantype}, {NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation} }; /* These tags can occur multiple times, and therefore they have special code to read them @@ -1183,7 +1191,6 @@ Directive directives[] = { {"CSAutokickMax", {{PARAM_POSINT, PARAM_RELOAD, &CSAutokickMax}}}, {"CSAutokickReason", {{PARAM_STRING, PARAM_RELOAD, &CSAutokickReason}}}, - {"CSDefBantype", {{PARAM_INT, PARAM_RELOAD, &CSDefBantype}}}, {"CSInhabit", {{PARAM_TIME, PARAM_RELOAD, &CSInhabit}}}, {"CSListMax", {{PARAM_POSINT, PARAM_RELOAD, &CSListMax}}}, {"CSListOpersOnly", {{PARAM_SET, PARAM_RELOAD, &CSListOpersOnly}}}, |