소스 검색

* Removed cmd_vbottree
* cmd_bottree now shows buildts/version and sets localhubs red.


svn: 935

Bryan Drewery 22 년 전
부모
커밋
a05f8d040d
10개의 변경된 파일118개의 추가작업 그리고 83개의 파일을 삭제
  1. 3 1
      doc/UPDATES
  2. 5 11
      misc/help.txt
  3. 29 9
      src/botcmd.c
  4. 5 3
      src/botmsg.c
  5. 42 34
      src/botnet.c
  6. 6 4
      src/botnet.h
  7. 1 8
      src/cmds.c
  8. 20 6
      src/dcc.c
  9. 3 3
      src/mod/share.mod/share.c
  10. 4 4
      src/tandem.h

+ 3 - 1
doc/UPDATES

@@ -3,13 +3,15 @@ This is a summary of ChangeLog basically.
 1.1.6
 
 1.Fixed a cosmetic error in cmd_downbots.
-2.Cleaned up and removed a ton of un-needed and old code.
+2.Cleaned up and removed a ton (30K+ compiled) of un-needed and old code.
 3.Fixed a bug in defalg_user()
 4.Several user cmds on BOTS were not being shared.
 5.Fixed a fatal bug in +take.
 6.Removed garblestrings dependancy on binary checksum checking.
 7.Cmd_pls_host now is available to o|o. Users can add hosts to themselves now.
 8.Fixed msg_invite spamming the password for non-users.
+9.Removed cmd_vbottree (cmd_bottree now shows the information).
+10.Fixed msgc_voice, was checking for +v instead of +q.
 
 1.1.5
 

+ 5 - 11
misc/help.txt

@@ -285,7 +285,7 @@ See also: botconfig
    eventually send you one line containing its version, network setting,
    channels, and uptime.
  
-See also: %{+n}bottree, vbottree%{-}%{+m}, bots%{-}
+See also: %{+n}bottree %{-}%{+m}, bots%{-}
 ::botjump:
 ###  %bbotjump%b <bot> [server [port [pass]]]
    Makes the bot jump to another server. If you don't specify a
@@ -315,7 +315,7 @@ See also: netnick
    There is no indication of which bots are directly connected to this current
    bot. %{+n}Use %b'%dwho'%b or %b'%dbottree'%b for that information.%{-}
  
-See also: downbots%{+n}, bottree, vbottree%{-}, botinfo
+See also: downbots%{+n}, bottree%{-}, botinfo
 ::botserver:
 ###  %bbotserver%b <bot>
    The bot will display it's current server and lag over DCC.
@@ -327,7 +327,7 @@ See also: netserver, servers%{+n}, config%{-}
    nice way to get a feel for how the bots are physically connected. If 2 bots
    are sharing, a + will be indicated, or a ? if nothing is known.
  
-See also: bots, downbots, botinfo, vbottree
+See also: bots, downbots, botinfo
 ::botversion:
 ###  %bbotversion%b <bot>
    The bot will display it's pack version and uname.
@@ -1498,7 +1498,7 @@ See also: console
    This is a list of the bots connected between you and the destination bot.
    It should also return the time in seconds taken for the trace to occur.
  
-See also: bots, bottree, vbottree
+See also: bots, bottree
 ::traffic
 ###  %btraffic%b
    Shows total and daily net traffic stats since the last %b'%drestart'%b.
@@ -1512,7 +1512,7 @@ See also: bots, bottree, vbottree
    to unlink them. If "*" is specified as the parameter, all bots will be
    unlinked.
  
-See also: %{+n}link, %{-}bots, downbots%{+n}, newleaf, bottree, vbottree%{-}
+See also: %{+n}link, %{-}bots, downbots%{+n}, newleaf, bottree%{-}
 ::unstick
 ###  %bunstick%b [ban/exempt/invite] <hostmask/number> [channel]
    Makes a "sticky" ban, exempt, or invite normal again.
@@ -1543,12 +1543,6 @@ See also: status
    will not appear in the list.
  
 See also: match, whois
-:hub:vbottree
-###  %bvbottree%b
-   Shows a tree-format diagram of the bots currently on the botnet, along with 
-   their internal version number. 
- 
-See also: bots, downbots, botinfo, vbottree
 :leaf:voice
 ###  %bvoice%b <nickname> [channel|*]
     will give a +v voice to a person you specify, so long as the

+ 29 - 9
src/botcmd.c

@@ -636,25 +636,36 @@ static void bot_unlink(int idx, char *par)
  */
 static void bot_update(int idx, char *par)
 {
-  char *bot = NULL, x;
-  int vnum;
+  char *bot = NULL, x, *vversion = NULL;
+  int vlocalhub = 0;
+  time_t vbuildts = 0L;
 
   bot = newsplit(&par);
   x = par[0];
   if (x)
     par++;
-  vnum = base64_to_int(par);
+
+  newsplit(&par);		/* vnum */
+
+  if (par[0])
+    vlocalhub = atoi(newsplit(&par));
+  if (par[0])
+    vbuildts = atol(newsplit(&par));
+  if (par[0])
+    vversion = newsplit(&par);
+
   if (in_chain(bot))
-    updatebot(idx, bot, x, vnum);
+    updatebot(idx, bot, x, vlocalhub, vbuildts, vversion);
 }
 
 /* Newbot next share?
  */
 static void bot_nlinked(int idx, char *par)
 {
-  char *newbot = NULL, *next = NULL, *p = NULL, s[1024] = "", x = 0;
+  char *newbot = NULL, *next = NULL, *p = NULL, s[1024] = "", x = 0, *vversion = NULL;
   struct userrec *u = NULL;
-  int bogus = 0, i;
+  int bogus = 0, i, vlocalhub = 0;
+  time_t vbuildts = 0L;
 
   newbot = newsplit(&par);
   next = newsplit(&par);
@@ -695,8 +706,17 @@ static void bot_nlinked(int idx, char *par)
     par++;
   else
     x = '-';
-  i = base64_to_int(par);
-  botnet_send_nlinked(idx, newbot, next, x, i);
+
+  newsplit(&par);		/* vnum */
+
+  if (par[0])
+    vlocalhub = atoi(newsplit(&par));
+  if (par[0])
+    vbuildts = atol(newsplit(&par));
+  if (par[0])
+    vversion = newsplit(&par);
+  botnet_send_nlinked(idx, newbot, next, x, vlocalhub, vbuildts, vversion);
+  
   if (x == '!') {
 #ifdef HUB
     chatout("*** (%s) %s %s.\n", next, NET_LINKEDTO, newbot);
@@ -705,7 +725,7 @@ static void bot_nlinked(int idx, char *par)
 #endif
     x = '-';
   }
-  addbot(newbot, dcc[idx].nick, next, x, i);
+  addbot(newbot, dcc[idx].nick, next, x, vlocalhub, vbuildts, vversion ? vversion : "");
   check_bind_link(newbot, next);
 
   u = get_user_by_handle(userlist, newbot);

+ 5 - 3
src/botmsg.c

@@ -343,12 +343,12 @@ void botnet_send_unlinked(int idx, char *bot, char *args)
   }
 }
 
-void botnet_send_nlinked(int idx, char *bot, char *next, char flag, int vernum)
+void botnet_send_nlinked(int idx, char *bot, char *next, char flag, int vlocalhub, time_t vbuildts, char *vversion)
 {
   size_t len;
 
   if (tands > 0) {
-    len = simple_sprintf(OBUF, "n %s %s %c%D\n", bot, next, flag, vernum);
+    len = simple_sprintf(OBUF, "n %s %s %cD0gc %d %d %s\n", bot, next, flag, vlocalhub, vbuildts, vversion ? vversion : "");
     send_tand_but(idx, OBUF, len);
   }
 }
@@ -374,7 +374,9 @@ void botnet_send_update(int idx, tand_t * ptr)
   size_t len;
 
   if (tands > 0) {
-    len = simple_sprintf(OBUF, "u %s %c%D\n", ptr->bot, ptr->share, ptr->ver);
+    /* the D0gc is a lingering hack which probably will never be able to come out. */
+    len = simple_sprintf(OBUF, "u %s %cD0gc %d %d %s\n", ptr->bot, ptr->share, ptr->localhub, 
+                                                          ptr->buildts, ptr->version ? ptr->version : "");
     send_tand_but(idx, OBUF, len);
   }
 }

+ 42 - 34
src/botnet.c

@@ -11,6 +11,7 @@
 
 #include "common.h"
 #include "botnet.h"
+#include "color.h"
 #include "chanprog.h"
 #include "net.h"
 #include "users.h"
@@ -56,7 +57,7 @@ tand_t *findbot(char *who)
 
 /* Add a tandem bot to our chain list
  */
-void addbot(char *who, char *from, char *next, char flag, int vernum)
+void addbot(char *who, char *from, char *next, char flag, int vlocalhub, time_t vbuildts, char *vversion)
 {
   tand_t **ptr = &tandbot, *ptr2 = NULL;
 
@@ -69,7 +70,9 @@ void addbot(char *who, char *from, char *next, char flag, int vernum)
   strncpy(ptr2->bot, who, HANDLEN);
   ptr2->bot[HANDLEN] = 0;
   ptr2->share = flag;
-  ptr2->ver = vernum;
+  ptr2->localhub = vlocalhub;
+  ptr2->buildts = vbuildts;
+  ptr2->version = vversion ? strdup(vversion) : NULL;
   ptr2->next = *ptr;
   *ptr = ptr2;
   /* May be via itself */
@@ -97,15 +100,19 @@ void check_should_backup()
 #endif /* G_BACKUP */
 #endif /* HUB */
 
-void updatebot(int idx, char *who, char share, int vernum)
+void updatebot(int idx, char *who, char share, int vlocalhub, time_t vbuildts, char *vversion)
 {
   tand_t *ptr = findbot(who);
 
   if (ptr) {
     if (share)
       ptr->share = share;
-    if (vernum)
-      ptr->ver = vernum;
+    if (vlocalhub)
+      ptr->localhub = vlocalhub;
+    if (vbuildts)
+      ptr->buildts = vbuildts;
+    if (vversion)
+      ptr->version = vversion;
     botnet_send_update(idx, ptr);
   }
 }
@@ -301,6 +308,8 @@ void rembot(char *who)
 
   ptr2 = *ptr;
   *ptr = ptr2->next;
+  if (ptr2->version && ptr2->version != "")
+    free(ptr2->version);
   free(ptr2);
   tands--;
 
@@ -542,6 +551,7 @@ void answer_local_whom(int idx, int chan)
   dprintf(idx, "Total users: %d\n", total);
 }
 
+#ifdef HUB
 /* Show z a list of all bots connected
  */
 void tell_bots(int idx)
@@ -578,7 +588,7 @@ void tell_bots(int idx)
 
 /* Show a simpleton bot tree
  */
-void tell_bottree(int idx, int showver)
+void tell_bottree(int idx)
 {
   char s[161] = "", work[1024] = "";
   tand_t *last[20] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -600,12 +610,14 @@ void tell_bottree(int idx, int showver)
       strcpy(s + i, bot->bot);
       i += strlen(bot->bot);
     }
+
   if (s[0])
     dprintf(idx, "(%s %s)\n", BOT_NOTRACEINFO, s);
-  if (showver)
-    dprintf(idx, "%s (%lu)\n", conf.bot->nick, buildts);
-  else
-    dprintf(idx, "%s\n", conf.bot->nick);
+  dprintf(idx, "%s%s%s (%s %li)\n", localhub ? RED(idx) : "", 
+                                    conf.bot->nick, 
+                                    localhub ? COLOR_END(idx) : "",
+                                    egg_version, buildts);
+
   this = (tand_t *) 1;
   work[0] = 0;
   while (more) {
@@ -635,17 +647,14 @@ void tell_bottree(int idx, int showver)
       bot = tandbot;
       while (!s[0]) {
 	if (bot->uplink == this) {
-	  if (bot->ver) {
-	    i = sprintf(s, "%c%s", bot->share, bot->bot);
-	    if (showver)
-	      sprintf(s + i, " (%d.%d.%d.%d)",
-		      bot->ver / 1000000,
-		      bot->ver % 1000000 / 10000,
-		      bot->ver % 10000 / 100,
-		      bot->ver % 100);
-	  } else {
-	    sprintf(s, "-%s", bot->bot);
-	  }
+          if (bot->share)
+            i = sprintf(s, "%c", bot->share);
+          else
+            i = sprintf(s, "-");
+          i = sprintf(s + 1, "%s%s%s (%s %li)", bot->localhub ? RED(idx) : "",
+                                                bot->bot,
+                                                bot->localhub ? COLOR_END(idx) : "",
+                                                bot->version, bot->buildts);
 	} else
 	  bot = bot->next;
       }
@@ -675,17 +684,14 @@ void tell_bottree(int idx, int showver)
 	      cnt++;
 	      if (cnt == 1) {
 		bot2 = bot;
-		if (bot->ver) {
-		  i = sprintf(s, "%c%s", bot->share, bot->bot);
-		  if (showver)
-		    sprintf(s + i, " (%d.%d.%d.%d)",
-			    bot->ver / 1000000,
-			    bot->ver % 1000000 / 10000,
-			    bot->ver % 10000 / 100,
-			    bot->ver % 100);
-		} else {
-		  sprintf(s, "-%s", bot->bot);
-		}
+                if (bot->share)
+                  i = sprintf(s, "%c", bot->share);
+                else
+                  i = sprintf(s, "-");
+                i = sprintf(s + 1, "%s%s%s (%s %li)", bot->localhub ? RED(idx) : "",
+                                                      bot->bot,
+                                                      bot->localhub ? COLOR_END(idx) : "",
+                                                      bot->version, bot->buildts);
 	      }
 	    }
 	  }
@@ -744,8 +750,9 @@ void dump_links(int z)
       p = conf.bot->nick;
     else
       p = bot->uplink->bot;
-    l = simple_sprintf(x, "n %s %s %c%D\n", bot->bot, p, bot->share, bot->ver);
-    tputs(dcc[z].sock, x, l);
+    l = simple_sprintf(x, "n %s %s %cD0gc %d %d %s\n", bot->bot, p, bot->share, bot->localhub, 
+                                                        bot->buildts, bot->version ? bot->version : "");
+     tputs(dcc[z].sock, x, l);
   }
   /* Dump party line members */
   for (i = 0; i < dcc_total; i++) {
@@ -767,6 +774,7 @@ void dump_links(int z)
     }
   }
 }
+#endif /* HUB */
 
 int in_chain(char *who)
 {

+ 6 - 4
src/botnet.h

@@ -17,13 +17,15 @@ void answer_local_whom(int, int);
 char *lastbot(char *);
 int nextbot(char *);
 int in_chain(char *);
+#ifdef HUB
 void tell_bots(int);
-void tell_bottree(int, int);
+void tell_bottree(int);
+void dump_links(int);
+#endif /* HUB */
 int botlink(char *, int, char *);
 int botunlink(int, char *, char *);
-void dump_links(int);
-void addbot(char *, char *, char *, char, int);
-void updatebot(int, char *, char, int);
+void addbot(char *, char *, char *, char, int, time_t, char *);
+void updatebot(int, char *, char, int, time_t, char *);
 void rembot(char *);
 struct tand_t_struct *findbot(char *);
 void unvia(int, struct tand_t_struct *);

+ 1 - 8
src/cmds.c

@@ -741,13 +741,7 @@ static void cmd_downbots(struct userrec *u, int idx, char *par)
 static void cmd_bottree(struct userrec *u, int idx, char *par)
 {
   putlog(LOG_CMDS, "*", "#%s# bottree", dcc[idx].nick);
-  tell_bottree(idx, 0);
-}
-
-static void cmd_vbottree(struct userrec *u, int idx, char *par)
-{
-  putlog(LOG_CMDS, "*", "#%s# vbottree", dcc[idx].nick);
-  tell_bottree(idx, 1);
+  tell_bottree(idx);
 }
 #endif /* HUB */
 
@@ -4189,7 +4183,6 @@ cmd_t C_dcc[] =
   {"uptime",		"m|m",	(Function) cmd_uptime,		NULL},
   {"crontab",		"a",	(Function) cmd_crontab,		NULL},
 #ifdef HUB
-  {"vbottree",		"n",	(Function) cmd_vbottree,	NULL},
   {"who",		"n",	(Function) cmd_who,		NULL},
 #endif /* HUB */
   {"whois",		"",	(Function) cmd_whois,		NULL},

+ 20 - 6
src/dcc.c

@@ -243,7 +243,7 @@ static void greet_new_bot(int idx)
   else
     sysname = un.sysname;
 
-  dprintf(idx, "v 1001500 %d %s <%s>\n", HANDLEN, ver, network);
+  dprintf(idx, "v 1001500 %d %s <%s> %d %li %s\n", HANDLEN, ver, network, localhub, buildts, egg_version);
   dprintf(idx, "vs %s\n", sysname);
   dprintf(idx, "bts %lu\n", buildts);
   for (i = 0; i < dcc_total; i++) {
@@ -256,8 +256,9 @@ static void greet_new_bot(int idx)
 
 static void bot_version(int idx, char *par)
 {
-  char x[1024] = "";
-  int l;
+  char x[1024] = "", *vversion = NULL;
+  int l, vlocalhub = 0;
+  time_t vbuildts = 0;
 
   dcc[idx].timeval = now;
   if (in_chain(dcc[idx].nick)) {
@@ -286,6 +287,15 @@ static void bot_version(int idx, char *par)
       return;
     }
   strncpyz(dcc[idx].u.bot->version, par, 120);
+  newsplit(&par);	/* 'ver' */
+  newsplit(&par);	/* handlen */
+  newsplit(&par);	/* network */
+  if (par[0])
+    vlocalhub = atoi(newsplit(&par));
+  if (par[0])
+    vbuildts = atol(newsplit(&par));
+  if (par[0])
+    vversion = newsplit(&par);
 #ifdef HUB
   putlog(LOG_BOTS, "*", DCC_LINKED, dcc[idx].nick);
   chatout("*** Linked to %s\n", dcc[idx].nick);
@@ -293,11 +303,15 @@ static void bot_version(int idx, char *par)
   putlog(LOG_BOTS, "*", "Linked to botnet.");
   chatout("*** Linked to botnet.\n");
 #endif /* HUB */
-  botnet_send_nlinked(idx, dcc[idx].nick, conf.bot->nick, '!', 1001500);
-  touch_laston(dcc[idx].user, "linked", now);
+
+#ifdef HUB
+  botnet_send_nlinked(idx, dcc[idx].nick, conf.bot->nick, '!', vlocalhub, vbuildts, vversion);
   dump_links(idx);
+#endif /* HUB */
+
+  touch_laston(dcc[idx].user, "linked", now);
   dcc[idx].type = &DCC_BOT;
-  addbot(dcc[idx].nick, dcc[idx].nick, conf.bot->nick, '-', 1001500);
+  addbot(dcc[idx].nick, dcc[idx].nick, conf.bot->nick, '-', vlocalhub, vbuildts, vversion);
   check_bind_link(dcc[idx].nick, conf.bot->nick);
   egg_snprintf(x, sizeof x, "v 1001500");
   bot_shareupdate(idx, x);

+ 3 - 3
src/mod/share.mod/share.c

@@ -1511,7 +1511,7 @@ finish_share(int idx)
   checkchans(1);                /* remove marked channels */
   trigger_cfg_changed();
   reaffirm_owners();            /* Make sure my owners are +a   */
-  updatebot(-1, dcc[j].nick, '+', 0);
+  updatebot(-1, dcc[j].nick, '+', 0, 0, NULL);
 }
 
 #ifdef HUB
@@ -1550,7 +1550,7 @@ start_sending_users(int idx)
            i == DCCSEND_BADFN ? "BAD FILE" : i == DCCSEND_FEMPTY ? "EMPTY FILE" : "UNKNOWN REASON!");
     dcc[idx].status &= ~(STAT_SHARE | STAT_SENDING | STAT_AGGRESSIVE);
   } else {
-    updatebot(-1, dcc[idx].nick, '+', 0);
+    updatebot(-1, dcc[idx].nick, '+', 0, 0, NULL);
     dcc[idx].status |= STAT_SENDING;
     i = dcc_total - 1;
     strcpy(dcc[i].host, dcc[idx].nick); /* Store bot's nick */
@@ -1574,7 +1574,7 @@ cancel_user_xfer(int idx, void *x)
   if (idx < 0) {
     idx = -idx;
     k = 1;
-    updatebot(-1, dcc[idx].nick, '-', 0);
+    updatebot(-1, dcc[idx].nick, '-', 0, 0, NULL);
   }
   if (dcc[idx].status & STAT_SHARE) {
     if (dcc[idx].status & STAT_GETTING) {

+ 4 - 4
src/tandem.h

@@ -13,7 +13,9 @@ typedef struct tand_t_struct {
   struct tand_t_struct *via;
   struct tand_t_struct *uplink;
   struct tand_t_struct *next;
-  int ver;
+  char *version;
+  time_t buildts;
+  int localhub;
   char share;
 } tand_t;
 
@@ -55,7 +57,7 @@ void botnet_send_trace(int, char *, char *, char *);
 void botnet_send_unlink(int, char *, char *, char *, char *);
 void botnet_send_link(int, char *, char *, char *);
 void botnet_send_update(int, tand_t *);
-void botnet_send_nlinked(int, char *, char *, char, int);
+void botnet_send_nlinked(int, char *, char *, char, int, time_t, char *);
 void botnet_send_reject(int, char *, char *, char *, char *, char *);
 void botnet_send_zapf(int, char *, char *, char *);
 void botnet_send_zapf_broad(int, char *, char *, char *);
@@ -75,7 +77,5 @@ void botnet_send_cmd_broad(int idx, char * fbot, char * from, int fromidx, char
 void botnet_send_cmdreply(char * fbot, char * bot, char * to, char * toidx, char * ln);
 
 #define b_status(a)	(dcc[a].status)
-#define b_version(a)	(dcc[a].u.bot->version)
-#define b_linker(a)	(dcc[a].u.bot->linker)
 
 #endif				/* _EGG_TANDEM_H */