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

* Port [3166] to 1.2.13
* -user on a bot now works on linked bots. (fixes #200)



svn: 3167

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

+ 1 - 0
doc/UPDATES

@@ -19,6 +19,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fix cmd_chattr accepting invalid flags. (fixes #293)
 * See 'help whois' as some flags are now user, bot, chan, global only.
 * Fix cmd_console not working for +private channels correctly (fixes #325)
+* -user on a bot now works on linked bots. (fixes #200)
 
 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)

+ 11 - 12
src/cmds.c

@@ -3353,27 +3353,26 @@ static void cmd_mns_user(int idx, char *par)
     dprintf(idx, "You can't remove a bot owner!\n");
     return;
   }
+
   if (u2->bot) {
     if (!(dcc[idx].user->flags & USER_OWNER)) {
         dprintf(idx, "You can't remove bots.\n");
         return;
     }
+    int i = nextbot(handle);
 
-    int idx2;
+    if (i < 0)
+      botunlink(idx, handle, "Bot removed.");
+    else if (!egg_strcasecmp(dcc[i].nick, handle))
+      botunlink(idx, handle, "Bot removed.");
+    else {
+      char x[40] = "";
 
-    for (idx2 = 0; idx2 < dcc_total; idx2++)
-      if (dcc[idx2].type && dcc[idx2].type != &DCC_RELAY && dcc[idx2].type != &DCC_FORK_BOT && 
-                 !egg_strcasecmp(dcc[idx2].nick, handle))
-        break;
-    if (idx2 != dcc_total) {
-      dprintf(idx, "You can't remove a directly linked bot.\n");
-      return;
+      simple_snprintf(x, sizeof(x), "%d:%s@%s", dcc[idx].sock, dcc[idx].nick, conf.bot->nick);
+      botnet_send_unlink(i, x, lastbot(handle), handle, "Bot removed.");
     }
   }
-  if (!(dcc[idx].user->flags & USER_MASTER) && !u2->bot) {
-    dprintf(idx, "You can't remove users who aren't bots!\n");
-    return;
-  }
+
   if (!conf.bot->hub)
     check_this_user(handle, 1, NULL);
   if (deluser(handle)) {