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

* Fixed an issue with cmd_pls_host not adding all hosts given, and 'hostmask already there' now displays WHICH host. (#153)

svn: 2359
Bryan Drewery 21 лет назад
Родитель
Сommit
9bac310db6
2 измененных файлов с 14 добавлено и 10 удалено
  1. 1 0
      doc/UPDATES
  2. 13 10
      src/cmds.c

+ 1 - 0
doc/UPDATES

@@ -30,6 +30,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed hang on running binary on some FreeBSD systems.
 * Fixed bots not correctly recognizing changes in botset to empty vars after restart/update. (#150)
 * Disabled chanset flags '+/-revenge' and '+/-revengebot' as they are 100% incompatable/untouched egg code.
+* Fixed an issue with cmd_pls_host not adding all hosts given, and 'hostmask already there' now displays WHICH host. (#153)
 
 1.2.6
 * (REVERTED FROM 1.2.3) Disabled all memory allocations after a segfault (Fixes CPU spinning)

+ 13 - 10
src/cmds.c

@@ -3386,11 +3386,6 @@ static void cmd_pls_host(int idx, char *par)
     return;
   }
   
-  if (user_has_host(NULL, dcc[idx].user, host)) {
-    dprintf(idx, "That hostmask is already there.\n");
-    return;
-  }
-
   char ahost[UHOSTLEN] = "", *phost = NULL;
 
   if (!strchr(host, '!')) {
@@ -3403,9 +3398,13 @@ static void cmd_pls_host(int idx, char *par)
   } else
     phost = host;
 
-  addhost_by_handle(handle, phost);
-  update_mod(handle, dcc[idx].nick, "+host", phost);
-  dprintf(idx, "Added host '%s' to %s.\n", phost, handle);
+  if (user_has_host(NULL, dcc[idx].user, phost))
+    dprintf(idx, "The hostmask '%s' is already there.\n", phost);
+  else {
+    addhost_by_handle(handle, phost);
+    update_mod(handle, dcc[idx].nick, "+host", phost);
+    dprintf(idx, "Added host '%s' to %s.\n", phost, handle);
+  }
 
   while (par[0]) {
     phost = 0;
@@ -3422,8 +3421,12 @@ static void cmd_pls_host(int idx, char *par)
     } else
       phost = host;
 
-    addhost_by_handle(handle, phost);
-    dprintf(idx, "Added host '%s' to %s.\n", phost, handle);
+    if (user_has_host(NULL, dcc[idx].user, phost))
+      dprintf(idx, "The hostmask '%s' is already there.\n", phost);
+    else {
+      addhost_by_handle(handle, phost);
+      dprintf(idx, "Added host '%s' to %s.\n", phost, handle);
+    }
   }
   if (!conf.bot->hub)
     check_this_user(handle, 0, NULL);