From 834736070e2d3fb5c189bfa4848cf14fe4a6abd7 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sun, 2 Jan 2022 13:09:33 +0100 Subject: [PATCH] Make "SVS(2)MODE -b user" work properly for extended bans. It was missing for a lot of extbans (removing too little) and for ~t it was removing too much (eg quiet bans). Bug reported and changes suggested by k4be. Coders: Setting extban.options to EXTBOPT_CHSVSMODE has no effect anymore, just didn't want to remove it so modules would still compile. We now purely match based on .is_banned_events including BANCHK_JOIN. --- include/modules.h | 2 +- src/modules/extbans/realname.c | 2 +- src/modules/extbans/timedban.c | 1 - src/modules/svsmode.c | 4 ++-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/modules.h b/include/modules.h index 62054cf86..c97a3bb4b 100644 --- a/include/modules.h +++ b/include/modules.h @@ -394,7 +394,7 @@ typedef enum ExtbanType { #define EXTBANTABLESZ 32 typedef enum ExtbanOptions { - EXTBOPT_CHSVSMODE=0x1, /**< SVSMODE -b/-e/-I will clear this ban */ + EXTBOPT_CHSVSMODE=0x1, /**< SVSMODE -b/-e/-I will clear this ban (UNUSED as of 6.0.1+) */ EXTBOPT_ACTMODIFIER=0x2, /**< Action modifier (not a matcher). These are extended bans like ~q/~n/~j. */ EXTBOPT_NOSTACKCHILD=0x4, /**< Disallow prefixing with another extban. Eg disallow ~n:~T:censor:xyz */ EXTBOPT_INVEX=0x8, /**< Available for use with +I too */ diff --git a/src/modules/extbans/realname.c b/src/modules/extbans/realname.c index 074948e38..f2e94c9b1 100644 --- a/src/modules/extbans/realname.c +++ b/src/modules/extbans/realname.c @@ -43,7 +43,7 @@ MOD_INIT() req.conv_param = extban_realname_conv_param; req.is_banned = extban_realname_is_banned; req.is_banned_events = BANCHK_ALL|BANCHK_TKL; - req.options = EXTBOPT_CHSVSMODE|EXTBOPT_INVEX|EXTBOPT_TKL; + req.options = EXTBOPT_INVEX|EXTBOPT_TKL; if (!ExtbanAdd(modinfo->handle, req)) { config_error("could not register extended ban type"); diff --git a/src/modules/extbans/timedban.c b/src/modules/extbans/timedban.c index 5ec418cde..af20c524b 100644 --- a/src/modules/extbans/timedban.c +++ b/src/modules/extbans/timedban.c @@ -78,7 +78,6 @@ MOD_INIT() extban.letter = 't'; extban.name = "time"; extban.options |= EXTBOPT_ACTMODIFIER; /* not really, but ours shouldn't be stacked from group 1 */ - extban.options |= EXTBOPT_CHSVSMODE; /* so "SVSMODE -nick" will unset affected ~t extbans */ extban.options |= EXTBOPT_INVEX; /* also permit timed invite-only exceptions (+I) */ extban.conv_param = timedban_extban_conv_param; extban.is_ok = timedban_extban_is_ok; diff --git a/src/modules/svsmode.c b/src/modules/svsmode.c index 5fb402588..2a2a4aece 100644 --- a/src/modules/svsmode.c +++ b/src/modules/svsmode.c @@ -136,7 +136,7 @@ void unban_user(Client *client, Channel *channel, Client *acptr, char chmode) } else if (chmode != 'I' && *ban->banstr == '~' && (extban = findmod_by_bantype(ban->banstr, &nextbanstr))) { - if ((extban->options & EXTBOPT_CHSVSMODE) && (extban->is_banned_events & b->ban_check_types)) + if (extban->is_banned_events & b->ban_check_types) { b->banstr = nextbanstr; if (extban->is_banned(b)) @@ -176,7 +176,7 @@ void clear_bans(Client *client, Channel *channel, char chmode) bnext = ban->next; if (chmode != 'I' && (*ban->banstr == '~') && (extban = findmod_by_bantype(ban->banstr, NULL))) { - if (!(extban->options & EXTBOPT_CHSVSMODE)) + if (!(extban->is_banned_events & BANCHK_JOIN)) continue; } add_send_mode_param(channel, client, '-', chmode, ban->banstr);