[IRCServices Coding] [IRCServices] akick not setting channel ban

Andrew Church achurch at achurch.org
Sun Dec 7 19:44:33 PST 2008


It does indeed look like the lack of a check can lead to desyncs, causing
the failure to set a ban you originally reported.  I'll make a release
soon with the fix included.

Thanks for figuring this out!

  --Andrew Church
    achurch at achurch.org
    http://achurch.org/

>| 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);
>------------------------------------------------------------------
>To unsubscribe or change your subscription options, visit:
>http://lists.ircservices.za.net/mailman/listinfo/ircservices-coding