From bb419b95d1aafbd9da828ad434757ccd5eea93f3 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sun, 28 May 2023 20:25:02 +0200 Subject: [PATCH] Remove set::maxbanlength as it is not useful and only confusing. https://www.unrealircd.org/docs/Set_block#set::maxbanlength --- doc/RELEASE-NOTES.md | 5 +++++ include/dynconf.h | 3 --- src/channel.c | 13 ++++--------- src/conf.c | 8 ++------ src/modules/extbans/textban.c | 4 ---- 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/doc/RELEASE-NOTES.md b/doc/RELEASE-NOTES.md index 629db6456..e3f863663 100644 --- a/doc/RELEASE-NOTES.md +++ b/doc/RELEASE-NOTES.md @@ -111,6 +111,11 @@ in progress and may not be a stable version. * The [`require module` block](https://www.unrealircd.org/docs/Require_module_block) was only checked of one side of the link, thus partially not working. +### Removed: +* [set::maxbanlength](https://www.unrealircd.org/docs/Set_block#set::maxbanlength) + has been removed as it was not deemed useful and only confusing + to users and admins. + ### Developers and protocol: * Server to server lines can now be 16384 bytes in size when `PROTOCTL BIGLINES` is set. This will allow us to do things more diff --git a/include/dynconf.h b/include/dynconf.h index 483f533f3..54bf5cbee 100644 --- a/include/dynconf.h +++ b/include/dynconf.h @@ -126,7 +126,6 @@ struct Configuration { int spamfilter_stop_on_first_match; int spamfilter_utf8; int maxbans; - int maxbanlength; int watch_away_notification; int uhnames; unsigned short default_ipv6_clone_mask; @@ -249,7 +248,6 @@ extern MODVAR int ipv6_disabled; #define CHECK_TARGET_NICK_BANS iConf.check_target_nick_bans #define MAXBANS iConf.maxbans -#define MAXBANLENGTH iConf.maxbanlength #define WATCH_AWAY_NOTIFICATION iConf.watch_away_notification @@ -299,7 +297,6 @@ struct SetCheck { unsigned has_default_bantime:1; unsigned has_who_limit:1; unsigned has_maxbans:1; - unsigned has_maxbanlength:1; unsigned has_silence_limit:1; unsigned has_ban_version_tkl_time:1; unsigned has_spamfilter_ban_time:1; diff --git a/src/channel.c b/src/channel.c index 1f9522012..5176531d0 100644 --- a/src/channel.c +++ b/src/channel.c @@ -249,15 +249,14 @@ int identical_ban(const char *one, const char *two) int add_listmode_ex(Ban **list, Client *client, Channel *channel, const char *banid, const char *setby, time_t seton) { Ban *ban; - int cnt = 0, len; + int cnt = 0; int do_not_add = 0; char isnew = 0; //if (MyUser(client)) // collapse(banid); - len = strlen(banid); - if (!*list && ((len > MAXBANLENGTH) || (MAXBANS < 1))) + if (!*list && (MAXBANS < 1)) { if (MyUser(client)) { @@ -268,14 +267,10 @@ int add_listmode_ex(Ban **list, Client *client, Channel *channel, const char *ba } for (ban = *list; ban; ban = ban->next) { - len += strlen(ban->banstr); - /* Check MAXBANLENGTH / MAXBANS only for local clients - * and 'me' (for +b's set during +f). + /* Check MAXBANS only for local clients and 'me' (for +b's set during +f). */ - if ((MyUser(client) || IsMe(client)) && ((len > MAXBANLENGTH) || (++cnt >= MAXBANS))) - { + if ((MyUser(client) || IsMe(client)) && (++cnt >= MAXBANS)) do_not_add = 1; - } if (identical_ban(ban->banstr, banid)) break; /* update existing ban (potentially) */ } diff --git a/src/conf.c b/src/conf.c index 606b27b53..b01cd9c3d 100644 --- a/src/conf.c +++ b/src/conf.c @@ -1680,7 +1680,6 @@ void config_setdefaultsettings(Configuration *i) safe_strdup(i->channel_command_prefix, "`!."); i->check_target_nick_bans = 1; i->maxbans = 60; - i->maxbanlength = 2048; safe_strdup(i->level_on_join, "o"); i->watch_away_notification = 1; i->uhnames = 1; @@ -7600,9 +7599,6 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) else if (!strcmp(cep->name, "maxbans")) { tempiConf.maxbans = atol(cep->value); } - else if (!strcmp(cep->name, "maxbanlength")) { - tempiConf.maxbanlength = atol(cep->value); - } else if (!strcmp(cep->name, "silence-limit")) { tempiConf.silence_limit = atol(cep->value); } @@ -8275,8 +8271,8 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) CheckDuplicate(cep, maxbans, "maxbans"); } else if (!strcmp(cep->name, "maxbanlength")) { - CheckNull(cep); - CheckDuplicate(cep, maxbanlength, "maxbanlength"); + config_warn("%s:%d: set::maxbanlength no longer exists as it was not deemed useful, this setting is now ignored.", + cep->file->filename, cep->line_number); } else if (!strcmp(cep->name, "silence-limit")) { CheckNull(cep); diff --git a/src/modules/extbans/textban.c b/src/modules/extbans/textban.c index cc241f5a5..da7235844 100644 --- a/src/modules/extbans/textban.c +++ b/src/modules/extbans/textban.c @@ -31,10 +31,6 @@ * that do not have halfops or higher, and only channels that have any * textbans set. * UPDATE: The speed impact for 15 bans per channel is 42 usec PEAK. - * HINT: If you are hitting the "normal banlimit" before you actually hit this - * one, then you might want to tweak the #define MAXBANS and #define - * MAXBANLENGTH in include/struct.h. Doubling MAXBANLENGTH is usually - * a good idea, and then you can enlarge MAXBANS too a bit if you want to. */ #define MAX_EXTBANT_PER_CHAN 15 /* Max number of ~T bans in a channel. */