浏览代码

* Fixed bots unlinking others with invalid reasons, ie "Illegal link by leaf" instead of "Loop detected"

svn: 2109
Bryan Drewery 21 年之前
父节点
当前提交
6eaefa1b6e
共有 1 个文件被更改,包括 10 次插入7 次删除
  1. 10 7
      src/botcmd.c

+ 10 - 7
src/botcmd.c

@@ -602,8 +602,9 @@ static void bot_update(int idx, char *par)
 static void bot_nlinked(int idx, char *par)
 {
   char *newbot = NULL, *next = NULL, *p = NULL, s[1024] = "", x = 0, *vversion = NULL;
-  int bogus = 0, i, vlocalhub = 0;
+  int i, vlocalhub = 0;
   time_t vbuildts = 0L;
+  bool bogus = 0;
 
   newbot = newsplit(&par);
   next = newsplit(&par);
@@ -625,16 +626,18 @@ static void bot_nlinked(int idx, char *par)
     i = nextbot(next);
     if (i != idx)
       bogus = 1;
+
+    if (bogus) {
+      putlog(LOG_BOTS, "*", "Bogus link notice from %s!  (%s -> %s)", dcc[idx].nick, next, newbot);
+      simple_sprintf(s, "Bogus link notice from: %s Disconnected", dcc[idx].nick);
+      dprintf(idx, "error Bogus link notice from (%s -> %s)\n", next, newbot);
+    }
   }
-  if (bogus) {
-    putlog(LOG_BOTS, "*", "Bogus link notice from %s!  (%s -> %s)", dcc[idx].nick, next, newbot);
-    simple_sprintf(s, "Bogus link notice from: %s Disconnected", dcc[idx].nick);
-    dprintf(idx, "error Bogus link notice from (%s -> %s)\n", next, newbot);
-  }
+
   if (s[0]) {
     chatout("*** %s\n", s);
     botnet_send_unlinked(idx, dcc[idx].nick, s);
-    dprintf(idx, "bye Illegal link by leaf\n");
+    dprintf(idx, "bye %s\n", s);
     killsock(dcc[idx].sock);
     lostdcc(idx);
     return;