[IRCServices Coding] [IRCServices] akick not setting channel ban
Aragon Gouveia
aragon at phat.za.net
Tue Nov 25 12:59:27 PST 2008
| By Aragon Gouveia <aragon at phat.za.net>
| [ 2008-11-25 14:10 +0200 ]
> So I've changed do_cmode:
>
> case 'b':
> if (add) {
> int i = find_ban(chan, av[0]);
> if (i == -1) {
> ARRAY_EXTEND(chan->bans);
> chan->bans[chan->bans_count-1] = sstrdup(av[0]);
> }
>
>
> Which I've tested with some oper assisted relinking and things look much
> better now. I believe 5.1's do_cmode will cause the same problems (it looks
> the same as 5.0's).
Below is a diff against 5.1.13 that I reworked a little better than above.
Not sure if the extra logging is desirable, and I'm assuming do_cmode() and
find_ban() work the same in 5.1. :)
Regards,
Aragon
--- channels.c.orig Tue Nov 25 22:48:24 2008
+++ channels.c Tue Nov 25 22:53:56 2008
@@ -360,11 +360,16 @@
break;
case 'b':
+ int i = find_ban(chan, av[0]);
if (add) {
- ARRAY_EXTEND(chan->bans);
- chan->bans[chan->bans_count-1] = sstrdup(av[0]);
+ if (i == -1) {
+ ARRAY_EXTEND(chan->bans);
+ chan->bans[chan->bans_count-1] = sstrdup(av[0]);
+ } else {
+ log("channel: MODE %s +b %s: ban already exists",
+ chan->name, *av);
+ }
} else {
- int i = find_ban(chan, av[0]);
if (i >= 0) {
free(chan->bans[i]);
ARRAY_REMOVE(chan->bans, i);