Просмотр исходного кода

* Fix cmd_slowpart issues

It was using free()'d memory via (chan)
Bryan Drewery 17 лет назад
Родитель
Сommit
49fca842bb
2 измененных файлов с 14 добавлено и 9 удалено
  1. 1 0
      doc/UPDATES
  2. 13 9
      src/mod/channels.mod/cmdschan.c

+ 1 - 0
doc/UPDATES

@@ -14,6 +14,7 @@
 * Cleanup +r implementation a bit to lookup users more often than only on join. (fixes #127)
 * If a user does not have a console setting, they will be given default settings on login.
 * Fix a case where the temporary file was not cleaned up when exiting config editor (-C) (fixes #428)
+* Fix cmd_slowpart issues
 
 1.2.16 - http://wraith.botpack.net/milestone/1.2.16
 * Add 'set altchars' so that alternative characters used for nicks can be changed. (fixes #418)

+ 13 - 9
src/mod/channels.mod/cmdschan.c

@@ -612,18 +612,10 @@ static void cmd_slowpart(int idx, char *par)
     dprintf(idx, "No such channel %s\n", chname);
     return;
   }
-  remove_channel(chan);
-  if (conf.bot->hub)
-    write_userfile(-1);
-  dprintf(idx, "Channel %s removed from the bot.\n", chname);
-  dprintf(idx, "This includes any channel specific bans, invites, exemptions and user records that you set.\n");
 
-  if (findchan_by_dname(chname)) {
-    dprintf(idx, "Failed to remove channel.\n");
-    return;
-  }
   if (conf.bot->hub)
     count = 0;
+
   for (bot = tandbot; bot; bot = bot->next) {
     char tmp[100] = "";
 
@@ -647,6 +639,18 @@ static void cmd_slowpart(int idx, char *par)
         putbot(bot->bot, tmp);
     }  
   }
+
+  remove_channel(chan);
+  if (conf.bot->hub)
+    write_userfile(-1);
+  dprintf(idx, "Channel %s removed from the bot.\n", chname);
+  dprintf(idx, "This includes any channel specific bans, invites, exemptions and user records that you set.\n");
+
+  if (findchan_by_dname(chname)) {
+    dprintf(idx, "Failed to remove channel.\n");
+    return;
+  }
+
   dprintf(idx, "%i bots parting %s during the next %i seconds\n", count, chname, delay);
   if (!conf.bot->hub)
     dprintf(DP_MODE, "PART %s\n", chname);