allow any removals of bot matching bans (even if user has no access to remove bans)
authorpk910 <philipp@zoelle1.de>
Tue, 23 Oct 2012 21:28:58 +0000 (23:28 +0200)
committerpk910 <philipp@zoelle1.de>
Tue, 23 Oct 2012 21:28:58 +0000 (23:28 +0200)
src/modules/NeonServ.mod/event_neonserv_mode.c

index 79264931d1298b08d241547c8c360d2ac131bb0e..87d4495f9d4697aad51f82bdd08aaf1e05ecafa2 100644 (file)
@@ -202,8 +202,22 @@ static void neonserv_event_mode_async1(struct ClientSocket *client, struct UserN
                     db_canban = -1;
                 }
                 if(db_canban == -1) {
-                    if(!neonserv_cmd_mode_botwar_detect(client, user, chan, &botwar_detect_executed))
+                    if(!neonserv_cmd_mode_botwar_detect(client, user, chan, &botwar_detect_executed)) {
+                        if(!add) {
+                            //check if a user just removed a bot ban
+                            for(chanuser = getChannelUsers(chan, NULL); chanuser; chanuser = getChannelUsers(chan, chanuser)) {
+                                cuser = chanuser->user;
+                                sprintf(usermask, "%s!%s@%s", cuser->nick, cuser->ident, cuser->host);
+                                if(!match(carg, usermask) && isBot(cuser)) {
+                                    skip = 1;
+                                    break;
+                                }
+                            }
+                            if(skip)
+                                break;
+                        }
                         modeBufferSet(modeBuf, !add, modes[i], carg);
+                    }
                     if(uaccess < db_getop)
                         deop_user = 1;
                     break;