[cvslog] (2002-09-22 01:25:30 UTC) Module eggdrop1.7: Change committed

cvslog cvs at tsss.org
Sat Sep 21 20:26:01 CST 2002


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.7
Commit time: 2002-09-22 01:25:29 UTC
Commited by: stdarg <stdarg at techmonkeys.org>

Removed files:
     src/botcmd.c src/botcmd.h src/botmsg.c src/botmsg.h src/botnet.c
     src/botnet.h src/tandem.h

Log message:

* Remove unnecessary files (botnet stuff)

---------------------- diff included ----------------------
Index: eggdrop1.7/src/botcmd.c
diff -u eggdrop1.7/src/botcmd.c:1.39 eggdrop1.7/src/botcmd.c:removed
--- eggdrop1.7/src/botcmd.c:1.39	Tue Jun 18 01:12:32 2002
+++ eggdrop1.7/src/botcmd.c	Sat Sep 21 20:25:29 2002
@@ -1,1592 +0,0 @@
-/*
- * botcmd.c --
- *
- *	commands that comes across the botnet
- *	userfile transfer and update commands from sharebots
- */
-/*
- * Copyright (C) 1997 Robey Pointer
- * Copyright (C) 1999, 2000, 2001, 2002 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef lint
-static const char rcsid[] = "$Id: botcmd.c,v 1.39 2002/06/18 06:12:32 guppy Exp $";
-#endif
-
-#include "main.h"
-#include "tandem.h"
-#include "users.h"
-#include "chan.h"
-#include "modules.h"
-#include "logfile.h"
-#include "misc.h"
-#include "cmdt.h"		/* cmd_t				*/
-#include "botmsg.h"		/* add_note				*/
-#include "botnet.h"		/* botlink, botunlink, in_chain,
-				   updatebot, addbot, lastbot, unvia, 
-				   rembot				*/
-#include "dccutil.h"		/* dprintf_eggdrop, lostdcc, chatout	
-				   new_dcc, changeover_dcc, chanout_but	*/
-#include "net.h"		/* killsock				*/
-#include "core_binds.h"		/* check_bind_chat, check_bind_bcst, 
-				   check_bind_act, check_bind_link,
-				   check_bind_bot, check_bind_chpt,
-				   check_bind_chjn, check_bind_away	*/
-#include "botcmd.h"		/* prototypes				*/
-#include "userrec.h"		/* change_handle, touch_laston		*/
-
-extern char		 botnetnick[], ver[], admin[], network[], motdfile[];
-extern int		 dcc_total, remote_boots, noshare;
-extern struct dcc_t	*dcc;
-extern struct chanset_t	*chanset;
-extern struct userrec	*userlist;
-extern time_t		 now, online_since;
-extern party_t		*party;
-extern module_entry	*module_list;
-
-#ifndef MAKING_MODS
-extern struct dcc_table DCC_BOT;
-#endif /* MAKING_MODS 	*/
-
-static char TBUF[1024];		/* Static buffer for goofy bot stuff */
-
-static char base64to[256] =
-{
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0,
-  0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
-  15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 62, 0, 63, 0, 0, 0, 26, 27, 28,
-  29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
-  49, 50, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-
-int base64_to_int(char *buf)
-{
-  int i = 0;
-
-  while (*buf) {
-    i = i << 6;
-    i += base64to[(int) *buf];
-    buf++;
-  }
-  return i;
-}
-
-/* Used for 1.0 compatibility: if a join message arrives with no sock#,
- * i'll just grab the next "fakesock" # (incrementing to assure uniqueness)
- */
-static int fakesock = 2300;
-
-static void fake_alert(int idx, char *item, char *extra)
-{
-  static unsigned long lastfake;	/* The last time fake_alert was used */
-
-  if (now - lastfake > 10) {	
-    /* Don't fake_alert more than once every 10secs */
-#ifndef NO_OLD_BOTNET
-    if (b_numver(idx) < NEAT_BOTNET)
-      dprintf(idx, "chat %s NOTICE: %s (%s != %s).\n",
-	      botnetnick, _("Fake message rejected"), item, extra);
-    else
-#endif
-      dprintf(idx, "ct %s NOTICE: %s (%s != %s).\n",
-	      botnetnick, _("Fake message rejected"), item, extra);
-    putlog(LOG_BOTS, "*", "%s %s (%s != %s).", dcc[idx].nick, _("Fake message rejected"),
-	   item, extra);
-    lastfake = now;
-  }
-}
-
-/* chan <from> <chan> <text>
- */
-static void bot_chan2(int idx, char *msg)
-{
-  char *from, *p;
-  int i, chan;
-
-  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
-    return;
-  from = newsplit(&msg);
-  p = newsplit(&msg);
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    chan = atoi(p);
-  else
-#endif
-    chan = base64_to_int(p);
-  /* Strip annoying control chars */
-  for (p = from; *p;) {
-    if ((*p < 32) || (*p == 127))
-      strcpy(p, p + 1);
-    else
-      p++;
-  }
-  p = strchr(from, '@');
-  if (p) {
-    sprintf(TBUF, "<%s> %s", from, msg);
-    *p = 0;
-    if (!partyidle(p + 1, from)) {
-      *p = '@';
-      fake_alert(idx, "user", from);
-      return;
-    }
-    *p = '@';
-    p++;
-  } else {
-    sprintf(TBUF, "*** (%s) %s", from, msg);
-    p = from;
-  }
-  i = nextbot(p);
-  if (i != idx) {
-    fake_alert(idx, "direction", p);
-  } else {
-    chanout_but(-1, chan, "%s\n", TBUF);
-    /* Send to new version bots */
-    if (i >= 0)
-      botnet_send_chan(idx, from, NULL, chan, msg);
-    if (strchr(from, '@') != NULL)
-      check_bind_chat(from, chan, msg);
-    else
-      check_bind_bcst(from, chan, msg);
-  }
-}
-
-/* chat <from> <notice>  -- only from bots
- */
-static void bot_chat(int idx, char *par)
-{
-  char *from;
-  int i;
-
-  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
-    return;
-  from = newsplit(&par);
-  if (strchr(from, '@') != NULL) {
-    fake_alert(idx, "bot", from);
-    return;
-  }
-  /* Make sure the bot is valid */
-  i = nextbot(from);
-  if (i != idx) {
-    fake_alert(idx, "direction", from);
-    return;
-  }
-  chatout("*** (%s) %s\n", from, par);
-  botnet_send_chat(idx, from, par);
-}
-
-/* actchan <from> <chan> <text>
- */
-static void bot_actchan(int idx, char *par)
-{
-  char *from, *p;
-  int i, chan;
-
-  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
-    return;
-  from = newsplit(&par);
-  p = strchr(from, '@');
-  if (p == NULL) {
-    /* How can a bot do an action? */
-    fake_alert(idx, "user at bot", from);
-    return;
-  }
-  *p = 0;
-  if (!partyidle(p + 1, from)) {
-    *p = '@';
-    fake_alert(idx, "user", from);
-  }
-  *p = '@';
-  p++;
-  i = nextbot(p);
-  if (i != idx) {
-    fake_alert(idx, "direction", p);
-    return;
-  }
-  p = newsplit(&par);
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    chan = atoi(p);
-  else
-#endif
-    chan = base64_to_int(p);
-  for (p = from; *p;) {
-    if ((*p < 32) || (*p == 127))
-      strcpy(p, p + 1);
-    else
-      p++;
-  }
-  chanout_but(-1, chan, "* %s %s\n", from, par);
-  botnet_send_act(idx, from, NULL, chan, par);
-  check_bind_act(from, chan, par);
-}
-
-/* priv <from> <to> <message>
- */
-static void bot_priv(int idx, char *par)
-{
-  char *from, *p, *to = TBUF, *tobot;
-  int i;
-
-  from = newsplit(&par);
-  tobot = newsplit(&par);
-  splitc(to, tobot, '@');
-  p = strchr(from, '@');
-  if (p != NULL)
-    p++;
-  else
-    p = from;
-  i = nextbot(p);
-  if (i != idx) {
-    fake_alert(idx, "direction", p);
-    return;
-  }
-  if (!to[0])
-    return;			/* Silently ignore notes to '@bot' this
-				 * is legacy code */
-  if (!strcasecmp(tobot, botnetnick)) {		/* For me! */
-    if (p == from)
-      add_note(to, from, par, -2, 0);
-    else {
-      i = add_note(to, from, par, -1, 0);
-      if (from[0] != '@')
-	switch (i) {
-	case NOTE_ERROR:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s.", _("No such user"), to);
-	  break;
-	case NOTE_STORED:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s", _("Not online; note stored."));
-	  break;
-	case NOTE_FULL:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s", _("Notebox is full, sorry."));
-	  break;
-	case NOTE_AWAY:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s", to, _("is away; note stored."));
-	  break;
-	case NOTE_FWD:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s", _("Not online; note forwarded to:"), to);
-	  break;
-	case NOTE_REJECT:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s", to, _("rejected your note."));
-          break;
-	case NOTE_TCL:
-	  break;		/* Do nothing */
-	case NOTE_OK:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s.", _("Note sent to"), to);
-	  break;
-	}
-    }
-  } else {			/* Pass it on */
-    i = nextbot(tobot);
-    if (i >= 0)
-      botnet_send_priv(i, from, to, tobot, "%s", par);
-  }
-}
-
-static void bot_bye(int idx, char *par)
-{
-  char s[1024];
-  int users, bots;
-
-  bots = bots_in_subtree(findbot(dcc[idx].nick));
-  users = users_in_subtree(findbot(dcc[idx].nick));
-  simple_sprintf(s, "%s %s. %s (lost %d bot%s and %d user%s)",
-		 _("Disconnected from:"), dcc[idx].nick, par[0] ?
-		 par : "No reason", bots, (bots != 1) ?
-		 "s" : "", users, (users != 1) ? "s" : "");
-  putlog(LOG_BOTS, "*", "%s", s);
-  chatout("*** %s\n", s);
-  botnet_send_unlinked(idx, dcc[idx].nick, s);
-  dprintf(idx, "*bye\n");
-  killsock(dcc[idx].sock);
-  lostdcc(idx);
-}
-
-static void remote_tell_who(int idx, char *nick, int chan)
-{
-  int i = 10, k, l, ok = 0;
-  char s[1024], *realnick;
-  struct chanset_t *c;
-
-  realnick = strchr(nick, ':');
-  if (realnick)
-    realnick++;
-  else
-    realnick = nick;
-  putlog(LOG_BOTS, "*", "#%s# who", realnick);
-  strcpy(s, "Channels: ");
-  for (c = chanset; c; c = c->next)
-    if (!channel_secret(c)) {
-      l = strlen(c->name);
-      if (i + l < 1021) {
-	if (i > 10)
-          sprintf(s, "%s, %s", s, c->name);
-	else {
-          strcpy(s, c->name);
-	  i += (l + 2);
-        }
-      }
-    }
-  if (i > 10) {
-    botnet_send_priv(idx, botnetnick, nick, NULL, "%s  (%s)", s, ver);
-  } else
-    botnet_send_priv(idx, botnetnick, nick, NULL, "%s  (%s)", _("no channels"),
-		     ver);
-  if (admin[0])
-    botnet_send_priv(idx, botnetnick, nick, NULL, "Admin: %s", admin);
-  if (chan == 0)
-    botnet_send_priv(idx, botnetnick, nick, NULL,
-		     "%s  (* = %s, + = %s, @ = %s)",
-		     _("Party line members:"), _("owner"), _("master"), _("op"));
-  else {
-    botnet_send_priv(idx, botnetnick, nick, NULL,
-		       "%s %s%d:  (* = %s, + = %s, @ = %s)\n",
-		       _("People on channel"),
-		       (chan < GLOBAL_CHANS) ? "" : "*",
-		       chan % GLOBAL_CHANS,
-		       _("owner"), _("master"), _("op"));
-  }
-  for (i = 0; i < dcc_total; i++)
-    if (dcc[i].type->flags & DCT_REMOTEWHO)
-      if (dcc[i].u.chat->channel == chan) {
-	k = sprintf(s, "  %c%-15s %s",
-		    (geticon(dcc[i].user) == '-' ? ' ' : geticon(dcc[i].user)),
-		    dcc[i].nick, dcc[i].host);
-	if (now - dcc[i].timeval > 300) {
-	  unsigned long days, hrs, mins;
-
-	  days = (now - dcc[i].timeval) / 86400;
-	  hrs = ((now - dcc[i].timeval) - (days * 86400)) / 3600;
-	  mins = ((now - dcc[i].timeval) - (hrs * 3600)) / 60;
-	  if (days > 0)
-	    sprintf(s + k, " (%s %lud%luh)",
-		    _("idle"), days, hrs);
-	  else if (hrs > 0)
-	    sprintf(s + k, " (%s %luh%lum)",
-		    _("idle"), hrs, mins);
-	  else
-	    sprintf(s + k, " (%s %lum)",
-		    _("idle"), mins);
-	}
-	botnet_send_priv(idx, botnetnick, nick, NULL, "%s", s);
-	if (dcc[i].u.chat->away != NULL)
-	  botnet_send_priv(idx, botnetnick, nick, NULL, "      %s: %s",
-			   _("AWAY"), dcc[i].u.chat->away);
-      }
-  for (i = 0; i < dcc_total; i++)
-    if (dcc[i].type == &DCC_BOT) {
-      if (!ok) {
-	ok = 1;
-	botnet_send_priv(idx, botnetnick, nick, NULL,
-			 "%s:", _("Bots connected"));
-      }
-      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);
-    }
-  ok = 0;
-  for (i = 0; i < dcc_total; i++)
-    if (dcc[i].type->flags & DCT_REMOTEWHO)
-      if (dcc[i].u.chat->channel != chan) {
-	if (!ok) {
-	  ok = 1;
-	  botnet_send_priv(idx, botnetnick, nick, NULL, "%s:",
-			   _("Other people on the bot"));
-	}
-	l = sprintf(s, "  %c%-15s %s",
-		    (geticon(dcc[i].user) == '-' ? ' ' : geticon(dcc[i].user)),
-		    dcc[i].nick, dcc[i].host);
-	if (now - dcc[i].timeval > 300) {
-	  k = (now - dcc[i].timeval) / 60;
-	  if (k < 60)
-	    sprintf(s + l, " (%s %dm)", _("idle"), k);
-	  else
-	    sprintf(s + l, " (%s %dh%dm)", _("idle"), k / 60, k % 60);
-	}
-	botnet_send_priv(idx, botnetnick, nick, NULL, "%s", s);
-	if (dcc[i].u.chat->away != NULL)
-	  botnet_send_priv(idx, botnetnick, nick, NULL,
-			   "      %s: %s", _("AWAY"),
-			   dcc[i].u.chat->away);
-      }
-}
-
-/* who <from at bot> <tobot> <chan#>
- */
-static void bot_who(int idx, char *par)
-{
-  char *from, *to, *p;
-  int i, chan;
-
-  from = newsplit(&par);
-  p = strchr(from, '@');
-  if (!p) {
-    sprintf(TBUF, "%s@%s", from, dcc[idx].nick);
-    from = TBUF;
-  }
-  to = newsplit(&par);
-  if (!strcasecmp(to, botnetnick))
-    to[0] = 0;			/* (for me) */
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    chan = atoi(par);
-  else
-#endif
-    chan = base64_to_int(par);
-  if (to[0]) {			/* Pass it on */
-    i = nextbot(to);
-    if (i >= 0)
-      botnet_send_who(i, from, to, chan);
-  } else {
-    remote_tell_who(idx, from, chan);
-  }
-}
-
-static void bot_endlink(int idx, char *par)
-{
-  dcc[idx].status &= ~STAT_LINKING;
-}
-
-/* info? <from at bot>   -> send priv
- */
-static void bot_infoq(int idx, char *par)
-{
-  char s[200], s2[32], *realnick;
-  struct chanset_t *chan;
-  time_t now2;
-  int hr, min;
-
-  /* Strip the idx from user at bot */
-  realnick = strchr(par, ':');
-  if (realnick)
-    realnick++;
-  else
-    realnick = par;
-  putlog(LOG_BOTS, "*", "#%s# botinfo", realnick);
-
-  now2 = now - online_since;
-  s2[0] = 0;
-  if (now2 > 86400) {
-    int days = now2 / 86400;
-
-    /* Days */
-    sprintf(s2, "%d day", days);
-    if (days >= 2)
-      strcat(s2, "s");
-    strcat(s2, ", ");
-    now2 -= days * 86400;
-  }
-  hr = (time_t) ((int) now2 / 3600);
-  now2 -= (hr * 3600);
-  min = (time_t) ((int) now2 / 60);
-  sprintf(&s2[strlen(s2)], "%02d:%02d", (int) hr, (int) min);
-  if (module_find("server", 0, 0)) {
-    s[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) >= 200) {
-          strcat(s,"++  ");
-          break; /* Yegads..! */
-        }
-	strcat(s, chan->dname);
-	strcat(s, ", ");
-      }
-    }
-    if (s[0]) {
-      s[strlen(s) - 2] = 0;
-      botnet_send_priv(idx, botnetnick, par, NULL,
-		       "%s <%s> (%s) [UP %s]", ver, network, s, s2);
-    } else
-      botnet_send_priv(idx, botnetnick, par, NULL,
-		    "%s <%s> (%s) [UP %s]", ver, network, _("no channels"),
-		       s2);
-  } else
-    botnet_send_priv(idx, botnetnick, par, NULL,
-		     "%s <NO_IRC> [UP %s]", ver, s2);
-  botnet_send_infoq(idx, par);
-}
-
-static void bot_ping(int idx, char *par)
-{
-  botnet_send_pong(idx);
-}
-
-static void bot_pong(int idx, char *par)
-{
-  dcc[idx].status &= ~STAT_PINGED;
-}
-
-/* link <from at bot> <who> <to-whom>
- */
-static void bot_link(int idx, char *par)
-{
-  char *from, *bot, *rfrom;
-  int i;
-
-  from = newsplit(&par);
-  bot = newsplit(&par);
-
-  if (!strcasecmp(bot, botnetnick)) {
-    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 ...",
-		       _("Attempting to link"), par);
-    else
-      botnet_send_priv(idx, botnetnick, from, NULL, "%s.",
-		       _("Cant link there"));
-  } else {
-    i = nextbot(bot);
-    if (i >= 0)
-      botnet_send_link(i, from, bot, par);
-  }
-}
-
-/* unlink <from at bot> <linking-bot> <undesired-bot> <reason>
- */
-static void bot_unlink(int idx, char *par)
-{
-  char *from, *bot, *rfrom, *p, *undes;
-  int i;
-
-  from = newsplit(&par);
-  bot = newsplit(&par);
-  undes = newsplit(&par);
-  if (!strcasecmp(bot, botnetnick)) {
-    if ((rfrom = strchr(from, ':')))
-      rfrom++;
-    else
-      rfrom = from;
-    putlog(LOG_CMDS, "*", "#%s# unlink %s (%s)", rfrom, undes, par[0] ? par :
-	   "No reason");
-    i = botunlink(-3, undes, par[0] ? par : NULL);
-    if (i == 1) {
-      p = strchr(from, '@');
-      if (p) {
-	/* idx will change after unlink -- get new idx
-	 *
-	 * TODO: This has changed with the new lostdcc() behaviour. Check
-	 *       if we can optimise the situation.
-	 */
-	i = nextbot(p + 1);
-	if (i >= 0)
-	  botnet_send_priv(i, botnetnick, from, NULL,
-			   "Unlinked from %s.", undes);
-      }
-    } else if (i == 0) {
-      botnet_send_unlinked(-1, undes, "");
-      p = strchr(from, '@');
-      if (p) {
-	/* Ditto above, about idx */
-	i = nextbot(p + 1);
-	if (i >= 0)
-	  botnet_send_priv(i, botnetnick, from, NULL,
-			   "%s %s.", _("Cant unlink"), undes);
-      }
-    } else {
-      p = strchr(from, '@');
-      if (p) {
-	i = nextbot(p + 1);
-	if (i >= 0)
-	  botnet_send_priv(i, botnetnick, from, NULL,
-			   "Can't remotely unlink sharebots.");
-      }
-    }
-  } else {
-    i = nextbot(bot);
-    if (i >= 0)
-      botnet_send_unlink(i, from, bot, undes, par);
-  }
-}
-
-/* Bot next share?
- */
-static void bot_update(int idx, char *par)
-{
-  char *bot, x;
-  int vnum;
-
-  bot = newsplit(&par);
-  x = par[0];
-  if (x)
-    par++;
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    vnum = atoi(par);
-  else
-#endif
-    vnum = base64_to_int(par);
-  if (in_chain(bot))
-    updatebot(idx, bot, x, vnum);
-}
-
-/* Newbot next share?
- */
-static void bot_nlinked(int idx, char *par)
-{
-  char *newbot, *next, *p, s[1024], x;
-  int bogus = 0, i;
-  struct userrec *u;
-
-  newbot = newsplit(&par);
-  next = newsplit(&par);
-  s[0] = 0;
-  if (!next[0]) {
-    putlog(LOG_BOTS, "*", _("Invalid eggnet protocol from %s (zapfing)"),
-	   dcc[idx].nick);
-    simple_sprintf(s, _("Disconnected %s (invalid bot)"), dcc[idx].nick);
-    dprintf(idx, "error invalid eggnet protocol for 'nlinked'\n");
-  } else if ((in_chain(newbot)) || (!strcasecmp(newbot, botnetnick))) {
-    /* Loop! */
-    putlog(LOG_BOTS, "*", _("Loop detected %1$s (mutual: %2$s)"), dcc[idx].nick, newbot);
-    simple_sprintf(s, _("Detected loop: two bots exist named %1$s: disconnecting %2$s"), newbot, dcc[idx].nick);
-    dprintf(idx, "error Loop (%s)\n", newbot);
-  }
-  if (!s[0]) {
-    for (p = newbot; *p; p++)
-      if ((*p < 32) || (*p == 127) || ((p - newbot) >= HANDLEN))
-	bogus = 1;
-    i = nextbot(next);
-    if (i != idx)
-      bogus = 1;
-  }
-  if (bogus) {
-    putlog(LOG_BOTS, "*", "%s %s!  (%s -> %s)", _("Bogus link notice from"), dcc[idx].nick,
-	   next, newbot);
-    simple_sprintf(s, _("Bogus link notice from: %s Disconnected"), dcc[idx].nick);
-    dprintf(idx, "error %s (%s -> %s)\n",
-	    _("Bogus link notice from"), next, newbot);
-  }
-  if (bot_flags(dcc[idx].user) & BOT_LEAF) {
-    putlog(LOG_BOTS, "*", _("Disconnected left %1$s (Linked to %2$s)"),
-           dcc[idx].nick, newbot);
-    simple_sprintf(s, _("Illegal link by leaf %1$s (to %2$s): Disconnected"),
-		   dcc[idx].nick, newbot);
-    dprintf(idx, "error %s\n", _("You are supposed to be a leaf!"));
-  }
-  if (s[0]) {
-    chatout("*** %s\n", s);
-    botnet_send_unlinked(idx, dcc[idx].nick, s);
-    dprintf(idx, "bye %s\n", _("Illegal link by leaf"));
-    killsock(dcc[idx].sock);
-    lostdcc(idx);
-    return;
-  }
-  x = par[0];
-  if (x)
-    par++;
-  else
-    x = '-';
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    i = atoi(par);
-  else
-#endif
-    i = base64_to_int(par);
-  botnet_send_nlinked(idx, newbot, next, x, i);
-  if (x == '!') {
-    chatout("*** (%s) %s %s.\n", next, _("Linked to"), newbot);
-    x = '-';
-  }
-  addbot(newbot, dcc[idx].nick, next, x, i);
-  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);
-    putlog(LOG_BOTS, "*", _("Rejecting bot %1$s from %2$s"), newbot,
-           dcc[idx].nick);
-  }
-}
-
-#ifndef NO_OLD_BOTNET
-static void bot_linked(int idx, char *par)
-{
-  char s[1024];
-  int bots, users;
-
-  bots = bots_in_subtree(findbot(dcc[idx].nick));
-  users = users_in_subtree(findbot(dcc[idx].nick));
-  putlog(LOG_BOTS, "*", _("Older bot detected (unsupported)"));
-  /* FIXME PLURAL: handle it properly */
-  simple_sprintf(s,
-		 _("Disconnected %s (outdated) (lost %d bot%s and %d user%s"),
-  		 dcc[idx].nick,
-		 bots, (bots != 1) ? "s" : "", users,
-		 (users != 1) ? "s" : "");
-  chatout("*** %s\n", s);
-  botnet_send_unlinked(idx, dcc[idx].nick, s);
-  killsock(dcc[idx].sock);
-  lostdcc(idx);
-}
-#endif	/* !NO_OLD_BOTNET */
-
-static void bot_unlinked(int idx, char *par)
-{
-  int i;
-  char *bot;
-
-  bot = newsplit(&par);
-  i = nextbot(bot);
-  if ((i >= 0) && (i != idx))	/* Bot is NOT downstream along idx, so
-				 * BOGUS! */
-    fake_alert(idx, "direction", bot);
-  else if (i >= 0) {		/* Valid bot downstream of idx */
-    if (par[0])
-      chatout("*** (%s) %s\n", lastbot(bot), par);
-    botnet_send_unlinked(idx, bot, par);
-    unvia(idx, findbot(bot));
-    rembot(bot);
-  }
-  /* Otherwise it's not even a valid bot, so just ignore! */
-}
-
-/* trace <from at bot> <dest> <chain:chain..>
- */
-static void bot_trace(int idx, char *par)
-{
-  char *from, *dest;
-  int i;
-
-  from = newsplit(&par);
-  dest = newsplit(&par);
-  simple_sprintf(TBUF, "%s:%s", par, botnetnick);
-  botnet_send_traced(idx, from, TBUF);
-  if (strcasecmp(dest, botnetnick) && ((i = nextbot(dest)) > 0))
-    botnet_send_trace(i, from, dest, par);
-}
-
-/* traced <to at bot> <chain:chain..>
- */
-static void bot_traced(int idx, char *par)
-{
-  char *to, *p;
-  int i, sock;
-
-  to = newsplit(&par);
-  p = strchr(to, '@');
-  if (p == NULL)
-    p = to;
-  else {
-    *p = 0;
-    p++;
-  }
-  if (!strcasecmp(p, botnetnick)) {
-    time_t t = 0;
-    char *p = par, *ss = TBUF;
-
-    splitc(ss, to, ':');
-    if (ss[0])
-      sock = atoi(ss);
-    else
-      sock = (-1);
-    if (par[0] == ':') {
-      t = atoi(par + 1);
-      p = strchr(par + 1, ':');
-      if (p)
-	p++;
-      else
-	p = par + 1;
-    }
-    for (i = 0; i < dcc_total; i++)
-      if ((dcc[i].type->flags & DCT_CHAT) &&
-	  (!strcasecmp(dcc[i].nick, to)) &&
-	  ((sock == (-1)) || (sock == dcc[i].sock))) {
-	if (t) {
-	  dprintf(i, "%s -> %s (%lu secs)\n", _("Trace result"), p, now - t);
-	} else
-	  dprintf(i, "%s -> %s\n", _("Trace result"), p);
-      }
-  } else {
-    i = nextbot(p);
-    if (p != to)
-      *--p = '@';
-    if (i >= 0)
-      botnet_send_traced(i, to, par);
-  }
-}
-
-/* reject <from> <bot>
- */
-static void bot_reject(int idx, char *par)
-{
-  char *from, *who, *destbot, *frombot;
-  struct userrec *u;
-  int i;
-
-  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
-    return;
-  from = newsplit(&par);
-  frombot = strchr(from, '@');
-  if (frombot)
-    frombot++;
-  else
-    frombot = from;
-  i = nextbot(frombot);
-  if (i != idx) {
-    fake_alert(idx, "direction", frombot);
-    return;
-  }
-  who = newsplit(&par);
-  if (!(destbot = strchr(who, '@'))) {
-    /* Rejecting a bot */
-    i = nextbot(who);
-    if (i < 0) {
-      botnet_send_priv(idx, botnetnick, from, NULL, "%s %s (%s)",
-		       _("Cant unlink"), who, _("doesnt exist"));
-    } else if (!strcasecmp(dcc[i].nick, who)) {
-      char s[1024];
-
-      /* I'm the connection to the rejected bot */
-      putlog(LOG_BOTS, "*", "%s %s %s", from, _("rejected"), dcc[i].nick);
-      dprintf(i, "bye %s\n", par[0] ? par : _("rejected"));
-      simple_sprintf(s, "%s %s (%s: %s)",
-		     _("Disconnected"), dcc[i].nick, from,
-		     par[0] ? par : _("rejected"));
-      chatout("*** %s\n", s);
-      botnet_send_unlinked(i, dcc[i].nick, s);
-      killsock(dcc[i].sock);
-      lostdcc(i);
-    } else {
-      if (i >= 0)
-	botnet_send_reject(i, from, NULL, who, NULL, par);
-    }
-  } else {			/* Rejecting user */
-    *destbot++ = 0;
-    if (!strcasecmp(destbot, botnetnick)) {
-      /* Kick someone here! */
-      int ok = 0;
-
-      if (remote_boots == 1) {
-	frombot = strchr(from, '@');
-	if (frombot == NULL)
-	  frombot = from;
-	else
-	  frombot++;
-	u = get_user_by_handle(userlist, frombot);
-	if (!(bot_flags(u) & BOT_SHARE)) {
-	  add_note(from, botnetnick, "No non sharebot boots.", -1, 0);
-	  ok = 1;
-	}
-      } else if (remote_boots == 0) {
-	botnet_send_priv(idx, botnetnick, from, NULL, "%s",
-			 _("Remote boots are not allowed."));
-	ok = 1;
-      }
-      for (i = 0; (i < dcc_total) && (!ok); i++)
-	if ((!strcasecmp(who, dcc[i].nick)) &&
-	    (dcc[i].type->flags & DCT_CHAT)) {
-	  u = get_user_by_handle(userlist, dcc[i].nick);
-	  if (u && (u->flags & USER_OWNER)) {
-	    add_note(from, botnetnick, _("Cant boot the bot owner."), -1, 0);
-	    return;
-	  }
-	  do_boot(i, from, par);
-	  ok = 1;
-	  putlog(LOG_CMDS, "*", "#%s# boot %s (%s)", from, dcc[i].nick, par);
-	}
-    } else {
-      i = nextbot(destbot);
-      *--destbot = '@';
-      if (i >= 0)
-	botnet_send_reject(i, from, NULL, who, NULL, par);
-    }
-  }
-}
-
-static void bot_thisbot(int idx, char *par)
-{
-  if (strcasecmp(par, dcc[idx].nick)) {
-    char s[1024];
-
-    putlog(LOG_BOTS, "*", _("Wrong bot--wanted %s, got %s"), dcc[idx].nick, par);
-    dprintf(idx, "bye %s\n", _("imposter"));
-    simple_sprintf(s, "%s %s (%s)", _("Disconnected"), dcc[idx].nick,
-		   _("imposter"));
-    chatout("*** %s\n", s);
-    botnet_send_unlinked(idx, dcc[idx].nick, s);
-    unvia(idx, findbot(dcc[idx].nick));
-    killsock(dcc[idx].sock);
-    lostdcc(idx);
-    return;
-  }
-  if (bot_flags(dcc[idx].user) & BOT_LEAF)
-    dcc[idx].status |= STAT_LEAF;
-  /* Set capitalization the way they want it */
-  noshare = 1;
-  change_handle(dcc[idx].user, par);
-  noshare = 0;
-  strcpy(dcc[idx].nick, par);
-}
-
-static void bot_handshake(int idx, char *par)
-{
-  struct userrec *u = get_user_by_handle(userlist, dcc[idx].nick);
-
-  /* We *don't* want botnet passwords migrating */
-  noshare = 1;
-  set_user(&USERENTRY_PASS, u, par);
-  noshare = 0;
-}
-
-/* Used to send a direct msg from Tcl on one bot to Tcl on another
- * zapf <frombot> <tobot> <code [param]>
- */
-static void bot_zapf(int idx, char *par)
-{
-  char *from, *to;
-  int i;
-
-  from = newsplit(&par);
-  to = newsplit(&par);
-  i = nextbot(from);
-  if (i != idx) {
-    fake_alert(idx, "direction", from);
-    return;
-  }
-  if (!strcasecmp(to, botnetnick)) {
-    /* For me! */
-    char *opcode;
-
-    opcode = newsplit(&par);
-    check_bind_bot(from, opcode, par);
-    return;
-  }
-  i = nextbot(to);
-  if (i >= 0)
-    botnet_send_zapf(i, from, to, par);
-}
-
-/* Used to send a global msg from Tcl on one bot to every other bot
- * zapf-broad <frombot> <code [param]>
- */
-static void bot_zapfbroad(int idx, char *par)
-{
-  char *from, *opcode;
-  int i;
-
-  from = newsplit(&par);
-  opcode = newsplit(&par);
-
-  i = nextbot(from);
-  if (i != idx) {
-    fake_alert(idx, "direction", from);
-    return;
-  }
-  check_bind_bot(from, opcode, par);
-  botnet_send_zapf_broad(idx, from, opcode, par);
-}
-
-/* Show motd to someone
- */
-static void bot_motd(int idx, char *par)
-{
-  FILE *vv;
-  char *s = TBUF, *who, *p;
-  int i;
-  struct flag_record fr = {FR_BOT, USER_BOT, 0, 0, 0, 0};
-
-  who = newsplit(&par);
-  if (!par[0] || !strcasecmp(par, botnetnick)) {
-    int irc = 0;
-
-    p = strchr(who, ':');
-    if (p)
-      p++;
-    else
-      p = who;
-    if (who[0] == '!') {
-      irc = HELP_IRC;
-      who++;
-    } else if (who[0] == '#') {
-      who++;
-    }
-    putlog(LOG_CMDS, "*", "#%s# motd", p);
-    vv = fopen(motdfile, "r");
-    if (vv != NULL) {
-      botnet_send_priv(idx, botnetnick, who, NULL, "--- %s\n", _("MOTD file:"));
-      help_subst(NULL, NULL, 0, irc, NULL);
-      while (!feof(vv)) {
-	fgets(s, 120, vv);
-	if (!feof(vv)) {
-	  if (s[strlen(s) - 1] == '\n')
-	    s[strlen(s) - 1] = 0;
-	  if (!s[0])
-	    strcpy(s, " ");
-	  help_subst(s, who, &fr, HELP_DCC, dcc[idx].nick);
-	  if (s[0])
-	    botnet_send_priv(idx, botnetnick, who, NULL, "%s", s);
-	}
-      }
-      fclose(vv);
-    } else
-      botnet_send_priv(idx, botnetnick, who, NULL, "%s :(", _("No MOTD file."));
-  } else {
-    /* Pass it on */
-    i = nextbot(par);
-    if (i >= 0)
-      botnet_send_motd(i, who, par);
-  }
-}
-
-/* These are still here, so that they will pass the relevant
- * requests through even if no filesys is loaded.
- *
- * filereject <bot:filepath> <sock:nick at bot> <reason...>
- */
-static void bot_filereject(int idx, char *par)
-{
-  char *path, *to, *tobot, *p;
-  int i;
-
-  path = newsplit(&par);
-  to = newsplit(&par);
-  if ((tobot = strchr(to, '@')))
-    tobot++;
-  else
-    tobot = to;			/* Bot wants a file?! :) */
-  if (strcasecmp(tobot, botnetnick)) {	/* for me! */
-    p = strchr(to, ':');
-    if (p != NULL) {
-      *p = 0;
-      for (i = 0; i < dcc_total; i++) {
-	if (dcc[i].sock == atoi(to))
-	  dprintf(i, "%s (%s): %s\n", _("FILE TRANSFER REJECTED"), path, par);
-      }
-      *p = ':';
-    }
-    /* No ':'? malformed */
-    putlog(LOG_FILES, "*", "%s %s: %s", path, _("rejected"), par);
-  } else {			/* Pass it on */
-    i = nextbot(tobot);
-    if (i >= 0)
-      botnet_send_filereject(i, path, to, par);
-  }
-}
-
-/* filereq <sock:nick at bot> <bot:file>
- */
-static void bot_filereq(int idx, char *tobot)
-{
-  char *from, *path;
-  int i;
-
-  from = newsplit(&tobot);
-  if ((path = strchr(tobot, ':'))) {
-    *path++ = 0;
-
-    if (!strcasecmp(tobot, botnetnick)) {	/* For me! */
-      /* Process this */
-      module_entry *fs = module_find("filesys", 0, 0);
-
-      if (fs == NULL)
-	botnet_send_priv(idx, botnetnick, from, NULL, _("Filesys module not loaded."));
-      else {
-	Function f = fs->funcs[FILESYS_REMOTE_REQ];
-
-	f(idx, from, path);
-      }
-    } else {			/* Pass it on */
-      i = nextbot(tobot);
-      if (i >= 0)
-	botnet_send_filereq(i, from, tobot, path);
-    }
-  }
-}
-
-/* filesend <bot:path> <sock:nick at bot> <IP#> <port> <size>
- */
-static void bot_filesend(int idx, char *par)
-{
-  char *botpath, *to, *tobot, *nick;
-  int i;
-  char *nfn;
-
-  botpath = newsplit(&par);
-  to = newsplit(&par);
-  if ((tobot = strchr(to, '@'))) {
-    *tobot = 0;
-    tobot++;
-  } else {
-    tobot = to;
-  }
-  if (!strcasecmp(tobot, botnetnick)) {		/* For me! */
-    nfn = strrchr(botpath, '/');
-    if (nfn == NULL) {
-      nfn = strrchr(botpath, ':');
-      if (nfn == NULL)
-	nfn = botpath;		/* That's odd. */
-      else
-	nfn++;
-    } else
-      nfn++;
-    if ((nick = strchr(to, ':')))
-      nick++;
-    else
-      nick = to;
-    /* Send it to 'nick' as if it's from me */
-    dprintf(DP_SERVER, "PRIVMSG %s :\001DCC SEND %s %s\001\n", nick, nfn, par);
-  } else {
-    i = nextbot(tobot);
-    if (i >= 0) {
-      *--tobot = '@';
-      botnet_send_filesend(i, botpath, to, par);
-    }
-  }
-}
-
-static void bot_error(int idx, char *par)
-{
-  putlog(LOG_MISC | LOG_BOTS, "*", "%s: %s", dcc[idx].nick, par);
-}
-
-/* nc <bot> <sock> <newnick>
- */
-static void bot_nickchange(int idx, char *par)
-{
-  char *bot, *ssock, *newnick;
-  int sock, i;
-
-  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
-    return;
-  bot = newsplit(&par);
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET) {
-    fake_alert(idx, "botversion", "NEAT_BOTNET");
-    return;
-  }
-#endif
-  i = nextbot(bot);
-  if (i != idx) {
-    fake_alert(idx, "direction", bot);
-    return;
-  }
-  ssock = newsplit(&par);
-  sock = base64_to_int(ssock);
-  newnick = newsplit(&par);
-  i = partynick(bot, sock, newnick);
-  if (i < 0) {
-    fake_alert(idx, "sock#", ssock);
-    return;
-  }
-  chanout_but(-1, party[i].chan, "*** (%s) Nick change: %s -> %s\n",
-	      bot, newnick, party[i].nick);
-  botnet_send_nkch_part(idx, i, newnick);
-}
-
-/* join <bot> <nick> <chan> <flag><sock> <from>
- */
-static void bot_join(int idx, char *par)
-{
-  char *bot, *nick, *x, *y;
-  struct userrec *u;
-  int i, sock, chan, i2, linking = 0;
-
-  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
-    return;
-  bot = newsplit(&par);
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) >= NEAT_BOTNET)
-#endif
-    if (bot[0] == '!') {
-      linking = 1;
-      bot++;
-    }
-  if (b_status(idx) & STAT_LINKING) {
-    linking = 1;
-  }
-  nick = newsplit(&par);
-  x = newsplit(&par);
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    chan = atoi(x);
-  else
-#endif
-    chan = base64_to_int(x);
-  y = newsplit(&par);
-  if ((chan < 0) || !y[0])
-    return;			/* Woops! pre 1.2.1's send .chat off'ers
-				 * too!! */
-  if (!y[0]) {
-    y[0] = '-';
-    sock = 0;
-  } else {
-#ifndef NO_OLD_BOTNET
-    if (b_numver(idx) < NEAT_BOTNET)
-      sock = atoi(y + 1);
-    else
-#endif
-      sock = base64_to_int(y + 1);
-  }
-  /* 1.1 bots always send a sock#, even on a channel change
-   * so if sock# is 0, this is from an old bot and we must tread softly
-   * grab old sock# if there is one, otherwise make up one.
-   */
-  if (sock == 0)
-    sock = partysock(bot, nick);
-  if (sock == 0)
-    sock = fakesock++;
-  i = nextbot(bot);
-  if (i != idx) {		/* Ok, garbage from a 1.0g (who uses that
-				 * now?) OR raistlin being evil :) */
-    fake_alert(idx, "direction", bot);
-    return;
-  }
-  u = get_user_by_handle(userlist, nick);
-  if (u) {
-    sprintf(TBUF, "@%s", bot);
-    touch_laston(u, TBUF, now);
-  }
-  i = addparty(bot, nick, chan, y[0], sock, par, &i2);
-  botnet_send_join_party(idx, linking, i2, i);
-  if (i != chan) {
-    if (i >= 0) {
-      if (b_numver(idx) >= NEAT_BOTNET)
-	chanout_but(-1, i, "*** (%s) %s %s %s.\n", bot, nick, _("has left the"),
-		    i ? "channel" : "party line");
-      check_bind_chpt(bot, nick, sock, i);
-    }
-    if ((b_numver(idx) >= NEAT_BOTNET) && !linking)
-      chanout_but(-1, chan, "*** (%s) %s %s %s.\n", bot, nick, _("has joined the"),
-		  chan ? "channel" : "party line");
-    check_bind_chjn(bot, nick, chan, y[0], sock, par);
-  }
-}
-
-/* part <bot> <nick> <sock> [etc..]
- */
-static void bot_part(int idx, char *par)
-{
-  char *bot, *nick, *etc;
-  struct userrec *u;
-  int sock, partyidx;
-  int silent = 0;
-
-  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
-    return;
-  bot = newsplit(&par);
-  if (bot[0] == '!') {
-    silent = 1;
-    bot++;
-  }
-  nick = newsplit(&par);
-  etc = newsplit(&par);
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET) {
-    sock = atoi(etc);
-    silent = 1;
-  } else
-#endif
-    sock = base64_to_int(etc);
-  if (sock == 0)
-    sock = partysock(bot, nick);
-  u = get_user_by_handle(userlist, nick);
-  if (u) {
-    sprintf(TBUF, "@%s", bot);
-    touch_laston(u, TBUF, now);
-  }
-  if ((partyidx = getparty(bot, sock)) != -1) {
-    if (party[partyidx].chan >= 0) {
-      check_bind_chpt(bot, nick, sock, party[partyidx].chan);
-    }
-    if ((b_numver(idx) >= NEAT_BOTNET) && !silent) {
-      register int chan = party[partyidx].chan;
-
-      if (par[0])
-	chanout_but(-1, chan, "*** (%s) %s %s %s (%s).\n", bot, nick,
-		    _("has left the"),
-		    chan ? "channel" : "party line", par);
-      else
-	chanout_but(-1, chan, "*** (%s) %s %s %s.\n", bot, nick,
-		    _("has left the"),
-		    chan ? "channel" : "party line");
-    }
-    botnet_send_part_party(idx, partyidx, par, silent);
-    remparty(bot, sock);
-  }
-}
-
-/* away <bot> <sock> <message>
- * null message = unaway
- */
-static void bot_away(int idx, char *par)
-{
-  char *bot, *etc;
-  int sock, partyidx, linking = 0;
-
-  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
-    return;
-  bot = newsplit(&par);
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) >= NEAT_BOTNET)
-#endif
-    if (bot[0] == '!') {
-      linking = 1;
-      bot++;
-    }
-  if (b_status(idx) & STAT_LINKING) {
-    linking = 1;
-  }
-  etc = newsplit(&par);
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    sock = atoi(etc);
-  else
-#endif
-    sock = base64_to_int(etc);
-  if (sock == 0)
-    sock = partysock(bot, etc);
-  check_bind_away(bot, sock, par);
-  if (par[0]) {
-    partystat(bot, sock, PLSTAT_AWAY, 0);
-    partyaway(bot, sock, par);
-  } else {
-    partystat(bot, sock, 0, PLSTAT_AWAY);
-  }
-  partyidx = getparty(bot, sock);
-  if ((b_numver(idx) >= NEAT_BOTNET) && !linking) {
-    if (par[0])
-      chanout_but(-1, party[partyidx].chan,
-		  "*** (%s) %s %s: %s.\n", bot,
-		  party[partyidx].nick, _("is now away"), par);
-    else
-      chanout_but(-1, party[partyidx].chan,
-		  "*** (%s) %s %s.\n", bot,
-		  party[partyidx].nick, _("is no longer away"));
-  }
-  botnet_send_away(idx, bot, sock, par, linking);
-}
-
-/* (a courtesy info to help during connect bursts)
- * idle <bot> <sock> <#secs> [away msg]
- */
-static void bot_idle(int idx, char *par)
-{
-  char *bot, *work;
-  int sock, idle;
-
-  if (bot_flags(dcc[idx].user) & BOT_ISOLATE)
-    return;
-  bot = newsplit(&par);
-  work = newsplit(&par);
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    sock = atoi(work);
-  else
-#endif
-    sock = base64_to_int(work);
-  if (sock == 0)
-    sock = partysock(bot, work);
-  work = newsplit(&par);
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    idle = atoi(work);
-  else
-#endif
-    idle = base64_to_int(work);
-  partysetidle(bot, sock, idle);
-  if (par[0]) {
-    partystat(bot, sock, PLSTAT_AWAY, 0);
-    partyaway(bot, sock, par);
-  }
-  botnet_send_idle(idx, bot, sock, idle, par);
-}
-
-#ifndef NO_OLD_BOTNET
-
-static void bot_ufno(int idx, char *par)
-{
-  putlog(LOG_BOTS, "*", "%s %s: %s", _("User file rejected by"), dcc[idx].nick, par);
-  dcc[idx].status &= ~STAT_OFFERED;
-  if (!(dcc[idx].status & STAT_GETTING))
-    dcc[idx].status &= ~STAT_SHARE;
-}
-
-static void bot_old_userfile(int idx, char *par)
-{
-  putlog(LOG_BOTS, "*", "%s %s", _("Old style share request by"), dcc[idx].nick);
-  dprintf(idx, "uf-no %s\n", _("Antiquated sharing request"));
-}
-
-#endif	/* !NO_OLD_BOTNET */
-
-void bot_share(int idx, char *par)
-{
-  sharein(idx, par);
-}
-
-/* v <frombot> <tobot> <idx:nick>
- */
-static void bot_versions(int sock, char *par)
-{
-  char *frombot = newsplit(&par), *tobot, *from;
-  module_entry *me;
-
-  if (nextbot(frombot) != sock)
-    fake_alert(sock, "versions-direction", frombot);
-  else if (strcasecmp(tobot = newsplit(&par), botnetnick)) {
-    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");
-    for (me = module_list; me; me = me->next)
-      botnet_send_priv(sock, botnetnick, 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");
-  }
-}
-
-/* BOT COMMANDS
- *
- * function call should be:
- * int bot_whatever(idx,"parameters");
- *
- * SORT these, dcc_bot uses a shortcut which requires them sorted
- *
- * yup, those are tokens there to allow a more efficient botnet as
- * time goes on (death to slowly upgrading llama's)
- */
-botcmd_t C_bot[] =
-{
-  {"a",			(Function) bot_actchan},
-#ifndef NO_OLD_BOTNET
-  {"actchan",		(Function) bot_actchan},
-#endif
-  {"aw",		(Function) bot_away},
-  {"away",		(Function) bot_away},
-  {"bye",		(Function) bot_bye},
-  {"c",			(Function) bot_chan2},
-#ifndef NO_OLD_BOTNET
-  {"chan",		(Function) bot_chan2},
-  {"chat",		(Function) bot_chat},
-#endif
-  {"ct",		(Function) bot_chat},
-  {"e",			(Function) bot_error},
-  {"el",		(Function) bot_endlink},
-#ifndef NO_OLD_BOTNET
-  {"error",		(Function) bot_error},
-#endif
-  {"f!",		(Function) bot_filereject},
-#ifndef NO_OLD_BOTNET
-  {"filereject",	(Function) bot_filereject},
-  {"filereq",		(Function) bot_filereq},
-  {"filesend",		(Function) bot_filesend},
-#endif
-  {"fr",		(Function) bot_filereq},
-  {"fs",		(Function) bot_filesend},
-  {"h",			(Function) bot_handshake},
-#ifndef NO_OLD_BOTNET
-  {"handshake",		(Function) bot_handshake},
-#endif
-  {"i",			(Function) bot_idle},
-  {"i?",		(Function) bot_infoq},
-#ifndef NO_OLD_BOTNET
-  {"idle",		(Function) bot_idle},
-  {"info?",		(Function) bot_infoq},
-#endif
-  {"j",			(Function) bot_join},
-#ifndef NO_OLD_BOTNET
-  {"join",		(Function) bot_join},
-#endif
-  {"l",			(Function) bot_link},
-#ifndef NO_OLD_BOTNET
-  {"link",		(Function) bot_link},
-  {"linked",		(Function) bot_linked},
-#endif
-  {"m",			(Function) bot_motd},
-#ifndef NO_OLD_BOTNET
-  {"motd",		(Function) bot_motd},
-#endif
-  {"n",			(Function) bot_nlinked},
-  {"nc",		(Function) bot_nickchange},
-#ifndef NO_OLD_BOTNET
-  {"nlinked",		(Function) bot_nlinked},
-#endif
-  {"p",			(Function) bot_priv},
-#ifndef NO_OLD_BOTNET
-  {"part",		(Function) bot_part},
-#endif
-  {"pi",		(Function) bot_ping},
-#ifndef NO_OLD_BOTNET
-  {"ping",		(Function) bot_ping},
-#endif
-  {"po",		(Function) bot_pong},
-#ifndef NO_OLD_BOTNET
-  {"pong",		(Function) bot_pong},
-  {"priv",		(Function) bot_priv},
-#endif
-  {"pt",		(Function) bot_part},
-  {"r",			(Function) bot_reject},
-#ifndef NO_OLD_BOTNET
-  {"reject",		(Function) bot_reject},
-#endif
-  {"s",			(Function) bot_share},
-  {"t",			(Function) bot_trace},
-  {"tb",		(Function) bot_thisbot},
-  {"td",		(Function) bot_traced},
-#ifndef NO_OLD_BOTNET
-  {"thisbot",		(Function) bot_thisbot},
-  {"trace",		(Function) bot_trace},
-  {"traced",		(Function) bot_traced},
-#endif
-  {"u",			(Function) bot_update},
-#ifndef NO_OLD_BOTNET
-  {"uf-no",		(Function) bot_ufno},
-#endif
-  {"ul",		(Function) bot_unlink},
-  {"un",		(Function) bot_unlinked},
-#ifndef NO_OLD_BOTNET
-  {"unaway",		(Function) bot_away},
-  {"unlink",		(Function) bot_unlink},
-  {"unlinked",		(Function) bot_unlinked},
-  {"update",		(Function) bot_update},
-  {"userfile?",		(Function) bot_old_userfile},
-#endif
-  {"v",			(Function) bot_versions},
-  {"w",			(Function) bot_who},
-#ifndef NO_OLD_BOTNET
-  {"who",		(Function) bot_who},
-#endif
-  {"z",			(Function) bot_zapf},
-#ifndef NO_OLD_BOTNET
-  {"zapf",		(Function) bot_zapf},
-  {"zapf-broad",	(Function) bot_zapfbroad},
-#endif
-  {"zb",		(Function) bot_zapfbroad},
-  {NULL,		NULL}
-};
Index: eggdrop1.7/src/botcmd.h
diff -u eggdrop1.7/src/botcmd.h:1.2 eggdrop1.7/src/botcmd.h:removed
--- eggdrop1.7/src/botcmd.h:1.2	Sun May  5 11:40:37 2002
+++ eggdrop1.7/src/botcmd.h	Sat Sep 21 20:25:29 2002
@@ -1,30 +0,0 @@
-/*
- * botcmd.h --
- */
-/*
- * Copyright (C) 2000, 2001, 2002 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-/*
- * $Id: botcmd.h,v 1.2 2002/05/05 16:40:37 tothwolf Exp $
- */
-
-#ifndef _EGG_BOTCMD_H
-#define _EGG_BOTCMD_H
-
-void bot_share(int, char *);
-
-#endif				/* !_EGG_BOTCMD_H */
Index: eggdrop1.7/src/botmsg.c
diff -u eggdrop1.7/src/botmsg.c:1.38 eggdrop1.7/src/botmsg.c:removed
--- eggdrop1.7/src/botmsg.c:1.38	Tue May 28 15:36:07 2002
+++ eggdrop1.7/src/botmsg.c	Sat Sep 21 20:25:29 2002
@@ -1,786 +0,0 @@
-/*
- * botmsg.c --
- *
- *	formatting of messages to be sent on the botnet
- *	sending differnet messages to different versioned bots
- *
- * by Darrin Smith (beldin at light.iinet.net.au)
- */
-/*
- * Copyright (C) 1997 Robey Pointer
- * Copyright (C) 1999, 2000, 2001, 2002 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef lint
-static const char rcsid[] = "$Id: botmsg.c,v 1.38 2002/05/28 20:36:07 stdarg Exp $";
-#endif
-
-#include "main.h"
-#include "tandem.h"
-#include "misc.h"
-#include "modules.h"	/* match_noterej, storenote			*/
-#include "cmdt.h"	/* cmd_t					*/
-#include "core_binds.h"	/* check_bind_note				*/
-#include "users.h"	/* bot_flags, get_user_by_handle, is_bot	*/
-#include "botnet.h"	/* lastbot, getparty, nextbot			*/
-#include "botcmd.h"	/* add_note					*/
-#include "net.h"	/* tputs					*/
-#include "dccutil.h"	/* dprintf_eggdrop				*/
-#include "botmsg.h"	/* prototypes					*/
-
-extern struct dcc_t	*dcc;
-extern int		 dcc_total, tands;
-extern char		 botnetnick[];
-extern party_t		*party;
-extern struct userrec	*userlist;
-
-static char	OBUF[1024];
-
-#ifndef MAKING_MODS
-extern struct dcc_table DCC_BOT, DCC_CHAT;
-#endif /* MAKING_MODS   */
-
-
-#ifndef NO_OLD_BOTNET
-/* Ditto for tandem bots
- */
-void tandout_but EGG_VARARGS_DEF(int, arg1)
-{
-  int i, x, len;
-  char *format;
-  char s[601];
-  va_list va;
-
-  x = EGG_VARARGS_START(int, arg1, va);
-  format = va_arg(va, char *);
-  len = vsnprintf(s, 511, format, va);
-  va_end(va);
-  if (len < 0 || len >= sizeof(s)) len = sizeof(s)-1;
-  s[len] = 0;
-
-  for (i = 0; i < dcc_total; i++)
-    if ((dcc[i].type == &DCC_BOT) && (i != x) &&
-        (b_numver(i) < NEAT_BOTNET))
-      tputs(dcc[i].sock, s, len);
-}
-#endif
-
-/* Ditto for tandem bots
- */
-void send_tand_but(int x, char *buf, int len)
-{
-  int i, iso = 0;
-
-  if (len < 0) {
-    len = -len;
-    iso = 1;
-  }
-  for (i = 0; i < dcc_total; i++)
-    if ((dcc[i].type == &DCC_BOT) && (i != x) &&
-	(b_numver(i) >= NEAT_BOTNET) &&
-	(!iso || !(bot_flags(dcc[i].user) & BOT_ISOLATE)))
-      tputs(dcc[i].sock, buf, len);
-}
-
-void botnet_send_bye()
-{
-  if (tands > 0) {
-    send_tand_but(-1, "bye\n", 4);
-#ifndef NO_OLD_BOTNET
-    tandout_but(-1, "bye\n");
-#endif
-  }
-}
-
-void botnet_send_chan(int idx, char *botnick, char *user,
-		      int chan, char *data)
-{
-  int i;
-
-  if ((tands > 0) && (chan < GLOBAL_CHANS)) {
-    if (user) {
-      i = simple_sprintf(OBUF, "c %s@%s %D %s\n", user, botnick, chan, data);
-    } else {
-      i = simple_sprintf(OBUF, "c %s %D %s\n", botnick, chan, data);
-    }
-    send_tand_but(idx, OBUF, -i);
-#ifndef NO_OLD_BOTNET
-    tandout_but(idx, "chan %s%s%s %d %s\n", user ? user : "",
-		user ? "@" : "", botnick, chan, data);
-#endif
-  }
-}
-
-void botnet_send_act(int idx, char *botnick, char *user,
-		     int chan, char *data)
-{
-  int i;
-
-  if ((tands > 0) && (chan < GLOBAL_CHANS)) {
-    if (user) {
-      i = simple_sprintf(OBUF, "a %s@%s %D %s\n", user, botnick, chan, data);
-    } else {
-      i = simple_sprintf(OBUF, "a %s %D %s\n", botnick, chan, data);
-    }
-    send_tand_but(idx, OBUF, -i);
-#ifndef NO_OLD_BOTNET
-    tandout_but(idx, "actchan %s%s%s %d %s\n", user ? user : "",
-		user ? "@" : "", botnick, chan, data);
-#endif
-  }
-}
-
-void botnet_send_chat(int idx, char *botnick, char *data)
-{
-  int i;
-
-  if (tands > 0) {
-    i = simple_sprintf(OBUF, "ct %s %s\n", botnick, data);
-    send_tand_but(idx, OBUF, -i);
-#ifndef NO_OLD_BOTNET
-    tandout_but(idx, "chat %s %s\n", botnick, data);
-#endif
-  }
-}
-
-void botnet_send_ping(int idx)
-{
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    tputs(dcc[idx].sock, "ping\n", 5);
-  else
-#endif
-    tputs(dcc[idx].sock, "pi\n", 3);
-}
-
-void botnet_send_pong(int idx)
-{
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    tputs(dcc[idx].sock, "pong\n", 5);
-  else
-#endif
-    tputs(dcc[idx].sock, "po\n", 3);
-}
-
-void botnet_send_priv EGG_VARARGS_DEF(int, arg1)
-{
-  int idx, l;
-  char *from, *to, *tobot, *format;
-  char tbuf[1024];
-  va_list va;
-
-  idx = EGG_VARARGS_START(int, arg1, va);
-  from = va_arg(va, char *);
-  to = va_arg(va, char *);
-  tobot = va_arg(va, char *);
-  format = va_arg(va, char *);
-  vsnprintf(tbuf, 450, format, va);
-  va_end(va);
-  tbuf[sizeof(tbuf)-1] = 0;
-
-  if (tobot) {
-#ifndef NO_OLD_BOTNET
-    if (b_numver(idx) < NEAT_BOTNET)
-      l = simple_sprintf(OBUF, "priv %s %s@%s %s\n", from, to, tobot, tbuf);
-    else
-#endif
-      l = simple_sprintf(OBUF, "p %s %s@%s %s\n", from, to, tobot, tbuf);
-  } else {
-#ifndef NO_OLD_BOTNET
-    if (b_numver(idx) < NEAT_BOTNET)
-      l = simple_sprintf(OBUF, "priv %s %s %s\n", from, to, tbuf);
-    else
-#endif
-      l = simple_sprintf(OBUF, "p %s %s %s\n", from, to, tbuf);
-  }
-  tputs(dcc[idx].sock, OBUF, l);
-}
-
-void botnet_send_who(int idx, char *from, char *to, int chan)
-{
-  int l;
-
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    l = simple_sprintf(OBUF, "who %s %s %d\n", from, to, chan);
-  else
-#endif
-    l = simple_sprintf(OBUF, "w %s %s %D\n", from, to, chan);
-  tputs(dcc[idx].sock, OBUF, l);
-}
-
-void botnet_send_infoq(int idx, char *par)
-{
-  int i = simple_sprintf(OBUF, "i? %s\n", par);
-
-  send_tand_but(idx, OBUF, i);
-#ifndef NO_OLD_BOTNET
-  tandout_but(idx, "info? %s\n", par);
-#endif
-}
-
-void botnet_send_unlink(int idx, char *who, char *via,
-			char *bot, char *reason)
-{
-  int l;
-
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    l = simple_sprintf(OBUF, "unlink %s %s %s %s\n", who, via, bot, reason);
-  else
-#endif
-    l = simple_sprintf(OBUF, "ul %s %s %s %s\n", who, via, bot, reason);
-  tputs(dcc[idx].sock, OBUF, l);
-}
-
-void botnet_send_link(int idx, char *who, char *via, char *bot)
-{
-  int l;
-
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    l = simple_sprintf(OBUF, "link %s %s %s\n", who, via, bot);
-  else
-#endif
-    l = simple_sprintf(OBUF, "l %s %s %s\n", who, via, bot);
-  tputs(dcc[idx].sock, OBUF, l);
-}
-
-void botnet_send_unlinked(int idx, char *bot, char *args)
-{
-  int l;
-
-  if (tands > 0) {
-    l = simple_sprintf(OBUF, "un %s %s\n", bot, args ? args : "");
-    send_tand_but(idx, OBUF, l);
-#ifndef NO_OLD_BOTNET
-    if ((idx >= 0) && (b_numver(idx) >= NEAT_BOTNET) && args && args[0])
-      tandout_but(idx, "chat %s %s\n", lastbot(bot), args);
-    tandout_but(idx, "unlinked %s\n", bot);
-#endif
-  }
-}
-
-void botnet_send_nlinked(int idx, char *bot, char *next, char flag,
-			 int vernum)
-{
-  int l;
-
-  if (tands > 0) {
-    l = simple_sprintf(OBUF, "n %s %s %c%D\n", bot, next, flag, vernum);
-    send_tand_but(idx, OBUF, l);
-#ifndef NO_OLD_BOTNET
-    if (flag == '!') {
-      flag = '-';
-      tandout_but(idx, "chat %s %s %s\n", next, _("Linked to"), bot);
-    }
-    tandout_but(idx, "nlinked %s %s %c%d\n", bot, next, flag, vernum);
-#endif
-  }
-}
-
-void botnet_send_traced(int idx, char *bot, char *buf)
-{
-  int l;
-
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    l = simple_sprintf(OBUF, "traced %s %s\n", bot, buf);
-  else
-#endif
-    l = simple_sprintf(OBUF, "td %s %s\n", bot, buf);
-  tputs(dcc[idx].sock, OBUF, l);
-}
-
-void botnet_send_trace(int idx, char *to, char *from, char *buf)
-{
-  int l;
-
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    l = simple_sprintf(OBUF, "trace %s %s %s:%s\n", to, from, buf, botnetnick);
-  else
-#endif
-    l = simple_sprintf(OBUF, "t %s %s %s:%s\n", to, from, buf, botnetnick);
-  tputs(dcc[idx].sock, OBUF, l);
-}
-
-void botnet_send_update(int idx, tand_t * ptr)
-{
-  int l;
-
-  if (tands > 0) {
-    l = simple_sprintf(OBUF, "u %s %c%D\n", ptr->bot, ptr->share, ptr->ver);
-    send_tand_but(idx, OBUF, l);
-#ifndef NO_OLD_BOTNET
-    tandout_but(idx, "update %s %c%d\n", ptr->bot, ptr->share, ptr->ver);
-#endif
-  }
-}
-
-void botnet_send_reject(int idx, char *fromp, char *frombot, char *top,
-			char *tobot, char *reason)
-{
-  int l;
-  char to[NOTENAMELEN + 1], from[NOTENAMELEN + 1];
-
-  if (!(bot_flags(dcc[idx].user) & BOT_ISOLATE)) {
-    if (tobot) {
-      simple_sprintf(to, "%s@%s", top, tobot);
-      top = to;
-    }
-    if (frombot) {
-      simple_sprintf(from, "%s@%s", fromp, frombot);
-      fromp = from;
-    }
-    if (!reason)
-      reason = "";
-#ifndef NO_OLD_BOTNET
-    if (b_numver(idx) < NEAT_BOTNET)
-      l = simple_sprintf(OBUF, "reject %s %s %s\n", fromp, top, reason);
-    else
-#endif
-      l = simple_sprintf(OBUF, "r %s %s %s\n", fromp, top, reason);
-    tputs(dcc[idx].sock, OBUF, l);
-  }
-}
-
-void botnet_send_zapf(int idx, char *a, char *b, char *c)
-{
-  int l;
-
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    l = simple_sprintf(OBUF, "zapf %s %s %s\n", a, b, c);
-  else
-#endif
-    l = simple_sprintf(OBUF, "z %s %s %s\n", a, b, c);
-  tputs(dcc[idx].sock, OBUF, l);
-}
-
-void botnet_send_zapf_broad(int idx, char *a, char *b, char *c)
-{
-  int l;
-
-  if (tands > 0) {
-    l = simple_sprintf(OBUF, "zb %s %s%s%s\n", a, b ? b : "", b ? " " : "", c);
-    send_tand_but(idx, OBUF, l);
-#ifndef NO_OLD_BOTNET
-    tandout_but(idx, "zapf-broad %s\n", OBUF + 3);
-#endif
-  }
-}
-
-void botnet_send_motd(int idx, char *from, char *to)
-{
-  int l;
-
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    l = simple_sprintf(OBUF, "motd %s %s\n", from, to);
-  else
-#endif
-    l = simple_sprintf(OBUF, "m %s %s\n", from, to);
-  tputs(dcc[idx].sock, OBUF, l);
-}
-
-void botnet_send_filereject(int idx, char *path, char *from, char *reason)
-{
-  int l;
-
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    l = simple_sprintf(OBUF, "filereject %s %s %s\n", path, from, reason);
-  else
-#endif
-    l = simple_sprintf(OBUF, "f! %s %s %s\n", path, from, reason);
-  tputs(dcc[idx].sock, OBUF, l);
-}
-
-void botnet_send_filesend(int idx, char *path, char *from, char *data)
-{
-  int l;
-
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    l = simple_sprintf(OBUF, "filesend %s %s %s\n", path, from, data);
-  else
-#endif
-    l = simple_sprintf(OBUF, "fs %s %s %s\n", path, from, data);
-  tputs(dcc[idx].sock, OBUF, l);
-}
-
-void botnet_send_filereq(int idx, char *from, char *bot, char *path)
-{
-  int l;
-
-#ifndef NO_OLD_BOTNET
-  if (b_numver(idx) < NEAT_BOTNET)
-    l = simple_sprintf(OBUF, "filereq %s %s:%s\n", from, bot, path);
-  else
-#endif
-    l = simple_sprintf(OBUF, "fr %s %s:%s\n", from, bot, path);
-  tputs(dcc[idx].sock, OBUF, l);
-}
-
-void botnet_send_idle(int idx, char *bot, int sock, int idle, char *away)
-{
-  int l;
-
-  if (tands > 0) {
-    l = simple_sprintf(OBUF, "i %s %D %D %s\n", bot, sock, idle,
-		       away ? away : "");
-    send_tand_but(idx, OBUF, -l);
-#ifndef NO_OLD_BOTNET
-    if (away && away[0])
-      tandout_but(idx, "away %s %d %s\n", bot, sock, away);
-    tandout_but(idx, "idle %s %d %d\n", bot, sock, idle);
-#endif
-  }
-}
-
-void botnet_send_away(int idx, char *bot, int sock,
-		      char *msg, int linking)
-{
-  int l;
-
-  if (tands > 0) {
-    l = simple_sprintf(OBUF, "aw %s%s %D %s\n",
-		       ((idx >= 0) && linking) ? "!" : "",
-		       bot, sock, msg ? msg : "");
-    send_tand_but(idx, OBUF, -l);
-#ifndef NO_OLD_BOTNET
-    if (msg) {
-      if (idx < 0) {
-	tandout_but(idx, "chan %s %d %s is now away: %s.\n", bot,
-		    dcc[linking].u.chat->channel, dcc[linking].nick,
-		    msg);
-      } else if ((b_numver(idx) >= NEAT_BOTNET)) {
-	int partyidx = getparty(bot, sock);
-
-	if (partyidx >= 0)
-	  tandout_but(idx, "chan %s %d %s %s: %s.\n", bot,
-		      party[partyidx].chan, party[partyidx].nick,
-		      _("is now away"), msg);
-      }
-      tandout_but(idx, "away %s %d %s\n", bot, sock, msg);
-    } else {
-      if (idx < 0) {
-	tandout_but(idx, "chan %s %d %s %s.\n", bot,
-		    dcc[linking].u.chat->channel, dcc[linking].nick,
-		    _("is no longer away"));
-      } else if (b_numver(idx) >= NEAT_BOTNET) {
-	int partyidx = getparty(bot, sock);
-
-	if (partyidx >= 0)
-	  tandout_but(idx, "chan %s %d %s %s.\n", bot,
-		      party[partyidx].chan, party[partyidx].nick,
-		      _("is no longer away"));
-      }
-      tandout_but(idx, "unaway %s %d\n", bot, sock);
-    }
-#endif
-  }
-}
-
-void botnet_send_join_idx(int useridx, int oldchan)
-{
-  int l;
-
-  if (tands > 0) {
-    l = simple_sprintf(OBUF, "j %s %s %D %c%D %s\n",
-		       botnetnick, dcc[useridx].nick,
-		       dcc[useridx].u.chat->channel, geticon(dcc[useridx].user),
-		       dcc[useridx].sock, dcc[useridx].host);
-    send_tand_but(-1, OBUF, -l);
-#ifndef NO_OLD_BOTNET
-    tandout_but(-1, "join %s %s %d %c%d %s\n", botnetnick,
-		dcc[useridx].nick, dcc[useridx].u.chat->channel,
-		geticon(dcc[useridx].user), dcc[useridx].sock,
-		dcc[useridx].host);
-    tandout_but(-1, "chan %s %d %s %s %s.\n",
-		botnetnick, dcc[useridx].u.chat->channel,
-		dcc[useridx].nick, _("has joined the"),
-		dcc[useridx].u.chat->channel ? "channel" : "party line");
-    if ((oldchan >= 0) && (oldchan < GLOBAL_CHANS)) {
-      tandout_but(-1, "chan %s %d %s %s %s.\n",
-		  botnetnick, oldchan,
-		  dcc[useridx].nick, _("has left the"),
-		  oldchan ? "channel" : "party line");
-    }
-#endif
-  }
-}
-
-void botnet_send_join_party(int idx, int linking, int useridx, int oldchan)
-{
-  int l;
-
-  if (tands > 0) {
-    l = simple_sprintf(OBUF, "j %s%s %s %D %c%D %s\n", linking ? "!" : "",
-		       party[useridx].bot, party[useridx].nick,
-		       party[useridx].chan, party[useridx].flag,
-		       party[useridx].sock,
-		       party[useridx].from ? party[useridx].from : "");
-    send_tand_but(idx, OBUF, -l);
-#ifndef NO_OLD_BOTNET
-    tandout_but(idx, "join %s %s %d %c%d %s\n", party[useridx].bot,
-		party[useridx].nick, party[useridx].chan,
-		party[useridx].flag, party[useridx].sock,
-		party[useridx].from ? party[useridx].from : "");
-    if ((idx < 0) || (!linking && (b_numver(idx) >= NEAT_BOTNET))) {
-      tandout_but(idx, "chan %s %d %s %s %s.\n",
-		  party[useridx].bot, party[useridx].chan,
-		  party[useridx].nick, _("has joined the"),
-		  party[useridx].chan ? "channel" : "party line");
-    }
-    if ((oldchan >= 0) && (oldchan < GLOBAL_CHANS) &&
-	((idx < 0) || (b_numver(idx) >= NEAT_BOTNET))) {
-      tandout_but(idx, "chan %s %d %s %s %s.\n",
-		  party[useridx].bot, oldchan, party[useridx].nick,
-		  _("has left the"),
-		  party[useridx].chan ? "channel" : "party line");
-    }
-#endif
-  }
-}
-
-void botnet_send_part_idx(int useridx, char *reason)
-{
-  int l = simple_sprintf(OBUF, "pt %s %s %D %s\n", botnetnick,
-			 dcc[useridx].nick, dcc[useridx].sock,
-			 reason ? reason : "");
-
-  if (tands > 0) {
-    send_tand_but(-1, OBUF, -l);
-#ifndef NO_OLD_BOTNET
-    tandout_but(-1, "part %s %s %d\n", botnetnick,
-		dcc[useridx].nick, dcc[useridx].sock);
-    tandout_but(-1, "chan %s %d %s has left the %s%s%s.\n",
-		botnetnick, dcc[useridx].u.chat->channel,
-		dcc[useridx].nick,
-		dcc[useridx].u.chat->channel ? "channel" : "party line",
-		reason ? ": " : "", reason ? reason : "");
-#endif
-  }
-}
-
-void botnet_send_part_party(int idx, int partyidx, char *reason,
-			    int silent)
-{
-  int l;
-
-  if (tands > 0) {
-    l = simple_sprintf(OBUF, "pt %s%s %s %D %s\n",
-		       silent ? "!" : "", party[partyidx].bot,
-		       party[partyidx].nick, party[partyidx].sock,
-		       reason ? reason : "");
-    send_tand_but(idx, OBUF, -l);
-#ifndef NO_OLD_BOTNET
-    tandout_but(idx, "part %s %s %d\n", party[partyidx].bot,
-		party[partyidx].nick, party[partyidx].sock);
-    if (((idx < 0) || (b_numver(idx) >= NEAT_BOTNET)) && !silent) {
-      tandout_but(idx, "chan %s %d %s has left the %s%s%s.\n",
-		  party[partyidx].bot, party[partyidx].chan,
-		  party[partyidx].nick,
-		  party[partyidx].chan ? "channel" : "party line",
-		  reason ? ": " : "", reason ? reason : "");
-    }
-#endif
-  }
-}
-
-void botnet_send_nkch(int useridx, char *oldnick)
-{
-  int l;
-
-  if (tands > 0) {
-    l = simple_sprintf(OBUF, "nc %s %D %s\n", botnetnick,
-		       dcc[useridx].sock, dcc[useridx].nick);
-    send_tand_but(-1, OBUF, -l);
-#ifndef NO_OLD_BOTNET
-    tandout_but(-1, "part %s %s %d\n", botnetnick,
-		dcc[useridx].nick, dcc[useridx].sock);
-    tandout_but(-1, "join %s %s %d %c%d %s\n", botnetnick,
-		dcc[useridx].nick, dcc[useridx].u.chat->channel,
-		geticon(dcc[useridx].user), dcc[useridx].sock,
-		dcc[useridx].host);
-    tandout_but(-1, "chan %s %d %s: %s -> %s.\n",
-		botnetnick, dcc[useridx].u.chat->channel,
-		oldnick, _("Nick Change:"), dcc[useridx].nick);
-#endif
-  }
-}
-
-void botnet_send_nkch_part(int butidx, int useridx, char *oldnick)
-{
-  int l;
-
-  if (tands > 0) {
-    l = simple_sprintf(OBUF, "nc %s %D %s\n", party[useridx].bot,
-		       party[useridx].sock, party[useridx].nick);
-    send_tand_but(butidx, OBUF, -l);
-#ifndef NO_OLD_BOTNET
-    tandout_but(butidx, "part %s %s %d\n", party[useridx].bot,
-		party[useridx].nick, party[useridx].sock);
-    tandout_but(butidx, "join %s %s %d %c%d %s\n", party[useridx].bot,
-		party[useridx].nick, party[useridx].chan,
-		party[useridx].flag, party[useridx].sock,
-		party[useridx].from ? party[useridx].from : "");
-    tandout_but(butidx, "chan %s %d %s : %s -> %s.\n",
-		party[useridx].bot, party[useridx].chan,
-		_("Nick Change:"),
-		oldnick, party[useridx].nick);
-#endif
-  }
-}
-
-/* This part of add_note is more relevant to the botnet than
- * to the notes file
- */
-int add_note(char *to, char *from, char *msg, int idx, int echo)
-{
-  int status, i, iaway, sock;
-  char *p, botf[81], ss[81], ssf[81];
-  struct userrec *u;
-
-  if (strlen(msg) > 450)
-    msg[450] = 0;		/* Notes have a limit */
-  /* note length + PRIVMSG header + nickname + date  must be <512  */
-  p = strchr(to, '@');
-  if (p != NULL) {		/* Cross-bot note */
-    char x[21];
-
-    *p = 0;
-    strncpy(x, to, 20);
-    x[20] = 0;
-    *p = '@';
-    p++;
-    if (!strcasecmp(p, botnetnick))	/* To me?? */
-      return add_note(x, from, msg, idx, echo); /* Start over, dimwit. */
-    if (strcasecmp(from, botnetnick)) {
-      if (strlen(from) > 40)
-	from[40] = 0;
-      if (strchr(from, '@')) {
-	strcpy(botf, from);
-      } else
-	sprintf(botf, "%s@%s", from, botnetnick);
-    } else
-      strcpy(botf, botnetnick);
-    i = nextbot(p);
-    if (i < 0) {
-      if (idx >= 0)
-	dprintf(idx, _("That bot isnt here.\n"));
-      return NOTE_ERROR;
-    }
-    if ((idx >= 0) && (echo))
-      dprintf(idx, "-> %s@%s: %s\n", x, p, msg);
-    if (idx >= 0) {
-      sprintf(ssf, "%lu:%s", dcc[idx].sock, botf);
-      botnet_send_priv(i, ssf, x, p, "%s", msg);
-    } else
-      botnet_send_priv(i, botf, x, p, "%s", msg);
-    return NOTE_OK;		/* Forwarded to the right bot */
-  }
-  /* Might be form "sock:nick" */
-  splitc(ssf, from, ':');
-  rmspace(ssf);
-  splitc(ss, to, ':');
-  rmspace(ss);
-  if (!ss[0])
-    sock = (-1);
-  else
-    sock = atoi(ss);
-  /* Don't process if there's a note binding for it */
-  if (idx != (-2)) {		/* Notes from bots don't trigger it */
-    if (check_bind_note(from, to, msg)) {
-      if ((idx >= 0) && (echo))
-	dprintf(idx, "-> %s: %s\n", to, msg);
-      return NOTE_TCL;
-    }
-  }
-  if (!(u = get_user_by_handle(userlist, to))) {
-    if (idx >= 0)
-      dprintf(idx, _("I dont know anyone by that name.\n"));
-    return NOTE_ERROR;
-  }
-  if (is_bot(u)) {
-    if (idx >= 0)
-      dprintf(idx, _("Thats a bot.  You cant leave notes for a bot.\n"));
-    return NOTE_ERROR;
-  }
-  if (match_noterej(u, from)) {
-    if (idx >= 0)
-       dprintf(idx, "%s %s\n", u->handle, "rejected your note.");
-    return NOTE_REJECT;
-  }
-  status = NOTE_STORED;
-  iaway = 0;
-  /* Online right now? */
-  for (i = 0; i < dcc_total; i++) {
-    if (dcc[i].type && (dcc[i].type->flags & DCT_GETNOTES) &&
-	((sock == (-1)) || (sock == dcc[i].sock)) &&
-	(!strcasecmp(dcc[i].nick, to))) {
-      int aok = 1;
-
-      if (dcc[i].type == &DCC_CHAT)
-	if ((dcc[i].u.chat->away != NULL) &&
-	    (idx != (-2))) {
-	  /* Only check away if it's not from a bot */
-	  aok = 0;
-	  if (idx >= 0)
-	    dprintf(idx, "%s %s: %s\n", dcc[i].nick, _("is away"),
-		    dcc[i].u.chat->away);
-	  if (!iaway)
-	    iaway = i;
-	  status = NOTE_AWAY;
-	}
-      if (aok) {
-	char *p, *fr = from;
-	int l = 0;
-	char work[1024];
-
-	while ((*msg == '<') || (*msg == '>')) {
-	  p = newsplit(&msg);
-	  if (*p == '<')
-	    l += simple_sprintf(work + l, "via %s, ", p + 1);
-	  else if (*from == '@')
-	    fr = p + 1;
-	}
-	if (idx == -2 || (!strcasecmp(from, botnetnick)))
-	  dprintf(i, "*** [%s] %s%s\n", fr, l ? work : "", msg);
-	else
-	  dprintf(i, "%cNote [%s]: %s%s\n", 7, fr, l ? work : "", msg);
-	if ((idx >= 0) && (echo))
-	  dprintf(idx, "-> %s: %s\n", to, msg);
-	return NOTE_OK;
-      }
-    }
-  }
-  if (idx == (-2))
-    return NOTE_OK;		/* Error msg from a tandembot: don't store */
-  status = storenote(from, to, msg, idx, NULL, 0);
-  if (status < 0) status = NOTE_ERROR;
-  else if (status == NOTE_AWAY) {
-      /* User is away in all sessions -- just notify the user that a
-       * message arrived and was stored. (only oldest session is notified.)
-       */
-      dprintf(iaway, "*** %s.\n", _("Note arrived for you"));
-  }
-  return(status);
-}
Index: eggdrop1.7/src/botmsg.h
diff -u eggdrop1.7/src/botmsg.h:1.2 eggdrop1.7/src/botmsg.h:removed
--- eggdrop1.7/src/botmsg.h:1.2	Sun May  5 11:40:37 2002
+++ eggdrop1.7/src/botmsg.h	Sat Sep 21 20:25:29 2002
@@ -1,31 +0,0 @@
-/*
- * botmsg.h --
- */
-/*
- * Copyright (C) 2000, 2001, 2002 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-/*
- * $Id: botmsg.h,v 1.2 2002/05/05 16:40:37 tothwolf Exp $
- */
-
-#ifndef _EGG_BOTMSG_H
-#define _EGG_BOTMSG_H
-
-int add_note(char *, char *, char *, int, int);
-void tandout_but EGG_VARARGS(int, arg1);
-
-#endif				/* !_EGG_BOTMSG_H */
Index: eggdrop1.7/src/botnet.c
diff -u eggdrop1.7/src/botnet.c:1.62 eggdrop1.7/src/botnet.c:removed
--- eggdrop1.7/src/botnet.c:1.62	Sun May 26 03:34:13 2002
+++ eggdrop1.7/src/botnet.c	Sat Sep 21 20:25:29 2002
@@ -1,1728 +0,0 @@
-/*
- * botnet.c --
- *
- *	keeping track of which bot's connected where in the chain
- *	dumping a list of bots or a bot tree to a user
- *	rejecting a bot
- *	linking, unlinking, and relaying to another bot
- *	pinging the bots periodically and checking leaf status
- */
-/*
- * Copyright (C) 1997 Robey Pointer
- * Copyright (C) 1999, 2000, 2001, 2002 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-#ifndef lint
-static const char rcsid[] = "$Id: botnet.c,v 1.62 2002/05/26 08:34:13 stdarg Exp $";
-#endif
-
-#include "main.h"
-#include "tandem.h"
-#include "modules.h"
-#include "logfile.h"
-#include "misc.h"
-#include "dns.h"
-#include "cmdt.h"		/* cmd_t				*/
-#include "tclhash.h"		/* add_builtins2	*/
-#include "core_binds.h"		/* check_bind_disc, check_bind_chpt,
-				   check_bind_chof, check_bind_chon,
-				   check_bind_chjn			*/
-#include "users.h"		/* getuser, get_user_by_handle, is_bot  */
-#include "botmsg.h"		/* tandout_bot				*/
-#include "botnet.h"		/* bot_idle, bot_away, bot_join		*/ 
-#include "dcc.h"		/* dupwait_notify, failed_link		*/
-#include "dccutil.h"		/* dprintf_eggdrop, lostdcc, chatout,
-				   new_dcc, changeover_dcc		*/
-#include "net.h"		/* tputs, killsock, getsock, 
-				   open_telnet_raw			*/
-#include "userrec.h"		/* touch_laston, correct_handle		*/
-#include "botnet.h"		/* prototypes				*/
-
-extern char		 spaces[], spaces2[];
-extern int		 dcc_total, backgrd, connect_timeout, max_dcc,
-			 egg_numver;
-extern struct userrec	*userlist;
-extern struct dcc_t	*dcc;
-extern time_t		 now;
-
-tand_t		*tandbot;		/* Keep track of tandem bots on the
-					   botnet */
-party_t		*party;			/* Keep track of people on the botnet */
-static int	 maxparty = 50;		/* 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 = 0;	/* Allow remote unlinks of my
-					   sharebots? */
-
-/* From main.c */
-extern int die_on_sigterm;
-extern int die_on_sighup;
-
-#ifndef MAKING_MODS
-extern struct dcc_table DCC_CHAT, DCC_BOT, DCC_PRE_RELAY, DCC_FORK_RELAY,
-			DCC_RELAYING, DCC_DNSWAIT, DCC_FORK_BOT, DCC_BOT_NEW,
-			DCC_RELAY;
-#endif /* MAKING_MODS   */
-
-static void botnet_sigterm(char *);
-static void botnet_sighup(char *);
-
-/* We want to listen to the sigterm event. */
-static cmd_t botnet_events[] = {
-	{"botnet_sigterm", "", (Function) botnet_sigterm, NULL},
-	{"botnet_sighup", "", (Function) botnet_sighup, NULL},
-	{0}
-};
-
-static void init_bots();
-
-void botnet_init()
-{
-	init_bots();
-
-	/* Add our event handlers */
-	add_hook(HOOK_5MINUTELY, (Function) check_botnet_pings);
-	add_builtins("event", botnet_events);
-}
-
-/* Handle TERM signal */
-static void botnet_sigterm(char *event)
-{
-	if (die_on_sigterm) botnet_send_chat(-1, botnetnick, "ACK, I've been terminated! (SIGTERM)");
-}
-
-static void botnet_sighup(char *event)
-{
-	if (die_on_sighup) botnet_send_chat(-1, botnetnick, "ACK, I've been terminated! (SIGHUP)");
-}
-
-static void init_bots()
-{
-  tandbot = NULL;
-  /* Grab space for 50 bots for now -- expand later as needed */
-  maxparty = 50;
-  party = (party_t *) malloc(maxparty * sizeof(party_t));
-}
-
-tand_t *findbot(char *who)
-{
-  tand_t *ptr;
-
-  for (ptr = tandbot; ptr; ptr = ptr->next)
-    if (!strcasecmp(ptr->bot, who))
-      return ptr;
-  return NULL;
-}
-
-/* Add a tandem bot to our chain list
- */
-void addbot(char *who, char *from, char *next, char flag, int vernum)
-{
-  tand_t **ptr = &tandbot, *ptr2;
-
-  while (*ptr) {
-    if (!strcasecmp((*ptr)->bot, who))
-      putlog(LOG_BOTS, "*", "!!! Duplicate botnet bot entry!!");
-    ptr = &((*ptr)->next);
-  }
-  ptr2 = malloc(sizeof(tand_t));
-  strncpy(ptr2->bot, who, HANDLEN);
-  ptr2->bot[HANDLEN] = 0;
-  ptr2->share = flag;
-  ptr2->ver = vernum;
-  ptr2->next = *ptr;
-  *ptr = ptr2;
-  /* May be via itself */
-  ptr2->via = findbot(from);
-  if (!strcasecmp(next, botnetnick))
-    ptr2->uplink = (tand_t *) 1;
-  else
-    ptr2->uplink = findbot(next);
-  tands++;
-}
-
-void updatebot(int idx, char *who, char share, int vernum)
-{
-  tand_t *ptr = findbot(who);
-
-  if (ptr) {
-    if (share)
-      ptr->share = share;
-    if (vernum)
-      ptr->ver = vernum;
-    botnet_send_update(idx, ptr);
-  }
-}
-
-/* For backward 1.0 compatibility:
- * grab the (first) sock# for a user on another bot
- */
-int partysock(char *bot, char *nick)
-{
-  int i;
-
-  for (i = 0; i < parties; i++) {
-    if ((!strcasecmp(party[i].bot, bot)) &&
-	(!strcasecmp(party[i].nick, nick)))
-      return party[i].sock;
-  }
-  return 0;
-}
-
-/* New botnet member
- */
-int addparty(char *bot, char *nick, int chan, char flag, int sock,
-	     char *from, int *idx)
-{
-  int i;
-
-  for (i = 0; i < parties; i++) {
-    /* Just changing the channel of someone already on? */
-    if (!strcasecmp(party[i].bot, bot) &&
-	(party[i].sock == sock)) {
-      int oldchan = party[i].chan;
-
-      party[i].chan = chan;
-      party[i].timer = now;
-      if (from[0]) {
-	if (flag == ' ')
-	  flag = '-';
-	party[i].flag = flag;
-	if (party[i].from)
-	  free(party[i].from);
-	party[i].from = strdup(from);
-      }
-      *idx = i;
-      return oldchan;
-    }
-  }
-  /* New member */
-  if (parties == maxparty) {
-    maxparty += 50;
-    party = (party_t *) realloc((void *) party, maxparty * sizeof(party_t));
-  }
-  strncpy(party[parties].nick, nick, HANDLEN);
-  party[parties].nick[HANDLEN] = 0;
-  strncpy(party[parties].bot, bot, HANDLEN);
-  party[parties].bot[HANDLEN] = 0;
-  party[parties].chan = chan;
-  party[parties].sock = sock;
-  party[parties].status = 0;
-  party[parties].away = 0;
-  party[parties].timer = now;	/* cope. */
-  if (from[0]) {
-    if (flag == ' ')
-      flag = '-';
-    party[parties].flag = flag;
-    party[parties].from = strdup(from);
-  } else {
-    party[parties].flag = ' ';
-    party[parties].from = strdup("(unknown)");
-  }
-  *idx = parties;
-  parties++;
-  return -1;
-}
-
-/* Alter status flags for remote party-line user.
- */
-void partystat(char *bot, int sock, int add, int rem)
-{
-  int i;
-
-  for (i = 0; i < parties; i++) {
-    if ((!strcasecmp(party[i].bot, bot)) &&
-	(party[i].sock == sock)) {
-      party[i].status |= add;
-      party[i].status &= ~rem;
-    }
-  }
-}
-
-/* Other bot is sharing idle info.
- */
-void partysetidle(char *bot, int sock, int secs)
-{
-  int i;
-
-  for (i = 0; i < parties; i++) {
-    if ((!strcasecmp(party[i].bot, bot)) &&
-	(party[i].sock == sock)) {
-      party[i].timer = (now - (time_t) secs);
-    }
-  }
-}
-
-/* Return someone's chat channel.
- */
-int getparty(char *bot, int sock)
-{
-  int i;
-
-  for (i = 0; i < parties; i++) {
-    if (!strcasecmp(party[i].bot, bot) &&
-	(party[i].sock == sock)) {
-      return i;
-    }
-  }
-  return -1;
-}
-
-/* Un-idle someone
- */
-int partyidle(char *bot, char *nick)
-{
-  int i, ok = 0;
-
-  for (i = 0; i < parties; i++) {
-    if ((!strcasecmp(party[i].bot, bot)) &&
-	(!strcasecmp(party[i].nick, nick))) {
-      party[i].timer = now;
-      ok = 1;
-    }
-  }
-  return ok;
-}
-
-/* Change someone's nick
- */
-int partynick(char *bot, int sock, char *nick)
-{
-  char work[HANDLEN + 1];
-  int i;
-
-  for (i = 0; i < parties; i++) {
-    if (!strcasecmp(party[i].bot, bot) && (party[i].sock == sock)) {
-      strcpy(work, party[i].nick);
-      strncpy(party[i].nick, nick, HANDLEN);
-      party[i].nick[HANDLEN] = 0;
-      strcpy(nick, work);
-      return i;
-    }
-  }
-  return -1;
-}
-
-/* Set away message
- */
-void partyaway(char *bot, int sock, char *msg)
-{
-  int i;
-
-  for (i = 0; i < parties; i++) {
-    if ((!strcasecmp(party[i].bot, bot)) &&
-	(party[i].sock == sock)) {
-      if (party[i].away)
-	free(party[i].away);
-      if (msg[0])
-	party[i].away = strdup(msg);
-      else
-	party[i].away = 0;
-    }
-  }
-}
-
-/* Remove a tandem bot from the chain list
- */
-void rembot(char *who)
-{
-  tand_t **ptr = &tandbot, *ptr2;
-  struct userrec *u;
-
-  while (*ptr) {
-    if (!strcasecmp((*ptr)->bot, who))
-      break;
-    ptr = &((*ptr)->next);
-  }
-  if (!*ptr)
-    /* May have just .unlink *'d */
-    return;
-  check_bind_disc(who);
-
-  u = get_user_by_handle(userlist, who);
-  if (u != NULL)
-    touch_laston(u, "unlinked", now);
-
-  ptr2 = *ptr;
-  *ptr = ptr2->next;
-  free(ptr2);
-  tands--;
-
-  dupwait_notify(who);
-}
-
-void remparty(char *bot, int sock)
-{
-  int i;
-
-  for (i = 0; i < parties; i++)
-    if ((!strcasecmp(party[i].bot, bot)) &&
-	(party[i].sock == sock)) {
-      parties--;
-      if (party[i].from)
-	free(party[i].from);
-      if (party[i].away)
-	free(party[i].away);
-      if (i < parties) {
-	strcpy(party[i].bot, party[parties].bot);
-	strcpy(party[i].nick, party[parties].nick);
-	party[i].chan = party[parties].chan;
-	party[i].sock = party[parties].sock;
-	party[i].flag = party[parties].flag;
-	party[i].status = party[parties].status;
-	party[i].timer = party[parties].timer;
-	party[i].from = party[parties].from;
-	party[i].away = party[parties].away;
-      }
-    }
-}
-
-/* Cancel every user that was on a certain bot
- */
-void rempartybot(char *bot)
-{
-  int i;
-
-  for (i = 0; i < parties; i++)
-    if (!strcasecmp(party[i].bot, bot)) {
-      if (party[i].chan >= 0) {
-        check_bind_chpt(bot, party[i].nick, party[i].sock, party[i].chan);
-      }
-      remparty(bot, party[i].sock);
-      i--;
-    }
-}
-
-/* Remove every bot linked 'via' bot <x>
- */
-void unvia(int idx, tand_t * who)
-{
-  tand_t *bot, *bot2;
-
-  if (!who)
-    return;			/* Safety */
-  rempartybot(who->bot);
-  bot = tandbot;
-  while (bot) {
-    if (bot->uplink == who) {
-      unvia(idx, bot);
-      bot2 = bot->next;
-      rembot(bot->bot);
-      bot = bot2;
-    } else
-      bot = bot->next;
-  }
-#ifndef NO_OLD_BOTNET
-  /* Every bot unvia's bots behind anyway, so why send msg's for
-   * EVERY one? - will this break things?!
-   */
-  tandout_but(idx, "unlinked %s\n", who->bot);
-#endif
-}
-
-/* Return index into dcc list of the bot that connects us to bot <x>
- */
-int nextbot(char *who)
-{
-  int j;
-  tand_t *bot = findbot(who);
-
-  if (!bot)
-    return -1;
-
-  for (j = 0; j < dcc_total; j++)
-    if (bot->via && !strcasecmp(bot->via->bot, dcc[j].nick) &&
-	(dcc[j].type == &DCC_BOT))
-      return j;
-  return -1;			/* We're not connected to 'via' */
-}
-
-/* Return name of the bot that is directly connected to bot X
- */
-char *lastbot(char *who)
-{
-  tand_t *bot = findbot(who);
-
-  if (!bot)
-    return "*";
-  else if (bot->uplink == (tand_t *) 1)
-    return botnetnick;
-  else
-    return bot->uplink->bot;
-}
-
-/* Modern version of 'whom' (use local data)
- */
-void answer_local_whom(int idx, int chan)
-{
-  char c, idle[40], spaces2[33] = "                               ";
-  int i, len, len2, t, nicklen, botnicklen, total = 0;
-
-  if (chan == (-1))
-    dprintf(idx, "%s (+: %s, *: %s)\n", _("Users across the botnet"), _("Party line"),
-	    _("Local channel"));
-  else if (chan > 0) {
-    dprintf(idx, "%s %s%d:\n", _("Users on channel"),
-	      (chan < 100000) ? "" : "*", chan % 100000);
-  }
-  /* Find longest nick and botnick */
-  nicklen = botnicklen = 0;
-  for (i = 0; i < dcc_total; i++)
-    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;
-      }
-    }
-  for (i = 0; i < parties; i++) {
-    if ((chan == (-1)) || ((chan >= 0) && (party[i].chan == chan))) {
-      t = strlen(party[i].nick); if(t > nicklen) nicklen = t;
-      t = strlen(party[i].bot); if(t > botnicklen) botnicklen = t;
-    }
-  }
-  if(nicklen < 9) nicklen = 9;
-  if(botnicklen < 9) botnicklen = 9;
-
-  spaces[nicklen - 9] = 0;
-  spaces2[botnicklen - 9] = 0;
-  dprintf(idx, " Nick     %s   Bot      %s  Host\n", spaces, spaces2);
-  dprintf(idx, "----------%s   ---------%s  --------------------\n",
-	  spaces, spaces2);
-  spaces[nicklen - 9] = ' ';
-  spaces2[botnicklen - 9] = ' ';
-  for (i = 0; i < dcc_total; i++)
-    if (dcc[i].type == &DCC_CHAT) {
-      if ((chan == (-1)) || ((chan >= 0) && (dcc[i].u.chat->channel == chan))) {
-	c = geticon(dcc[i].user);
-	if (c == '-')
-	  c = ' ';
-	if (now - dcc[i].timeval > 300) {
-	  unsigned long days, hrs, mins;
-
-	  days = (now - dcc[i].timeval) / 86400;
-	  hrs = ((now - dcc[i].timeval) - (days * 86400)) / 3600;
-	  mins = ((now - dcc[i].timeval) - (hrs * 3600)) / 60;
-	  if (days > 0)
-	    sprintf(idle, " [idle %lud%luh]", days, hrs);
-	  else if (hrs > 0)
-	    sprintf(idle, " [idle %luh%lum]", hrs, mins);
-	  else
-	    sprintf(idle, " [idle %lum]", mins);
-	} else
-	  idle[0] = 0;
-	spaces[len = nicklen - strlen(dcc[i].nick)] = 0;
-	spaces2[len2 = botnicklen - strlen(botnetnick)] = 0;
-	total++;
-	dprintf(idx, "%c%s%s %c %s%s  %s%s\n", c, dcc[i].nick, spaces,
-		(dcc[i].u.chat->channel == 0) && (chan == (-1)) ? '+' :
-		(dcc[i].u.chat->channel > 100000) &&
-		(chan == (-1)) ? '*' : ' ',
-		botnetnick, spaces2, dcc[i].host, idle);
-	spaces[len] = ' ';
-	spaces2[len2] = ' ';
-	if (dcc[i].u.chat->away != NULL)
-	  dprintf(idx, "   AWAY: %s\n", dcc[i].u.chat->away);
-      }
-    }
-  for (i = 0; i < parties; i++) {
-    if ((chan == (-1)) || ((chan >= 0) && (party[i].chan == chan))) {
-      c = party[i].flag;
-      if (c == '-')
-	c = ' ';
-      if (party[i].timer == 0L)
-	strcpy(idle, " [idle?]");
-      else if (now - party[i].timer > 300) {
-	unsigned long days, hrs, mins;
-
-	days = (now - party[i].timer) / 86400;
-	hrs = ((now - party[i].timer) - (days * 86400)) / 3600;
-	mins = ((now - party[i].timer) - (hrs * 3600)) / 60;
-	if (days > 0)
-	  sprintf(idle, " [idle %lud%luh]", days, hrs);
-	else if (hrs > 0)
-	  sprintf(idle, " [idle %luh%lum]", hrs, mins);
-	else
-	  sprintf(idle, " [idle %lum]", mins);
-      } else
-	idle[0] = 0;
-      spaces[len = nicklen - strlen(party[i].nick)] = 0;
-      spaces2[len2 = botnicklen - strlen(party[i].bot)] = 0;
-      total++;
-      dprintf(idx, "%c%s%s %c %s%s  %s%s\n", c, party[i].nick, spaces,
-	      (party[i].chan == 0) && (chan == (-1)) ? '+' : ' ',
-	      party[i].bot, spaces2, party[i].from, idle);
-      spaces[len] = ' ';
-      spaces2[len2] = ' ';
-      if (party[i].status & PLSTAT_AWAY)
-	dprintf(idx, "   %s: %s\n", _("AWAY"),
-		party[i].away ? party[i].away : "");
-    }
-  }
-  dprintf(idx, "Total users: %d\n", total);
-}
-
-/* Show z a list of all bots connected
- */
-void tell_bots(int idx)
-{
-  char s[512];
-  int i;
-  tand_t *bot;
-
-  if (!tands) {
-    dprintf(idx, "%s\n", _("No bots linked."));
-    return;
-  }
-  strcpy(s, botnetnick);
-  i = strlen(botnetnick);
-
-  for (bot = tandbot; bot; bot = bot->next) {
-    if (i > (500 - HANDLEN)) {
-      dprintf(idx, "Bots: %s\n", s);
-      s[0] = 0;
-      i = 0;
-    }
-    if (i) {
-      s[i++] = ',';
-      s[i++] = ' ';
-    }
-    strcpy(s + i, bot->bot);
-    i += strlen(bot->bot);
-  }
-  if (s[0])
-    dprintf(idx, "Bots: %s\n", s);
-  dprintf(idx, "(%s: %d)\n", _("total"), tands + 1);
-}
-
-/* Show a simpleton bot tree
- */
-void tell_bottree(int idx, int showver)
-{
-  char s[161];
-  tand_t *last[20], *this, *bot, *bot2 = NULL;
-  int lev = 0, more = 1, mark[20], ok, cnt, i, imark;
-  char work[1024];
-  int tothops = 0;
-
-  if (tands == 0) {
-    dprintf(idx, "%s\n", _("No bots linked."));
-    return;
-  }
-  s[0] = 0;
-  i = 0;
-
-  for (bot = tandbot; bot; bot = bot->next)
-    if (!bot->uplink) {
-      if (i) {
-	s[i++] = ',';
-	s[i++] = ' ';
-      }
-      strcpy(s + i, bot->bot);
-      i += strlen(bot->bot);
-    }
-  if (s[0])
-    dprintf(idx, "(%s %s)\n", _("No trace info for:"), s);
-  if (showver)
-    dprintf(idx, "%s (%d.%d.%d.%d)\n", botnetnick,
-	    egg_numver / 1000000,
-	    egg_numver % 1000000 / 10000,
-	    egg_numver % 10000 / 100,
-	    egg_numver % 100);
-  else
-    dprintf(idx, "%s\n", botnetnick);
-  this = (tand_t *) 1;
-  work[0] = 0;
-  while (more) {
-    if (lev == 20) {
-      dprintf(idx, "\n%s\n", _("Tree too complex!"));
-      return;
-    }
-    cnt = 0;
-    tothops += lev;
-    for (bot = tandbot; bot; bot = bot->next)
-      if (bot->uplink == this)
-	cnt++;
-    if (cnt) {
-      imark = 0;
-      for (i = 0; i < lev; i++) {
-	if (mark[i])
-	  strcpy(work + imark, "  |  ");
-	else
-	  strcpy(work + imark, "     ");
-	imark += 5;
-      }
-      if (cnt > 1)
-	strcpy(work + imark, "  |-");
-      else
-	strcpy(work + imark, "  `-");
-      s[0] = 0;
-      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);
-	  }
-	} else
-	  bot = bot->next;
-      }
-      dprintf(idx, "%s%s\n", work, s);
-      if (cnt > 1)
-	mark[lev] = 1;
-      else
-	mark[lev] = 0;
-      work[0] = 0;
-      last[lev] = this;
-      this = bot;
-      lev++;
-      more = 1;
-    } else {
-      while (cnt == 0) {
-	/* No subtrees from here */
-	if (lev == 0) {
-	  dprintf(idx, "(( tree error ))\n");
-	  return;
-	}
-	ok = 0;
-	for (bot = tandbot; bot; bot = bot->next) {
-	  if (bot->uplink == last[lev - 1]) {
-	    if (this == bot)
-	      ok = 1;
-	    else if (ok) {
-	      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 (cnt) {
-	  imark = 0;
-	  for (i = 1; i < lev; i++) {
-	    if (mark[i - 1])
-	      strcpy(work + imark, "  |  ");
-	    else
-	      strcpy(work + imark, "     ");
-	    imark += 5;
-	  }
-	  more = 1;
-	  if (cnt > 1)
-	    dprintf(idx, "%s  |-%s\n", work, s);
-	  else
-	    dprintf(idx, "%s  `-%s\n", work, s);
-	  this = bot2;
-	  work[0] = 0;
-	  if (cnt > 1)
-	    mark[lev - 1] = 1;
-	  else
-	    mark[lev - 1] = 0;
-	} else {
-	  /* This was the last child */
-	  lev--;
-	  if (lev == 0) {
-	    more = 0;
-	    cnt = 999;
-	  } else {
-	    more = 1;
-	    this = last[lev];
-	  }
-	}
-      }
-    }
-  }
-  /* Hop information: (9d) */
-  dprintf(idx, "Average hops: %3.1f, total bots: %d\n",
-	  ((float) tothops) / ((float) tands), tands + 1);
-}
-
-/* Dump list of links to a new bot
- */
-void dump_links(int z)
-{
-  register int i, l;
-  char x[1024];
-  tand_t *bot;
-
-  for (bot = tandbot; bot; bot = bot->next) {
-    char *p;
-
-    if (bot->uplink == (tand_t *) 1)
-      p = botnetnick;
-    else
-      p = bot->uplink->bot;
-#ifndef NO_OLD_BOTNET
-    if (b_numver(z) < NEAT_BOTNET)
-      l = simple_sprintf(x, "nlinked %s %s %c%d\n", bot->bot,
-			 p, bot->share, bot->ver);
-    else
-#endif
-      l = simple_sprintf(x, "n %s %s %c%D\n", bot->bot, p,
-			 bot->share, bot->ver);
-    tputs(dcc[z].sock, x, l);
-  }
-  if (!(bot_flags(dcc[z].user) & BOT_ISOLATE)) {
-    /* Dump party line members */
-    for (i = 0; i < dcc_total; i++) {
-      if (dcc[i].type == &DCC_CHAT) {
-	if ((dcc[i].u.chat->channel >= 0) &&
-	    (dcc[i].u.chat->channel < 100000)) {
-#ifndef NO_OLD_BOTNET
-	  if (b_numver(z) < NEAT_BOTNET)
-	    l = simple_sprintf(x, "join %s %s %d %c%d %s\n",
-			       botnetnick, dcc[i].nick,
-			       dcc[i].u.chat->channel, geticon(dcc[i].user),
-			       dcc[i].sock, dcc[i].host);
-	  else
-#endif
-	    l = simple_sprintf(x, "j !%s %s %D %c%D %s\n",
-			       botnetnick, dcc[i].nick,
-			       dcc[i].u.chat->channel, geticon(dcc[i].user),
-			       dcc[i].sock, dcc[i].host);
-	  tputs(dcc[z].sock, x, l);
-#ifndef NO_OLD_BOTNET
-	  if (b_numver(z) < NEAT_BOTNET) {
-	    if (dcc[i].u.chat->away) {
-	      l = simple_sprintf(x, "away %s %d %s\n", botnetnick,
-				 dcc[i].sock, dcc[i].u.chat->away);
-	      tputs(dcc[z].sock, x, l);
-	    }
-	    l = simple_sprintf(x, "idle %s %d %d\n", botnetnick,
-			       dcc[i].sock, now - dcc[i].timeval);
-	  } else
-#endif
-	    l = simple_sprintf(x, "i %s %D %D %s\n", botnetnick,
-			       dcc[i].sock, now - dcc[i].timeval,
-			 dcc[i].u.chat->away ? dcc[i].u.chat->away : "");
-	  tputs(dcc[z].sock, x, l);
-	}
-      }
-    }
-    for (i = 0; i < parties; i++) {
-#ifndef NO_OLD_BOTNET
-      if (b_numver(z) < NEAT_BOTNET)
-	l = simple_sprintf(x, "join %s %s %d %c%d %s\n",
-			   party[i].bot, party[i].nick,
-			   party[i].chan, party[i].flag,
-			   party[i].sock, party[i].from);
-      else
-#endif
-	l = simple_sprintf(x, "j %s %s %D %c%D %s\n",
-			   party[i].bot, party[i].nick,
-			   party[i].chan, party[i].flag,
-			   party[i].sock, party[i].from);
-      tputs(dcc[z].sock, x, l);
-      if ((party[i].status & PLSTAT_AWAY) || (party[i].timer != 0)) {
-#ifndef NO_OLD_BOTNET
-	if (b_numver(z) < NEAT_BOTNET) {
-	  if (party[i].status & PLSTAT_AWAY) {
-	    l = simple_sprintf(x, "away %s %d %s\n", party[i].bot,
-			       party[i].sock, party[i].away);
-	    tputs(dcc[z].sock, x, l);
-	  }
-	  l = simple_sprintf(x, "idle %s %d %d\n", party[i].bot,
-			     party[i].sock, now - party[i].timer);
-	} else
-#endif
-	  l = simple_sprintf(x, "i %s %D %D %s\n", party[i].bot,
-			     party[i].sock, now - party[i].timer,
-			     party[i].away ? party[i].away : "");
-	tputs(dcc[z].sock, x, l);
-      }
-    }
-  }
-}
-
-int in_chain(char *who)
-{
-  if (findbot(who))
-    return 1;
-  if (!strcasecmp(who, botnetnick))
-    return 1;
-  return 0;
-}
-
-int bots_in_subtree(tand_t *bot)
-{
-  int nr = 1;
-  tand_t *b;
-
-  if (!bot)
-    return 0;
-  for (b = tandbot; b; b = b->next) {
-    if (b->bot && (b->uplink == bot)) {
-      nr += bots_in_subtree(b);
-    }
-  }
-  return nr;
-}
-
-int users_in_subtree(tand_t *bot)
-{
-  int i, nr;
-  tand_t *b;
-
-  nr = 0;
-  if (!bot)
-    return 0;
-  for (i = 0; i < parties; i++)
-    if (!strcasecmp(party[i].bot, bot->bot))
-      nr++;
-  for (b = tandbot; b; b = b->next)
-    if (b->bot && (b->uplink == bot))
-      nr += users_in_subtree(b);
-  return nr;
-}
-
-/* Break link with a tandembot
- */
-int botunlink(int idx, char *nick, char *reason)
-{
-  register int i;
-  int bots, users;
-  tand_t *bot;
-
-  if (nick[0] == '*')
-    dprintf(idx, "%s\n", _("Unlinking all bots..."));
-  for (i = 0; i < dcc_total; i++) {
-    if ((nick[0] == '*') || !strcasecmp(dcc[i].nick, nick)) {
-      if (dcc[i].type == &DCC_FORK_BOT) {
-	if (idx >= 0)
-	  dprintf(idx, "%s: %s -> %s.\n", _("Killed link attempt to"),
-		  dcc[i].nick, dcc[i].host);
-	putlog(LOG_BOTS, "*", "%s: %s -> %s:%d",
-	       _("Killed link attempt to"), dcc[i].nick,
-	       dcc[i].host, dcc[i].port);
-	killsock(dcc[i].sock);
-	lostdcc(i);
-	if (nick[0] != '*')
-	  return 1;
-      } else if (dcc[i].type == &DCC_BOT_NEW) {
-	if (idx >= 0)
-	  dprintf(idx, "%s %s.\n", _("No longer trying to link:"),
-		  dcc[i].nick);
-	putlog(LOG_BOTS, "*", "%s %s @ %s:%d",
-	       "Stopped trying to link", dcc[i].nick,
-	       dcc[i].host, dcc[i].port);
-	killsock(dcc[i].sock);
-	lostdcc(i);
-	if (nick[0] != '*')
-	  return 1;
-      } else if (dcc[i].type == &DCC_BOT) {
-	char s[1024];
-
-	if (idx >= 0)
-	  dprintf(idx, "%s %s.\n", _("Breaking link with"), dcc[i].nick);
-	else if ((idx == -3) && (b_status(i) & STAT_SHARE) && !share_unlinks)
-	  return -1;
-	bot = findbot(dcc[i].nick);
-	bots = bots_in_subtree(bot);
-	users = users_in_subtree(bot);
-	if (reason && reason[0]) {
-	  /* FIXME PLURAL: handle this correctly with gettext */
-	  simple_sprintf(s, "%s %s (%s) (lost %d bot%s and %d user%s)",
-	  		 _("Unlinked from:"), dcc[i].nick, reason, bots,
-			 (bots != 1) ? "s" : "", users, (users != 1) ?
-			 "s" : "");
-	  dprintf(i, "bye %s\n", reason);
-	} else {
-	  /* FIXME PLURAL: handle this correctly with gettext */
-	  simple_sprintf(s, "%s %s (lost %d bot%s and %d user%s)",
-	  		 _("Unlinked from:"), dcc[i].nick, bots, (bots > 1) ?
-			 "s" : "", users, (users != 1) ? "s" : "");
-	  dprintf(i, "bye No reason\n");
-	}
-	chatout("*** %s\n", s);
-	botnet_send_unlinked(i, dcc[i].nick, s);
-	killsock(dcc[i].sock);
-	lostdcc(i);
-	if (nick[0] != '*')
-	  return 1;
-      }
-    }
-  }
-  if (idx >= 0 && nick[0] != '*')
-    dprintf(idx, "%s\n", _("Not connected to that bot."));
-  if (nick[0] != '*') {
-    bot = findbot(nick);
-    if (bot) {
-      /* The internal bot list is desynched from the dcc list
-         sometimes. While we still search for the bug, provide
-         an easy way to clear out those `ghost'-bots.
-				       Fabian (2000-08-02)  */
-      char *ghost = "BUG!!: Found bot `%s' in internal bot list, but it\n"
-		    "   shouldn't have been there! Removing.\n"
-		    "   This is a known bug we haven't fixed yet. If this\n"
-		    "   bot is the newest eggdrop version available and you\n"
-		    "   know a *reliable* way to reproduce the bug, please\n"
-		    "   contact us - we need your help!\n";
-      if (idx >= 0)
-	dprintf(idx, ghost, nick);
-      else
-	putlog(LOG_MISC, "*", ghost, nick);
-      rembot(bot->bot);
-      return 1;
-    }
-  }
-  if (nick[0] == '*') {
-    dprintf(idx, "%s\n", _("Smooshing bot tables..."));
-    while (tandbot)
-      rembot(tandbot->bot);
-    while (parties) {
-      parties--;
-      /* assert? */
-      if (party[i].chan >= 0) {
-        check_bind_chpt(party[i].bot, party[i].nick, party[i].sock,
-		       party[i].chan);
-      }
-    }
-  }
-  return 0;
-}
-
-static void botlink_resolve_success(int);
-static void botlink_resolve_failure(int);
-
-/* Link to another bot
- */
-int botlink(char *linker, int idx, char *nick)
-{
-  struct bot_addr *bi;
-  struct userrec *u;
-  register int i;
-
-  u = get_user_by_handle(userlist, nick);
-  if (!u || !(u->flags & USER_BOT)) {
-    if (idx >= 0)
-      dprintf(idx, _("%s is not a known bot.\n"), nick);
-  } else if (!strcasecmp(nick, botnetnick)) {
-    if (idx >= 0)
-      dprintf(idx, _("Link to myself?  Oh boy, Freud would have a field day.\n"));
-  } else if (in_chain(nick) && (idx != -3)) {
-    if (idx >= 0)
-      dprintf(idx, _("That bot is already connected up.\n"));
-  } else {
-    for (i = 0; i < dcc_total; i++)
-      if ((dcc[i].user == u) &&
-	  ((dcc[i].type == &DCC_FORK_BOT) ||
-	   (dcc[i].type == &DCC_BOT_NEW))) {
-	if (idx >= 0)
-	  dprintf(idx, _("Already linking to that bot.\n"));
-	return 0;
-      }
-    /* Address to connect to is in 'info' */
-    bi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u);
-    if (!bi || !strlen(bi->address) || !bi->telnet_port || (bi->telnet_port <= 0)) {
-      if (idx >= 0) {
-	dprintf(idx, _("Invalid telnet address:port stored for '%s'.\n"), nick);
-	dprintf(idx, _("Use: .chaddr %s <address>:<port#>[/<relay-port#>]\n"),
-		nick);
-      }
-    } else if (dcc_total == max_dcc) {
-      if (idx >= 0)
-	dprintf(idx, _("Sorry, too many DCC connections.\n"));
-    } else {
-      correct_handle(nick);
-
-      if (idx > -2)
-	putlog(LOG_BOTS, "*", _("Linking to %s at %s:%d ..."), nick,
-	       bi->address, bi->telnet_port);
-
-      i = new_dcc(&DCC_DNSWAIT, sizeof(struct dns_info));
-      dcc[i].timeval = now;
-      dcc[i].port = bi->telnet_port;
-      dcc[i].user = u;
-      strcpy(dcc[i].nick, nick);
-      strcpy(dcc[i].host, bi->address);
-      dcc[i].u.dns->ibuf = idx;
-      dcc[i].u.dns->cptr = strdup(linker);
-      dcc[i].u.dns->host = strdup(dcc[i].host);
-      dcc[i].u.dns->dns_success = botlink_resolve_success;
-      dcc[i].u.dns->dns_failure = botlink_resolve_failure;
-      dcc[i].u.dns->dns_type = RES_IPBYHOST;
-      dcc[i].u.dns->type = &DCC_FORK_BOT;
-      dcc_dnsipbyhost(bi->address);
-      return 1;
-    }
-  }
-  return 0;
-}
-
-static void botlink_resolve_failure(int i)
-{
-  char s[81];
-
-  putlog(LOG_BOTS, "*", _("Failed link to %s."), dcc[i].nick);
-  strcpy(s, dcc[i].nick);
-  free(dcc[i].u.dns->cptr);
-  lostdcc(i);
-  autolink_cycle(s);          /* Check for more auto-connections */
-}
-
-static void botlink_resolve_success(int i)
-{
-  int idx = dcc[i].u.dns->ibuf;
-  char *linker = dcc[i].u.dns->cptr;
-
-  strcpy(dcc[i].addr, dcc[i].u.dns->host);
-  changeover_dcc(i, &DCC_FORK_BOT, sizeof(struct bot_info));
-  dcc[i].timeval = now;
-  strcpy(dcc[i].u.bot->linker, linker);
-  strcpy(dcc[i].u.bot->version, "(primitive bot)");
-  dcc[i].u.bot->numver = idx;
-  dcc[i].u.bot->port = dcc[i].port;		/* Remember where i started */
-  dcc[i].sock = getsock(SOCK_STRONGCONN);
-  free(linker);
-  if (dcc[i].sock < 0 ||
-      open_telnet_raw(dcc[i].sock, dcc[i].addr,
-		      dcc[i].port) < 0)
-    failed_link(i);
-}
-
-static void failed_tandem_relay(int idx)
-{
-  int uidx = (-1), i;
-
-  for (i = 0; i < dcc_total; i++)
-    if ((dcc[i].type == &DCC_PRE_RELAY) &&
-	(dcc[i].u.relay->sock == dcc[idx].sock))
-      uidx = i;
-  if (uidx < 0) {
-    putlog(LOG_MISC, "*", "%s  %d -> %d", _("Cant find user for relay!"),
-	   dcc[idx].sock, dcc[idx].u.relay->sock);
-    killsock(dcc[idx].sock);
-    lostdcc(idx);
-    return;
-  }
-  if (dcc[idx].port >= dcc[idx].u.relay->port + 3) {
-    struct chat_info *ci = dcc[uidx].u.relay->chat;
-
-    dprintf(uidx, "%s %s.\n", _("Could not link to"), dcc[idx].nick);
-    dcc[uidx].status = dcc[uidx].u.relay->old_status;
-    free(dcc[uidx].u.relay);
-    dcc[uidx].u.chat = ci;
-    dcc[uidx].type = &DCC_CHAT;
-    killsock(dcc[idx].sock);
-    lostdcc(idx);
-    return;
-  }
-  killsock(dcc[idx].sock);
-  dcc[idx].sock = getsock(SOCK_STRONGCONN);
-  dcc[uidx].u.relay->sock = dcc[idx].sock;
-  dcc[idx].port++;
-  dcc[idx].timeval = now;
-  if (dcc[idx].sock < 0 ||
-      open_telnet_raw(dcc[idx].sock, dcc[idx].addr[0] ?
-				     dcc[idx].addr :
-				     dcc[idx].host, dcc[idx].port) < 0)
-    failed_tandem_relay(idx);
-}
-
-
-static void tandem_relay_resolve_failure(int);
-static void tandem_relay_resolve_success(int);
-
-/* Relay to another tandembot
- */
-void tandem_relay(int idx, char *nick, register int i)
-{
-  struct userrec *u;
-  struct bot_addr *bi;
-  struct chat_info *ci;
-
-  u = get_user_by_handle(userlist, nick);
-  if (!u || !(u->flags & USER_BOT)) {
-    dprintf(idx, "%s %s\n", nick, _("is not a known bot."));
-    return;
-  }
-  if (!strcasecmp(nick, botnetnick)) {
-    dprintf(idx, "%s\n", _("Relay to myself?  What on EARTH would be the point?!"));
-    return;
-  }
-  /* Address to connect to is in 'info' */
-  bi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u);
-  if (!bi || !strlen(bi->address) || !bi->relay_port || (bi->relay_port <= 0)) {
-    dprintf(idx, _("Invalid telnet address:port stored for '%s'.\n"), nick);
-    dprintf(idx, _("Use: .chaddr %s <address>:<port#>[/<relay-port#>]\n"),
-	    nick);
-
-    return;
-  }
-  i = new_dcc(&DCC_DNSWAIT, sizeof(struct dns_info));
-  if (i < 0) {
-    dprintf(idx, _("Sorry, too many DCC connections.\n"));
-    return;
-  }
-
-  dcc[i].sock = getsock(SOCK_STRONGCONN | SOCK_VIRTUAL);
-  if (dcc[i].sock < 0) {
-    lostdcc(i);
-    dprintf(idx, _("No free sockets available.\n"));
-    return;
-  }
-
-  dcc[i].port = bi->relay_port;
-  dcc[i].addr[0] = '\0';
-  strcpy(dcc[i].nick, nick);
-  dcc[i].user = u;
-  strcpy(dcc[i].host, bi->address);
-  dprintf(idx, "Connecting to %s @ %s:%d ...\n", nick,
-	  bi->address, bi->relay_port);
-  dprintf(idx, _("(Type *BYE* on a line by itself to abort.)\n"));
-  dcc[idx].type = &DCC_PRE_RELAY;
-  ci = dcc[idx].u.chat;
-  dcc[idx].u.relay = calloc(1, sizeof(struct relay_info));
-  dcc[idx].u.relay->chat = ci;
-  dcc[idx].u.relay->old_status = dcc[idx].status;
-  dcc[idx].u.relay->sock = dcc[i].sock;
-  dcc[i].timeval = now;
-  dcc[i].u.dns->ibuf = dcc[idx].sock;
-  dcc[i].u.dns->host = strdup(bi->address);
-  dcc[i].u.dns->dns_success = tandem_relay_resolve_success;
-  dcc[i].u.dns->dns_failure = tandem_relay_resolve_failure;
-  dcc[i].u.dns->dns_type = RES_IPBYHOST;
-  dcc[i].u.dns->type = &DCC_FORK_RELAY;
-  dcc_dnsipbyhost(bi->address);
-}
-
-static void tandem_relay_resolve_failure(int idx)
-{
-  struct chat_info *ci;
-  register int uidx = (-1), i;
-
-  for (i = 0; i < dcc_total; i++)
-    if ((dcc[i].type == &DCC_PRE_RELAY) &&
-	(dcc[i].u.relay->sock == dcc[idx].sock)) {
-      uidx = i;
-      break;
-    }
-  if (uidx < 0) {
-    putlog(LOG_MISC, "*", _("Cant find user for relay!  %d -> %d"),
-	   dcc[idx].sock, dcc[idx].u.relay->sock);
-    killsock(dcc[idx].sock);
-    lostdcc(idx);
-    return;
-  }
-  ci = dcc[uidx].u.relay->chat;
-  dprintf(uidx, _("Could not link to %s.\n"), dcc[idx].nick);
-  dcc[uidx].status = dcc[uidx].u.relay->old_status;
-  free(dcc[uidx].u.relay);
-  dcc[uidx].u.chat = ci;
-  dcc[uidx].type = &DCC_CHAT;
-  killsock(dcc[idx].sock);
-  lostdcc(idx);
-}
-
-static void tandem_relay_resolve_success(int i)
-{
-  int sock = dcc[i].u.dns->ibuf;
-
-  strcpy(dcc[i].addr, dcc[i].u.dns->host);
-  changeover_dcc(i, &DCC_FORK_RELAY, sizeof(struct relay_info));
-  dcc[i].u.relay->chat = calloc(1, sizeof(struct chat_info));
-
-  dcc[i].u.relay->sock = sock;
-  dcc[i].u.relay->port = dcc[i].port;
-  dcc[i].u.relay->chat->away = NULL;
-  dcc[i].u.relay->chat->msgs_per_sec = 0;
-  dcc[i].u.relay->chat->con_flags = 0;
-  dcc[i].u.relay->chat->buffer = NULL;
-  dcc[i].u.relay->chat->max_line = 0;
-  dcc[i].u.relay->chat->line_count = 0;
-  dcc[i].u.relay->chat->current_lines = 0;
-  dcc[i].timeval = now;
-  if (open_telnet_raw(dcc[i].sock, dcc[i].addr,
-		      dcc[i].port) < 0)
-    failed_tandem_relay(i);
-}
-
-/* Input from user before connect is ready
- */
-static void pre_relay(int idx, char *buf, register int i)
-{
-  register int tidx = (-1);
-
-  for (i = 0; i < dcc_total; i++)
-    if ((dcc[i].type == &DCC_FORK_RELAY) &&
-	(dcc[i].u.relay->sock == dcc[idx].sock)) {
-      tidx = i;
-      break;
-    }
-  if (tidx < 0) {
-    /* Now try to find it among the DNSWAIT sockets instead. */
-    for (i = 0; i < dcc_total; i++)
-      if ((dcc[i].type == &DCC_DNSWAIT) &&
-	  (dcc[i].sock == dcc[idx].u.relay->sock)) {
-	tidx = i;
-	break;
-      }
-  }
-  if (tidx < 0) {
-    putlog(LOG_MISC, "*", _("Cant find user for relay!  %d -> %d"),
-	   dcc[idx].sock, dcc[idx].u.relay->sock);
-    killsock(dcc[idx].sock);
-    lostdcc(idx);
-    return;
-  }
-  if (!strcasecmp(buf, "*bye*")) {
-    /* Disconnect */
-    struct chat_info *ci = dcc[idx].u.relay->chat;
-
-    dprintf(idx, _("Aborting relay attempt to %s.\n"), dcc[tidx].nick);
-    dprintf(idx, _("You are now back on %s.\n\n"), botnetnick);
-    putlog(LOG_MISC, "*", _("Relay aborted: %s -> %s"), dcc[idx].nick,
-	   dcc[tidx].nick);
-    dcc[idx].status = dcc[idx].u.relay->old_status;
-    free(dcc[idx].u.relay);
-    dcc[idx].u.chat = ci;
-    dcc[idx].type = &DCC_CHAT;
-    killsock(dcc[tidx].sock);
-    lostdcc(tidx);
-    return;
-  }
-}
-
-/* User disconnected before her relay had finished connecting
- */
-static void failed_pre_relay(int idx)
-{
-  register int tidx = (-1), i;
-
-  for (i = 0; i < dcc_total; i++)
-    if ((dcc[i].type == &DCC_FORK_RELAY) &&
-	(dcc[i].u.relay->sock == dcc[idx].sock)) {
-      tidx = i;
-      break;
-    }
-  if (tidx < 0) {
-    /* Now try to find it among the DNSWAIT sockets instead. */
-    for (i = 0; i < dcc_total; i++)
-      if ((dcc[i].type == &DCC_DNSWAIT) &&
-	  (dcc[i].sock == dcc[idx].u.relay->sock)) {
-	tidx = i;
-	break;
-      }
-  }
-  if (tidx < 0) {
-    putlog(LOG_MISC, "*", _("Cant find user for relay!  %d -> %d"),
-	   dcc[idx].sock, dcc[idx].u.relay->sock);
-    killsock(dcc[idx].sock);
-    lostdcc(idx);
-    return;
-  }
-  putlog(LOG_MISC, "*", _("Lost dcc connection to [%s]%s/%d"), dcc[idx].nick,
-	 dcc[idx].host, dcc[idx].port);
-  putlog(LOG_MISC, "*", _("(Dropping relay attempt to %s)"), dcc[tidx].nick);
-  if ((dcc[tidx].sock != STDOUT) || backgrd) {
-    if (idx > tidx) {
-      int t = tidx;
-
-      tidx = idx;
-      idx = t;
-    }
-    killsock(dcc[tidx].sock);
-    lostdcc(tidx);
-  } else {
-    fatal("Lost my terminal?!", 0);
-  }
-  killsock(dcc[idx].sock);
-  lostdcc(idx);
-}
-
-static void cont_tandem_relay(int idx, char *buf, register int i)
-{
-  register int uidx = (-1);
-  struct relay_info *ri;
-
-  for (i = 0; i < dcc_total; i++)
-    if ((dcc[i].type == &DCC_PRE_RELAY) &&
-	(dcc[i].u.relay->sock == dcc[idx].sock))
-      uidx = i;
-  if (uidx < 0) {
-    putlog(LOG_MISC, "*", "%s  %d -> %d", _("Cant find user for relay!"),
-	   dcc[i].sock, dcc[i].u.relay->sock);
-    killsock(dcc[i].sock);
-    lostdcc(i);
-    return;
-  }
-  dcc[idx].type = &DCC_RELAY;
-  dcc[idx].u.relay->sock = dcc[uidx].sock;
-  dcc[uidx].u.relay->sock = dcc[idx].sock;
-  dprintf(uidx, "%s %s ...\n", _("Success!\n\nNOW CONNECTED TO RELAY BOT"), dcc[idx].nick);
-  dprintf(uidx, "%s\n\n", _("(You can type *BYE* to prematurely close the connection.)"));
-  putlog(LOG_MISC, "*", "%s %s -> %s", _("Relay link:"),
-	 dcc[uidx].nick, dcc[idx].nick);
-  ri = dcc[uidx].u.relay;	/* YEAH */
-  dcc[uidx].type = &DCC_CHAT;
-  dcc[uidx].u.chat = ri->chat;
-  if (dcc[uidx].u.chat->channel >= 0) {
-    chanout_but(-1, dcc[uidx].u.chat->channel, "*** %s %s\n",
-		dcc[uidx].nick, _("left the party line."));
-    if (dcc[uidx].u.chat->channel < 100000)
-      botnet_send_part_idx(uidx, NULL);
-    check_bind_chpt(botnetnick, dcc[uidx].nick, dcc[uidx].sock,
-		   dcc[uidx].u.chat->channel);
-  }
-  check_bind_chof(dcc[uidx].nick, uidx);
-  dcc[uidx].type = &DCC_RELAYING;
-  dcc[uidx].u.relay = ri;
-}
-
-static void eof_dcc_relay(int idx)
-{
-  register int j;
-  struct chat_info *ci;
-
-  for (j = 0; j < dcc_total; j++)
-    if (dcc[j].sock == dcc[idx].u.relay->sock)
-      break;
-  if (j == dcc_total) {
-    killsock(dcc[idx].sock);
-    lostdcc(idx);
-    return;
-  }
-  dcc[j].status = dcc[j].u.relay->old_status;
-  /* In case echo was off, turn it back on (send IAC WON'T ECHO): */
-  if (dcc[j].status & STAT_TELNET)
-    dprintf(j, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n");
-  putlog(LOG_MISC, "*", "%s: %s -> %s", _("Ended relay link"), dcc[j].nick,
-	 dcc[idx].nick);
-  dprintf(j, "\n\n*** %s %s\n", _("RELAY CONNECTION DROPPED.\nYou are now back on"), botnetnick);
-  ci = dcc[j].u.relay->chat;
-  free(dcc[j].u.relay);
-  dcc[j].u.chat = ci;
-  dcc[j].type = &DCC_CHAT;
-  if (dcc[j].u.chat->channel >= 0) {
-    chanout_but(-1, dcc[j].u.chat->channel, "*** %s %s.\n",
-		dcc[j].nick, _("rejoined the party line."));
-    if (dcc[j].u.chat->channel < 100000)
-      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,
-		 geticon(dcc[j].user), dcc[j].sock, dcc[j].host);
-  killsock(dcc[idx].sock);
-  lostdcc(idx);
-}
-
-static void eof_dcc_relaying(int idx)
-{
-  register int j, x = dcc[idx].u.relay->sock;
-
-  putlog(LOG_MISC, "*", "%s [%s]%s/%d", _("Lost dcc connection to"), dcc[idx].nick,
-	 dcc[idx].host, dcc[idx].port);
-  killsock(dcc[idx].sock);
-  lostdcc(idx);
-  for (j = 0; (dcc[j].sock != x) || (dcc[j].type == &DCC_FORK_RELAY); j++);
-  putlog(LOG_MISC, "*", "(%s %s)", _("Dropping relay link to"), dcc[j].nick);
-  killsock(dcc[j].sock);
-  lostdcc(j);			/* Drop connection to the bot */
-}
-
-static void dcc_relay(int idx, char *buf, int j)
-{
-  unsigned char *p = (unsigned char *) buf;
-  int mark;
-
-  for (j = 0; dcc[j].sock != dcc[idx].u.relay->sock ||
-       dcc[j].type != &DCC_RELAYING; j++);
-  /* If redirecting to a non-telnet user, swallow telnet codes and
-     escape sequences. */
-  if (!(dcc[j].status & STAT_TELNET)) {
-    while (*p != 0) {
-      while (*p != 255 && (*p != '\033' || *(p + 1) != '[') && *p != '\r' && *p)
-	p++;			/* Search for IAC, escape sequences and CR. */
-      if (*p == 255) {
-	mark = 2;
-	if (!*(p + 1))
-	  mark = 1;		/* Bogus */
-	if ((*(p + 1) >= 251) || (*(p + 1) <= 254)) {
-	  mark = 3;
-	  if (!*(p + 2))
-	    mark = 2;		/* Bogus */
-	}
-	strcpy((char *) p, (char *) (p + mark));
-      } else if (*p == '\033') {
-	unsigned char	*e;
-
-	/* Search for the end of the escape sequence. */
-	for (e = p + 2; *e != 'm' && *e; e++)
-	  ;
-	strcpy((char *) p, (char *) (e + 1));
-      } else if (*p == '\r')
-	strcpy((char *) p, (char *) (p + 1));
-    }
-    if (!buf[0])
-      dprintf(-dcc[idx].u.relay->sock, " \n");
-    else
-      dprintf(-dcc[idx].u.relay->sock, "%s\n", buf);
-    return;
-  }
-  /* Telnet user */
-  if (!buf[0])
-    dprintf(-dcc[idx].u.relay->sock, " \r\n");
-  else
-    dprintf(-dcc[idx].u.relay->sock, "%s\r\n", buf);
-}
-
-static void dcc_relaying(int idx, char *buf, int j)
-{
-  struct chat_info *ci;
-
-  if (strcasecmp(buf, "*bye*")) {
-    dprintf(-dcc[idx].u.relay->sock, "%s\n", buf);
-    return;
-  }
-  for (j = 0; (dcc[j].sock != dcc[idx].u.relay->sock) ||
-       (dcc[j].type != &DCC_RELAY); j++);
-  dcc[idx].status = dcc[idx].u.relay->old_status;
-  /* In case echo was off, turn it back on (send IAC WON'T ECHO): */
-  if (dcc[idx].status & STAT_TELNET)
-    dprintf(idx, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n");
-  dprintf(idx, "\n(%s %s.)\n", _("Breaking connection to"), dcc[j].nick);
-  dprintf(idx, "%s %s.\n\n", _("You are now back on"), botnetnick);
-  putlog(LOG_MISC, "*", "%s: %s -> %s", _("Relay broken"),
-	 dcc[idx].nick, dcc[j].nick);
-  if (dcc[idx].u.relay->chat->channel >= 0) {
-    chanout_but(-1, dcc[idx].u.relay->chat->channel,
-		"*** %s joined the party line.\n", dcc[idx].nick);
-    if (dcc[idx].u.relay->chat->channel < 100000)
-      botnet_send_join_idx(idx, -1);
-  }
-  ci = dcc[idx].u.relay->chat;
-  free(dcc[idx].u.relay);
-  dcc[idx].u.chat = ci;
-  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,
-		   geticon(dcc[idx].user), dcc[idx].sock, dcc[idx].host);
-  }
-  killsock(dcc[j].sock);
-  lostdcc(j);
-}
-
-static void display_relay(int i, char *other)
-{
-  sprintf(other, "rela  -> sock %d", dcc[i].u.relay->sock);
-}
-
-static void display_relaying(int i, char *other)
-{
-  sprintf(other, ">rly  -> sock %d", dcc[i].u.relay->sock);
-}
-
-static void display_tandem_relay(int i, char *other)
-{
-  strcpy(other, "other  rela");
-}
-
-static void display_pre_relay(int i, char *other)
-{
-  strcpy(other, "other  >rly");
-}
-
-static void kill_relay(int idx, void *x)
-{
-  register struct relay_info *p = (struct relay_info *) x;
-
-  if (p->chat)
-    DCC_CHAT.kill(idx, p->chat);
-  free(p);
-}
-
-struct dcc_table DCC_RELAY =
-{
-  "RELAY",
-  0,				/* Flags */
-  eof_dcc_relay,
-  dcc_relay,
-  NULL,
-  NULL,
-  display_relay,
-  kill_relay,
-  NULL
-};
-
-static void out_relay(int idx, char *buf, void *x)
-{
-  register struct relay_info *p = (struct relay_info *) x;
-
-  if (p && p->chat)
-    DCC_CHAT.output(idx, buf, p->chat);
-  else
-    tputs(dcc[idx].sock, buf, strlen(buf));
-}
-
-struct dcc_table DCC_RELAYING =
-{
-  "RELAYING",
-  0,				/* Flags */
-  eof_dcc_relaying,
-  dcc_relaying,
-  NULL,
-  NULL,
-  display_relaying,
-  kill_relay,
-  out_relay
-};
-
-struct dcc_table DCC_FORK_RELAY =
-{
-  "FORK_RELAY",
-  0,				/* Flags */
-  failed_tandem_relay,
-  cont_tandem_relay,
-  &connect_timeout,
-  failed_tandem_relay,
-  display_tandem_relay,
-  kill_relay,
-  NULL
-};
-
-struct dcc_table DCC_PRE_RELAY =
-{
-  "PRE_RELAY",
-  0,				/* Flags */
-  failed_pre_relay,
-  pre_relay,
-  NULL,
-  NULL,
-  display_pre_relay,
-  kill_relay,
-  NULL
-};
-
-/* Once a minute, send 'ping' to each bot -- no exceptions
- */
-void check_botnet_pings()
-{
-  int i;
-  int bots, users;
-  tand_t *bot;
-
-  for (i = 0; i < dcc_total; i++)
-    if (dcc[i].type == &DCC_BOT)
-      if (dcc[i].status & STAT_PINGED) {
-	char s[1024];
-
-	putlog(LOG_BOTS, "*", "%s: %s", _("Ping timeout"), dcc[i].nick);
-	bot = findbot(dcc[i].nick);
-	bots = bots_in_subtree(bot);
-	users = users_in_subtree(bot);
-	simple_sprintf(s, "%s: %s (lost %d bot%s and %d user%s)", _("Ping timeout"),
-		       dcc[i].nick, bots, (bots != 1) ? "s" : "",
-		       users, (users != 1) ? "s" : "");
-	chatout("*** %s\n", s);
-	botnet_send_unlinked(i, dcc[i].nick, s);
-	killsock(dcc[i].sock);
-	lostdcc(i);
-      }
-  for (i = 0; i < dcc_total; i++)
-    if (dcc[i].type == &DCC_BOT) {
-      botnet_send_ping(i);
-      dcc[i].status |= STAT_PINGED;
-    }
-  for (i = 0; i < dcc_total; i++)
-    if ((dcc[i].type == &DCC_BOT) && (dcc[i].status & STAT_LEAF)) {
-      tand_t *bot, *via = findbot(dcc[i].nick);
-
-      for (bot = tandbot; bot; bot = bot->next) {
-	if ((via == bot->via) && (bot != via)) {
-	  /* Not leaflike behavior */
-	  if (dcc[i].status & STAT_WARNED) {
-	    char s[1024];
-
-	    putlog(LOG_BOTS, "*", "%s %s (%s).", _("Disconnected from:"),
-		   dcc[i].nick, _("unleaflike behavior"));
-	    dprintf(i, "bye %s\n", _("unleaflike behavior"));
-	    bot = findbot(dcc[i].nick);
-	    bots = bots_in_subtree(bot);
-	    users = users_in_subtree(bot);
-	    simple_sprintf(s, "%s %s (%s) (lost %d bot%s and %d user%s)",
-	    		   _("Disconnected from:"), dcc[i].nick, _("unleaflike behavior"),
-			   bots, (bots != 1) ? "s" : "", users, (users != 1) ?
-			   "s" : "");
-	    chatout("*** %s\n", s);
-	    botnet_send_unlinked(i, dcc[i].nick, s);
-	    killsock(dcc[i].sock);
-	    lostdcc(i);
-	  } else {
-	    botnet_send_reject(i, botnetnick, NULL, bot->bot,
-			       NULL, NULL);
-	    dcc[i].status |= STAT_WARNED;
-	  }
-	} else
-	  dcc[i].status &= ~STAT_WARNED;
-      }
-    }
-}
-
-void zapfbot(int idx)
-{
-  char s[1024];
-  int bots, users;
-  tand_t *bot;
-
-  bot = findbot(dcc[idx].nick);
-  bots = bots_in_subtree(bot);
-  users = users_in_subtree(bot);
-  simple_sprintf(s, "%s: %s (lost %d bot%s and %d user%s)", _("Dropped bot"),
-  		 dcc[idx].nick, bots, (bots != 1) ? "s" : "", users,
-		 (users != 1) ? "s" : "");
-  chatout("*** %s\n", s);
-  botnet_send_unlinked(idx, dcc[idx].nick, s);
-  killsock(dcc[idx].sock);
-  lostdcc(idx);
-}
-
-void restart_chons()
-{
-  int i;
-
-  /* Dump party line members */
-  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,
-		     geticon(dcc[i].user), dcc[i].sock, dcc[i].host);
-    }
-  }
-  for (i = 0; i < parties; i++) {
-    check_bind_chjn(party[i].bot, party[i].nick, party[i].chan,
-		   party[i].flag, party[i].sock, party[i].from);
-  }
-}
Index: eggdrop1.7/src/botnet.h
diff -u eggdrop1.7/src/botnet.h:1.2 eggdrop1.7/src/botnet.h:removed
--- eggdrop1.7/src/botnet.h:1.2	Sun May  5 11:40:37 2002
+++ eggdrop1.7/src/botnet.h	Sat Sep 21 20:25:30 2002
@@ -1,55 +0,0 @@
-/*
- * botnet.h --
- */
-/*
- * Copyright (C) 2000, 2001, 2002 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-/*
- * $Id: botnet.h,v 1.2 2002/05/05 16:40:37 tothwolf Exp $
- */
-
-#ifndef _EGG_BOTNET_H
-#define _EGG_BOTNET_H
-
-void answer_local_whom(int, int);
-char *lastbot(char *);
-int nextbot(char *);
-int in_chain(char *);
-void tell_bots(int);
-void tell_bottree(int, int);
-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 rembot(char *);
-struct tand_t_struct *findbot(char *);
-void unvia(int, struct tand_t_struct *);
-void check_botnet_pings();
-int partysock(char *, char *);
-int addparty(char *, char *, int, char, int, char *, int *);
-void remparty(char *, int);
-void partystat(char *, int, int, int);
-int partynick(char *, int, char *);
-int partyidle(char *, char *);
-void partysetidle(char *, int, int);
-void partyaway(char *, int, char *);
-void zapfbot(int);
-void tandem_relay(int, char *, int);
-int getparty(char *, int);
-
-#endif				/* !_EGG_BOTNET_H */
Index: eggdrop1.7/src/tandem.h
diff -u eggdrop1.7/src/tandem.h:1.10 eggdrop1.7/src/tandem.h:removed
--- eggdrop1.7/src/tandem.h:1.10	Sun May  5 11:40:38 2002
+++ eggdrop1.7/src/tandem.h	Sat Sep 21 20:25:30 2002
@@ -1,108 +0,0 @@
-/*
- * tandem.h --
- */
-/*
- * Copyright (C) 1997 Robey Pointer
- * Copyright (C) 1999, 2000, 2001, 2002 Eggheads Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-/*
- * $Id: tandem.h,v 1.10 2002/05/05 16:40:38 tothwolf Exp $
- */
-
-#ifndef _EGG_TANDEM_H
-#define _EGG_TANDEM_H
-
-/* Keep track of tandem-bots in the chain */
-typedef struct tand_t_struct {
-  char bot[HANDLEN + 1];
-  struct tand_t_struct *via;
-  struct tand_t_struct *uplink;
-  struct tand_t_struct *next;
-  int ver;
-  char share;
-} tand_t;
-
-/* Keep track of party-line members */
-typedef struct {
-  char nick[HANDLEN + 1];
-  char bot[HANDLEN + 1];
-  int sock;
-  int chan;
-  char *from;
-  char flag;
-  char status;
-  time_t timer;			/* Track idle time */
-  char *away;
-} party_t;
-
-/* Status: */
-#define PLSTAT_AWAY   0x001
-#define IS_PARTY      0x002
-
-/* Minimum version that uses tokens & base64 ints
- * for channel msg's
- */
-#define NEAT_BOTNET 1029900
-#define GLOBAL_CHANS 100000
-
-
-#ifndef MAKING_MODS
-
-void send_tand_but(int, char *, int);
-void botnet_send_chan(int, char *, char *, int, char *);
-void botnet_send_chat(int, char *, char *);
-void botnet_send_act(int, char *, char *, int, char *);
-void botnet_send_ping(int);
-void botnet_send_pong(int);
-void botnet_send_priv EGG_VARARGS(int, arg1);
-void botnet_send_who(int, char *, char *, int);
-void botnet_send_infoq(int, char *);
-void botnet_send_unlinked(int, char *, char *);
-void botnet_send_traced(int, char *, char *);
-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_reject(int, char *, char *, char *, char *, char *);
-void botnet_send_zapf(int, char *, char *, char *);
-void botnet_send_zapf_broad(int, char *, char *, char *);
-void botnet_send_motd(int, char *, char *);
-void botnet_send_filereq(int, char *, char *, char *);
-void botnet_send_filereject(int, char *, char *, char *);
-void botnet_send_filesend(int, char *, char *, char *);
-void botnet_send_away(int, char *, int, char *, int);
-void botnet_send_idle(int, char *, int, int, char *);
-void botnet_send_join_idx(int, int);
-void botnet_send_join_party(int, int, int, int);
-void botnet_send_part_idx(int, char *);
-void botnet_send_part_party(int, int, char *, int);
-void botnet_send_bye();
-void botnet_send_nkch_part(int, int, char *);
-void botnet_send_nkch(int, char *);
-int bots_in_subtree(tand_t *);
-int users_in_subtree(tand_t *);
-
-#endif				/* MAKING_MODS */
-
-
-#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)
-#define b_numver(a)	(dcc[a].u.bot->numver)
-
-#endif				/* !_EGG_TANDEM_H */
----------------------- End of diff -----------------------



More information about the Changes mailing list