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

* Adding hosts with missing nick/ident will now prefix the host with '*!' and '*!*' respectively.

svn: 2196
Bryan Drewery 21 лет назад
Родитель
Сommit
0db86f2a28
2 измененных файлов с 33 добавлено и 5 удалено
  1. 1 0
      doc/UPDATES
  2. 32 5
      src/cmds.c

+ 1 - 0
doc/UPDATES

@@ -69,6 +69,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * cmd_dump now has a substitution. '$n' is replaced with the bot's current IRC nick.
 * Disabled all memory allocations after a segfault (Fixes CPU spinning)
 * Changed password encryption, should auto convert, might need to reset all though. (#75)
+* Adding hosts with missing nick/ident will now prefix the host with '*!' and '*!*' respectively.
 
 ----- FIXES -----
 

+ 32 - 5
src/cmds.c

@@ -3330,13 +3330,40 @@ static void cmd_pls_host(int idx, char *par)
     dprintf(idx, "That hostmask is already there.\n");
     return;
   }
-  addhost_by_handle(handle, host);
-  update_mod(handle, dcc[idx].nick, "+host", host);
-  dprintf(idx, "Added host '%s' to %s.\n", host, handle);
+
+  char ahost[UHOSTLEN] = "", *phost = NULL;
+
+  if (!strchr(host, '!')) {
+    if (!strchr(host, '@')) {
+      simple_snprintf(ahost, sizeof(ahost), "*!*@%s", host);
+    } else
+      simple_snprintf(ahost, sizeof(ahost), "*!%s", host);
+
+    phost = ahost;
+  } 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);
+
   while (par[0]) {
+    phost = 0;
+    ahost[0] = 0;
     host = newsplit(&par);
-    addhost_by_handle(handle, host);
-    dprintf(idx, "Added host '%s' to %s.\n", host, handle);
+
+    if (!strchr(host, '!')) {
+      if (!strchr(host, '@')) {
+        simple_snprintf(ahost, sizeof(ahost), "*!*@%s", host);
+      } else
+        simple_snprintf(ahost, sizeof(ahost), "*!%s", host);
+
+      phost = ahost;
+    } else
+      phost = host;
+
+    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);