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

* Port [3487] to 1.2.14
* -host now accepts partial host masks, ie, '-host user@host'.



svn: 3488

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

+ 1 - 0
doc/UPDATES

@@ -53,6 +53,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed +closed from interfering with 'chanmode -pi'. (fixes #294)
 * Fix logging/usage bug in cmd_mop. (fixes #313)
 * Bad uname EMAILS now include the localhub's nick. (fixes #354)
+* -host now accepts partial host masks, ie, '-host user@host'.
 
 1.2.13 - http://wraith.shatow.net/milestone/1.2.13
 * Fix cmd_chanset accepting invalid flags

+ 32 - 6
src/cmds.c

@@ -3573,16 +3573,42 @@ static void cmd_mns_host(int idx, char *par)
       return;
     }
   }
-  if (delhost_by_handle(handle, host)) {
-    dprintf(idx, "Removed host '%s' from %s.\n", host, handle);
-    update_mod(handle, dcc[idx].nick, "-host", host);
+
+  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;
+
+  if (delhost_by_handle(handle, phost)) {
+    dprintf(idx, "Removed host '%s' from %s.\n", phost, handle);
+    update_mod(handle, dcc[idx].nick, "-host", phost);
 
     while (par[0]) {
+      phost = 0;
+      ahost[0] = 0;
       host = newsplit(&par);
-      if (delhost_by_handle(handle, host)) {
+
+      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;
+
+      if (delhost_by_handle(handle, phost)) {
         if (!conf.bot->hub)
-          check_this_user(handle, 2, host);
-        dprintf(idx, "Removed host '%s' from %s.\n", host, handle);
+          check_this_user(handle, 2, phost);
+        dprintf(idx, "Removed host '%s' from %s.\n", phost, handle);
       }
     }