Selaa lähdekoodia

* Port [3170] to 1.2.13
* Fix cmd_mns_chan not sharing console changes. (fixes #328)



svn: 3171

Bryan Drewery 19 vuotta sitten
vanhempi
commit
fefd795f00
4 muutettua tiedostoa jossa 14 lisäystä ja 12 poistoa
  1. 1 0
      doc/UPDATES
  2. 8 4
      src/mod/channels.mod/cmdschan.c
  3. 4 7
      src/mod/console.mod/console.c
  4. 1 1
      src/mod/console.mod/console.h

+ 1 - 0
doc/UPDATES

@@ -21,6 +21,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fix cmd_console not working for +private channels correctly (fixes #325)
 * -user on a bot now works on linked bots. (fixes #200)
 * Fix cmd_link being used to link to non-hubs. (fixes #329)
+* Fix cmd_mns_chan not sharing console changes. (fixes #328)
 
 1.2.12 - http://wraith.shatow.net/milestone/1.2.12
 * Clearing a variable via 'set var -' now resets that variable to default settings. (implements #111)

+ 8 - 4
src/mod/channels.mod/cmdschan.c

@@ -6,6 +6,7 @@
 
 
 #include <ctype.h>
+#include "src/mod/console.mod/console.h"
 
 static struct flag_record user	 = {FR_GLOBAL | FR_CHAN, 0, 0, 0 };
 static struct flag_record victim = {FR_GLOBAL | FR_CHAN, 0, 0, 0 };
@@ -1030,14 +1031,17 @@ static void mns_chan(int idx, char *par, char *bot)
   }
 
   if (!bot) {
-    for (i = 0; i < dcc_total; i++)
-      if (dcc[i].type && (dcc[i].type->flags & DCT_CHAT) && !rfc_casecmp(dcc[i].u.chat->con_chan, chan->dname)) {
+    for (i = 0; i < dcc_total; i++) {
+      if (dcc[i].type && (dcc[i].type->flags & DCT_CHAT) && 
+          !rfc_casecmp(dcc[i].u.chat->con_chan, chan->dname)) {
         dprintf(i, "%s is no longer a valid channel, changing your console to '*'\n", chname);
         strcpy(dcc[i].u.chat->con_chan, "*");
-      } 
+        console_dostore(i, 0);
+      }
+    }
     remove_channel(chan);
     if (conf.bot->hub)
-      write_userfile(-1);
+      write_userfile(idx);
     dprintf(idx, "Channel %s removed from the botnet.\n", chname);
     dprintf(idx, "This includes any channel specific bans, invites, exemptions and user records that you set.\n");
   } else

+ 4 - 7
src/mod/console.mod/console.c

@@ -20,8 +20,6 @@
 #include "src/misc.h"
 #include "src/core_binds.h"
 
-static int console_autosave = 1;
-
 struct console_info {
   char *channel;
   int conflags;
@@ -285,7 +283,7 @@ console_chon(char *handle, int idx)
 }
 
 static int
-console_store(int idx, char *par)
+console_store(int idx, char *par, bool displaySave)
 {
   struct console_info *i = (struct console_info *) get_user(&USERENTRY_CONSOLE, dcc[idx].user);
 
@@ -341,16 +339,15 @@ console_store(int idx, char *par)
   set_user(&USERENTRY_CONSOLE, dcc[idx].user, i);
   dprintf(idx, "Console setting stored.\n");
   if (conf.bot->hub)
-    write_userfile(idx);
+    write_userfile(displaySave ? idx : -1);
   return 0;
 }
 
 /* cmds.c:cmd_console calls this, better than chof bind - drummer,07/25/1999 */
 void
-console_dostore(int idx)
+console_dostore(int idx, bool displaySave)
 {
-  if (console_autosave)
-    console_store(idx, NULL);
+  console_store(idx, NULL, displaySave);
   return;
 }
 

+ 1 - 1
src/mod/console.mod/console.h

@@ -18,6 +18,6 @@
 #define CONSOLE_NO		"no"
 #define CONSOLE_COLOR		"Color:"
 
-void console_dostore(int);
+void console_dostore(int, bool = 1);
 
 #endif				/* _EGG_MOD_CONSOLE_CONSOLE_H */