Skip to content

Commit

Permalink
properly report channel bans in .bans
Browse files Browse the repository at this point in the history
  • Loading branch information
vanosg committed Jan 14, 2024
1 parent bf2c80b commit a786c7a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/mod/channels.mod/userchan.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ static void display_invite(int idx, int number, maskrec *invite,
static void tell_bans(int idx, int show_inact, char *match)
{
int k = 1;
char *chname;
char *chname = NULL;
struct chanset_t *chan = NULL;
maskrec *u;

Expand Down Expand Up @@ -788,7 +788,16 @@ static void tell_bans(int idx, int show_inact, char *match)
} else
display_ban(idx, k++, u, chan, show_inact);
}
if (chan) {
for (chan = chanset; chan; chan = chan->next) {
/* Show a channel's bans if:
* - the console is set to *
* - the console is set to this channel
* - we're matching a mask
* - this channel was specifically requested in .bans
*/
if ( (!strcmp(dcc[idx].u.chat->con_chan, "*")) ||
(!strcmp(dcc[idx].u.chat->con_chan, chan->dname) && (!chname || match[0])) ||
(chname && !strcasecmp(chname, chan->dname)) ) {
if (show_inact)
dprintf(idx, "%s %s: (! = %s, * = %s)\n",
BANS_BYCHANNEL, chan->dname, MODES_NOTACTIVE2, MODES_NOTBYBOT);
Expand All @@ -801,6 +810,9 @@ static void tell_bans(int idx, int show_inact, char *match)
(wild_match(match, u->desc)) || (wild_match(match, u->user)))
display_ban(idx, k, u, chan, 1);
k++;
} else if (chname && !strcasecmp(chname, chan->dname)) {
display_ban(idx, k, u, chan, 0);
k++;
} else
display_ban(idx, k++, u, chan, show_inact);
}
Expand Down Expand Up @@ -831,6 +843,7 @@ static void tell_bans(int idx, int show_inact, char *match)
}
}
}
}
}
if (k == 1)
dprintf(idx, "(There are no bans, permanent or otherwise.)\n");
Expand Down

0 comments on commit a786c7a

Please sign in to comment.