Переглянути джерело

* Show HUBS as yellow in cmd_bottree

svn: 1508
Bryan Drewery 21 роки тому
батько
коміт
2ad726610a
2 змінених файлів з 34 додано та 8 видалено
  1. 1 0
      doc/UPDATES
  2. 33 8
      src/botnet.c

+ 1 - 0
doc/UPDATES

@@ -63,6 +63,7 @@ This is a summary of ChangeLog basically.
 * Check server lag every 30 seconds, not every 5 minutes.
 * Check server lag every 30 seconds, not every 5 minutes.
 * +v users are no longer enforced if opped.
 * +v users are no longer enforced if opped.
 * cmdpasses now require that the old pass be used to clear old pass.
 * cmdpasses now require that the old pass be used to clear old pass.
+* cmd_bottree now shows HUBS as yellow.
 
 
 1.1.9
 1.1.9
 
 

+ 33 - 8
src/botnet.c

@@ -566,11 +566,12 @@ void tell_bottree(int idx)
     return;
     return;
   }
   }
 
 
-  char s[161] = "", work[1024] = "";
+  char s[161] = "", work[1024] = "", *color = NULL;
   tand_t *last[20] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
   tand_t *last[20] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
                        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
   tand_t *thisbot = NULL, *bot = NULL, *bot2 = NULL;
   tand_t *thisbot = NULL, *bot = NULL, *bot2 = NULL;
   int lev = 0, more = 1, mark[20], ok, cnt, i = 0, imark, tothops = 0;
   int lev = 0, more = 1, mark[20], ok, cnt, i = 0, imark, tothops = 0;
+  struct userrec *botu = NULL;
 
 
   for (bot = tandbot; bot; bot = bot->next)
   for (bot = tandbot; bot; bot = bot->next)
     if (!bot->uplink) {
     if (!bot->uplink) {
@@ -582,11 +583,17 @@ void tell_bottree(int idx)
       i += strlen(bot->bot);
       i += strlen(bot->bot);
     }
     }
 
 
+  if (bot_hublevel(conf.bot->u) < 999))
+    color = YELLOW(idx);
+  if (localhub)
+    color = RED(idx);
+  else
+    color = NULL;
+
   if (s[0])
   if (s[0])
     dprintf(idx, "(%s %s)\n", BOT_NOTRACEINFO, s);
     dprintf(idx, "(%s %s)\n", BOT_NOTRACEINFO, s);
-  dprintf(idx, "%s%s%s (%s %li)\n", localhub ? RED(idx) : "", 
-                                    conf.bot->nick, 
-                                    localhub ? COLOR_END(idx) : "",
+  dprintf(idx, "%s%s%s (%s %li)\n", color ? color : "", 
+                                    color ? COLOR_END(idx) : "",
                                     egg_version, buildts);
                                     egg_version, buildts);
 
 
   thisbot = (tand_t *) 1;
   thisbot = (tand_t *) 1;
@@ -618,13 +625,22 @@ void tell_bottree(int idx)
       bot = tandbot;
       bot = tandbot;
       while (!s[0]) {
       while (!s[0]) {
 	if (bot->uplink == thisbot) {
 	if (bot->uplink == thisbot) {
+          botu = get_user_by_handle(userlist, bot->bot);
+       
+          if (botu && bot_hublevel(botu) < 999)
+            color = YELLOW(idx);
+          if (botu && bot->localhub)
+            color = RED(idx);
+          else
+            color = NULL;
+
           if (bot->share)
           if (bot->share)
             i = sprintf(s, "%c", bot->share);
             i = sprintf(s, "%c", bot->share);
           else
           else
             i = sprintf(s, "-");
             i = sprintf(s, "-");
-          i = sprintf(s + 1, "%s%s%s (%s %li)", bot->localhub ? RED(idx) : "",
+          i = sprintf(s + 1, "%s%s%s (%s %li)", color ? color : "",
                                                 bot->bot,
                                                 bot->bot,
-                                                bot->localhub ? COLOR_END(idx) : "",
+                                                color ? COLOR_END(idx) : "",
                                                 bot->version, bot->buildts);
                                                 bot->version, bot->buildts);
 	} else
 	} else
 	  bot = bot->next;
 	  bot = bot->next;
@@ -654,14 +670,23 @@ void tell_bottree(int idx)
 	    else if (ok) {
 	    else if (ok) {
 	      cnt++;
 	      cnt++;
 	      if (cnt == 1) {
 	      if (cnt == 1) {
+                botu = get_user_by_handle(userlist, bot->bot);
+       
+                if (botu && bot_hublevel(botu) < 999)
+                  color = YELLOW(idx);
+                if (botu && bot->localhub)
+                  color = RED(idx);
+                else
+                  color = NULL;
+
 		bot2 = bot;
 		bot2 = bot;
                 if (bot->share)
                 if (bot->share)
                   i = sprintf(s, "%c", bot->share);
                   i = sprintf(s, "%c", bot->share);
                 else
                 else
                   i = sprintf(s, "-");
                   i = sprintf(s, "-");
-                i = sprintf(s + 1, "%s%s%s (%s %li)", bot->localhub ? RED(idx) : "",
+                i = sprintf(s + 1, "%s%s%s (%s %li)", color ? color : "",
                                                       bot->bot,
                                                       bot->bot,
-                                                      bot->localhub ? COLOR_END(idx) : "",
+                                                      color ? COLOR_END(idx) : "",
                                                       bot->version, bot->buildts);
                                                       bot->version, bot->buildts);
 	      }
 	      }
 	    }
 	    }