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.
pull/41/head
Bram Matthys 1 year ago
parent 46bdc1c5e1
commit 834736070e
No known key found for this signature in database
GPG Key ID: BF8116B163EAAE98

@ -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 */

@ -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");

@ -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;

@ -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);

Loading…
Cancel
Save