use modeBuffer in recover_chan function and call it when someone ops a bot on a channel
authorpk910 <philipp@zoelle1.de>
Sun, 1 Jul 2012 15:10:38 +0000 (17:10 +0200)
committerpk910 <philipp@zoelle1.de>
Sun, 1 Jul 2012 15:10:38 +0000 (17:10 +0200)
src/modules/NeonBackup.mod/bot_NeonBackup.c
src/modules/NeonServ.mod/event_neonserv_mode.c

index 19cffbde99cd6caafcbe9e4e2c6c05f9bcd44939..6cabdda853a8ef85d3ea4dce8cd60b245c93fc3d 100644 (file)
@@ -136,11 +136,14 @@ void neonbackup_recover_chan(struct ChanNode *chan) {
     if(!bot) //no opped bots present... channel can't be recovered
         return;
     struct ClientSocket *target;
+    struct ModeBuffer *modeBuf;
+    modeBuf = initModeBuffer(bot, chan);
     for(target = getBots(SOCKET_FLAG_READY, NULL); target; target = getBots(SOCKET_FLAG_READY, target)) {
         if((target->flags & SOCKET_FLAG_REQUEST_OP) && (chanuser = getChanUser(target->user, chan)) && !(chanuser->flags & CHANUSERFLAG_OPPED)) {
-            putsock(bot, "MODE %s +o %s", chan->name, target->user->nick);
+            modeBufferOp(modeBuf, target->user->nick);
         }
     }
+    freeModeBuffer(modeBuf);
 }
 
 static void neonbackup_event_join(struct ChanUser *chanuser) {
index 56696cb87e657d8b9181ca024785be7d1f399898..4ec84c5cf4016d80ea5d225cd9ae8899ede62d9f 100644 (file)
@@ -131,6 +131,10 @@ static void neonserv_event_mode_async1(struct ClientSocket *client, struct UserN
                     //someone deopped the bot???
                     if(!neonserv_cmd_mode_botwar_detect(client, user, chan, &botwar_detect_executed))
                                                requestOp(client->user, chan);
+                } else if(modes[i] == 'o' && add && isBot(cuser)) {
+                    //someone opped a bot
+                    if(!neonserv_cmd_mode_botwar_detect(client, user, chan, &botwar_detect_executed))
+                                               module_neonbackup_recover_chan(chan);
                 }
                 if((modes[i] == 'o' || (modes[i] == 'h' && !with_halfops)) && !(add && isBot(cuser))) {
                     if(uaccess < db_canop) {