Explorar el Código

* Replaced botnetnick with conf.bot->nick
* Now copying/nulling bot->u properly in conf.c


svn: 684

Bryan Drewery hace 22 años
padre
commit
434a01810d

+ 51 - 51
src/botcmd.c

@@ -24,7 +24,7 @@
 #include "modules.h"
 #include "core_binds.h"
 
-extern char		 botnetnick[], ver[], admin[], network[], motdfile[];
+extern char		 ver[], admin[], network[], motdfile[];
 extern int		 dcc_total, remote_boots, noshare, timesync, conmask;
 extern struct dcc_t	*dcc;
 extern struct chanset_t	*chanset;
@@ -78,7 +78,7 @@ static void fake_alert(int idx, char *item, char *extra)
   if (now - lastfake > 10) {	
     /* Don't fake_alert more than once every 10secs */
     dprintf(idx, "ct %s NOTICE: %s (%s != %s).\n",
-	    botnetnick, NET_FAKEREJECT, item, extra);
+	    conf.bot->nick, NET_FAKEREJECT, item, extra);
     putlog(LOG_BOTS, "*", "%s %s (%s != %s).", dcc[idx].nick, NET_FAKEREJECT,
 	 item, extra);
     lastfake = now;
@@ -165,7 +165,7 @@ void bot_remotecmd(int idx, char *par) {
   fbot = newsplit(&par);
   fhnd = newsplit(&par);
   fidx = newsplit(&par);
-  if (!strcmp(tbot, botnetnick)) {
+  if (!strcmp(tbot, conf.bot->nick)) {
     gotremotecmd(tbot, fbot, fhnd, fidx, par);
   } else if (!strcmp(tbot, "*")) {
     botnet_send_cmd_broad(idx, fbot, fhnd, atoi(fidx), par);
@@ -182,7 +182,7 @@ void bot_remotereply(int idx, char *par) {
   fbot = newsplit(&par);
   fhnd = newsplit(&par);
   fidx = newsplit(&par);
-  if (!strcmp(tbot, botnetnick)) {
+  if (!strcmp(tbot, conf.bot->nick)) {
     gotremotereply(fbot, fhnd, fidx, par);
   } else {
     if (nextbot(tbot)!= idx)
@@ -280,7 +280,7 @@ static void bot_priv(int idx, char *par)
   if (!to[0])
     return;			/* Silently ignore notes to '@bot' this
 				 * is legacy code */
-  if (!egg_strcasecmp(tobot, botnetnick)) {		/* For me! */
+  if (!egg_strcasecmp(tobot, conf.bot->nick)) {		/* For me! */
     if (p == from)
       add_note(to, from, par, -2, 0);
     else {
@@ -288,24 +288,24 @@ static void bot_priv(int idx, char *par)
       if (from[0] != '@')
 	switch (i) {
 	case NOTE_ERROR:
-	  botnet_send_priv(idx, botnetnick, from, NULL, "%s %s.", BOT_NOSUCHUSER, to);
+	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s %s.", BOT_NOSUCHUSER, to);
 	  break;
 	case NOTE_STORED:
-	  botnet_send_priv(idx, botnetnick, from, NULL, "%s", BOT_NOTESTORED2);
+	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s", BOT_NOTESTORED2);
 	  break;
 	case NOTE_FULL:
-	  botnet_send_priv(idx, botnetnick, from, NULL, "%s", BOT_NOTEBOXFULL);
+	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s", BOT_NOTEBOXFULL);
 	  break;
 	case NOTE_AWAY:
-	  botnet_send_priv(idx, botnetnick, from, NULL, "%s %s", to, BOT_NOTEISAWAY);
+	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s %s", to, BOT_NOTEISAWAY);
 	  break;
 	case NOTE_FWD:
-	  botnet_send_priv(idx, botnetnick, from, NULL, "%s %s", "Not online; note forwarded to:", to);
+	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s %s", "Not online; note forwarded to:", to);
 	  break;
 	case NOTE_TCL:
 	  break;		/* Do nothing */
 	case NOTE_OK:
-	  botnet_send_priv(idx, botnetnick, from, NULL, "%s %s.", BOT_NOTESENTTO, to);
+	  botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s %s.", BOT_NOTESENTTO, to);
 	  break;
 	}
     }
@@ -361,27 +361,27 @@ static void remote_tell_who(int idx, char *nick, int chan)
       }
     }
   if (i > 10) {
-    botnet_send_priv(idx, botnetnick, nick, NULL, "%s  (%s)", s, ver);
+    botnet_send_priv(idx, conf.bot->nick, nick, NULL, "%s  (%s)", s, ver);
   } else {
-    botnet_send_priv(idx, botnetnick, nick, NULL, "%s  (%s)", BOT_NOCHANNELS, ver);
+    botnet_send_priv(idx, conf.bot->nick, nick, NULL, "%s  (%s)", BOT_NOCHANNELS, ver);
   }
   if (admin[0])
-    botnet_send_priv(idx, botnetnick, nick, NULL, "Admin: %s", admin);
+    botnet_send_priv(idx, conf.bot->nick, nick, NULL, "Admin: %s", admin);
   if (chan == 0) {
-    botnet_send_priv(idx, botnetnick, nick, NULL,
+    botnet_send_priv(idx, conf.bot->nick, nick, NULL,
 		     "%s  (* = %s, + = %s, @ = %s)",
 		     BOT_PARTYMEMBS, MISC_OWNER, MISC_MASTER, MISC_OP);
   } else {
     simple_sprintf(s, "assoc %d", chan);
     if ((Tcl_Eval(interp, s) != TCL_OK) || !interp->result[0]) {
-      botnet_send_priv(idx, botnetnick, nick, NULL,
+      botnet_send_priv(idx, conf.bot->nick, nick, NULL,
 		       "%s %s%d:  (* = %s, + = %s, @ = %s)\n",
 		       BOT_PEOPLEONCHAN,
 		       (chan < GLOBAL_CHANS) ? "" : "*",
 		       chan % GLOBAL_CHANS,
 		       MISC_OWNER, MISC_MASTER, MISC_OP);
     } else {
-      botnet_send_priv(idx, botnetnick, nick, NULL,
+      botnet_send_priv(idx, conf.bot->nick, nick, NULL,
 		       "%s '%s' (%s%d):  (* = %s, + = %s, @ = %s)\n",
 		       BOT_PEOPLEONCHAN, interp->result,
 		       (chan < GLOBAL_CHANS) ? "" : "*",
@@ -411,9 +411,9 @@ static void remote_tell_who(int idx, char *nick, int chan)
 	    sprintf(s + k, " (%s %lum)",
 		    MISC_IDLE, mins);
 	}
-	botnet_send_priv(idx, botnetnick, nick, NULL, "%s", s);
+	botnet_send_priv(idx, conf.bot->nick, nick, NULL, "%s", s);
 	if (dcc[i].u.chat->away != NULL)
-	  botnet_send_priv(idx, botnetnick, nick, NULL, "      %s: %s",
+	  botnet_send_priv(idx, conf.bot->nick, nick, NULL, "      %s: %s",
 			   MISC_AWAY, dcc[i].u.chat->away);
       }
   }
@@ -421,14 +421,14 @@ static void remote_tell_who(int idx, char *nick, int chan)
     if (dcc[i].type == &DCC_BOT) {
       if (!ok) {
 	ok = 1;
-	botnet_send_priv(idx, botnetnick, nick, NULL,
+	botnet_send_priv(idx, conf.bot->nick, nick, NULL,
 			 "%s:", BOT_BOTSCONNECTED);
       }
       sprintf(s, "  %s%c%-15s %s",
 	      dcc[i].status & STAT_CALLED ? "<-" : "->",
 	      dcc[i].status & STAT_SHARE ? '+' : ' ',
 	      dcc[i].nick, dcc[i].u.bot->version);
-      botnet_send_priv(idx, botnetnick, nick, NULL, "%s", s);
+      botnet_send_priv(idx, conf.bot->nick, nick, NULL, "%s", s);
     }
   }
   ok = 0;
@@ -437,7 +437,7 @@ static void remote_tell_who(int idx, char *nick, int chan)
       if (dcc[i].u.chat->channel != chan) {
 	if (!ok) {
 	  ok = 1;
-	  botnet_send_priv(idx, botnetnick, nick, NULL, "%s:",
+	  botnet_send_priv(idx, conf.bot->nick, nick, NULL, "%s:",
 			   BOT_OTHERPEOPLE);
 	}
 	l = sprintf(s, "  %c%-15s %s", (geticon(i) == '-' ? ' ' : geticon(i)),
@@ -449,9 +449,9 @@ static void remote_tell_who(int idx, char *nick, int chan)
 	  else
 	    sprintf(s + l, " (%s %dh%dm)", MISC_IDLE, k / 60, k % 60);
 	}
-	botnet_send_priv(idx, botnetnick, nick, NULL, "%s", s);
+	botnet_send_priv(idx, conf.bot->nick, nick, NULL, "%s", s);
 	if (dcc[i].u.chat->away != NULL)
-	  botnet_send_priv(idx, botnetnick, nick, NULL,
+	  botnet_send_priv(idx, conf.bot->nick, nick, NULL,
 			   "      %s: %s", MISC_AWAY,
 			   dcc[i].u.chat->away);
       }
@@ -481,7 +481,7 @@ static void bot_who(int idx, char *par)
     from = TBUF;
   }
   to = newsplit(&par);
-  if (!egg_strcasecmp(to, botnetnick))
+  if (!egg_strcasecmp(to, conf.bot->nick))
     to[0] = 0;			/* (for me) */
   chan = base64_to_int(par);
   if (to[0]) {			/* Pass it on */
@@ -536,7 +536,7 @@ static void bot_infoq(int idx, char *par)
     for (chan = chanset; chan; chan = chan->next) {
       if (!channel_secret(chan)) {
         if ((strlen(s) + strlen(chan->dname) + strlen(network)
-                   + strlen(botnetnick) + strlen(ver) + 1) >= 200) {
+                   + strlen(conf.bot->nick) + strlen(ver) + 1) >= 200) {
           strcat(s,"++  ");
           break; /* Yegads..! */
         }
@@ -546,14 +546,14 @@ static void bot_infoq(int idx, char *par)
     }
     if (s[0]) {
       s[strlen(s) - 2] = 0;
-      botnet_send_priv(idx, botnetnick, par, NULL,
+      botnet_send_priv(idx, conf.bot->nick, par, NULL,
 		       "%s <%s> (%s) [UP %s]", ver, network, s, s2);
     } else
-      botnet_send_priv(idx, botnetnick, par, NULL,
+      botnet_send_priv(idx, conf.bot->nick, par, NULL,
 		    "%s <%s> (%s) [UP %s]", ver, network, BOT_NOCHANNELS,
 		       s2);
   } else
-    botnet_send_priv(idx, botnetnick, par, NULL,
+    botnet_send_priv(idx, conf.bot->nick, par, NULL,
 		     "%s <NO_IRC> [UP %s]", ver, s2);
   botnet_send_infoq(idx, par);
 }
@@ -583,17 +583,17 @@ static void bot_link(int idx, char *par)
   from = newsplit(&par);
   bot = newsplit(&par);
 
-  if (!egg_strcasecmp(bot, botnetnick)) {
+  if (!egg_strcasecmp(bot, conf.bot->nick)) {
     if ((rfrom = strchr(from, ':')))
       rfrom++;
     else
       rfrom = from;
     putlog(LOG_CMDS, "*", "#%s# link %s", rfrom, par);
     if (botlink(from, -1, par))
-      botnet_send_priv(idx, botnetnick, from, NULL, "%s %s ...",
+      botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s %s ...",
 		       BOT_LINKATTEMPT, par);
     else
-      botnet_send_priv(idx, botnetnick, from, NULL, "%s.",
+      botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s.",
 		       BOT_CANTLINKTHERE);
   } else {
     i = nextbot(bot);
@@ -612,7 +612,7 @@ static void bot_unlink(int idx, char *par)
   from = newsplit(&par);
   bot = newsplit(&par);
   undes = newsplit(&par);
-  if (!egg_strcasecmp(bot, botnetnick)) {
+  if (!egg_strcasecmp(bot, conf.bot->nick)) {
     if ((rfrom = strchr(from, ':')))
       rfrom++;
     else
@@ -630,7 +630,7 @@ static void bot_unlink(int idx, char *par)
 	 */
 	i = nextbot(p + 1);
 	if (i >= 0)
-	  botnet_send_priv(i, botnetnick, from, NULL,
+	  botnet_send_priv(i, conf.bot->nick, from, NULL,
 			   "Unlinked from %s.", undes);
       }
     } else if (i == 0) {
@@ -640,7 +640,7 @@ static void bot_unlink(int idx, char *par)
 	/* Ditto above, about idx */
 	i = nextbot(p + 1);
 	if (i >= 0)
-	  botnet_send_priv(i, botnetnick, from, NULL,
+	  botnet_send_priv(i, conf.bot->nick, from, NULL,
 			   "%s %s.", BOT_CANTUNLINK, undes);
       }
     } else {
@@ -648,7 +648,7 @@ static void bot_unlink(int idx, char *par)
       if (p) {
 	i = nextbot(p + 1);
 	if (i >= 0)
-	  botnet_send_priv(i, botnetnick, from, NULL,
+	  botnet_send_priv(i, conf.bot->nick, from, NULL,
 			   "Can't remotely unlink sharebots.");
       }
     }
@@ -724,7 +724,7 @@ static void bot_nlinked(int idx, char *par)
     simple_sprintf(s, "%s %s (%s)", MISC_DISCONNECTED, dcc[idx].nick,
 		   MISC_INVALIDBOT);
     dprintf(idx, "error invalid eggnet protocol for 'nlinked'\n");
-  } else if ((in_chain(newbot)) || (!egg_strcasecmp(newbot, botnetnick))) {
+  } else if ((in_chain(newbot)) || (!egg_strcasecmp(newbot, conf.bot->nick))) {
     /* Loop! */
     putlog(LOG_BOTS, "*", "%s %s (mutual: %s)",
 	   BOT_LOOPDETECT, dcc[idx].nick, newbot);
@@ -775,7 +775,7 @@ static void bot_nlinked(int idx, char *par)
   check_bind_link(newbot, next);
   u = get_user_by_handle(userlist, newbot);
   if (bot_flags(u) & BOT_REJECT) {
-    botnet_send_reject(idx, botnetnick, NULL, newbot, NULL, NULL);
+    botnet_send_reject(idx, conf.bot->nick, NULL, newbot, NULL, NULL);
     putlog(LOG_BOTS, "*", "%s %s %s %s", BOT_REJECTING,
 	   newbot, MISC_FROM, dcc[idx].nick);
   }
@@ -816,9 +816,9 @@ static void bot_trace(int idx, char *par)
 
   from = newsplit(&par);
   dest = newsplit(&par);
-  simple_sprintf(TBUF, "%s:%s", par, botnetnick);
+  simple_sprintf(TBUF, "%s:%s", par, conf.bot->nick);
   botnet_send_traced(idx, from, TBUF);
-  if (egg_strcasecmp(dest, botnetnick) && ((i = nextbot(dest)) > 0))
+  if (egg_strcasecmp(dest, conf.bot->nick) && ((i = nextbot(dest)) > 0))
     botnet_send_trace(i, from, dest, par);
 }
 
@@ -837,7 +837,7 @@ static void bot_traced(int idx, char *par)
     *p = 0;
     p++;
   }
-  if (!egg_strcasecmp(p, botnetnick)) {
+  if (!egg_strcasecmp(p, conf.bot->nick)) {
     time_t t = 0;
     char *p = par, *ss = TBUF;
 
@@ -919,7 +919,7 @@ static void bot_reject(int idx, char *par)
     /* Rejecting a bot */
     i = nextbot(who);
     if (i < 0) {
-      botnet_send_priv(idx, botnetnick, from, NULL, "%s %s (%s)",
+      botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s %s (%s)",
 		       BOT_CANTUNLINK, who, BOT_DOESNTEXIST);
     } else if (!egg_strcasecmp(dcc[i].nick, who)) {
       char s[1024];
@@ -940,7 +940,7 @@ static void bot_reject(int idx, char *par)
     }
   } else {			/* Rejecting user */
     *destbot++ = 0;
-    if (!egg_strcasecmp(destbot, botnetnick)) {
+    if (!egg_strcasecmp(destbot, conf.bot->nick)) {
       /* Kick someone here! */
       int ok = 0;
 
@@ -952,11 +952,11 @@ static void bot_reject(int idx, char *par)
 	  frombot++;
 	u = get_user_by_handle(userlist, frombot);
 	if (!(bot_flags(u) & BOT_SHARE)) {
-	  add_note(from, botnetnick, "No non sharebot boots.", -1, 0);
+	  add_note(from, conf.bot->nick, "No non sharebot boots.", -1, 0);
 	  ok = 1;
 	}
       } else if (remote_boots == 0) {
-	botnet_send_priv(idx, botnetnick, from, NULL, "%s",
+	botnet_send_priv(idx, conf.bot->nick, from, NULL, "%s",
 			 BOT_NOREMOTEBOOT);
 	ok = 1;
       }
@@ -966,7 +966,7 @@ static void bot_reject(int idx, char *par)
 	  u = get_user_by_handle(userlist, dcc[i].nick);
 	  if (u && 
               ((u->flags & USER_OWNER) && !(dcc[idx].user->flags & USER_ADMIN))) {
-	    add_note(from, botnetnick, BOT_NOOWNERBOOT, -1, 0);
+	    add_note(from, conf.bot->nick, BOT_NOOWNERBOOT, -1, 0);
 	    return;
 	  }
 	  do_boot(i, from, par);
@@ -1041,7 +1041,7 @@ static void bot_zapf(int idx, char *par)
     fake_alert(idx, "direction", from);
     return;
   }
-  if (!egg_strcasecmp(to, botnetnick)) {
+  if (!egg_strcasecmp(to, conf.bot->nick)) {
     /* For me! */
     char *opcode;
 
@@ -1306,16 +1306,16 @@ static void bot_versions(int sock, char *par)
 
   if (nextbot(frombot) != sock)
     fake_alert(sock, "versions-direction", frombot);
-  else if (egg_strcasecmp(tobot = newsplit(&par), botnetnick)) {
+  else if (egg_strcasecmp(tobot = newsplit(&par), conf.bot->nick)) {
     if ((sock = nextbot(tobot)) >= 0)
       dprintf(sock, "v %s %s %s\n", frombot, tobot, par);
   } else {
     from = newsplit(&par);
-    botnet_send_priv(sock, botnetnick, from, frombot, "Modules loaded:\n");
+    botnet_send_priv(sock, conf.bot->nick, from, frombot, "Modules loaded:\n");
     for (me = module_list; me; me = me->next)
-      botnet_send_priv(sock, botnetnick, from, frombot, "  Module: %s (v%d.%d)\n",
+      botnet_send_priv(sock, conf.bot->nick, from, frombot, "  Module: %s (v%d.%d)\n",
 		       me->name, me->major, me->minor);
-    botnet_send_priv(sock, botnetnick, from, frombot, "End of module list.\n");
+    botnet_send_priv(sock, conf.bot->nick, from, frombot, "End of module list.\n");
   }
 }
 

+ 16 - 17
src/botmsg.c

@@ -25,7 +25,6 @@
 
 extern struct dcc_t	*dcc;
 extern int		 dcc_total, tands;
-extern char		 botnetnick[];
 extern time_t now;
 extern party_t		*party;
 extern struct userrec	*userlist;
@@ -195,10 +194,10 @@ int botnet_send_cmd(char * fbot, char * bot, char * from, int fromidx, char * cm
     sprintf(buf, STR("rc %s %s %s %i %s\n"), bot, fbot, from, fromidx, cmd);
     tputs(dcc[i].sock, buf, strlen(buf));
     return 1;
-  } else if (!strcmp(bot, botnetnick)) {
+  } else if (!strcmp(bot, conf.bot->nick)) {
     char tmp[24];
     sprintf(tmp, "%i", fromidx);
-    gotremotecmd(botnetnick, botnetnick, from, tmp, cmd);
+    gotremotecmd(conf.bot->nick, conf.bot->nick, from, tmp, cmd);
   }
   return 0;
 }
@@ -212,7 +211,7 @@ void botnet_send_cmd_broad(int idx, char * fbot, char * from, int fromidx, char
   if (idx<0) {
     char tmp[24];
     sprintf(tmp, "%i", fromidx);
-    gotremotecmd("*", botnetnick, from, tmp, cmd);
+    gotremotecmd("*", conf.bot->nick, from, tmp, cmd);
   }
 }
 
@@ -222,8 +221,8 @@ void botnet_send_cmdreply(char * fbot, char * bot, char * to, char * toidx, char
     char buf[2048];
     sprintf(buf, STR("rr %s %s %s %s %s\n"), bot, fbot, to, toidx, ln);
     tputs(dcc[i].sock, buf, strlen(buf));
-  } else if (!strcmp(bot, botnetnick)) {
-    gotremotereply(botnetnick, to, toidx, ln);
+  } else if (!strcmp(bot, conf.bot->nick)) {
+    gotremotereply(conf.bot->nick, to, toidx, ln);
   }
 }
 
@@ -372,7 +371,7 @@ void botnet_send_trace(int idx, char *to, char *from, char *buf)
 {
   int l;
 
-  l = simple_sprintf(OBUF, "t %s %s %s:%s\n", to, from, buf, botnetnick);
+  l = simple_sprintf(OBUF, "t %s %s %s:%s\n", to, from, buf, conf.bot->nick);
   tputs(dcc[idx].sock, OBUF, l);
 }
 
@@ -413,7 +412,7 @@ void putallbots(char *par)
   if (!par || !par[0])
     return;
   strncpyz(msg, par, sizeof msg);
-  botnet_send_zapf_broad(-1, botnetnick, NULL, msg);
+  botnet_send_zapf_broad(-1, conf.bot->nick, NULL, msg);
 }
 
 void putbot(char *bot, char *par)
@@ -426,7 +425,7 @@ void putbot(char *bot, char *par)
   if (i < 0)
     return;
   strncpyz(msg, par, sizeof msg);
-  botnet_send_zapf(i, botnetnick, bot, msg);
+  botnet_send_zapf(i, conf.bot->nick, bot, msg);
 }
 
 void botnet_send_zapf(int idx, char *a, char *b, char *c)
@@ -491,7 +490,7 @@ void botnet_send_join_idx(int useridx, int oldchan)
 
   if (tands > 0) {
     l = simple_sprintf(OBUF, "j %s %s %D %c%D %s\n",
-		       botnetnick, dcc[useridx].nick,
+		       conf.bot->nick, dcc[useridx].nick,
 		       dcc[useridx].u.chat->channel, geticon(useridx),
 		       dcc[useridx].sock, dcc[useridx].host);
     send_tand_but(-1, OBUF, -l);
@@ -514,7 +513,7 @@ void botnet_send_join_party(int idx, int linking, int useridx, int oldchan)
 
 void botnet_send_part_idx(int useridx, char *reason)
 {
-  int l = simple_sprintf(OBUF, "pt %s %s %D %s\n", botnetnick,
+  int l = simple_sprintf(OBUF, "pt %s %s %D %s\n", conf.bot->nick,
 			 dcc[useridx].nick, dcc[useridx].sock,
 			 reason ? reason : "");
 
@@ -542,7 +541,7 @@ void botnet_send_nkch(int useridx, char *oldnick)
   int l;
 
   if (tands > 0) {
-    l = simple_sprintf(OBUF, "nc %s %D %s\n", botnetnick,
+    l = simple_sprintf(OBUF, "nc %s %D %s\n", conf.bot->nick,
 		       dcc[useridx].sock, dcc[useridx].nick);
     send_tand_but(-1, OBUF, -l);
   }
@@ -580,17 +579,17 @@ int add_note(char *to, char *from, char *msg, int idx, int echo)
     x[20] = 0;
     *p = '@';
     p++;
-    if (!egg_strcasecmp(p, botnetnick))	/* To me?? */
+    if (!egg_strcasecmp(p, conf.bot->nick))	/* To me?? */
       return add_note(x, from, msg, idx, echo); /* Start over, dimwit. */
-    if (egg_strcasecmp(from, botnetnick)) {
+    if (egg_strcasecmp(from, conf.bot->nick)) {
       if (strlen(from) > 40)
 	from[40] = 0;
       if (strchr(from, '@')) {
 	strcpy(botf, from);
       } else
-	sprintf(botf, "%s@%s", from, botnetnick);
+	sprintf(botf, "%s@%s", from, conf.bot->nick);
     } else
-      strcpy(botf, botnetnick);
+      strcpy(botf, conf.bot->nick);
     i = nextbot(p);
     if (i < 0) {
       if (idx >= 0)
@@ -667,7 +666,7 @@ int add_note(char *to, char *from, char *msg, int idx, int echo)
 	  else if (*from == '@')
 	    fr = p + 1;
 	}
-	if (idx == -2 || (!egg_strcasecmp(from, botnetnick)))
+	if (idx == -2 || (!egg_strcasecmp(from, conf.bot->nick)))
 	  dprintf(i, "*** [%s] %s%s\n", fr, l ? work : "", msg);
 	else
 	  dprintf(i, "%cNote [%s]: %s%s\n", 7, fr, l ? work : "", msg);

+ 23 - 24
src/botnet.c

@@ -38,7 +38,6 @@ static int 		maxparty = 200;			/* Maximum space for party line members
 							   currently */
 int			tands = 0;			/* Number of bots on the botnet */
 int			parties = 0;			/* Number of people on the botnet */
-char			botnetnick[HANDLEN + 1] = "";	/* Botnet nickname */
 int			share_unlinks = 1;		/* Allow remote unlinks of my
 							   sharebots? */
 
@@ -80,7 +79,7 @@ void addbot(char *who, char *from, char *next, char flag, int vernum)
   *ptr = ptr2;
   /* May be via itself */
   ptr2->via = findbot(from);
-  if (!egg_strcasecmp(next, botnetnick))
+  if (!egg_strcasecmp(next, conf.bot->nick))
     ptr2->uplink = (tand_t *) 1;
   else
     ptr2->uplink = findbot(next);
@@ -425,7 +424,7 @@ char *lastbot(char *who)
   if (!bot)
     return "*";
   else if (bot->uplink == (tand_t *) 1)
-    return botnetnick;
+    return conf.bot->nick;
   else
     return bot->uplink->bot;
 }
@@ -457,7 +456,7 @@ void answer_local_whom(int idx, int chan)
     if (dcc[i].type == &DCC_CHAT) {
       if ((chan == (-1)) || ((chan >= 0) && (dcc[i].u.chat->channel == chan))) {
         t = strlen(dcc[i].nick); if(t > nicklen) nicklen = t;
-        t = strlen(botnetnick); if(t > botnicklen) botnicklen = t;
+        t = strlen(conf.bot->nick); if(t > botnicklen) botnicklen = t;
       }
     }
   for (i = 0; i < parties; i++) {
@@ -508,7 +507,7 @@ void answer_local_whom(int idx, int chan)
 		(dcc[i].u.chat->channel == 0) && (chan == (-1)) ? '+' :
 		(dcc[i].u.chat->channel > GLOBAL_CHANS) &&
 #ifdef HUB
-		(chan == (-1)) ? '*' : ' ', botnetnick, dcc[i].host, idle);
+		(chan == (-1)) ? '*' : ' ', conf.bot->nick, dcc[i].host, idle);
 #else /* !HUB */
 		(chan == (-1)) ? '*' : ' ', idle);
 #endif /* HUB */
@@ -567,8 +566,8 @@ void tell_bots(int idx)
     dprintf(idx, STR("No bots linked\n"));
     return;
   }
-  strcpy(s, botnetnick);
-  i = strlen(botnetnick);
+  strcpy(s, conf.bot->nick);
+  i = strlen(conf.bot->nick);
 
   for (bot = tandbot; bot; bot = bot->next) {
     if (i > (500 - HANDLEN)) {
@@ -618,13 +617,13 @@ void tell_bottree(int idx, int showver)
   if (s[0])
     dprintf(idx, "(%s %s)\n", BOT_NOTRACEINFO, s);
   if (showver)
-    dprintf(idx, "%s (%d.%d.%d.%d)\n", botnetnick,
+    dprintf(idx, "%s (%d.%d.%d.%d)\n", conf.bot->nick,
 	    egg_numver / 1000000,
 	    egg_numver % 1000000 / 10000,
 	    egg_numver % 10000 / 100,
 	    egg_numver % 100);
   else
-    dprintf(idx, "%s\n", botnetnick);
+    dprintf(idx, "%s\n", conf.bot->nick);
   this = (tand_t *) 1;
   work[0] = 0;
   while (more) {
@@ -760,7 +759,7 @@ void dump_links(int z)
     char *p;
 
     if (bot->uplink == (tand_t *) 1)
-      p = botnetnick;
+      p = conf.bot->nick;
     else
       p = bot->uplink->bot;
     l = simple_sprintf(x, "n %s %s %c%D\n", bot->bot, p,
@@ -774,11 +773,11 @@ void dump_links(int z)
 	if ((dcc[i].u.chat->channel >= 0) &&
 	    (dcc[i].u.chat->channel < GLOBAL_CHANS)) {
           l = simple_sprintf(x, "j !%s %s %D %c%D %s\n",
-			       botnetnick, dcc[i].nick,
+			       conf.bot->nick, dcc[i].nick,
 			       dcc[i].u.chat->channel, geticon(i),
 			       dcc[i].sock, dcc[i].host);
 	  tputs(dcc[z].sock, x, l);
-          l = simple_sprintf(x, "i %s %D %D %s\n", botnetnick,
+          l = simple_sprintf(x, "i %s %D %D %s\n", conf.bot->nick,
 			       dcc[i].sock, now - dcc[i].timeval,
 			 dcc[i].u.chat->away ? dcc[i].u.chat->away : "");
 	  tputs(dcc[z].sock, x, l);
@@ -805,7 +804,7 @@ int in_chain(char *who)
 {
   if (findbot(who))
     return 1;
-  if (!egg_strcasecmp(who, botnetnick))
+  if (!egg_strcasecmp(who, conf.bot->nick))
     return 1;
   return 0;
 }
@@ -963,7 +962,7 @@ int botlink(char *linker, int idx, char *nick)
   if (!u || !(u->flags & USER_BOT)) {
     if (idx >= 0)
       dprintf(idx, "%s %s\n", nick, BOT_BOTUNKNOWN);
-  } else if (!egg_strcasecmp(nick, botnetnick)) {
+  } else if (!egg_strcasecmp(nick, conf.bot->nick)) {
     if (idx >= 0)
       dprintf(idx, "%s\n", BOT_CANTLINKMYSELF);
   } else if (in_chain(nick) && (idx != -3)) {
@@ -1136,7 +1135,7 @@ void tandem_relay(int idx, char *nick, register int i)
     dprintf(idx, "%s %s\n", nick, BOT_BOTUNKNOWN);
     return;
   }
-  if (!egg_strcasecmp(nick, botnetnick)) {
+  if (!egg_strcasecmp(nick, conf.bot->nick)) {
     dprintf(idx, "%s\n", BOT_CANTRELAYMYSELF);
     return;
   }
@@ -1286,7 +1285,7 @@ static void pre_relay(int idx, char *buf, register int i)
     struct chat_info *ci = dcc[idx].u.relay->chat;
 
     dprintf(idx, "%s %s.\n", BOT_ABORTRELAY1, dcc[tidx].nick);
-    dprintf(idx, "%s %s.\n\n", BOT_ABORTRELAY2, botnetnick);
+    dprintf(idx, "%s %s.\n\n", BOT_ABORTRELAY2, conf.bot->nick);
     putlog(LOG_MISC, "*", "%s %s -> %s", BOT_ABORTRELAY3, dcc[idx].nick,
 	   dcc[tidx].nick);
     dcc[idx].status = dcc[idx].u.relay->old_status;
@@ -1377,7 +1376,7 @@ static void cont_tandem_relay(int idx, char *buf, register int i)
 		dcc[uidx].nick, BOT_PARTYLEFT);
     if (dcc[uidx].u.chat->channel < GLOBAL_CHANS)
       botnet_send_part_idx(uidx, NULL);
-    check_bind_chpt(botnetnick, dcc[uidx].nick, dcc[uidx].sock,
+    check_bind_chpt(conf.bot->nick, dcc[uidx].nick, dcc[uidx].sock,
 		   dcc[uidx].u.chat->channel);
   }
   check_bind_chof(dcc[uidx].nick, uidx);
@@ -1404,7 +1403,7 @@ static void eof_dcc_relay(int idx)
     dprintf(j, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n");
   putlog(LOG_MISC, "*", "%s: %s -> %s", BOT_ENDRELAY1, dcc[j].nick,
 	 dcc[idx].nick);
-  dprintf(j, "\n\n*** %s %s\n", BOT_ENDRELAY2, botnetnick);
+  dprintf(j, "\n\n*** %s %s\n", BOT_ENDRELAY2, conf.bot->nick);
   ci = dcc[j].u.relay->chat;
   free(dcc[j].u.relay);
   dcc[j].u.chat = ci;
@@ -1416,7 +1415,7 @@ static void eof_dcc_relay(int idx)
       botnet_send_join_idx(j, -1);
   }
   check_bind_chon(dcc[j].nick, j);
-  check_bind_chjn(botnetnick, dcc[j].nick, dcc[j].u.chat->channel,
+  check_bind_chjn(conf.bot->nick, dcc[j].nick, dcc[j].u.chat->channel,
 		 geticon(j), dcc[j].sock, dcc[j].host);
   killsock(dcc[idx].sock);
   lostdcc(idx);
@@ -1497,7 +1496,7 @@ static void dcc_relaying(int idx, char *buf, int j)
   if (dcc[idx].status & STAT_TELNET)
     dprintf(idx, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n");
   dprintf(idx, "\n(%s %s.)\n", BOT_BREAKRELAY, dcc[j].nick);
-  dprintf(idx, "%s %s.\n\n", BOT_ABORTRELAY2, botnetnick);
+  dprintf(idx, "%s %s.\n\n", BOT_ABORTRELAY2, conf.bot->nick);
   putlog(LOG_MISC, "*", "%s: %s -> %s", BOT_RELAYBROKEN,
 	 dcc[idx].nick, dcc[j].nick);
   if (dcc[idx].u.relay->chat->channel >= 0) {
@@ -1512,7 +1511,7 @@ static void dcc_relaying(int idx, char *buf, int j)
   dcc[idx].type = &DCC_CHAT;
   check_bind_chon(dcc[idx].nick, idx);
   if (dcc[idx].u.chat->channel >= 0)
-    check_bind_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
+    check_bind_chjn(conf.bot->nick, dcc[idx].nick, dcc[idx].u.chat->channel,
 		   geticon(idx), dcc[idx].sock, dcc[idx].host);
   killsock(dcc[j].sock);
   lostdcc(j);
@@ -1667,7 +1666,7 @@ void check_botnet_pings()
 	    lostdcc(i);
 	  } else {
             putlog(LOG_MISC, "*", "I am lame, and am now rejecting %s", bot->bot);
-	    botnet_send_reject(i, botnetnick, NULL, bot->bot,
+	    botnet_send_reject(i, conf.bot->nick, NULL, bot->bot,
 			       NULL, NULL);
 	    dcc[i].status |= STAT_WARNED;
 	  }
@@ -1712,7 +1711,7 @@ void restart_chons()
   for (i = 0; i < dcc_total; i++) {
     if (dcc[i].type == &DCC_CHAT) {
       check_bind_chon(dcc[i].nick, i);
-      check_bind_chjn(botnetnick, dcc[i].nick, dcc[i].u.chat->channel,
+      check_bind_chjn(conf.bot->nick, dcc[i].nick, dcc[i].u.chat->channel,
 		     geticon(i), dcc[i].sock, dcc[i].host);
     }
   }
@@ -1759,7 +1758,7 @@ void lower_bot_linked(int idx)
 {
   char tmp[6];
   sprintf(tmp, STR("rl %d"), get_role(dcc[idx].nick));
-  botnet_send_zapf(nextbot(dcc[idx].nick), botnetnick, dcc[idx].nick, tmp);
+  botnet_send_zapf(nextbot(dcc[idx].nick), conf.bot->nick, dcc[idx].nick, tmp);
 
 }
 

+ 2 - 3
src/cfg.c

@@ -22,7 +22,6 @@
 
 #include "stat.h"
 
-extern char			botnetnick[];
 extern struct userrec 		*userlist;
 extern time_t		 	now;
 
@@ -605,7 +604,7 @@ void set_cfg_str(char *target, char *entryname, char *data)
     struct xtra_key *xk;
     char *olddata = entry->ldata;
 
-    if (u && !strcmp(botnetnick, u->handle)) {
+    if (u && !strcmp(conf.bot->nick, u->handle)) {
       if (data) {
         entry->ldata = strdup(data);
       } else
@@ -831,7 +830,7 @@ void trigger_cfg_changed()
       if (xk) {
 	putlog(LOG_DEBUG, "*", STR("trigger_cfg_changed for %s"), cfg[i]->name ? cfg[i]->name : "(null)");
 	if (!strcmp(cfg[i]->name, xk->key ? xk->key : "")) {
-	  set_cfg_str(botnetnick, cfg[i]->name, xk->data);
+	  set_cfg_str(conf.bot->nick, cfg[i]->name, xk->data);
 	}
       }
     }

+ 5 - 6
src/chanprog.c

@@ -30,7 +30,7 @@
 #include "modules.h"
 
 extern struct userrec	*userlist;
-extern char		 ver[], botnetnick[], firewall[], myip[], 
+extern char		 ver[], firewall[], myip[], 
 			 motdfile[], userfile[], tempdir[],
 			 owner[], 
                          botuser[], *owners, *hubs;
@@ -556,12 +556,11 @@ void chanprog()
  /* now this only checks server shit. (no channels) */
   call_hook(HOOK_REHASH);
   protect_readonly = 1;
-  if (!botnetnick[0]) {
-    strncpyz(botnetnick, origbotname, HANDLEN + 1);
-  }
+
   strcpy(botuser, origbotname);
-  if (!botnetnick[0])
-    fatal("I don't have a botnet nick!!\n", 0);
+
+  if (!conf.bot->nick)
+    fatal("I don't have a nickname!!\n", 0);
 #ifdef HUB
   loading = 1;
   checkchans(0);

+ 59 - 59
src/cmds.c

@@ -45,7 +45,7 @@ extern int		 dcc_total, remote_boots, backgrd,
 
 extern egg_traffic_t traffic;
 extern Tcl_Interp 	 *interp;
-extern char		 botnetnick[], origbotname[], ver[], network[],
+extern char		 origbotname[], ver[], network[],
 			 owner[], quit_msg[], dcc_prefix[], 
                          botname[], *binname, version[], egg_version[];
 extern time_t		 now, online_since, buildts;
@@ -243,14 +243,14 @@ static void cmd_botinfo(struct userrec *u, int idx, char *par)
   now2 -= (hr * 3600);
   min = (time_t) ((int) now2 / 60);
   sprintf(&s2[strlen(s2)], "%02d:%02d", (int) hr, (int) min);
-  simple_sprintf(s, "%d:%s@%s", dcc[idx].sock, dcc[idx].nick, botnetnick);
+  simple_sprintf(s, "%d:%s@%s", dcc[idx].sock, dcc[idx].nick, conf.bot->nick);
   botnet_send_infoq(-1, s);
   s[0] = 0;
   if (module_find("server", 0, 0)) {
     for (chan = chanset; chan; chan = chan->next) { 
       if (!channel_secret(chan)) {
 	if ((strlen(s) + strlen(chan->dname) + strlen(network)
-                   + strlen(botnetnick) + strlen(ver) + 1) >= 490) {
+                   + strlen(conf.bot->nick) + strlen(ver) + 1) >= 490) {
           strcat(s,"++  ");
           break; /* yeesh! */
 	}
@@ -261,13 +261,13 @@ static void cmd_botinfo(struct userrec *u, int idx, char *par)
 
     if (s[0]) {
       s[strlen(s) - 2] = 0;
-      dprintf(idx, "*** [%s] %s <%s> (%s) [UP %s]\n", botnetnick,
+      dprintf(idx, "*** [%s] %s <%s> (%s) [UP %s]\n", conf.bot->nick,
 	      ver, network, s, s2);
     } else
-      dprintf(idx, "*** [%s] %s <%s> (%s) [UP %s]\n", botnetnick,
+      dprintf(idx, "*** [%s] %s <%s> (%s) [UP %s]\n", conf.bot->nick,
 	      ver, network, BOT_NOCHANNELS, s2);
   } else
-    dprintf(idx, STR("*** [%s] %s <NO_IRC> [UP %s]\n"), botnetnick, ver, s2);
+    dprintf(idx, STR("*** [%s] %s <NO_IRC> [UP %s]\n"), conf.bot->nick, ver, s2);
 }
 #endif /* HUB */
 
@@ -581,7 +581,7 @@ static void cmd_me(struct userrec *u, int idx, char *par)
 	(dcc[i].u.chat->channel == dcc[idx].u.chat->channel) &&
 	((i != idx) || (dcc[i].status & STAT_ECHO)))
       dprintf(i, "* %s %s\n", dcc[idx].nick, par);
-  botnet_send_act(idx, botnetnick, dcc[idx].nick,
+  botnet_send_act(idx, conf.bot->nick, dcc[idx].nick,
 		  dcc[idx].u.chat->channel, par);
   check_bind_act(dcc[idx].nick, dcc[idx].u.chat->channel, par);
 }
@@ -730,7 +730,7 @@ static void cmd_downbots(struct userrec *u, int idx, char *par)
   putlog(LOG_CMDS, "*", STR("#%s# downbots"), dcc[idx].nick);
   for (u2 = userlist; u2; u2 = u2->next) {
     if (u2->flags & USER_BOT) {
-      if (egg_strcasecmp(u2->handle, botnetnick)) {
+      if (egg_strcasecmp(u2->handle, conf.bot->nick)) {
         if (nextbot(u2->handle) == -1) {
           strcat(work, u2->handle);
           cnt++;
@@ -904,7 +904,7 @@ static void cmd_who(struct userrec *u, int idx, char *par)
       return;
     }
     putlog(LOG_CMDS, "*", STR("#%s# who %s"), dcc[idx].nick, par);
-    if (!egg_strcasecmp(par, botnetnick))
+    if (!egg_strcasecmp(par, conf.bot->nick))
       tell_who(u, idx, dcc[idx].u.chat->channel);
     else {
       i = nextbot(par);
@@ -916,7 +916,7 @@ static void cmd_who(struct userrec *u, int idx, char *par)
 	char s[40];
 
 	simple_sprintf(s, "%d:%s@%s", dcc[idx].sock,
-		       dcc[idx].nick, botnetnick);
+		       dcc[idx].nick, conf.bot->nick);
 	botnet_send_who(i, s, par, dcc[idx].u.chat->channel);
       }
     }
@@ -1179,7 +1179,7 @@ static void cmd_boot(struct userrec *u, int idx, char *par)
     char whonick[HANDLEN + 1];
 
     splitcn(whonick, who, '@', HANDLEN + 1);
-    if (!egg_strcasecmp(who, botnetnick)) {
+    if (!egg_strcasecmp(who, conf.bot->nick)) {
       cmd_boot(u, idx, whonick);
       return;
     }
@@ -1189,7 +1189,7 @@ static void cmd_boot(struct userrec *u, int idx, char *par)
         dprintf(idx, STR("No such bot connected.\n"));
         return;
       }
-      botnet_send_reject(i, dcc[idx].nick, botnetnick, whonick,
+      botnet_send_reject(i, dcc[idx].nick, conf.bot->nick, whonick,
 			 who, par[0] ? par : dcc[idx].nick);
       putlog(LOG_BOTS, "*", STR("#%s# boot %s@%s (%s)"), dcc[idx].nick, whonick,
 	     who, par[0] ? par : dcc[idx].nick);
@@ -1386,7 +1386,7 @@ static void cmd_chhandle(struct userrec *u, int idx, char *par)
       dprintf(idx, STR("You can't change a bot owner's handle.\n"));
     else if (isowner(hand) && egg_strcasecmp(dcc[idx].nick, hand))
       dprintf(idx, STR("You can't change a permanent bot owner's handle.\n"));
-    else if (!egg_strcasecmp(newhand, botnetnick) && (!(atr2 & USER_BOT) ||
+    else if (!egg_strcasecmp(newhand, conf.bot->nick) && (!(atr2 & USER_BOT) ||
              nextbot(hand) != -1))
       dprintf(idx, STR("Hey! That's MY name!\n"));
     else if (change_handle(u2, newhand)) {
@@ -1422,7 +1422,7 @@ static void cmd_handle(struct userrec *u, int idx, char *par)
   } else if (get_user_by_handle(userlist, newhandle) &&
 	     egg_strcasecmp(dcc[idx].nick, newhandle)) {
     dprintf(idx, STR("Somebody is already using %s.\n"), newhandle);
-  } else if (!egg_strcasecmp(newhandle, botnetnick)) {
+  } else if (!egg_strcasecmp(newhandle, conf.bot->nick)) {
     dprintf(idx, STR("Hey!  That's MY name!\n"));
   } else {
     strncpyz(oldhandle, dcc[idx].nick, sizeof oldhandle);
@@ -1820,7 +1820,7 @@ static void cmd_restart(struct userrec *u, int idx, char *par)
   }
 }
 #endif /* LEAF */
-  botnet_send_chat(-1, botnetnick, "Restarting...");
+  botnet_send_chat(-1, conf.bot->nick, "Restarting...");
   botnet_send_bye();
 
   fatal("Restarting...", 1);
@@ -1901,7 +1901,7 @@ static void cmd_link(struct userrec *u, int idx, char *par)
   }
   putlog(LOG_CMDS, "*", STR("#%s# link %s"), dcc[idx].nick, par);
   s = newsplit(&par);
-  if (!par[0] || !egg_strcasecmp(par, botnetnick))
+  if (!par[0] || !egg_strcasecmp(par, conf.bot->nick))
     botlink(dcc[idx].nick, idx, s);
   else {
     char x[40];
@@ -1911,7 +1911,7 @@ static void cmd_link(struct userrec *u, int idx, char *par)
       dprintf(idx, STR("No such bot online.\n"));
       return;
     }
-    simple_sprintf(x, "%d:%s@%s", dcc[idx].sock, dcc[idx].nick, botnetnick);
+    simple_sprintf(x, "%d:%s@%s", dcc[idx].sock, dcc[idx].nick, conf.bot->nick);
     botnet_send_link(i, x, s, par);
   }
 }
@@ -1941,7 +1941,7 @@ static void cmd_unlink(struct userrec *u, int idx, char *par)
   else {
     char x[40];
 
-    simple_sprintf(x, "%d:%s@%s", dcc[idx].sock, dcc[idx].nick, botnetnick);
+    simple_sprintf(x, "%d:%s@%s", dcc[idx].sock, dcc[idx].nick, conf.bot->nick);
     botnet_send_unlink(i, x, lastbot(bot), bot, par);
   }
 }
@@ -1997,7 +1997,7 @@ static void cmd_trace(struct userrec *u, int idx, char *par)
     dprintf(idx, STR("Usage: trace <bot>\n"));
     return;
   }
-  if (!egg_strcasecmp(par, botnetnick)) {
+  if (!egg_strcasecmp(par, conf.bot->nick)) {
     dprintf(idx, STR("That's me!  Hiya! :)\n"));
     return;
   }
@@ -2007,7 +2007,7 @@ static void cmd_trace(struct userrec *u, int idx, char *par)
     return;
   }
   putlog(LOG_CMDS, "*", STR("#%s# trace %s"), dcc[idx].nick, par);
-  simple_sprintf(x, "%d:%s@%s", dcc[idx].sock, dcc[idx].nick, botnetnick);
+  simple_sprintf(x, "%d:%s@%s", dcc[idx].sock, dcc[idx].nick, conf.bot->nick);
   simple_sprintf(y, ":%d", now);
   botnet_send_trace(i, x, par, y);
 }
@@ -2109,14 +2109,14 @@ int check_dcc_attrs(struct userrec *u, int oatr)
         /* no hub access, drop them. */
         dprintf(i, STR("-+- POOF! -+-\n"));
         dprintf(i, STR("You no longer have hub access.\n\n"));
-        do_boot(i, botnetnick, STR("No hub access.\n\n"));
+        do_boot(i, conf.bot->nick, STR("No hub access.\n\n"));
       }     
 #else /* !HUB */
       if (ischanhub() && !(u->flags & (USER_CHUBA))) {
         /* no chanhub access, drop them. */
         dprintf(i, STR("-+- POOF! -+-\n"));
         dprintf(i, STR("You no longer have chathub access.\n\n"));
-        do_boot(i, botnetnick, STR("No chathub access.\n\n"));
+        do_boot(i, conf.bot->nick, STR("No chathub access.\n\n"));
       }
 #endif /* HUB */
     }
@@ -2426,7 +2426,7 @@ static void cmd_chat(struct userrec *u, int idx, char *par)
       return;
     } else {
       dprintf(idx, STR("Leaving chat mode...\n"));
-      check_bind_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
+      check_bind_chpt(conf.bot->nick, dcc[idx].nick, dcc[idx].sock,
 		     dcc[idx].u.chat->channel);
       chanout_but(-1, dcc[idx].u.chat->channel,
 		  "*** %s left the party line.\n",
@@ -2498,7 +2498,7 @@ static void cmd_chat(struct userrec *u, int idx, char *par)
     } else {
       oldchan = dcc[idx].u.chat->channel;
       if (oldchan >= 0)
-	check_bind_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock, oldchan);
+	check_bind_chpt(conf.bot->nick, dcc[idx].nick, dcc[idx].sock, oldchan);
       if (!oldchan) {
 	chanout_but(-1, 0, "*** %s left the party line.\n", dcc[idx].nick);
       } else if (oldchan > 0) {
@@ -2512,7 +2512,7 @@ static void cmd_chat(struct userrec *u, int idx, char *par)
 	dprintf(idx, STR("Joining channel '%s'...\n"), arg);
 	chanout_but(-1, newchan, "*** %s joined the channel.\n", dcc[idx].nick);
       }
-      check_bind_chjn(botnetnick, dcc[idx].nick, newchan, geticon(idx),
+      check_bind_chjn(conf.bot->nick, dcc[idx].nick, newchan, geticon(idx),
 		     dcc[idx].sock, dcc[idx].host);
       if (newchan < GLOBAL_CHANS)
 	botnet_send_join_idx(idx, oldchan);
@@ -3018,8 +3018,8 @@ static void cmd_newleaf(struct userrec *u, int idx, char *par)
       u1 = get_user_by_handle(userlist, handle);
       bi = malloc(sizeof(struct bot_addr));
 
-      bi->uplink = malloc(strlen(botnetnick) + 1); 
-/*      strcpy(bi->uplink, botnetnick); */
+      bi->uplink = malloc(strlen(conf.bot->nick) + 1); 
+/*      strcpy(bi->uplink, conf.bot->nick); */
       strcpy(bi->uplink, "");
 
       bi->address = malloc(1);
@@ -3188,7 +3188,7 @@ static void cmd_pls_user(struct userrec *u, int idx, char *par)
     dprintf(idx, STR("Someone already exists by that name.\n"));
   else if (strchr(BADNICKCHARS, handle[0]) != NULL)
     dprintf(idx, STR("You can't start a nick with '%c'.\n"), handle[0]);
-  else if (!egg_strcasecmp(handle, botnetnick))
+  else if (!egg_strcasecmp(handle, conf.bot->nick))
     dprintf(idx, STR("Hey! That's MY name!\n"));
   else {
     struct userrec *u2;
@@ -3442,7 +3442,7 @@ static void cmd_mns_host(struct userrec *u, int idx, char *par)
 /* netserver */
 static void cmd_netserver(struct userrec * u, int idx, char * par) {
   putlog(LOG_CMDS, "*", STR("#%s# netserver"), dcc[idx].nick);
-  botnet_send_cmd_broad(-1, botnetnick, u->handle, idx, STR("cursrv"));
+  botnet_send_cmd_broad(-1, conf.bot->nick, u->handle, idx, STR("cursrv"));
 }
 
 static void cmd_botserver(struct userrec * u, int idx, char * par) {
@@ -3454,7 +3454,7 @@ static void cmd_botserver(struct userrec * u, int idx, char * par) {
   if (nextbot(par)<0) {
     dprintf(idx, STR("%s isn't a linked bot\n"), par);
   }
-  botnet_send_cmd(botnetnick, par, u->handle, idx, STR("cursrv"));
+  botnet_send_cmd(conf.bot->nick, par, u->handle, idx, STR("cursrv"));
 }
 
 
@@ -3473,7 +3473,7 @@ void rcmd_cursrv(char * fbot, char * fhand, char * fidx) {
     sprintf(tmp, "Currently: %-40s Lag: %d", cursrvname, server_lag);
   else
     sprintf(tmp, "Currently: none");
-  botnet_send_cmdreply(botnetnick, fbot, fhand, fidx, tmp);
+  botnet_send_cmdreply(conf.bot->nick, fbot, fhand, fidx, tmp);
 #endif /* LEAF */
 }
 
@@ -3481,7 +3481,7 @@ void rcmd_cursrv(char * fbot, char * fhand, char * fidx) {
 /* netversion */
 static void cmd_netversion(struct userrec * u, int idx, char * par) {
   putlog(LOG_CMDS, "*", STR("#%s# netversion"), dcc[idx].nick);
-  botnet_send_cmd_broad(-1, botnetnick, u->handle, idx, STR("ver"));
+  botnet_send_cmd_broad(-1, conf.bot->nick, u->handle, idx, STR("ver"));
 }
 
 static void cmd_botversion(struct userrec * u, int idx, char * par) {
@@ -3493,7 +3493,7 @@ static void cmd_botversion(struct userrec * u, int idx, char * par) {
   if (nextbot(par)<0) {
     dprintf(idx, STR("%s isn't a linked bot\n"), par);
   }
-  botnet_send_cmd(botnetnick, par, u->handle, idx, STR("ver"));
+  botnet_send_cmd(conf.bot->nick, par, u->handle, idx, STR("ver"));
 }
 #endif /* HUB */
 
@@ -3506,14 +3506,14 @@ void rcmd_ver(char * fbot, char * fhand, char * fidx) {
   } else {
     sprintf(tmp + strlen(tmp), STR("%s %s (%s)"), un.sysname, un.release, un.machine);
   }
-  botnet_send_cmdreply(botnetnick, fbot, fhand, fidx, tmp);
+  botnet_send_cmdreply(conf.bot->nick, fbot, fhand, fidx, tmp);
 }
 
 
 /* netnick, botnick */
 static void cmd_netnick (struct userrec *u, int idx, char *par) {
   putlog(LOG_CMDS, "*", STR("#%s# netnick"), dcc[idx].nick);
-  botnet_send_cmd_broad(-1, botnetnick, u->handle, idx, STR("curnick"));
+  botnet_send_cmd_broad(-1, conf.bot->nick, u->handle, idx, STR("curnick"));
 }
 
 static void cmd_botnick(struct userrec * u, int idx, char * par) {
@@ -3525,7 +3525,7 @@ static void cmd_botnick(struct userrec * u, int idx, char * par) {
   if (nextbot(par)<0) {
     dprintf(idx, STR("%s isn't a linked bot\n"), par);
   }
-  botnet_send_cmd(botnetnick, par, u->handle, idx, STR("curnick"));
+  botnet_send_cmd(conf.bot->nick, par, u->handle, idx, STR("curnick"));
 }
 
 void rcmd_curnick(char * fbot, char * fhand, char * fidx) {
@@ -3544,7 +3544,7 @@ void rcmd_curnick(char * fbot, char * fhand, char * fidx) {
     sprintf(tmp, STR("%sWant: %s"), tmp, origbotname);
   if (!server_online)
     sprintf(tmp, STR("%s(not online)"), tmp);
-  botnet_send_cmdreply(botnetnick, fbot, fhand, fidx, tmp);
+  botnet_send_cmdreply(conf.bot->nick, fbot, fhand, fidx, tmp);
 #endif /* LEAF */
 }
 
@@ -3564,7 +3564,7 @@ static void cmd_botmsg(struct userrec * u, int idx, char * par) {
     return;
   }
   sprintf(tmp, STR("msg %s %s"), tnick, par);
-  botnet_send_cmd(botnetnick, tbot, u->handle, idx, tmp);
+  botnet_send_cmd(conf.bot->nick, tbot, u->handle, idx, tmp);
 }
 
 static void cmd_netmsg(struct userrec * u, int idx, char * par) {
@@ -3577,7 +3577,7 @@ static void cmd_netmsg(struct userrec * u, int idx, char * par) {
     return;
   }
   sprintf(tmp, STR("msg %s %s"), tnick, par);
-  botnet_send_cmd_broad(-1, botnetnick, u->handle, idx, tmp);
+  botnet_send_cmd_broad(-1, conf.bot->nick, u->handle, idx, tmp);
 }
 
 void rcmd_msg(char * tobot, char * frombot, char * fromhand, char * fromidx, char * par) {
@@ -3585,9 +3585,9 @@ void rcmd_msg(char * tobot, char * frombot, char * fromhand, char * fromidx, cha
   char buf[1024], *nick;
   nick=newsplit(&par);
   dprintf(DP_SERVER, STR("PRIVMSG %s :%s\n"), nick, par);
-  if (!strcmp(tobot, botnetnick)) {
+  if (!strcmp(tobot, conf.bot->nick)) {
     sprintf(buf, STR("Sent message to %s"), nick);
-    botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, buf);
+    botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, buf);
   }
 #endif /* LEAF */
 }
@@ -3603,14 +3603,14 @@ static void cmd_netlag(struct userrec * u, int idx, char * par) {
   tm = (tv.tv_sec % 10000) * 100 + (tv.tv_usec * 100) / (1000000);
   sprintf(tmp, STR("ping %lu"), tm);
   dprintf(idx, STR("Sent ping to all linked bots\n"));
-  botnet_send_cmd_broad(-1, botnetnick, u->handle, idx, tmp);
+  botnet_send_cmd_broad(-1, conf.bot->nick, u->handle, idx, tmp);
 }
 #endif /* HUB */
 
 void rcmd_ping(char * frombot, char *fromhand, char * fromidx, char * par) {
   char tmp[64];
   sprintf(tmp, STR("pong %s"), par);
-  botnet_send_cmd(botnetnick, frombot, fromhand, atoi(fromidx), tmp);
+  botnet_send_cmd(conf.bot->nick, frombot, fromhand, atoi(fromidx), tmp);
 }
 
 void rcmd_pong(char *frombot, char *fromhand, char *fromidx, char *par) {
@@ -3630,7 +3630,7 @@ static void cmd_netw(struct userrec * u, int idx, char * par) {
   char tmp[128];
   putlog(LOG_CMDS, "*", STR("#%s# netw"), dcc[idx].nick);
   strcpy(tmp, STR("exec w"));
-  botnet_send_cmd_broad(-1, botnetnick, dcc[idx].nick, idx, tmp);
+  botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, tmp);
 }
 
 static void cmd_netps(struct userrec * u, int idx, char * par) {
@@ -3642,7 +3642,7 @@ static void cmd_netps(struct userrec * u, int idx, char * par) {
     return;
   }
   sprintf(buf, STR("exec ps %s"), par);
-  botnet_send_cmd_broad(-1, botnetnick, dcc[idx].nick, idx, buf);
+  botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, buf);
 }
 
 static void cmd_netlast(struct userrec * u, int idx, char * par) {
@@ -3654,7 +3654,7 @@ static void cmd_netlast(struct userrec * u, int idx, char * par) {
     return;
   }
   sprintf(buf, STR("exec last %s"), par);
-  botnet_send_cmd_broad(-1, botnetnick, dcc[idx].nick, idx, buf);
+  botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, buf);
 }
 #endif /* HUB */
 
@@ -3719,7 +3719,7 @@ static void cmd_netcrontab(struct userrec * u, int idx, char * par) {
     return;
   }
   egg_snprintf(buf, sizeof buf, STR("exec crontab %s %s"), cmd, par);
-  botnet_send_cmd_broad(-1, botnetnick, dcc[idx].nick, idx, buf);
+  botnet_send_cmd_broad(-1, conf.bot->nick, dcc[idx].nick, idx, buf);
 }
 #endif /* HUB */
 
@@ -3738,7 +3738,7 @@ void rcmd_exec(char * frombot, char * fromhand, char * fromidx, char * par) {
       strncpyz(user, conf.username, sizeof(user));
     }
     if (!user[0]) {
-      botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, STR("Can't determine user id for process"));
+      botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, STR("Can't determine user id for process"));
       return;
     }
     sprintf(scmd, STR("last %s"), user);
@@ -3771,7 +3771,7 @@ void rcmd_exec(char * frombot, char * fromhand, char * fromidx, char * par) {
         sprintf(s, STR("Crontabbed"));
       else
         sprintf(s, STR("Error checking crontab status"));
-      botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, s);
+      botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, s);
     }
   }
   if (!scmd[0])
@@ -3779,32 +3779,32 @@ void rcmd_exec(char * frombot, char * fromhand, char * fromidx, char * par) {
   if (shell_exec(scmd, NULL, &out, &err)) {
     if (out) {
       char *p = NULL, *np = NULL;
-      botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, STR("Result:"));
+      botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, STR("Result:"));
       p = out;
       while (p && p[0]) {
         np=strchr(p, '\n');
         if (np)
           *np++ = 0;
-        botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, p);
+        botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, p);
         p = np;
       }
       free(out);
     }
     if (err) {
       char *p = NULL, *np = NULL;
-      botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, STR("Errors:"));
+      botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, STR("Errors:"));
       p = err;
       while (p && p[0]) {
         np=strchr(p, '\n');
         if (np)
           *np++ = 0;
-        botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, p);
+        botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, p);
         p = np;
       }
       free(err);
     }
   } else {
-    botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, STR("exec failed"));
+    botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, STR("exec failed"));
   }
 
 }
@@ -3823,7 +3823,7 @@ static void cmd_botjump(struct userrec * u, int idx, char * par) {
     return;
   }
   sprintf(buf, STR("jump %s"), par);
-  botnet_send_cmd(botnetnick, tbot, dcc[idx].nick, idx, buf);
+  botnet_send_cmd(conf.bot->nick, tbot, dcc[idx].nick, idx, buf);
 }
 
 void rcmd_jump(char * frombot, char * fromhand, char * fromidx, char * par) {
@@ -3848,7 +3848,7 @@ void rcmd_jump(char * frombot, char * fromhand, char * fromidx, char * par) {
     (*(int *)(func[21])) = port; //newserverport
     strncpyz(((char *)(func[22])), par, 120); //newserverpass
   }
-  botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, STR("Jumping..."));
+  botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, STR("Jumping..."));
 
   (*(int *)(func[23])) = 0; //cycle_time
   (func[SERVER_NUKESERVER]) ("jumping...");
@@ -3879,7 +3879,7 @@ void gotremotecmd (char * forbot, char * frombot, char * fromhand, char * fromid
   } else if (!strcmp(cmd, STR("die"))) {
     exit(0);
   } else {
-    botnet_send_cmdreply(botnetnick, frombot, fromhand, fromidx, STR("Unrecognized remote command"));
+    botnet_send_cmdreply(conf.bot->nick, frombot, fromhand, fromidx, STR("Unrecognized remote command"));
   }
 }
     
@@ -3993,13 +3993,13 @@ static char *btos(unsigned long  bytes)
 static void cmd_whoami(struct userrec *u, int idx, char *par)
 {
   putlog(LOG_CMDS, "*", STR("#%s# whoami"), dcc[idx].nick);
-  dprintf(idx, "You are %s@%s.\n", dcc[idx].nick, botnetnick);
+  dprintf(idx, "You are %s@%s.\n", dcc[idx].nick, conf.bot->nick);
 }
 
 static void cmd_quit(struct userrec *u, int idx, char *text)
 {
 	if (dcc[idx].u.chat->channel >= 0 && dcc[idx].u.chat->channel < GLOBAL_CHANS) {
-		check_bind_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock, dcc[idx].u.chat->channel);
+		check_bind_chpt(conf.bot->nick, dcc[idx].nick, dcc[idx].sock, dcc[idx].u.chat->channel);
 	}
 	check_bind_chof(dcc[idx].nick, idx);
 	dprintf(idx, "*** See you later cowboy!\n\n");

+ 3 - 1
src/conf.c

@@ -17,7 +17,7 @@
 #include <pwd.h>
 #include <sys/types.h>
 
-extern char             origbotname[], botnetnick[], tempdir[],
+extern char             origbotname[], tempdir[],
                         userfile[], myip[], myip6[], natip[], hostname[], hostname6[];
 extern int              localhub;
 extern uid_t		myuid;
@@ -112,6 +112,7 @@ static void conf_addbot(char *nick, char *ip, char *host, char *ip6) {
   if (ip6)   bot->ip6 = strdup(ip6);
 
   bot->pid = checkpid(nick, bot);
+  bot->u = NULL;
 }
 
 
@@ -370,6 +371,7 @@ static void conf_bot_dup(conf_bot *dest, conf_bot *src) {
   dest->host =          src->host ? strdup(src->host) : NULL;
   dest->ip6 =           src->ip6 ? strdup(src->ip6) : NULL;
   dest->host6 =         src->host6 ? strdup(src->host6) : NULL;
+  dest->u =		src->u ? src->u : NULL;
   dest->pid =           src->pid;
 #ifdef LEAF
   dest->localhub =      src->localhub;

+ 17 - 17
src/dcc.c

@@ -44,7 +44,7 @@ extern time_t		 now, buildts;
 extern int		 egg_numver, connect_timeout, conmask, backgrd,
 			 max_dcc, default_flags, debug_output,
 			 ignore_time;
-extern char		 botnetnick[], ver[], origbotname[], bdhash[],
+extern char		 ver[], origbotname[], bdhash[],
                          dcc_prefix[];
 
 extern sock_list 	*socklist;
@@ -289,7 +289,7 @@ static void bot_version(int idx, char *par)
   } else
     dcc[idx].u.bot->numver = 0;
 
-    dprintf(idx, "tb %s\n", botnetnick);
+    dprintf(idx, "tb %s\n", conf.bot->nick);
     l = atoi(newsplit(&par));
     if (l != HANDLEN) {
       putlog(LOG_BOTS, "*", "Non-matching handle lengths with %s, they use %d characters.", 
@@ -309,14 +309,14 @@ 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, botnetnick, '!',
+  botnet_send_nlinked(idx, dcc[idx].nick, conf.bot->nick, '!',
 		      dcc[idx].u.bot->numver);
   touch_laston(dcc[idx].user, "linked", now);
   dump_links(idx);
   dcc[idx].type = &DCC_BOT;
-  addbot(dcc[idx].nick, dcc[idx].nick, botnetnick, '-',
+  addbot(dcc[idx].nick, dcc[idx].nick, conf.bot->nick, '-',
 	 dcc[idx].u.bot->numver);
-  check_bind_link(dcc[idx].nick, botnetnick);
+  check_bind_link(dcc[idx].nick, conf.bot->nick);
   egg_snprintf(x, sizeof x, "v %d", dcc[idx].u.bot->numver);
   bot_shareupdate(idx, x);
   bot_share(idx, x);
@@ -330,7 +330,7 @@ void failed_link(int idx)
   if (dcc[idx].u.bot->linker[0]) {
      egg_snprintf(s, sizeof s, "Couldn't link to %s.", dcc[idx].nick);
      strcpy(s1, dcc[idx].u.bot->linker);
-     add_note(s1, botnetnick, s, -2, 0);
+     add_note(s1, conf.bot->nick, s, -2, 0);
   }
   if (dcc[idx].u.bot->numver >= (-1))
     putlog(LOG_BOTS, "*", DCC_LINKFAIL, dcc[idx].nick);
@@ -371,20 +371,20 @@ static void cont_link(int idx, char *buf, int ii)
 /*.    ssl_link(dcc[idx].sock, CONNECT_SSL); */
     dcc[idx].type = &DCC_BOT_NEW;
     dcc[idx].u.bot->numver = 0;
-    dprintf(idx, "%s\n", botnetnick);
+    dprintf(idx, "%s\n", conf.bot->nick);
     i = sizeof(sa);
 
     /* initkey-gen leaf */
     /* bdhash myport hubnick mynick */
     getsockname(socklist[snum].sock, (struct sockaddr *) &sa, &i);
-    sprintf(tmp,"%s@%4x@%s@%s", bdhash, sa.sin_port, dcc[idx].nick, botnetnick);
+    sprintf(tmp,"%s@%4x@%s@%s", bdhash, sa.sin_port, dcc[idx].nick, conf.bot->nick);
     SHA1_Init(&ctx);
     SHA1_Update(&ctx, tmp, strlen(tmp));
     SHA1_Final(bufout, &ctx);
     strncpyz(socklist[snum].ikey, btoh(bufout, SHA_DIGEST_LENGTH), sizeof(socklist[snum].ikey));
     putlog(LOG_DEBUG, "@", "Link hash for %s: %s", dcc[idx].nick, tmp);
     putlog(LOG_DEBUG, "@", "initkey (%d): %s", strlen(socklist[snum].ikey), socklist[snum].ikey);
-    /* We've send our botnetnick and set the key for the link on the sock, wait for 'elink' back to verify key */
+    /* We've send our conf.bot->nick and set the key for the link on the sock, wait for 'elink' back to verify key */
     socklist[snum].encstatus = 1;
     socklist[snum].gz = 1;
   } else {
@@ -701,7 +701,7 @@ static void dcc_chat_pass(int idx, char *buf, int atr)
     strncpyz(dcc[idx].hash, makehash(dcc[idx].user, rand), sizeof dcc[idx].hash);
     dcc[idx].type = &DCC_CHAT_SECPASS;
     dcc[idx].timeval = now;
-    dprintf(idx, "-Auth %s %s\n", rand, botnetnick);
+    dprintf(idx, "-Auth %s %s\n", rand, conf.bot->nick);
 #else /* !S_DCCAUTH */
     dcc_chat_secpass(idx, buf, atr);
 #endif /* S_DCCAUTH */
@@ -871,7 +871,7 @@ static void append_line(int idx, char *line)
     }
     c->buffer = 0;
     dcc[idx].status &= ~STAT_PAGE;
-    do_boot(idx, botnetnick, "too many pages - senq full");
+    do_boot(idx, conf.bot->nick, "too many pages - senq full");
     return;
   }
   if ((c->line_count < c->max_line) && (c->buffer == NULL)) {
@@ -969,7 +969,7 @@ static void eof_dcc_chat(int idx)
 		dcc[idx].nick);
     if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
       botnet_send_part_idx(idx, "lost dcc link");
-    check_bind_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
+    check_bind_chpt(conf.bot->nick, dcc[idx].nick, dcc[idx].sock,
 		   dcc[idx].u.chat->channel);
   }
   check_bind_chof(dcc[idx].nick, idx);
@@ -1085,7 +1085,7 @@ static void dcc_chat(int idx, char *buf, int i)
          chanout_but(-1, dcc[idx].u.chat->channel, "<%s> %s\n", dcc[idx].nick, buf);
        else
          chanout_but(idx, dcc[idx].u.chat->channel, "<%s> %s\n", dcc[idx].nick, buf);
-       botnet_send_chan(-1, botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel, buf);
+       botnet_send_chan(-1, conf.bot->nick, dcc[idx].nick, dcc[idx].u.chat->channel, buf);
     }  
   }
   if (dcc[idx].type == &DCC_CHAT)	/* Could have change to files */
@@ -1464,8 +1464,8 @@ static void dcc_telnet_id(int idx, char *buf, int atr)
   correct_handle(buf);
   strcpy(dcc[idx].nick, buf);
   if (glob_bot(fr)) {
-    if (!egg_strcasecmp(botnetnick, dcc[idx].nick)) {
-      dprintf(idx, "error You cannot link using my botnetnick.\n");
+    if (!egg_strcasecmp(conf.bot->nick, dcc[idx].nick)) {
+      dprintf(idx, "error You cannot link using my conf.bot->nick.\n");
       putlog(LOG_BOTS, "*", DCC_MYBOTNETNICK, dcc[idx].host);
       killsock(dcc[idx].sock);
       lostdcc(idx);
@@ -1546,8 +1546,8 @@ static void dcc_telnet_pass(int idx, int atr)
       SHA_CTX ctx;
       
       /* initkey-gen hub */
-      /* bdhash port mynick botnetnick */
-      sprintf(tmp, "%s@%4x@%s@%s", bdhash, htons(dcc[idx].port), botnetnick, dcc[idx].nick);
+      /* bdhash port mynick conf.bot->nick */
+      sprintf(tmp, "%s@%4x@%s@%s", bdhash, htons(dcc[idx].port), conf.bot->nick, dcc[idx].nick);
       SHA1_Init(&ctx);
       SHA1_Update(&ctx, tmp, strlen(tmp));
       SHA1_Final(buf, &ctx);

+ 7 - 7
src/dccutil.c

@@ -28,7 +28,7 @@ extern int		 dcc_total, max_dcc, dcc_flood_thr, backgrd, MAXSOCKS, tands;
 #ifdef USE_IPV6
 extern unsigned long     notalloc;
 #endif /* USE_IPV6 */
-extern char		 botnetnick[], version[];
+extern char		 version[];
 extern time_t		 now;
 extern sock_list	*socklist;
 
@@ -255,7 +255,7 @@ void dcc_chatter(int idx)
   struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
 
   get_user_flagrec(dcc[idx].user, &fr, NULL);
-  dprintf(idx, "Connected to %s, running %s\n", botnetnick, version);
+  dprintf(idx, "Connected to %s, running %s\n", conf.bot->nick, version);
   show_banner(idx);
   show_motd(idx);
   if (glob_master(fr)) {
@@ -301,7 +301,7 @@ void dcc_chatter(int idx)
 	  botnet_send_join_idx(idx, -1);
 	}
       }
-      check_bind_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
+      check_bind_chjn(conf.bot->nick, dcc[idx].nick, dcc[idx].u.chat->channel,
 		     geticon(idx), dcc[idx].sock, dcc[idx].host);
     }
     /* But *do* bother with sending it locally */
@@ -427,13 +427,13 @@ void not_away(int idx)
     chanout_but(-1, dcc[idx].u.chat->channel,
 		"*** %s is no longer away.\n", dcc[idx].nick);
     if (dcc[idx].u.chat->channel < GLOBAL_CHANS) {
-      botnet_send_away(-1, botnetnick, dcc[idx].sock, NULL, idx);
+      botnet_send_away(-1, conf.bot->nick, dcc[idx].sock, NULL, idx);
     }
   }
   dprintf(idx, "You're not away any more.\n");
   free(dcc[idx].u.chat->away);
   dcc[idx].u.chat->away = NULL;
-  check_bind_away(botnetnick, dcc[idx].sock, NULL);
+  check_bind_away(conf.bot->nick, dcc[idx].sock, NULL);
 }
 
 void set_away(int idx, char *s)
@@ -453,11 +453,11 @@ void set_away(int idx, char *s)
     chanout_but(-1, dcc[idx].u.chat->channel,
 		"*** %s is now away: %s\n", dcc[idx].nick, s);
     if (dcc[idx].u.chat->channel < GLOBAL_CHANS) {
-      botnet_send_away(-1, botnetnick, dcc[idx].sock, s, idx);
+      botnet_send_away(-1, conf.bot->nick, dcc[idx].sock, s, idx);
     }
   }
   dprintf(idx, "You are now away.\n");
-  check_bind_away(botnetnick, dcc[idx].sock, s);
+  check_bind_away(conf.bot->nick, dcc[idx].sock, s);
 }
 
 

+ 1 - 1
src/main.c

@@ -53,7 +53,7 @@
 
 extern char *progname();		/* from settings.c */
 
-extern char		 origbotname[], userfile[], botnetnick[], packname[],
+extern char		 origbotname[], userfile[], packname[],
                          shellhash[];
 extern int		 dcc_total, conmask, cache_hit, cache_miss,
 			 fork_interval, optind, local_fork_interval,

+ 5 - 5
src/misc.c

@@ -36,7 +36,7 @@ extern struct dcc_t	*dcc;
 extern struct chanset_t	*chanset;
 
 extern char		 version[], origbotname[], botname[],
-			 admin[], network[], motdfile[], ver[], botnetnick[],
+			 admin[], network[], motdfile[], ver[], 
 			 userfile[], dcc_prefix[],
                          *binname, tempdir[], *owneremail;
 
@@ -688,7 +688,7 @@ void kill_bot(char *s1, char *s2)
 #endif /* HUB */
   call_hook(HOOK_DIE);
   chatout("*** %s\n", s1);
-  botnet_send_chat(-1, botnetnick, s1);
+  botnet_send_chat(-1, conf.bot->nick, s1);
   botnet_send_bye();
   fatal(s2, 0);
 }
@@ -717,7 +717,7 @@ void updatelocal(void)
   }
 #endif /* LEAF */
 
-  botnet_send_chat(-1, botnetnick, "Updating...");
+  botnet_send_chat(-1, conf.bot->nick, "Updating...");
   botnet_send_bye();
 
   fatal("Updating...", 1);
@@ -810,7 +810,7 @@ int updatebin(int idx, char *par, int autoi)
   if (localhub) {
     /* if localhub = 1, this is the spawn bot and controls
      * the spawning of new bots. */
-     sprintf(buf, "%s -L %s -P %d", buf, botnetnick, getpid());
+     sprintf(buf, "%s -L %s -P %d", buf, conf.bot->nick, getpid());
   } 
 #endif /* LEAF */
 
@@ -835,7 +835,7 @@ int updatebin(int idx, char *par, int autoi)
     if (idx)
       dprintf(idx, STR("Updating...bye\n"));
     putlog(LOG_MISC, "*", STR("Updating...\n"));
-    botnet_send_chat(-1, botnetnick, "Updating...");
+    botnet_send_chat(-1, conf.bot->nick, "Updating...");
     botnet_send_bye();
     fatal("Updating...", 1);
     usleep(2000 * 500);

+ 7 - 7
src/mod/channels.mod/userchan.c

@@ -1095,7 +1095,7 @@ static int write_bans(FILE *f, int idx)
     if (!mask ||
 	lfprintf(f, "- %s:%s%lu:%s:%lu:%s\n", mask,
 		(i->flags & IGREC_PERM) ? "+" : "", i->expire,
-		i->user ? i->user : botnetnick, i->added,
+		i->user ? i->user : conf.bot->nick, i->added,
 		i->msg ? i->msg : "") == EOF) {
       if (mask)
 	free(mask);
@@ -1112,7 +1112,7 @@ static int write_bans(FILE *f, int idx)
 	lfprintf(f, "- %s:%s%lu%s:+%lu:%lu:%s:%s\n", mask,
 		(b->flags & MASKREC_PERM) ? "+" : "", b->expire,
 		(b->flags & MASKREC_STICKY) ? "*" : "", b->added,
-		b->lastactive, b->user ? b->user : botnetnick,
+		b->lastactive, b->user ? b->user : conf.bot->nick,
 		b->desc ? b->desc : "requested") == EOF) {
       if (mask)
 	free(mask);
@@ -1137,7 +1137,7 @@ static int write_bans(FILE *f, int idx)
 	      lfprintf(f, "- %s:%s%lu%s:+%lu:%lu:%s:%s\n", mask,
 		      (b->flags & MASKREC_PERM) ? "+" : "", b->expire,
 		      (b->flags & MASKREC_STICKY) ? "*" : "", b->added,
-		      b->lastactive, b->user ? b->user : botnetnick,
+		      b->lastactive, b->user ? b->user : conf.bot->nick,
 		      b->desc ? b->desc : "requested") == EOF) {
 	    if (mask)
 	      free(mask);
@@ -1165,7 +1165,7 @@ static int write_exempts(FILE *f, int idx)
         lfprintf(f, "%s %s:%s%lu%s:+%lu:%lu:%s:%s\n", "%", mask,
 		(e->flags & MASKREC_PERM) ? "+" : "", e->expire,
 		(e->flags & MASKREC_STICKY) ? "*" : "", e->added,
-		e->lastactive, e->user ? e->user : botnetnick,
+		e->lastactive, e->user ? e->user : conf.bot->nick,
 		e->desc ? e->desc : "requested") == EOF) {
       if (mask)
 	free(mask);
@@ -1189,7 +1189,7 @@ static int write_exempts(FILE *f, int idx)
 	      lfprintf(f,"%s %s:%s%lu%s:+%lu:%lu:%s:%s\n","%", mask,
 		      (e->flags & MASKREC_PERM) ? "+" : "", e->expire,
 		      (e->flags & MASKREC_STICKY) ? "*" : "", e->added,
-		      e->lastactive, e->user ? e->user : botnetnick,
+		      e->lastactive, e->user ? e->user : conf.bot->nick,
 		      e->desc ? e->desc : "requested") == EOF) {
 	    if (mask)
 	      free(mask);
@@ -1218,7 +1218,7 @@ static int write_invites(FILE *f, int idx)
 	lfprintf(f,"@ %s:%s%lu%s:+%lu:%lu:%s:%s\n", mask,
 		(ir->flags & MASKREC_PERM) ? "+" : "", ir->expire,
 		(ir->flags & MASKREC_STICKY) ? "*" : "", ir->added,
-		ir->lastactive, ir->user ? ir->user : botnetnick,
+		ir->lastactive, ir->user ? ir->user : conf.bot->nick,
 		ir->desc ? ir->desc : "requested") == EOF) {
       if (mask)
 	free(mask);
@@ -1242,7 +1242,7 @@ static int write_invites(FILE *f, int idx)
 	      lfprintf(f,"@ %s:%s%lu%s:+%lu:%lu:%s:%s\n", mask,
 		      (ir->flags & MASKREC_PERM) ? "+" : "", ir->expire,
 		      (ir->flags & MASKREC_STICKY) ? "*" : "", ir->added,
-		      ir->lastactive, ir->user ? ir->user : botnetnick,
+		      ir->lastactive, ir->user ? ir->user : conf.bot->nick,
 		      ir->desc ? ir->desc : "requested") == EOF) {
 	    if (mask)
 	      free(mask);

+ 2 - 3
src/mod/console.mod/console.c

@@ -20,7 +20,6 @@
 #include "src/core_binds.h"
 
 extern int noshare;
-extern char botnetnick[];
 
 static int console_autosave = 1;
 static int info_party = 1;
@@ -265,7 +264,7 @@ static int console_chon(char *handle, int idx)
     if ((dcc[idx].u.chat->channel >= 0) &&
 	(dcc[idx].u.chat->channel < GLOBAL_CHANS)) {
       botnet_send_join_idx(idx, -1);
-      check_bind_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
+      check_bind_chjn(conf.bot->nick, dcc[idx].nick, dcc[idx].u.chat->channel,
 		     geticon(idx), dcc[idx].sock, dcc[idx].host);
     }
     if (info_party) {
@@ -278,7 +277,7 @@ static int console_chon(char *handle, int idx)
 	    chanout_but(-1, dcc[idx].u.chat->channel,
 			"*** [%s] %s\n", dcc[idx].nick, p);
 	    simple_sprintf(x, "[%s] %s", dcc[idx].nick, p);
-	    botnet_send_chan(-1, botnetnick, NULL,
+	    botnet_send_chan(-1, conf.bot->nick, NULL,
 			     dcc[idx].u.chat->channel, x);
 	}
       }

+ 2 - 2
src/mod/irc.mod/cmdsirc.c

@@ -552,7 +552,7 @@ ContextNote("!mdop!");
       if (!m->user)
 	targets[targetcount++] = m;
       else if (((m->user->flags & (USER_BOT | USER_OP)) == (USER_BOT | USER_OP))
-	       && (strcmp(botnetnick, m->user->handle))
+	       && (strcmp(conf.bot->nick, m->user->handle))
 	       && (nextbot(m->user->handle) >= 0))
 	chanbots[chanbotcount++] = m;
       else if (!(m->user->flags & USER_OP))
@@ -709,7 +709,7 @@ ContextNote("!mdop!");
     if (simul)
       dprintf(idx, "%s deops%s\n", chanbots[bpos]->nick, work);
     else
-      botnet_send_zapf(nextbot(chanbots[bpos]->user->handle), botnetnick, chanbots[bpos]->user->handle, work);
+      botnet_send_zapf(nextbot(chanbots[bpos]->user->handle), conf.bot->nick, chanbots[bpos]->user->handle, work);
     bots--;
     bpos++;
   }

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

@@ -412,7 +412,7 @@ void getin_request(char *botnick, char *code, char *par)
       sendi = 0;
       tmp = malloc(strlen(chan->dname) + strlen(p3) + 7);
       sprintf(tmp, STR("gi K %s %s"), chan->dname, p3);
-      botnet_send_zapf(nextbot(botnick), botnetnick, botnick, tmp);
+      botnet_send_zapf(nextbot(botnick), conf.bot->nick, botnick, tmp);
       putlog(LOG_GETIN, "*", STR("inreq from %s/%s for %s - Sent key (%s)"), botnick, nick, chan->dname, p3);
       free(tmp);
     }
@@ -466,7 +466,7 @@ void check_hostmask()
       return;
   }
 
-  addhost_by_handle(botnetnick, s);
+  addhost_by_handle(conf.bot->nick, s);
   putlog(LOG_GETIN, "*", STR("Updated my hostmask: %s"), s);
 }
 
@@ -773,7 +773,7 @@ static void punish_badguy(struct chanset_t *chan, char *whobad,
     splitnick(&whobad);
     maskhost(whobad, s1);
     simple_sprintf(s, "(%s) %s", ct, reason);
-    u_addban(chan, s1, botnetnick, s, now + (60 * chan->ban_time), 0);
+    u_addban(chan, s1, conf.bot->nick, s, now + (60 * chan->ban_time), 0);
     if (!mevictim && me_op(chan)) {
       add_mode(chan, '+', 'b', s1);
       flush_mode(chan, QUICK);

+ 2 - 2
src/mod/irc.mod/msgcmds.c

@@ -224,7 +224,7 @@ static int msg_authstart(char *nick, char *host, struct userrec *u, char *par)
   if (u)
     auth[i].user = u;
 
-  dprintf(DP_HELP, "PRIVMSG %s :auth%s %s\n", nick, u ? "." : "!", botnetnick);
+  dprintf(DP_HELP, "PRIVMSG %s :auth%s %s\n", nick, u ? "." : "!", conf.bot->nick);
 
   return BIND_RET_BREAK;
 
@@ -262,7 +262,7 @@ static int msg_auth(char *nick, char *host, struct userrec *u, char *par)
       auth[i].authing = 2;      
       make_rand_str(rand, 50);
       strncpyz(auth[i].hash, makehash(u, rand), sizeof auth[i].hash);
-      dprintf(DP_HELP, "PRIVMSG %s :-Auth %s %s\n", nick, rand, botnetnick);
+      dprintf(DP_HELP, "PRIVMSG %s :-Auth %s %s\n", nick, rand, conf.bot->nick);
   } else {
     putlog(LOG_CMDS, "*", "(%s!%s) !%s! failed -AUTH", nick, host, u->handle);
     removeauth(i);

+ 2 - 2
src/mod/module.h

@@ -256,8 +256,8 @@
 /* 120 - 123 */
 /* UNUSED 120 */
 #define dovoice ((int (*)(struct chanset_t *))global[121])
-#define Version ((char *)global[122])
-#define botnetnick ((char *)global[123])
+#define version ((char *)global[122])
+/* UNUSED 123 */
 /* 124 - 127 */
 #define DCC_CHAT_PASS (*(struct dcc_table *)(global[124]))
 #define DCC_BOT (*(struct dcc_table *)(global[125]))

+ 5 - 6
src/mod/notes.mod/notes.c

@@ -28,7 +28,6 @@
 
 extern struct userrec	*userlist;
 extern time_t now;
-extern char botnetnick[];
 extern int userfile_perm;
 
 static int maxnotes = 50;	/* Maximum number of notes to allow stored
@@ -210,7 +209,7 @@ int storenote(char *argv1, char *argv2, char *argv3, int idx, char *who, int buf
     /* User is valid & has a valid forwarding address */
      strcpy(fwd, f1);		/* Only 40 bytes are stored in the userfile */
      p = strchr(fwd, '@');
-    if (p && !egg_strcasecmp(p + 1, botnetnick)) {
+    if (p && !egg_strcasecmp(p + 1, conf.bot->nick)) {
       *p = 0;
       if (!egg_strcasecmp(fwd, argv2))
 	/* They're forwarding to themselves on the same bot, llama's */
@@ -248,12 +247,12 @@ int storenote(char *argv1, char *argv2, char *argv3, int idx, char *who, int buf
       }
       if (ok) {
 	if (p && strchr(argv1, '@')) {
-	  simple_sprintf(work, "<%s@%s >%s %s", argv2, botnetnick,
+	  simple_sprintf(work, "<%s@%s >%s %s", argv2, conf.bot->nick,
 			 argv1, argv3);
-	  simple_sprintf(u, "@%s", botnetnick);
+	  simple_sprintf(u, "@%s", conf.bot->nick);
 	  p = u;
 	} else {
-	  simple_sprintf(work, "<%s@%s %s", argv2, botnetnick,
+	  simple_sprintf(work, "<%s@%s %s", argv2, conf.bot->nick,
 			 argv3);
 	  p = argv1;
 	}
@@ -710,7 +709,7 @@ static void notes_hourly()
 
 static void away_notes(char *bot, int idx, char *msg)
 {
-  if (egg_strcasecmp(bot, botnetnick))
+  if (egg_strcasecmp(bot, conf.bot->nick))
     return;
   if (msg && msg[0])
     dprintf(idx, "%s\n", NOTES_STORED);

+ 1 - 1
src/mod/server.mod/server.c

@@ -1058,7 +1058,7 @@ void nick_changed(struct cfg_entry * entry, char * olddata, int * valid) {
   if (p && p[0])
     strncpyz(origbotname, p, NICKLEN + 1);
   else
-    strncpyz(origbotname, botnetnick, NICKLEN + 1);
+    strncpyz(origbotname, conf.bot->nick, NICKLEN + 1);
   if (server_online)
     dprintf(DP_SERVER, "NICK %s\n", origbotname);
 #endif /* LEAF */

+ 2 - 2
src/mod/server.mod/servmsg.c

@@ -324,7 +324,7 @@ static int detect_flood(char *floodnick, char *floodhost, char *from, int which)
     /* Private msg */
     simple_sprintf(h, "*!*@%s", p);
     putlog(LOG_MISC, "*", IRC_FLOODIGNORE1, p);
-    addignore(h, botnetnick, (which == FLOOD_CTCP) ? "CTCP flood" :
+    addignore(h, conf.bot->nick, (which == FLOOD_CTCP) ? "CTCP flood" :
 	      "MSG/NOTICE flood", now + (60 * ignore_time));
   }
   return 0;
@@ -379,7 +379,7 @@ static int gotmsg(char *from, char *msg)
       else
 	p = uhost;
       simple_sprintf(ctcpbuf, "*!*@%s", p);
-      addignore(ctcpbuf, botnetnick, "ctcp avalanche",
+      addignore(ctcpbuf, conf.bot->nick, "ctcp avalanche",
 		now + (60 * ignore_time));
     }
   }

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

@@ -1116,7 +1116,7 @@ static void share_ufsend(int idx, char *par)
   int i, sock;
   FILE *f;
 
-  egg_snprintf(s, sizeof s, "%s.share.%s.%lu.users", tempdir, botnetnick, now);
+  egg_snprintf(s, sizeof s, "%s.share.%s.%lu.users", tempdir, conf.bot->nick, now);
   if (!(b_status(idx) & STAT_SHARE)) {
     dprintf(idx, "s e You didn't ask; you just started sending.\n");
     dprintf(idx, "s e Ask before sending the userfile.\n");
@@ -1599,7 +1599,7 @@ static int write_tmp_userfile(char *fn, struct userrec *bu, int idx)
 
   if ((f = fopen(fn, "wb"))) {
     chmod(fn, 0600);		/* make it -rw------- */
-    lfprintf(f, "#4v: %s -- %s -- transmit\n", ver, botnetnick);
+    lfprintf(f, "#4v: %s -- %s -- transmit\n", ver, conf.bot->nick);
     ok = 1;
     if (!write_chans(f, idx))
      ok = 0;

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

@@ -40,7 +40,7 @@ static void cancel_user_xfer(int, void *);
 extern struct userrec	*userlist;
 extern tand_t		*tandbot;
 extern int 		localhub, max_dcc, egg_numver;
-extern char		botnetnick[], tempdir[], natip[];
+extern char		tempdir[], natip[];
 extern time_t		buildts;
 extern struct dcc_table DCC_FORK_SEND, DCC_GET;
 
@@ -96,9 +96,9 @@ static void update_ufsend(int idx, char *par)
   FILE *f;
   putlog(LOG_BOTS, "*", "Downloading updated binary from %s", dcc[idx].nick);
 #ifdef HUB
-  egg_snprintf(s, sizeof s, "%s.update.%s.hub", tempdir, botnetnick);
+  egg_snprintf(s, sizeof s, "%s.update.%s.hub", tempdir, conf.bot->nick);
 #else
-  egg_snprintf(s, sizeof s, "%s.update.%s.leaf", tempdir, botnetnick);
+  egg_snprintf(s, sizeof s, "%s.update.%s.leaf", tempdir, conf.bot->nick);
 #endif
   unlink(s); //make sure there isnt already a new binary here..
   if (dcc_total == max_dcc) {

+ 2 - 2
src/modules.c

@@ -42,7 +42,7 @@ extern struct auth_t    *auth;
 
 extern Tcl_Interp	*interp;
 extern struct userrec	*userlist, *lastuser;
-extern char		 tempdir[], botnetnick[], botname[], natip[], cmdprefix[],
+extern char		 tempdir[], botname[], natip[], cmdprefix[],
 			 hostname[], origbotname[], botuser[], admin[],
 			 userfile[], ver[], kickprefix[], bankickprefix[],
 			 version[], quit_msg[], hostname6[], bdhash[], dcc_prefix[],
@@ -320,7 +320,7 @@ Function global_table[] =
   (Function) 0,
   (Function) dovoice,
   (Function) version,		 /* char *				*/
-  (Function) botnetnick,	 /* char *				*/
+  (Function) 0,
   /* 124 - 127 */
   (Function) & DCC_CHAT_PASS,	 /* struct dcc_table *			*/
   (Function) & DCC_BOT,		 /* struct dcc_table *			*/

+ 6 - 6
src/tcl.c

@@ -43,7 +43,7 @@ extern int	backgrd, flood_telnet_thr, flood_telnet_time,
 		default_uflags, strict_host, userfile_perm;
 extern char	origbotname[], botuser[], motdfile[], admin[], userfile[],
                 firewall[], hostname[], hostname6[], myip[], myip6[],
-		tempdir[], owner[], network[], botnetnick[],
+		tempdir[], owner[], network[], 
 		egg_version[], natip[], 
 		dcc_prefix[];
 
@@ -74,16 +74,16 @@ Tcl_Interp *Tcl_CreateInterp();
 
 static void botnet_change(char *new)
 {
-  if (egg_strcasecmp(botnetnick, new)) {
+  if (egg_strcasecmp(conf.bot->nick, new)) {
     /* Trying to change bot's nickname */
     if (tands > 0) {
       putlog(LOG_MISC, "*", "* Tried to change my botnet nick, but I'm still linked to a botnet.");
       putlog(LOG_MISC, "*", "* (Unlink and try again.)");
       return;
     } else {
-      if (botnetnick[0])
-	putlog(LOG_MISC, "*", "* IDENTITY CHANGE: %s -> %s", botnetnick, new);
-      strcpy(botnetnick, new);
+      if (conf.bot->nick)
+	putlog(LOG_MISC, "*", "* IDENTITY CHANGE: %s -> %s", conf.bot->nick, new);
+      strcpy(conf.bot->nick, new);
     }
   }
 }
@@ -262,7 +262,7 @@ static char *tcl_eggstr(ClientData cdata, Tcl_Interp *irp, char *name1,
     if (s != NULL) {
       if (strlen(s) > abs(st->max))
 	s[abs(st->max)] = 0;
-      if (st->str == botnetnick)
+      if (st->str == conf.bot->nick)
 	botnet_change(s);
       else if (st->str == firewall) {
 	splitc(firewall, s, ':');

+ 3 - 3
src/userent.c

@@ -18,7 +18,7 @@ extern struct cfg_entry **cfg;
 extern struct userrec	*userlist;
 extern struct dcc_t	*dcc;
 extern Tcl_Interp	*interp;
-extern char		 whois_fields[], botnetnick[];
+extern char		 whois_fields[];
 extern time_t            now;
 
 static struct user_entry_type *entry_type_list;
@@ -346,7 +346,7 @@ int config_gotshare(struct userrec *u, struct user_entry *e, char *buf, int idx)
   arg = newsplit(&buf);
   if (!arg[0])
     return 1;
-  if (!strcmp(u->handle, botnetnick)) {
+  if (!strcmp(u->handle, conf.bot->nick)) {
     struct cfg_entry *cfgent = NULL;
     int i;
 
@@ -355,7 +355,7 @@ int config_gotshare(struct userrec *u, struct user_entry *e, char *buf, int idx)
       if (!strcmp(arg, cfg[i]->name) && (cfg[i]->flags & CFGF_LOCAL))
 	cfgent = cfg[i];
     if (cfgent) {
-      set_cfg_str(botnetnick, cfgent->name, (buf && buf[0]) ? buf : NULL);
+      set_cfg_str(conf.bot->nick, cfgent->name, (buf && buf[0]) ? buf : NULL);
     }
     cfg_noshare = 0;
     return 1;

+ 2 - 2
src/userrec.c

@@ -27,7 +27,7 @@ extern struct dcc_t	*dcc;
 extern struct chanset_t	*chanset;
 extern int		 default_flags, default_uflags, quiet_save,
 			 dcc_total;
-extern char		 userfile[], ver[], botnetnick[], tempdir[];
+extern char		 userfile[], ver[], tempdir[];
 extern time_t		 now;
 
 int		 noshare = 1;		/* don't send out to sharebots	    */
@@ -429,7 +429,7 @@ int write_userfile(int idx)
     sort_userlist();
   tt = now;
   strcpy(s1, ctime(&tt));
-  lfprintf(f, "#4v: %s -- %s -- written %s", ver, botnetnick, s1);
+  lfprintf(f, "#4v: %s -- %s -- written %s", ver, conf.bot->nick, s1);
   ok = 1;
   fclose(f);
   call_hook(HOOK_USERFILE);

+ 4 - 4
src/users.c

@@ -39,7 +39,7 @@ extern struct dcc_t *dcc;
 extern struct userrec *userlist, *lastuser;
 extern struct chanset_t *chanset;
 extern int dcc_total, noshare, egg_numver;
-extern char botnetnick[], tempdir[];
+extern char 		tempdir[];
 extern time_t now;
 
 char natip[121] = "";
@@ -1026,7 +1026,7 @@ int readuserfile(char *file, struct userrec **ret)
   for (u = bu; u; u = u->next) {
     struct user_entry *e;
 
-    if (!(u->flags & USER_BOT) && !egg_strcasecmp (u->handle, botnetnick)) {
+    if (!(u->flags & USER_BOT) && !egg_strcasecmp (u->handle, conf.bot->nick)) {
       putlog(LOG_MISC, "*", "(!) I have a user record, but without +b");
       /* u->flags |= USER_BOT; */
     }
@@ -1101,7 +1101,7 @@ struct userrec *next_hub(struct userrec *current, char *lowval, char *highval)
       cur = userlist;
     if (cur == current)
       break;
-    if ((cur->flags & USER_BOT) && (strcmp(cur->handle, botnetnick))) {
+    if ((cur->flags & USER_BOT) && (strcmp(cur->handle, conf.bot->nick))) {
       link_pref_val(cur, thisval);
       if ((strcmp(thisval, lowval) < 0) && (strcmp(thisval, highval) > 0) &&(strcmp(thisval, bestmatchval) < 0)) {
         strcpy(bestmatchval, thisval);
@@ -1276,7 +1276,7 @@ void autolink_cycle(char *start)
   hlc = 0;
   for (u = userlist; u; u = u->next) {
     get_user_flagrec(u, &fr, NULL);
-    if (glob_bot(fr) && strcmp(u->handle, botnetnick) && strcmp(u->handle, avoidbot) && (bot_hublevel(u) < 999)) {
+    if (glob_bot(fr) && strcmp(u->handle, conf.bot->nick) && strcmp(u->handle, avoidbot) && (bot_hublevel(u) < 999)) {
       putlog(LOG_DEBUG, "@", STR("Adding %s to hublist"), u->handle);
       hl2 = hl;
       hl = malloc(sizeof(struct hublist_entry));