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

* Fixes for cmd_bots

svn: 1534
Bryan Drewery 21 лет назад
Родитель
Сommit
babd237f66
3 измененных файлов с 17 добавлено и 12 удалено
  1. 10 9
      src/botnet.c
  2. 1 1
      src/botnet.h
  3. 6 2
      src/cmds.c

+ 10 - 9
src/botnet.c

@@ -523,15 +523,16 @@ void answer_local_whom(int idx, int chan)
 /* Show z a list of all bots connected
  */
 void
-tell_bots(int idx, int up, char *nodename)
+tell_bots(int idx, int up, const char *nodename)
 {
   struct userrec *u = NULL;
   int cnt = 0, tot = 0, total = 1, mtot = 0;
-  char work[128] = "", *node = NULL;
+  char work[151] = "", *node = NULL;
 
   if (up) {
-    node = (char *) get_user(&USERENTRY_NODENAME, conf.bot->u);    
-    if (!nodename || (nodename && node && wild_match(nodename, node))) {
+    if (nodename)
+      node = (char *) get_user(&USERENTRY_NODENAME, conf.bot->u);    
+    if (!nodename || wild_match(nodename, node)) {
       strcat(work, conf.bot->nick);
       strcat(work, " ");
       cnt++;
@@ -550,14 +551,14 @@ tell_bots(int idx, int up, char *nodename)
           found = 1;
         total++;
         if (nodename || (!nodename && ((!up && !found) || (up && found)))) {
-          node = (char *) get_user(&USERENTRY_NODENAME, u);
-          if (!nodename || (nodename && node && wild_match(nodename, node))) {
+          if (nodename)
+            node = (char *) get_user(&USERENTRY_NODENAME, u);
+          if (!nodename || wild_match(nodename, node)) {
             if (nodename && !found)
               strcat(work, "*");
             strcat(work, u->handle);
-            if (!nodename && found)
-              cnt++;
-            else if (nodename)
+            cnt++;
+            if (nodename)
               mtot++;
             if (!nodename || (nodename && found))
               tot++;

+ 1 - 1
src/botnet.h

@@ -17,7 +17,7 @@ char *lastbot(char *);
 int nextbot(char *);
 int in_chain(char *);
 #ifdef HUB
-void tell_bots(int, int, char *);
+void tell_bots(int, int, const char *);
 void tell_bottree(int);
 #endif /* HUB */
 void dump_links(int);

+ 6 - 2
src/cmds.c

@@ -685,8 +685,12 @@ static void cmd_secpass(int idx, char *par)
 #ifdef HUB
 static void cmd_bots(int idx, char *par)
 {
-  putlog(LOG_CMDS, "*", "#%s# bots %s", dcc[idx].nick, par ? par : "");
-  tell_bots(idx, 1, par[0] ? par : NULL);
+  char *node = NULL;
+   
+  if (par[0])
+    node = newsplit(&par);
+  putlog(LOG_CMDS, "*", "#%s# bots %s", dcc[idx].nick, node ? node : "");
+  tell_bots(idx, 1, node);
 }
 
 static void cmd_downbots(int idx, char *par)