[cvslog] (2003-01-28 06:37:38 UTC) Module eggdrop1.6: Change committed

cvslog cvs at tsss.org
Tue Jan 28 00:38:00 CST 2003


CVSROOT    : /usr/local/cvsroot
Module     : eggdrop1.6
Commit time: 2003-01-28 06:37:37 UTC
Commited by: Will Buckner <wcc at techmonkeys.org>

Modified files:
     README eggdrop.conf doc/html/mod-server.html doc/man1/eggdrop.1
     doc/settings/mod.server src/bg.c src/bg.h src/botcmd.c
     src/botmsg.c src/botnet.c src/chan.h src/chanprog.c src/cmds.c
     src/cmdt.h src/dcc.c src/dccutil.c src/dns.c src/dns.h
     src/eggdrop.h src/flags.c src/flags.h src/lang.h src/language.c
     src/main.c src/main.h src/match.c src/mem.c src/misc.c
     src/misc_file.c src/misc_file.h src/modules.c src/modules.h
     src/net.c src/patch.h src/proto.h src/rfc1459.c src/stat.h
     src/tandem.h src/tcl.c src/tcldcc.c src/tclegg.h src/tclhash.c
     src/tclhash.h src/tclmisc.c src/tcluser.c src/userent.c
     src/userrec.c src/users.c src/users.h src/compat/compat.h
     src/compat/gnu_strftime.c src/compat/inet_aton.c
     src/compat/inet_aton.h src/compat/memcpy.h src/compat/memset.h
     src/compat/snprintf.c src/compat/snprintf.h
     src/compat/strcasecmp.h src/compat/strftime.c
     src/compat/strftime.h src/md5/md5.h src/md5/md5c.c
     src/mod/module.h src/mod/modvals.h src/mod/assoc.mod/assoc.c
     src/mod/assoc.mod/assoc.h src/mod/blowfish.mod/bf_tab.h
     src/mod/blowfish.mod/blowfish.c src/mod/blowfish.mod/blowfish.h
     src/mod/channels.mod/channels.c src/mod/channels.mod/channels.h
     src/mod/channels.mod/cmdschan.c src/mod/channels.mod/tclchan.c
     src/mod/channels.mod/userchan.c
     src/mod/channels.mod/help/set/channels.help
     src/mod/compress.mod/compress.c src/mod/compress.mod/compress.h
     src/mod/compress.mod/tclcompress.c src/mod/console.mod/console.c
     src/mod/console.mod/console.h src/mod/ctcp.mod/ctcp.c
     src/mod/ctcp.mod/ctcp.h src/mod/dns.mod/coredns.c
     src/mod/dns.mod/dns.c src/mod/dns.mod/dns.h
     src/mod/filesys.mod/dbcompat.c src/mod/filesys.mod/dbcompat.h
     src/mod/filesys.mod/filedb3.c src/mod/filesys.mod/filedb3.h
     src/mod/filesys.mod/filelist.c src/mod/filesys.mod/filelist.h
     src/mod/filesys.mod/files.c src/mod/filesys.mod/files.h
     src/mod/filesys.mod/filesys.c src/mod/filesys.mod/filesys.h
     src/mod/filesys.mod/tclfiles.c src/mod/irc.mod/chan.c
     src/mod/irc.mod/cmdsirc.c src/mod/irc.mod/irc.c
     src/mod/irc.mod/irc.h src/mod/irc.mod/mode.c
     src/mod/irc.mod/msgcmds.c src/mod/irc.mod/tclirc.c
     src/mod/irc.mod/help/set/irc.help src/mod/notes.mod/cmdsnote.c
     src/mod/notes.mod/notes.c src/mod/notes.mod/notes.h
     src/mod/seen.mod/seen.c src/mod/server.mod/cmdsserv.c
     src/mod/server.mod/server.c src/mod/server.mod/server.h
     src/mod/server.mod/servmsg.c src/mod/server.mod/tclserv.c
     src/mod/server.mod/help/set/server.help src/mod/share.mod/share.c
     src/mod/share.mod/share.h src/mod/share.mod/uf_features.c
     src/mod/transfer.mod/tcltransfer.c
     src/mod/transfer.mod/transfer.c src/mod/transfer.mod/transfer.h
     src/mod/transfer.mod/transferfstat.c
     src/mod/transfer.mod/transferqueue.c src/mod/uptime.mod/uptime.c
     src/mod/wire.mod/wire.c src/mod/wire.mod/wire.h
     src/mod/woobie.mod/woobie.c

Log message:

* Ran indent on the tree (with hand editing of course) to fix our horrible
  indenting variations/problems. This is the same format we generally
  follow throughout most of the tree.

---------------------- diff included ----------------------
Index: eggdrop1.6/README
diff -u eggdrop1.6/README:1.31 eggdrop1.6/README:1.32
--- eggdrop1.6/README:1.31	Mon Dec 23 20:30:01 2002
+++ eggdrop1.6/README	Tue Jan 28 00:37:24 2003
@@ -5,9 +5,8 @@
                                    Readme
 
 
-  Please at least SKIM this document before asking questions. In fact, READ
-  IT if you've never successfully set up an Eggdrop bot before. PLEASE! READ
-  IT!
+  Please at least SKIM this document before asking questions. In fact, READ IT
+  if you've never successfully set up an Eggdrop bot before. PLEASE! READ IT!
 
   Contents
 
Index: eggdrop1.6/doc/html/mod-server.html
diff -u eggdrop1.6/doc/html/mod-server.html:1.23 eggdrop1.6/doc/html/mod-server.html:1.24
--- eggdrop1.6/doc/html/mod-server.html:1.23	Wed Jan 22 20:13:29 2003
+++ eggdrop1.6/doc/html/mod-server.html	Tue Jan 28 00:37:24 2003
@@ -1,5 +1,5 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<!-- $Id: mod-server.html,v 1.23 2003/01/23 02:13:29 wcc Exp $ -->
+<!-- $Id: mod-server.html,v 1.24 2003/01/28 06:37:24 wcc Exp $ -->
 
 <html>
   <head>
@@ -44,11 +44,11 @@
         <dd>
           <p>What is your network?</p>
 
-          <p>0 = Efnet (non +e/+I hybrid)<br>
+          <p>0 = Efnet (non +e/+I Hybrid)<br>
            1 = IRCnet<br>
            2 = Undernet<br>
            3 = Dalnet<br>
-           4 = Efnet +e/+I hybrid<br>
+           4 = Efnet +e/+I Hybrid<br>
            5 = Others</p>
         </dd>
 
Index: eggdrop1.6/doc/man1/eggdrop.1
diff -u eggdrop1.6/doc/man1/eggdrop.1:1.12 eggdrop1.6/doc/man1/eggdrop.1:1.13
--- eggdrop1.6/doc/man1/eggdrop.1:1.12	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/doc/man1/eggdrop.1	Tue Jan 28 00:37:24 2003
@@ -14,7 +14,7 @@
 is stand-alone, and does not require the
 .I ircII
 client.  It currently supports all known IRC nets, including EFnet,
-IRCNet, Dalnet and Undernet.
+IRCnet, DALnet and UnderNet.
 .PP
 By itself,
 .I eggdrop
Index: eggdrop1.6/doc/settings/mod.server
diff -u eggdrop1.6/doc/settings/mod.server:1.21 eggdrop1.6/doc/settings/mod.server:1.22
--- eggdrop1.6/doc/settings/mod.server:1.21	Wed Jan 22 20:13:29 2003
+++ eggdrop1.6/doc/settings/mod.server	Tue Jan 28 00:37:24 2003
@@ -20,11 +20,11 @@
 
   set net-type 0
     What is your network?
-      0 = EFnet (non +e/+I hybrid)
+      0 = EFnet (non +e/+I Hybrid)
       1 = IRCnet
       2 = Undernet
       3 = DALnet
-      4 = EFnet +e/+I hybrid
+      4 = EFnet +e/+I Hybrid
       5 = Others
 
 
Index: eggdrop1.6/eggdrop.conf
diff -u eggdrop1.6/eggdrop.conf:1.11 eggdrop1.6/eggdrop.conf:1.12
--- eggdrop1.6/eggdrop.conf:1.11	Wed Jan 22 20:13:28 2003
+++ eggdrop1.6/eggdrop.conf	Tue Jan 28 00:37:24 2003
@@ -1,7 +1,7 @@
 #! /path/to/executable/eggdrop
 # ^- This should contain a fully qualified path to your Eggdrop executable.
 #
-# $Id: eggdrop.conf,v 1.11 2003/01/23 02:13:28 wcc Exp $
+# $Id: eggdrop.conf,v 1.12 2003/01/28 06:37:24 wcc Exp $
 #
 # This is a sample Eggdrop configuration file which includes all possible
 # settings that can be used to configure your bot.
@@ -746,11 +746,11 @@
 loadmodule server
 
 # What is your network?
-#   0 = EFnet (non +e/+I hybrid)
+#   0 = EFnet (non +e/+I Hybrid)
 #   1 = IRCnet
 #   2 = Undernet
 #   3 = DALnet
-#   4 = EFnet +e/+I hybrid
+#   4 = EFnet +e/+I Hybrid
 #   5 = Others
 set net-type 0
 
Index: eggdrop1.6/src/bg.c
diff -u eggdrop1.6/src/bg.c:1.6 eggdrop1.6/src/bg.c:1.7
--- eggdrop1.6/src/bg.c:1.6	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/src/bg.c	Tue Jan 28 00:37:24 2003
@@ -3,7 +3,7 @@
  *   moving the process to the background, i.e. forking, while keeping threads
  *   happy.
  *
- * $Id: bg.c,v 1.6 2002/12/24 02:30:04 wcc Exp $
+ * $Id: bg.c,v 1.7 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -32,7 +32,7 @@
 #  define SUPPORT_THREADS
 #endif
 
-extern char	pid_file[];
+extern char pid_file[];
 
 #ifdef SUPPORT_THREADS
 
@@ -70,39 +70,35 @@
  */
 
 /* Format of messages sent from the newly forked process to the
-   original process, connected to the terminal. */
+ * original process, connected to the terminal.
+ */
 typedef struct {
-	enum {
-		BG_COMM_QUIT,		/* Quit original process. Write
-					   PID file, etc. i.e. detach.	 */
-		BG_COMM_ABORT,		/* Quit original process.	 */
-		BG_COMM_TRANSFERPF	/* Sending pid_file.		 */
-	} comm_type;
-	union {
-		struct {		/* Data for BG_COMM_TRANSFERPF.	 */
-			int	len;	/* Length of the file name.	 */
-		} transferpf;
-	} comm_data;
+  enum {
+    BG_COMM_QUIT,      /* Quit original process. Write PID file, detach. */
+    BG_COMM_ABORT,     /* Quit original process.                         */
+    BG_COMM_TRANSFERPF /* Sending pid_file.                              */
+  } comm_type;
+  union {
+    struct {           /* Data for BG_COMM_TRANSFERPF.                   */
+      int len;         /* Length of the file name.                       */
+    } transferpf;
+  } comm_data;
 } bg_comm_t;
 
 typedef enum {
-	BG_NONE = 0,			/* No forking has taken place
-					   yet.				 */
-	BG_SPLIT,			/* I'm the newly forked process. */
-	BG_PARENT			/* I'm the original process.	 */
+  BG_NONE = 0,         /* No forking has taken place yet.                */
+  BG_SPLIT,            /* I'm the newly forked process.                  */
+  BG_PARENT            /* I'm the original process.                      */
 } bg_state_t;
 
 typedef struct {
-	int		comm_recv;	/* Receives messages from the
-					   child process.		 */
-	int		comm_send;	/* Sends messages to the parent
-					   process.			 */
-	bg_state_t	state;		/* Current state, see above
-					   enum descriptions.		 */
-	pid_t		child_pid;	/* PID of split process.	 */
+  int comm_recv;        /* Receives messages from the child process.     */
+  int comm_send;        /* Sends messages to the parent process.         */
+  bg_state_t state;     /* Current state, see above enum descriptions.   */
+  pid_t child_pid;      /* PID of split process.                         */
 } bg_t;
 
-static bg_t	bg = { 0 };
+static bg_t bg = { 0 };
 
 #endif /* SUPPORT_THREADS */
 
@@ -113,7 +109,7 @@
  */
 static void bg_do_detach(pid_t p)
 {
-  FILE	*fp;
+  FILE *fp;
 
   /* Need to attempt to write pid now, not later. */
   unlink(pid_file);
@@ -129,7 +125,8 @@
       exit(1);
     }
     fclose(fp);
-  } else
+  }
+  else
     printf(EGG_NOWRITE, pid_file);
   printf("Launched into the background  (pid: %d)\n\n", p);
 #if HAVE_SETPGID
@@ -142,12 +139,12 @@
 {
 #ifdef SUPPORT_THREADS
   /* Create a pipe between parent and split process, fork to create a
-     parent and a split process and wait for messages on the pipe. */
-  pid_t		p;
-  bg_comm_t	message;
+   * parent and a split process and wait for messages on the pipe. */
+  pid_t p;
+  bg_comm_t message;
 
   {
-    int		comm_pair[2];
+    int comm_pair[2];
 
     if (pipe(comm_pair) < 0)
       fatal("CANNOT OPEN PIPE.", 0);
@@ -162,7 +159,8 @@
   if (p == 0) {
     bg.state = BG_SPLIT;
     return;
-  } else {
+  }
+  else {
     bg.child_pid = p;
     bg.state = BG_PARENT;
   }
@@ -179,10 +177,10 @@
       /* Now transferring file from split process.
        */
       if (message.comm_data.transferpf.len >= 40)
-	message.comm_data.transferpf.len = 40 - 1;
+        message.comm_data.transferpf.len = 40 - 1;
       /* Next message contains data. */
       if (read(bg.comm_recv, pid_file, message.comm_data.transferpf.len) <= 0)
-	goto error;
+        goto error;
       pid_file[message.comm_data.transferpf.len] = 0;
       break;
     }
@@ -202,7 +200,7 @@
  */
 static void bg_send_pidfile(void)
 {
-  bg_comm_t	message;
+  bg_comm_t message;
 
   message.comm_type = BG_COMM_TRANSFERPF;
   message.comm_data.transferpf.len = strlen(pid_file);
@@ -224,13 +222,15 @@
 #ifdef SUPPORT_THREADS
   if (bg.state == BG_PARENT) {
     kill(bg.child_pid, SIGKILL);
-  } else if (bg.state == BG_SPLIT) {
-    bg_comm_t	message;
+  }
+  else if (bg.state == BG_SPLIT) {
+    bg_comm_t message;
 
     if (q == BG_QUIT) {
       bg_send_pidfile();
       message.comm_type = BG_COMM_QUIT;
-    } else
+    }
+    else
       message.comm_type = BG_COMM_ABORT;
     /* Send message. */
     if (write(bg.comm_send, &message, sizeof(message)) < 0)
@@ -242,13 +242,11 @@
 void bg_do_split(void)
 {
 #ifdef SUPPORT_THREADS
-  /* Tell our parent process to go away now, as we don't need it
-     anymore. */
+  /* Tell our parent process to go away now, as we don't need it anymore. */
   bg_send_quit(BG_QUIT);
 #else
-  /* Split off a new process.
-   */
-  int	xx = fork();
+  /* Split off a new process. */
+  int xx = fork();
 
   if (xx == -1)
     fatal("CANNOT FORK PROCESS.", 0);
Index: eggdrop1.6/src/bg.h
diff -u eggdrop1.6/src/bg.h:1.4 eggdrop1.6/src/bg.h:1.5
--- eggdrop1.6/src/bg.h:1.4	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/src/bg.h	Tue Jan 28 00:37:24 2003
@@ -1,7 +1,7 @@
 /*
  * bg.h
  *
- * $Id: bg.h,v 1.4 2002/12/24 02:30:04 wcc Exp $
+ * $Id: bg.h,v 1.5 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -25,12 +25,12 @@
 #define _EGG_BG_H
 
 typedef enum {
-	BG_QUIT = 1,
-	BG_ABORT
+  BG_QUIT = 1,
+  BG_ABORT
 } bg_quit_t;
 
 void bg_prepare_split(void);
 void bg_send_quit(bg_quit_t q);
 void bg_do_split(void);
 
-#endif			/* _EGG_BG_H */
+#endif /* _EGG_BG_H */
Index: eggdrop1.6/src/botcmd.c
diff -u eggdrop1.6/src/botcmd.c:1.34 eggdrop1.6/src/botcmd.c:1.35
--- eggdrop1.6/src/botcmd.c:1.34	Mon Dec 23 21:33:24 2002
+++ eggdrop1.6/src/botcmd.c	Tue Jan 28 00:37:24 2003
@@ -3,7 +3,7 @@
  *   commands that comes across the botnet
  *   userfile transfer and update commands from sharebots
  *
- * $Id: botcmd.c,v 1.34 2002/12/24 03:33:24 wcc Exp $
+ * $Id: botcmd.c,v 1.35 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -30,20 +30,19 @@
 #include "chan.h"
 #include "modules.h"
 
-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 Tcl_Interp	*interp;
-extern time_t		 now, online_since;
-extern party_t		*party;
-extern module_entry	*module_list;
+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 Tcl_Interp *interp;
+extern time_t now, online_since;
+extern party_t *party;
+extern module_entry *module_list;
 
-static char TBUF[1024];		/* Static buffer for goofy bot stuff */
+static char TBUF[1024]; /* Static buffer for goofy bot stuff */
 
-static char base64to[256] =
-{
+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,
@@ -79,20 +78,19 @@
 
 static void fake_alert(int idx, char *item, char *extra)
 {
-  static unsigned long lastfake;	/* The last time fake_alert was used */
+  static unsigned long lastfake; /* The last time fake_alert was used */
 
-  if (now - lastfake > 10) {	
-    /* Don't fake_alert more than once every 10secs */
+  if (now - lastfake > 10) {
 #ifndef NO_OLD_BOTNET
     if (b_numver(idx) < NEAT_BOTNET)
       dprintf(idx, "chat %s NOTICE: %s (%s != %s).\n",
-	    botnetnick, NET_FAKEREJECT, item, extra);
+              botnetnick, NET_FAKEREJECT, item, extra);
     else
 #endif
       dprintf(idx, "ct %s NOTICE: %s (%s != %s).\n",
-	    botnetnick, NET_FAKEREJECT, item, extra);
+              botnetnick, NET_FAKEREJECT, item, extra);
     putlog(LOG_BOTS, "*", "%s %s (%s != %s).", dcc[idx].nick, NET_FAKEREJECT,
-	 item, extra);
+           item, extra);
     lastfake = now;
   }
 }
@@ -132,14 +130,16 @@
     }
     *p = '@';
     p++;
-  } else {
+  }
+  else {
     sprintf(TBUF, "*** (%s) %s", from, msg);
     p = from;
   }
   i = nextbot(p);
   if (i != idx) {
     fake_alert(idx, "direction", p);
-  } else {
+  }
+  else {
     chanout_but(-1, chan, "%s\n", TBUF);
     /* Send to new version bots */
     if (i >= 0)
@@ -243,48 +243,46 @@
     return;
   }
   if (!to[0])
-    return;			/* Silently ignore notes to '@bot' this
-				 * is legacy code */
-  if (!egg_strcasecmp(tobot, botnetnick)) {		/* For me! */
+    return; /* Silently ignore notes to '@bot' */
+  if (!egg_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.", BOT_NOSUCHUSER, to);
-	  break;
-	case NOTE_STORED:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s", BOT_NOTESTORED2);
-	  break;
-	case NOTE_FULL:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s", BOT_NOTEBOXFULL);
-	  break;
-	case NOTE_AWAY:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s", to, BOT_NOTEISAWAY);
-	  break;
-	case NOTE_FWD:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s", "Not online; note forwarded to:", to);
-	  break;
-	case NOTE_REJECT:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s", to, "rejected your note.");
+        switch (i) {
+        case NOTE_ERROR:
+          botnet_send_priv(idx, botnetnick, from, NULL,
+                           "%s %s.", BOT_NOSUCHUSER, to);
+          break;
+        case NOTE_STORED:
+          botnet_send_priv(idx, botnetnick, from, NULL, "%s", BOT_NOTESTORED2);
+          break;
+        case NOTE_FULL:
+          botnet_send_priv(idx, botnetnick, from, NULL, "%s", BOT_NOTEBOXFULL);
           break;
-	case NOTE_TCL:
-	  break;		/* Do nothing */
-	case NOTE_OK:
-	  botnet_send_priv(idx, botnetnick, from, NULL,
-			   "%s %s.", BOT_NOTESENTTO, to);
-	  break;
-	}
+        case NOTE_AWAY:
+          botnet_send_priv(idx, botnetnick, from, NULL,
+                           "%s %s", to, BOT_NOTEISAWAY);
+          break;
+        case NOTE_FWD:
+          botnet_send_priv(idx, botnetnick, from, NULL,
+                           "%s %s", "Not online; note forwarded to:", to);
+          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.", BOT_NOTESENTTO, to);
+          break;
+        }
     }
-  } else {			/* Pass it on */
+  }
+  else {                        /* Pass it on */
     i = nextbot(tobot);
     if (i >= 0)
       botnet_send_priv(i, from, to, tobot, "%s", par);
@@ -299,9 +297,9 @@
   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)",
-		 BOT_DISCONNECTED, dcc[idx].nick, par[0] ?
-		 par : "No reason", bots, (bots != 1) ?
-		 "s" : "", users, (users != 1) ? "s" : "");
+                 BOT_DISCONNECTED, 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);
@@ -327,105 +325,98 @@
     if (!channel_secret(c) && !channel_inactive(c)) {
       l = strlen(c->name);
       if (i + l < 1021) {
-	if (i > 10)
+        if (i > 10)
           sprintf(s, "%s, %s", s, c->name);
-	else {
+        else {
           strcpy(s, c->name);
-	  i += (l + 2);
+          i += (l + 2);
         }
       }
     }
   if (i > 10) {
     botnet_send_priv(idx, botnetnick, nick, NULL, "%s  (%s)", s, ver);
-  } else
+  }
+  else
     botnet_send_priv(idx, botnetnick, nick, NULL, "%s  (%s)", BOT_NOCHANNELS,
-		     ver);
+                     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)",
-		     BOT_PARTYMEMBS, MISC_OWNER, MISC_MASTER, MISC_OP);
+                     "%s  (* = %s, + = %s, @ = %s)",
+                     BOT_PARTYMEMBS, MISC_OWNER, MISC_MASTER, MISC_OP);
   else {
     simple_sprintf(s, "assoc %d", chan);
     if ((Tcl_Eval(interp, s) != TCL_OK) || !interp->result[0])
       botnet_send_priv(idx, botnetnick, nick, NULL,
-		       "%s %s%d:  (* = %s, + = %s, @ = %s)\n",
-		       BOT_PEOPLEONCHAN,
-		       (chan < GLOBAL_CHANS) ? "" : "*",
-		       chan % GLOBAL_CHANS,
-		       MISC_OWNER, MISC_MASTER, MISC_OP);
+                       "%s %s%d:  (* = %s, + = %s, @ = %s)\n",
+                       BOT_PEOPLEONCHAN,
+                       (chan < GLOBAL_CHANS) ? "" : "*",
+                       chan % GLOBAL_CHANS, MISC_OWNER, MISC_MASTER, MISC_OP);
     else
       botnet_send_priv(idx, botnetnick, nick, NULL,
-		       "%s '%s' (%s%d):  (* = %s, + = %s, @ = %s)\n",
-		       BOT_PEOPLEONCHAN, interp->result,
-		       (chan < GLOBAL_CHANS) ? "" : "*",
-		       chan % GLOBAL_CHANS,
-		       MISC_OWNER, MISC_MASTER, MISC_OP);
+                       "%s '%s' (%s%d):  (* = %s, + = %s, @ = %s)\n",
+                       BOT_PEOPLEONCHAN, interp->result,
+                       (chan < GLOBAL_CHANS) ? "" : "*",
+                       chan % GLOBAL_CHANS, MISC_OWNER, MISC_MASTER, MISC_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(i) == '-' ? ' ' : geticon(i)),
-		    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)",
-		    MISC_IDLE, days, hrs);
-	  else if (hrs > 0)
-	    sprintf(s + k, " (%s %luh%lum)",
-		    MISC_IDLE, hrs, mins);
-	  else
-	    sprintf(s + k, " (%s %lum)",
-		    MISC_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",
-			   MISC_AWAY, dcc[i].u.chat->away);
+        k = sprintf(s, "  %c%-15s %s",
+                    (geticon(i) == '-' ? ' ' : geticon(i)),
+                    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)", MISC_IDLE, days, hrs);
+          else if (hrs > 0)
+            sprintf(s + k, " (%s %luh%lum)", MISC_IDLE, hrs, mins);
+          else
+            sprintf(s + k, " (%s %lum)", MISC_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",
+                           MISC_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:", BOT_BOTSCONNECTED);
+        ok = 1;
+        botnet_send_priv(idx, botnetnick, nick, NULL, "%s:", BOT_BOTSCONNECTED);
       }
       sprintf(s, "  %s%c%-15s %s",
-	      dcc[i].status & STAT_CALLED ? "<-" : "->",
-	      dcc[i].status & STAT_SHARE ? '+' : ' ',
-	      dcc[i].nick, dcc[i].u.bot->version);
+              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:",
-			   BOT_OTHERPEOPLE);
-	}
-	l = sprintf(s, "  %c%-15s %s", (geticon(i) == '-' ? ' ' : geticon(i)),
-		    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)", MISC_IDLE, k);
-	  else
-	    sprintf(s + l, " (%s %dh%dm)", MISC_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", MISC_AWAY,
-			   dcc[i].u.chat->away);
+        if (!ok) {
+          ok = 1;
+          botnet_send_priv(idx, botnetnick, nick, NULL, "%s:", BOT_OTHERPEOPLE);
+        }
+        l = sprintf(s, "  %c%-15s %s", (geticon(i) == '-' ? ' ' : geticon(i)),
+                    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)", MISC_IDLE, k);
+          else
+            sprintf(s + l, " (%s %dh%dm)", MISC_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", MISC_AWAY, dcc[i].u.chat->away);
       }
 }
 
@@ -444,20 +435,20 @@
   }
   to = newsplit(&par);
   if (!egg_strcasecmp(to, botnetnick))
-    to[0] = 0;			/* (for me) */
+    to[0] = 0;
 #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 */
+  if (to[0]) {
     i = nextbot(to);
     if (i >= 0)
       botnet_send_who(i, from, to, chan);
-  } else {
-    remote_tell_who(idx, from, chan);
   }
+  else
+    remote_tell_who(idx, from, chan);
 }
 
 static void bot_endlink(int idx, char *par)
@@ -503,25 +494,26 @@
     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..! */
+             + strlen(botnetnick) + strlen(ver) + 1) >= 200) {
+          strcat(s, "++  ");
+          break;                /* Yegads..! */
         }
-	strcat(s, chan->dname);
-	strcat(s, ", ");
+        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, BOT_NOCHANNELS,
-		       s2);
-  } else
+                       "%s <%s> (%s) [UP %s]", ver, network, s, s2);
+    }
+    else
+      botnet_send_priv(idx, botnetnick, par, NULL, "%s <%s> (%s) [UP %s]", ver,
+                       network, BOT_NOCHANNELS, s2);
+  }
+  else
     botnet_send_priv(idx, botnetnick, par, NULL,
-		     "%s <NO_IRC> [UP %s]", ver, s2);
+                     "%s <NO_IRC> [UP %s]", ver, s2);
   botnet_send_infoq(idx, par);
 }
 
@@ -553,11 +545,11 @@
     putlog(LOG_CMDS, "*", "#%s# link %s", rfrom, par);
     if (botlink(from, -1, par))
       botnet_send_priv(idx, botnetnick, from, NULL, "%s %s ...",
-		       BOT_LINKATTEMPT, par);
+                       BOT_LINKATTEMPT, par);
     else
-      botnet_send_priv(idx, botnetnick, from, NULL, "%s.",
-		       BOT_CANTLINKTHERE);
-  } else {
+      botnet_send_priv(idx, botnetnick, from, NULL, "%s.", BOT_CANTLINKTHERE);
+  }
+  else {
     i = nextbot(bot);
     if (i >= 0)
       botnet_send_link(i, from, bot, par);
@@ -580,41 +572,44 @@
     else
       rfrom = from;
     putlog(LOG_CMDS, "*", "#%s# unlink %s (%s)", rfrom, undes, par[0] ? par :
-	   "No reason");
+           "No reason");
     i = botunlink(-3, undes, par[0] ? par : NULL, rfrom);
     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);
+        /* 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) {
+    }
+    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.", BOT_CANTUNLINK, undes);
+        /* Ditto above, about idx */
+        i = nextbot(p + 1);
+        if (i >= 0)
+          botnet_send_priv(i, botnetnick, from, NULL,
+                           "%s %s.", BOT_CANTUNLINK, undes);
       }
-    } else {
+    }
+    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.");
+        i = nextbot(p + 1);
+        if (i >= 0)
+          botnet_send_priv(i, botnetnick, from, NULL,
+                           "Can't remotely unlink sharebots.");
       }
     }
-  } else {
+  }
+  else {
     i = nextbot(bot);
     if (i >= 0)
       botnet_send_unlink(i, from, bot, undes, par);
@@ -655,41 +650,39 @@
   s[0] = 0;
   if (!next[0]) {
     putlog(LOG_BOTS, "*", "Invalid eggnet protocol from %s (zapfing)",
-	   dcc[idx].nick);
+           dcc[idx].nick);
     simple_sprintf(s, "%s %s (%s)", MISC_DISCONNECTED, dcc[idx].nick,
-		   MISC_INVALIDBOT);
+                   MISC_INVALIDBOT);
     dprintf(idx, "error invalid eggnet protocol for 'nlinked'\n");
-  } else if ((in_chain(newbot)) || (!egg_strcasecmp(newbot, botnetnick))) {
+  }
+  else if ((in_chain(newbot)) || (!egg_strcasecmp(newbot, botnetnick))) {
     /* Loop! */
     putlog(LOG_BOTS, "*", "%s %s (mutual: %s)",
-	   BOT_LOOPDETECT, dcc[idx].nick, newbot);
+           BOT_LOOPDETECT, dcc[idx].nick, newbot);
     simple_sprintf(s, "%s %s: disconnecting %s", MISC_LOOP, newbot,
-        dcc[idx].nick);
+                   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;
+        bogus = 1;
     i = nextbot(next);
     if (i != idx)
       bogus = 1;
   }
   if (bogus) {
     putlog(LOG_BOTS, "*", "%s %s!  (%s -> %s)", BOT_BOGUSLINK, dcc[idx].nick,
-	   next, newbot);
+           next, newbot);
     simple_sprintf(s, "%s: %s %s", BOT_BOGUSLINK, dcc[idx].nick,
-		   MISC_DISCONNECTED);
-    dprintf(idx, "error %s (%s -> %s)\n",
-	    BOT_BOGUSLINK, next, newbot);
+                   MISC_DISCONNECTED);
+    dprintf(idx, "error %s (%s -> %s)\n", BOT_BOGUSLINK, next, newbot);
   }
   if (bot_flags(dcc[idx].user) & BOT_LEAF) {
     putlog(LOG_BOTS, "*", "%s %s  (%s %s)",
-	   BOT_DISCONNLEAF, dcc[idx].nick, newbot,
-	   BOT_LINKEDTO);
+           BOT_DISCONNLEAF, dcc[idx].nick, newbot, BOT_LINKEDTO);
     simple_sprintf(s, "%s %s (to %s): %s",
-		   BOT_ILLEGALLINK, dcc[idx].nick, newbot,
-		   MISC_DISCONNECTED);
+                   BOT_ILLEGALLINK, dcc[idx].nick, newbot, MISC_DISCONNECTED);
     dprintf(idx, "error %s\n", BOT_YOUREALEAF);
   }
   if (s[0]) {
@@ -722,7 +715,7 @@
   if (bot_flags(u) & BOT_REJECT) {
     botnet_send_reject(idx, botnetnick, NULL, newbot, NULL, NULL);
     putlog(LOG_BOTS, "*", "%s %s %s %s", BOT_REJECTING,
-	   newbot, MISC_FROM, dcc[idx].nick);
+           newbot, MISC_FROM, dcc[idx].nick);
   }
 }
 
@@ -736,15 +729,14 @@
   users = users_in_subtree(findbot(dcc[idx].nick));
   putlog(LOG_BOTS, "*", "%s", BOT_OLDBOT);
   simple_sprintf(s, "%s %s (%s) (lost %d bot%s and %d user%s",
-  		 MISC_DISCONNECTED, dcc[idx].nick, MISC_OUTDATED,
-		 bots, (bots != 1) ? "s" : "", users,
-		 (users != 1) ? "s" : "");
+                 MISC_DISCONNECTED, dcc[idx].nick, MISC_OUTDATED,
+                 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 */
+#endif /* !NO_OLD_BOTNET */
 
 static void bot_unlinked(int idx, char *par)
 {
@@ -753,10 +745,10 @@
 
   bot = newsplit(&par);
   i = nextbot(bot);
-  if ((i >= 0) && (i != idx))	/* Bot is NOT downstream along idx, so
-				 * BOGUS! */
+  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 */
+  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);
@@ -804,31 +796,37 @@
     if (ss[0])
       sock = atoi(ss);
     else
-      sock = (-1);
+      sock = -1;
     if (par[0] == ':') {
       t = atoi(par + 1);
       p = strchr(par + 1, ':');
       if (p)
-	p++;
+        p++;
       else
-	p = par + 1;
+        p = par + 1;
     }
     for (i = 0; i < dcc_total; i++)
       if ((dcc[i].type->flags & DCT_CHAT) &&
-	  (!egg_strcasecmp(dcc[i].nick, to)) &&
-	  ((sock == (-1)) || (sock == dcc[i].sock))) {
-	if (t) {
-          int j=0;
+          (!egg_strcasecmp(dcc[i].nick, to)) &&
+          ((sock == -1) || (sock == dcc[i].sock))) {
+        if (t) {
+          int j = 0;
+
           {
-            register char *c=p;
-            for (; *c != '\0'; c++) if (*c == ':') j++;
+            register char *c = p;
+
+            for (; *c != '\0'; c++)
+              if (*c == ':')
+                j++;
           }
-	  dprintf(i, "%s -> %s (%lu secs, %d hop%s)\n", BOT_TRACERESULT, p,
-            now - t, j, (j != 1) ? "s" : "");
-	} else
-	  dprintf(i, "%s -> %s\n", BOT_TRACERESULT, p);
+          dprintf(i, "%s -> %s (%lu secs, %d hop%s)\n", BOT_TRACERESULT, p,
+                  now - t, j, (j != 1) ? "s" : "");
+        }
+        else
+          dprintf(i, "%s -> %s\n", BOT_TRACERESULT, p);
       }
-  } else {
+  }
+  else {
     i = nextbot(p);
     if (p != to)
       *--p = '@';
@@ -864,64 +862,68 @@
     i = nextbot(who);
     if (i < 0) {
       botnet_send_priv(idx, botnetnick, from, NULL, "%s %s (%s)",
-		       BOT_CANTUNLINK, who, BOT_DOESNTEXIST);
-    } else if (!egg_strcasecmp(dcc[i].nick, who)) {
+                       BOT_CANTUNLINK, who, BOT_DOESNTEXIST);
+    }
+    else if (!egg_strcasecmp(dcc[i].nick, who)) {
       char s[1024];
 
       /* I'm the connection to the rejected bot */
       putlog(LOG_BOTS, "*", "%s %s %s", from, MISC_REJECTED, dcc[i].nick);
       dprintf(i, "bye %s\n", par[0] ? par : MISC_REJECTED);
       simple_sprintf(s, "%s %s (%s: %s)",
-		     MISC_DISCONNECTED, dcc[i].nick, from,
-		     par[0] ? par : MISC_REJECTED);
+                     MISC_DISCONNECTED, dcc[i].nick, from,
+                     par[0] ? par : MISC_REJECTED);
       chatout("*** %s\n", s);
       botnet_send_unlinked(i, dcc[i].nick, s);
       killsock(dcc[i].sock);
       lostdcc(i);
-    } else {
+    }
+    else {
       if (i >= 0)
-	botnet_send_reject(i, from, NULL, who, NULL, par);
+        botnet_send_reject(i, from, NULL, who, NULL, par);
     }
-  } else {			/* Rejecting user */
+  }
+  else {                        /* Rejecting user */
     *destbot++ = 0;
     if (!egg_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",
-			 BOT_NOREMOTEBOOT);
-	ok = 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", BOT_NOREMOTEBOOT);
+        ok = 1;
       }
       for (i = 0; (i < dcc_total) && (!ok); i++)
-	if ((!egg_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, BOT_NOOWNERBOOT, -1, 0);
-	    return;
-	  }
-	  do_boot(i, from, par);
-	  ok = 1;
-	  putlog(LOG_CMDS, "*", "#%s# boot %s (%s)", from, who, 
-		 par[0] ? par : "No reason");
-	}
-    } else {
+        if ((!egg_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, BOT_NOOWNERBOOT, -1, 0);
+            return;
+          }
+          do_boot(i, from, par);
+          ok = 1;
+          putlog(LOG_CMDS, "*", "#%s# boot %s (%s)", from, who,
+                 par[0] ? par : "No reason");
+        }
+    }
+    else {
       i = nextbot(destbot);
       *--destbot = '@';
       if (i >= 0)
-	botnet_send_reject(i, from, NULL, who, NULL, par);
+        botnet_send_reject(i, from, NULL, who, NULL, par);
     }
   }
 }
@@ -934,7 +936,7 @@
     putlog(LOG_BOTS, "*", NET_WRONGBOT, dcc[idx].nick, par);
     dprintf(idx, "bye %s\n", MISC_IMPOSTER);
     simple_sprintf(s, "%s %s (%s)", MISC_DISCONNECTED, dcc[idx].nick,
-		   MISC_IMPOSTER);
+                   MISC_IMPOSTER);
     chatout("*** %s\n", s);
     botnet_send_unlinked(idx, dcc[idx].nick, s);
     unvia(idx, findbot(dcc[idx].nick));
@@ -1016,7 +1018,7 @@
   FILE *vv;
   char *s = TBUF, *who, *p;
   int i;
-  struct flag_record fr = {FR_BOT, USER_BOT, 0, 0, 0, 0};
+  struct flag_record fr = { FR_BOT, USER_BOT, 0, 0, 0, 0 };
 
   who = newsplit(&par);
   if (!par[0] || !egg_strcasecmp(par, botnetnick)) {
@@ -1032,7 +1034,8 @@
       fr.global |=USER_HIGHLITE;
 
       who++;
-    } else if (who[0] == '#') {
+    }
+    else if (who[0] == '#') {
       fr.global |=USER_HIGHLITE;
 
       who++;
@@ -1043,21 +1046,23 @@
       botnet_send_priv(idx, botnetnick, who, NULL, "--- %s\n", MISC_MOTDFILE);
       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);
-	}
+        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
+    }
+    else
       botnet_send_priv(idx, botnetnick, who, NULL, "%s :(", MISC_NOMOTDFILE);
-  } else {
+  }
+  else {
     /* Pass it on */
     i = nextbot(par);
     if (i >= 0)
@@ -1080,20 +1085,21 @@
   if ((tobot = strchr(to, '@')))
     tobot++;
   else
-    tobot = to;			/* Bot wants a file?! :) */
-  if (egg_strcasecmp(tobot, botnetnick)) {	/* for me! */
+    tobot = to;                 /* Bot wants a file?! :) */
+  if (egg_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", BOT_XFERREJECTED, path, par);
+        if (dcc[i].sock == atoi(to))
+          dprintf(i, "%s (%s): %s\n", BOT_XFERREJECTED, path, par);
       }
       *p = ':';
     }
     /* No ':'? malformed */
     putlog(LOG_FILES, "*", "%s %s: %s", path, MISC_REJECTED, par);
-  } else {			/* Pass it on */
+  }
+  else {                        /* Pass it on */
     i = nextbot(tobot);
     if (i >= 0)
       botnet_send_filereject(i, path, to, par);
@@ -1111,21 +1117,22 @@
   if ((path = strchr(tobot, ':'))) {
     *path++ = 0;
 
-    if (!egg_strcasecmp(tobot, botnetnick)) {	/* For me! */
+    if (!egg_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, MOD_NOFILESYSMOD);
+        botnet_send_priv(idx, botnetnick, from, NULL, MOD_NOFILESYSMOD);
       else {
-	Function f = fs->funcs[FILESYS_REMOTE_REQ];
+        Function f = fs->funcs[FILESYS_REMOTE_REQ];
 
-	f(idx, from, path);
+        f(idx, from, path);
       }
-    } else {			/* Pass it on */
+    }
+    else {                      /* Pass it on */
       i = nextbot(tobot);
       if (i >= 0)
-	botnet_send_filereq(i, from, tobot, path);
+        botnet_send_filereq(i, from, tobot, path);
     }
   }
 }
@@ -1143,18 +1150,19 @@
   if ((tobot = strchr(to, '@'))) {
     *tobot = 0;
     tobot++;
-  } else {
-    tobot = to;
   }
-  if (!egg_strcasecmp(tobot, botnetnick)) {		/* For me! */
+  else
+    tobot = to;
+  if (!egg_strcasecmp(tobot, botnetnick)) {     /* For me! */
     nfn = strrchr(botpath, '/');
     if (nfn == NULL) {
       nfn = strrchr(botpath, ':');
       if (nfn == NULL)
-	nfn = botpath;		/* That's odd. */
+        nfn = botpath;          /* That's odd. */
       else
-	nfn++;
-    } else
+        nfn++;
+    }
+    else
       nfn++;
     if ((nick = strchr(to, ':')))
       nick++;
@@ -1162,7 +1170,8 @@
       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 {
+  }
+  else {
     i = nextbot(tobot);
     if (i >= 0) {
       *--tobot = '@';
@@ -1206,7 +1215,7 @@
     return;
   }
   chanout_but(-1, party[i].chan, "*** (%s) Nick change: %s -> %s\n",
-	      bot, newnick, party[i].nick);
+              bot, newnick, party[i].nick);
   botnet_send_nkch_part(idx, i, newnick);
 }
 
@@ -1241,12 +1250,13 @@
     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!! */
+    return;                     /* Woops! pre 1.2.1's send .chat off'ers
+                                 * too!! */
   if (!y[0]) {
     y[0] = '-';
     sock = 0;
-  } else {
+  }
+  else {
 #ifndef NO_OLD_BOTNET
     if (b_numver(idx) < NEAT_BOTNET)
       sock = atoi(y + 1);
@@ -1263,8 +1273,8 @@
   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 :) */
+  if (i != idx) {               /* Ok, garbage from a 1.0g (who uses that
+                                 * now?) OR raistlin being evil :) */
     fake_alert(idx, "direction", bot);
     return;
   }
@@ -1278,13 +1288,13 @@
   if (i != chan) {
     if (i >= 0) {
       if (b_numver(idx) >= NEAT_BOTNET)
-	chanout_but(-1, i, "*** (%s) %s %s %s.\n", bot, nick, NET_LEFTTHE,
-		    i ? "channel" : "party line");
+        chanout_but(-1, i, "*** (%s) %s %s %s.\n", bot, nick, NET_LEFTTHE,
+                    i ? "channel" : "party line");
       check_tcl_chpt(bot, nick, sock, i);
     }
     if ((b_numver(idx) >= NEAT_BOTNET) && !linking)
       chanout_but(-1, chan, "*** (%s) %s %s %s.\n", bot, nick, NET_JOINEDTHE,
-		  chan ? "channel" : "party line");
+                  chan ? "channel" : "party line");
     check_tcl_chjn(bot, nick, chan, y[0], sock, par);
   }
 }
@@ -1311,7 +1321,8 @@
   if (b_numver(idx) < NEAT_BOTNET) {
     sock = atoi(etc);
     silent = 1;
-  } else
+  }
+  else
 #endif
     sock = base64_to_int(etc);
   if (sock == 0)
@@ -1328,13 +1339,11 @@
       register int chan = party[partyidx].chan;
 
       if (par[0])
-	chanout_but(-1, chan, "*** (%s) %s %s %s (%s).\n", bot, nick,
-		    NET_LEFTTHE,
-		    chan ? "channel" : "party line", par);
+        chanout_but(-1, chan, "*** (%s) %s %s %s (%s).\n", bot, nick,
+                    NET_LEFTTHE, chan ? "channel" : "party line", par);
       else
-	chanout_but(-1, chan, "*** (%s) %s %s %s.\n", bot, nick,
-		    NET_LEFTTHE,
-		    chan ? "channel" : "party line");
+        chanout_but(-1, chan, "*** (%s) %s %s %s.\n", bot, nick,
+                    NET_LEFTTHE, chan ? "channel" : "party line");
     }
     botnet_send_part_party(idx, partyidx, par, silent);
     remparty(bot, sock);
@@ -1375,19 +1384,18 @@
   if (par[0]) {
     partystat(bot, sock, PLSTAT_AWAY, 0);
     partyaway(bot, sock, par);
-  } else {
-    partystat(bot, sock, 0, PLSTAT_AWAY);
   }
+  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, NET_AWAY, par);
+                  "*** (%s) %s %s: %s.\n", bot,
+                  party[partyidx].nick, NET_AWAY, par);
     else
       chanout_but(-1, party[partyidx].chan,
-		  "*** (%s) %s %s.\n", bot,
-		  party[partyidx].nick, NET_UNAWAY);
+                  "*** (%s) %s %s.\n", bot, party[partyidx].nick, NET_UNAWAY);
   }
   botnet_send_away(idx, bot, sock, par, linking);
 }
@@ -1443,7 +1451,7 @@
   dprintf(idx, "uf-no %s\n", USERF_ANTIQUESHARE);
 }
 
-#endif	/* !NO_OLD_BOTNET */
+#endif /* !NO_OLD_BOTNET */
 
 void bot_share(int idx, char *par)
 {
@@ -1462,12 +1470,14 @@
   else if (egg_strcasecmp(tobot = newsplit(&par), botnetnick)) {
     if ((sock = nextbot(tobot)) >= 0)
       dprintf(sock, "v %s %s %s\n", frombot, tobot, par);
-  } else {
+  }
+  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,
+                       "  Module: %s (v%d.%d)\n", me->name, me->major,
+                       me->minor);
     botnet_send_priv(sock, botnetnick, from, frombot, "End of module list.\n");
   }
 }
@@ -1482,112 +1492,75 @@
  * 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},
+botcmd_t C_bot[] = {
+  {"a",    (Function) bot_actchan},
+  {"aw",   (Function) bot_away},
+  {"bye",  (Function) bot_bye},
+  {"c",    (Function) bot_chan2},
+  {"ct",   (Function) bot_chat},
+  {"e",    (Function) bot_error},
+  {"el",   (Function) bot_endlink},
+  {"f!",   (Function) bot_filereject},
+  {"fr",   (Function) bot_filereq},
+  {"fs",   (Function) bot_filesend},
+  {"h",    (Function) bot_handshake},
+  {"i",    (Function) bot_idle},
+  {"i?",   (Function) bot_infoq},
+  {"j",    (Function) bot_join},
+  {"l",    (Function) bot_link},
+  {"m",    (Function) bot_motd},
+  {"n",    (Function) bot_nlinked},
+  {"nc",   (Function) bot_nickchange},
+  {"p",    (Function) bot_priv},
+  {"pi",   (Function) bot_ping},
+  {"po",   (Function) bot_pong},
+  {"pt",   (Function) bot_part},
+  {"r",    (Function) bot_reject},
+  {"s",    (Function) bot_share},
+  {"t",    (Function) bot_trace},
+  {"tb",   (Function) bot_thisbot},
+  {"td",   (Function) bot_traced},
+  {"u",    (Function) bot_update},
+  {"ul",   (Function) bot_unlink},
+  {"un",   (Function) bot_unlinked},
+  {"v",    (Function) bot_versions},
+  {"w",    (Function) bot_who},
+  {"z",    (Function) bot_zapf},
+  {"zb",   (Function) bot_zapfbroad},
+#ifndef NO_OLD_BOTNET
+  {"actchan",    (Function) bot_actchan},
+  {"away",       (Function) bot_away},
+  {"chan",       (Function) bot_chan2},
+  {"chat",       (Function) bot_chat},
+  {"error",      (Function) bot_error},
+  {"filereject", (Function) bot_filereject},
+  {"filereq",    (Function) bot_filereq},
+  {"filesend",   (Function) bot_filesend},
+  {"handshake",  (Function) bot_handshake},
+  {"idle",       (Function) bot_idle},
+  {"info?",      (Function) bot_infoq},
+  {"join",       (Function) bot_join},
+  {"link",       (Function) bot_link},
+  {"linked",     (Function) bot_linked},
+  {"motd",       (Function) bot_motd},
+  {"nlinked",    (Function) bot_nlinked},
+  {"part",       (Function) bot_part},
+  {"ping",       (Function) bot_ping},
+  {"pong",       (Function) bot_pong},
+  {"priv",       (Function) bot_priv},
+  {"reject",     (Function) bot_reject},
+  {"thisbot",    (Function) bot_thisbot},
+  {"trace",      (Function) bot_trace},
+  {"traced",     (Function) bot_traced},
+  {"uf-no",      (Function) bot_ufno},
+  {"unaway",     (Function) bot_away},
+  {"unlink",     (Function) bot_unlink},
+  {"unlinked",   (Function) bot_unlinked},
+  {"update",     (Function) bot_update},
+  {"userfile?",  (Function) bot_old_userfile},
+  {"who",        (Function) bot_who},
+  {"zapf",       (Function) bot_zapf},
+  {"zapf-broad", (Function) bot_zapfbroad},
 #endif
-  {"zb",		(Function) bot_zapfbroad},
-  {NULL,		NULL}
+  {NULL,          NULL}
 };
Index: eggdrop1.6/src/botmsg.c
diff -u eggdrop1.6/src/botmsg.c:1.26 eggdrop1.6/src/botmsg.c:1.27
--- eggdrop1.6/src/botmsg.c:1.26	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/src/botmsg.c	Tue Jan 28 00:37:24 2003
@@ -5,7 +5,7 @@
  *
  * by Darrin Smith (beldin at light.iinet.net.au)
  *
- * $Id: botmsg.c,v 1.26 2002/12/24 02:30:04 wcc Exp $
+ * $Id: botmsg.c,v 1.27 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -29,14 +29,14 @@
 #include "main.h"
 #include "tandem.h"
 
-extern struct dcc_t	*dcc;
-extern int		 dcc_total, tands;
-extern char		 botnetnick[];
-extern party_t		*party;
-extern Tcl_Interp	*interp;
-extern struct userrec	*userlist;
+extern struct dcc_t *dcc;
+extern int dcc_total, tands;
+extern char botnetnick[];
+extern party_t *party;
+extern Tcl_Interp *interp;
+extern struct userrec *userlist;
 
-static char	OBUF[1024];
+static char OBUF[1024];
 
 
 #ifndef NO_OLD_BOTNET
@@ -51,22 +51,21 @@
 
   x = EGG_VARARGS_START(int, arg1, va);
   format = va_arg(va, char *);
+
   egg_vsnprintf(s, 511, format, va);
   va_end(va);
-  s[sizeof(s)-1] = 0;
+  s[sizeof(s) - 1] = 0;
 
   len = strlen(s);
 
   for (i = 0; i < dcc_total; i++)
-    if ((dcc[i].type == &DCC_BOT) && (i != x) &&
-        (b_numver(i) < NEAT_BOTNET))
+    if ((dcc[i].type == &DCC_BOT) && (i != x) && (b_numver(i) < NEAT_BOTNET))
       tputs(dcc[i].sock, s, len);
 }
 #endif
 
 /* Thank you ircu :) */
-static char tobase64array[64] =
-{
+static char tobase64array[64] = {
   'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
   'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
   'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
@@ -138,7 +137,7 @@
   return buf_base10 + i;
 }
 
-int simple_sprintf EGG_VARARGS_DEF(char *,arg1)
+int simple_sprintf EGG_VARARGS_DEF(char *, arg1)
 {
   char *buf, *format, *s;
   int c = 0, i;
@@ -152,36 +151,42 @@
       format++;
       switch (*format) {
       case 's':
-	s = va_arg(va, char *);
-	break;
+        s = va_arg(va, char *);
+
+        break;
       case 'd':
       case 'i':
-	i = va_arg(va, int);
-	s = int_to_base10(i);
-	break;
+        i = va_arg(va, int);
+
+        s = int_to_base10(i);
+        break;
       case 'D':
-	i = va_arg(va, int);
-	s = int_to_base64((unsigned int) i);
-	break;
+        i = va_arg(va, int);
+
+        s = int_to_base64((unsigned int) i);
+        break;
       case 'u':
-	i = va_arg(va, unsigned int);
+        i = va_arg(va, unsigned int);
+
         s = unsigned_int_to_base10(i);
-	break;
+        break;
       case '%':
-	buf[c++] = *format++;
-	continue;
+        buf[c++] = *format++;
+        continue;
       case 'c':
-	buf[c++] = (char) va_arg(va, int);
-	format++;
-	continue;
+        buf[c++] = (char) va_arg(va, int);
+
+        format++;
+        continue;
       default:
-	continue;
+        continue;
       }
       if (s)
-	while (*s && c < 1023)
-	  buf[c++] = *s++;
+        while (*s && c < 1023)
+          buf[c++] = *s++;
       format++;
-    } else
+    }
+    else
       buf[c++] = *format++;
   }
   va_end(va);
@@ -201,8 +206,8 @@
   }
   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)))
+        (b_numver(i) >= NEAT_BOTNET) &&
+        (!iso || !(bot_flags(dcc[i].user) & BOT_ISOLATE)))
       tputs(dcc[i].sock, buf, len);
 }
 
@@ -216,40 +221,40 @@
   }
 }
 
-void botnet_send_chan(int idx, char *botnick, char *user,
-		      int chan, char *data)
+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 {
+    }
+    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);
+                user ? "@" : "", botnick, chan, data);
 #endif
   }
 }
 
-void botnet_send_act(int idx, char *botnick, char *user,
-		     int chan, char *data)
+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 {
+    }
+    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);
+                user ? "@" : "", botnick, chan, data);
 #endif
   }
 }
@@ -299,9 +304,10 @@
   to = va_arg(va, char *);
   tobot = va_arg(va, char *);
   format = va_arg(va, char *);
+
   egg_vsnprintf(tbuf, 450, format, va);
   va_end(va);
-  tbuf[sizeof(tbuf)-1] = 0;
+  tbuf[sizeof(tbuf) - 1] = 0;
 
   if (tobot) {
 #ifndef NO_OLD_BOTNET
@@ -310,7 +316,8 @@
     else
 #endif
       l = simple_sprintf(OBUF, "p %s %s@%s %s\n", from, to, tobot, tbuf);
-  } else {
+  }
+  else {
 #ifndef NO_OLD_BOTNET
     if (b_numver(idx) < NEAT_BOTNET)
       l = simple_sprintf(OBUF, "priv %s %s %s\n", from, to, tbuf);
@@ -344,8 +351,7 @@
 #endif
 }
 
-void botnet_send_unlink(int idx, char *who, char *via,
-			char *bot, char *reason)
+void botnet_send_unlink(int idx, char *who, char *via, char *bot, char *reason)
 {
   int l;
 
@@ -386,8 +392,7 @@
   }
 }
 
-void botnet_send_nlinked(int idx, char *bot, char *next, char flag,
-			 int vernum)
+void botnet_send_nlinked(int idx, char *bot, char *next, char flag, int vernum)
 {
   int l;
 
@@ -430,7 +435,7 @@
   tputs(dcc[idx].sock, OBUF, l);
 }
 
-void botnet_send_update(int idx, tand_t * ptr)
+void botnet_send_update(int idx, tand_t *ptr)
 {
   int l;
 
@@ -444,7 +449,7 @@
 }
 
 void botnet_send_reject(int idx, char *fromp, char *frombot, char *top,
-			char *tobot, char *reason)
+                        char *tobot, char *reason)
 {
   int l;
   char to[NOTENAMELEN + 1], from[NOTENAMELEN + 1];
@@ -554,7 +559,7 @@
 
   if (tands > 0) {
     l = simple_sprintf(OBUF, "i %s %D %D %s\n", bot, sock, idle,
-		       away ? away : "");
+                       away ? away : "");
     send_tand_but(idx, OBUF, -l);
 #ifndef NO_OLD_BOTNET
     if (away && away[0])
@@ -564,43 +569,43 @@
   }
 }
 
-void botnet_send_away(int idx, char *bot, int sock,
-		      char *msg, int linking)
+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 : "");
+                       ((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,
-		      NET_AWAY, msg);
+        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,
+                      NET_AWAY, msg);
       }
       tandout_but(idx, "away %s %d %s\n", bot, sock, msg);
-    } else {
+    }
+    else {
       if (idx < 0) {
-	tandout_but(idx, "chan %s %d %s %s.\n", bot,
-		    dcc[linking].u.chat->channel, dcc[linking].nick,
-		    NET_UNAWAY);
-      } 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,
-		      NET_UNAWAY);
+        tandout_but(idx, "chan %s %d %s %s.\n", bot,
+                    dcc[linking].u.chat->channel, dcc[linking].nick,
+                    NET_UNAWAY);
+      }
+      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, NET_UNAWAY);
       }
       tandout_but(idx, "unaway %s %d\n", bot, sock);
     }
@@ -614,23 +619,23 @@
 
   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(useridx),
-		       dcc[useridx].sock, dcc[useridx].host);
+                       botnetnick, dcc[useridx].nick,
+                       dcc[useridx].u.chat->channel, geticon(useridx),
+                       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(useridx), dcc[useridx].sock, dcc[useridx].host);
+                dcc[useridx].nick, dcc[useridx].u.chat->channel,
+                geticon(useridx), 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, NET_JOINEDTHE,
-		dcc[useridx].u.chat->channel ? "channel" : "party line");
+                botnetnick, dcc[useridx].u.chat->channel,
+                dcc[useridx].nick, NET_JOINEDTHE,
+                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, NET_LEFTTHE,
-		  oldchan ? "channel" : "party line");
+                  botnetnick, oldchan,
+                  dcc[useridx].nick, NET_LEFTTHE,
+                  oldchan ? "channel" : "party line");
     }
 #endif
   }
@@ -642,28 +647,27 @@
 
   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 : "");
+                       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 : "");
+                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, NET_JOINEDTHE,
-		  party[useridx].chan ? "channel" : "party line");
+                  party[useridx].bot, party[useridx].chan,
+                  party[useridx].nick, NET_JOINEDTHE,
+                  party[useridx].chan ? "channel" : "party line");
     }
     if ((oldchan >= 0) && (oldchan < GLOBAL_CHANS) &&
-	((idx < 0) || (b_numver(idx) >= NEAT_BOTNET))) {
+        ((idx < 0) || (b_numver(idx) >= NEAT_BOTNET))) {
       tandout_but(idx, "chan %s %d %s %s %s.\n",
-		  party[useridx].bot, oldchan, party[useridx].nick,
-		  NET_LEFTTHE,
-		  party[useridx].chan ? "channel" : "party line");
+                  party[useridx].bot, oldchan, party[useridx].nick,
+                  NET_LEFTTHE, party[useridx].chan ? "channel" : "party line");
     }
 #endif
   }
@@ -672,43 +676,42 @@
 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 : "");
+                         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);
+                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 : "");
+                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)
+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 : "");
+                       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);
+                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 : "");
+                  party[partyidx].bot, party[partyidx].chan,
+                  party[partyidx].nick,
+                  party[partyidx].chan ? "channel" : "party line",
+                  reason ? ": " : "", reason ? reason : "");
     }
 #endif
   }
@@ -720,17 +723,17 @@
 
   if (tands > 0) {
     l = simple_sprintf(OBUF, "nc %s %D %s\n", botnetnick,
-		       dcc[useridx].sock, dcc[useridx].nick);
+                       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);
+                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(useridx), dcc[useridx].sock, dcc[useridx].host);
+                dcc[useridx].nick, dcc[useridx].u.chat->channel,
+                geticon(useridx), dcc[useridx].sock, dcc[useridx].host);
     tandout_but(-1, "chan %s %d %s: %s -> %s.\n",
-		botnetnick, dcc[useridx].u.chat->channel,
-		oldnick, NET_NICKCHANGE, dcc[useridx].nick);
+                botnetnick, dcc[useridx].u.chat->channel,
+                oldnick, NET_NICKCHANGE, dcc[useridx].nick);
 #endif
   }
 }
@@ -741,19 +744,18 @@
 
   if (tands > 0) {
     l = simple_sprintf(OBUF, "nc %s %D %s\n", party[useridx].bot,
-		       party[useridx].sock, party[useridx].nick);
+                       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);
+                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 : "");
+                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,
-		NET_NICKCHANGE,
-		oldnick, party[useridx].nick);
+                party[useridx].bot, party[useridx].chan,
+                NET_NICKCHANGE, oldnick, party[useridx].nick);
 #endif
   }
 }
@@ -768,10 +770,10 @@
   struct userrec *u;
 
   if (strlen(msg) > 450)
-    msg[450] = 0;		/* Notes have a limit */
+    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 */
+  if (p != NULL) {              /* Cross-bot note */
     char x[21];
 
     *p = 0;
@@ -779,21 +781,23 @@
     x[20] = 0;
     *p = '@';
     p++;
-    if (!egg_strcasecmp(p, botnetnick))	/* To me?? */
+    if (!egg_strcasecmp(p, botnetnick)) /* To me?? */
       return add_note(x, from, msg, idx, echo); /* Start over, dimwit. */
     if (egg_strcasecmp(from, botnetnick)) {
       if (strlen(from) > 40)
-	from[40] = 0;
+        from[40] = 0;
       if (strchr(from, '@')) {
-	strcpy(botf, from);
-      } else
-	sprintf(botf, "%s@%s", from, botnetnick);
-    } else
+        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, BOT_NOTHERE);
+        dprintf(idx, BOT_NOTHERE);
       return NOTE_ERROR;
     }
     if ((idx >= 0) && (echo))
@@ -801,9 +805,10 @@
     if (idx >= 0) {
       sprintf(ssf, "%lu:%s", dcc[idx].sock, botf);
       botnet_send_priv(i, ssf, x, p, "%s", msg);
-    } else
+    }
+    else
       botnet_send_priv(i, botf, x, p, "%s", msg);
-    return NOTE_OK;		/* Forwarded to the right bot */
+    return NOTE_OK;             /* Forwarded to the right bot */
   }
   /* Might be form "sock:nick" */
   splitc(ssf, from, ':');
@@ -811,14 +816,14 @@
   splitc(ss, to, ':');
   rmspace(ss);
   if (!ss[0])
-    sock = (-1);
+    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 (idx != -2) {            /* Notes from bots don't trigger it */
     if (check_tcl_note(from, to, msg)) {
       if ((idx >= 0) && (echo))
-	dprintf(idx, "-> %s: %s\n", to, msg);
+        dprintf(idx, "-> %s: %s\n", to, msg);
       return NOTE_TCL;
     }
   }
@@ -834,7 +839,7 @@
   }
   if (match_noterej(u, from)) {
     if (idx >= 0)
-       dprintf(idx, "%s %s\n", u->handle, "rejected your note.");
+      dprintf(idx, "%s %s\n", u->handle, "rejected your note.");
     return NOTE_REJECT;
   }
   status = NOTE_STORED;
@@ -842,53 +847,53 @@
   /* Online right now? */
   for (i = 0; i < dcc_total; i++) {
     if ((dcc[i].type->flags & DCT_GETNOTES) &&
-	((sock == (-1)) || (sock == dcc[i].sock)) &&
-	(!egg_strcasecmp(dcc[i].nick, to))) {
+        ((sock == -1) || (sock == dcc[i].sock)) &&
+        (!egg_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, BOT_USERAWAY,
-		    dcc[i].u.chat->away);
-	  if (!iaway)
-	    iaway = i;
-	  status = NOTE_AWAY;
-	}
+        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, BOT_USERAWAY,
+                    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 || (!egg_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;
+        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 || (!egg_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 */
+  if (idx == -2)
+    return NOTE_OK;             /* Error msg from a tandembot: don't store */
   /* Call store note here */
   Tcl_SetVar(interp, "_from", from, 0);
   Tcl_SetVar(interp, "_to", to, 0);
   Tcl_SetVar(interp, "_data", msg, 0);
   simple_sprintf(ss, "%d", dcc[idx].sock);
   Tcl_SetVar(interp, "_idx", ss, 0);
-  if (Tcl_VarEval(interp, "storenote", " $_from $_to $_data $_idx", NULL) == TCL_OK) {
+  if (Tcl_VarEval(interp, "storenote", " $_from $_to $_data $_idx", NULL) ==
+      TCL_OK) {
     if (interp->result && interp->result[0])
       status = NOTE_FWD;
     if (status == NOTE_AWAY) {
Index: eggdrop1.6/src/botnet.c
diff -u eggdrop1.6/src/botnet.c:1.46 eggdrop1.6/src/botnet.c:1.47
--- eggdrop1.6/src/botnet.c:1.46	Mon Dec 23 21:33:24 2002
+++ eggdrop1.6/src/botnet.c	Tue Jan 28 00:37:24 2003
@@ -7,7 +7,7 @@
  *   linking, unlinking, and relaying to another bot
  *   pinging the bots periodically and checking leaf status
  *
- * $Id: botnet.c,v 1.46 2002/12/24 03:33:24 wcc Exp $
+ * $Id: botnet.c,v 1.47 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -31,23 +31,22 @@
 #include "main.h"
 #include "tandem.h"
 
-extern int		 dcc_total, backgrd, connect_timeout, max_dcc,
-			 egg_numver;
-extern struct userrec	*userlist;
-extern struct dcc_t	*dcc;
-extern time_t		 now;
-extern Tcl_Interp	*interp;
-
-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? */
+extern int dcc_total, backgrd, connect_timeout, max_dcc, egg_numver;
+extern struct userrec *userlist;
+extern struct dcc_t *dcc;
+extern time_t now;
+extern Tcl_Interp *interp;
+
+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? */
 
 
 int expmem_botnet()
@@ -134,7 +133,7 @@
 
   for (i = 0; i < parties; i++) {
     if ((!egg_strcasecmp(party[i].bot, bot)) &&
-	(!egg_strcasecmp(party[i].nick, nick)))
+        (!egg_strcasecmp(party[i].nick, nick)))
       return party[i].sock;
   }
   return 0;
@@ -143,26 +142,25 @@
 /* New botnet member
  */
 int addparty(char *bot, char *nick, int chan, char flag, int sock,
-	     char *from, int *idx)
+             char *from, int *idx)
 {
   int i;
 
   for (i = 0; i < parties; i++) {
     /* Just changing the channel of someone already on? */
-    if (!egg_strcasecmp(party[i].bot, bot) &&
-	(party[i].sock == sock)) {
+    if (!egg_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)
-	  nfree(party[i].from);
-	party[i].from = nmalloc(strlen(from) + 1);
-	strcpy(party[i].from, from);
+        if (flag == ' ')
+          flag = '-';
+        party[i].flag = flag;
+        if (party[i].from)
+          nfree(party[i].from);
+        party[i].from = nmalloc(strlen(from) + 1);
+        strcpy(party[i].from, from);
       }
       *idx = i;
       return oldchan;
@@ -181,14 +179,15 @@
   party[parties].sock = sock;
   party[parties].status = 0;
   party[parties].away = 0;
-  party[parties].timer = now;	/* cope. */
+  party[parties].timer = now;   /* cope. */
   if (from[0]) {
     if (flag == ' ')
       flag = '-';
     party[parties].flag = flag;
     party[parties].from = nmalloc(strlen(from) + 1);
     strcpy(party[parties].from, from);
-  } else {
+  }
+  else {
     party[parties].flag = ' ';
     party[parties].from = nmalloc(10);
     strcpy(party[parties].from, "(unknown)");
@@ -205,8 +204,7 @@
   int i;
 
   for (i = 0; i < parties; i++) {
-    if ((!egg_strcasecmp(party[i].bot, bot)) &&
-	(party[i].sock == sock)) {
+    if ((!egg_strcasecmp(party[i].bot, bot)) && (party[i].sock == sock)) {
       party[i].status |= add;
       party[i].status &= ~rem;
     }
@@ -220,8 +218,7 @@
   int i;
 
   for (i = 0; i < parties; i++) {
-    if ((!egg_strcasecmp(party[i].bot, bot)) &&
-	(party[i].sock == sock)) {
+    if ((!egg_strcasecmp(party[i].bot, bot)) && (party[i].sock == sock)) {
       party[i].timer = (now - (time_t) secs);
     }
   }
@@ -234,8 +231,7 @@
   int i;
 
   for (i = 0; i < parties; i++) {
-    if (!egg_strcasecmp(party[i].bot, bot) &&
-	(party[i].sock == sock)) {
+    if (!egg_strcasecmp(party[i].bot, bot) && (party[i].sock == sock)) {
       return i;
     }
   }
@@ -250,7 +246,7 @@
 
   for (i = 0; i < parties; i++) {
     if ((!egg_strcasecmp(party[i].bot, bot)) &&
-	(!egg_strcasecmp(party[i].nick, nick))) {
+        (!egg_strcasecmp(party[i].nick, nick))) {
       party[i].timer = now;
       ok = 1;
     }
@@ -284,15 +280,15 @@
   int i;
 
   for (i = 0; i < parties; i++) {
-    if ((!egg_strcasecmp(party[i].bot, bot)) &&
-	(party[i].sock == sock)) {
+    if ((!egg_strcasecmp(party[i].bot, bot)) && (party[i].sock == sock)) {
       if (party[i].away)
-	nfree(party[i].away);
+        nfree(party[i].away);
       if (msg[0]) {
-	party[i].away = nmalloc(strlen(msg) + 1);
-	strcpy(party[i].away, msg);
-      } else
-	party[i].away = 0;
+        party[i].away = nmalloc(strlen(msg) + 1);
+        strcpy(party[i].away, msg);
+      }
+      else
+        party[i].away = 0;
     }
   }
 }
@@ -331,23 +327,22 @@
   int i;
 
   for (i = 0; i < parties; i++)
-    if ((!egg_strcasecmp(party[i].bot, bot)) &&
-	(party[i].sock == sock)) {
+    if ((!egg_strcasecmp(party[i].bot, bot)) && (party[i].sock == sock)) {
       parties--;
       if (party[i].from)
-	nfree(party[i].from);
+        nfree(party[i].from);
       if (party[i].away)
-	nfree(party[i].away);
+        nfree(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;
+        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;
       }
     }
 }
@@ -369,12 +364,12 @@
 
 /* Remove every bot linked 'via' bot <x>
  */
-void unvia(int idx, tand_t * who)
+void unvia(int idx, tand_t *who)
 {
   tand_t *bot, *bot2;
 
   if (!who)
-    return;			/* Safety */
+    return;                     /* Safety */
   rempartybot(who->bot);
   bot = tandbot;
   while (bot) {
@@ -383,7 +378,8 @@
       bot2 = bot->next;
       rembot(bot->bot);
       bot = bot2;
-    } else
+    }
+    else
       bot = bot->next;
   }
 #ifndef NO_OLD_BOTNET
@@ -406,9 +402,9 @@
 
   for (j = 0; j < dcc_total; j++)
     if (bot->via && !egg_strcasecmp(bot->via->bot, dcc[j].nick) &&
-	(dcc[j].type == &DCC_BOT))
+        (dcc[j].type == &DCC_BOT))
       return j;
-  return -1;			/* We're not connected to 'via' */
+  return -1;                    /* We're not connected to 'via' */
 }
 
 /* Return name of the bot that is directly connected to bot X
@@ -431,102 +427,114 @@
 {
   char format[81];
   char c, idle[40];
-  int i, t, nicklen, botnicklen, total=0;
+  int i, t, nicklen, botnicklen, total = 0;
 
-  if (chan == (-1))
+  if (chan == -1)
     dprintf(idx, "%s (+: %s, *: %s)\n", BOT_BOTNETUSERS, BOT_PARTYLINE,
-	    BOT_LOCALCHAN);
+            BOT_LOCALCHAN);
   else if (chan > 0) {
     simple_sprintf(idle, "assoc %d", chan);
     if ((Tcl_Eval(interp, idle) != TCL_OK) || !interp->result[0])
       dprintf(idx, "%s %s%d:\n", BOT_USERSONCHAN,
-	      (chan < GLOBAL_CHANS) ? "" : "*", chan % GLOBAL_CHANS);
+              (chan < GLOBAL_CHANS) ? "" : "*", chan % GLOBAL_CHANS);
     else
       dprintf(idx, "%s '%s%s' (%s%d):\n", BOT_USERSONCHAN,
-	      (chan < GLOBAL_CHANS) ? "" : "*", interp->result,
-	      (chan < GLOBAL_CHANS) ? "" : "*", chan % GLOBAL_CHANS);
+              (chan < GLOBAL_CHANS) ? "" : "*", interp->result,
+              (chan < GLOBAL_CHANS) ? "" : "*", chan % GLOBAL_CHANS);
   }
   /* 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;
+      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;
-
-  egg_snprintf(format, sizeof format, "%%-%us   %%-%us  %%s\n", 
-                                  nicklen, botnicklen);
-  dprintf(idx, format, " Nick", 	" Bot",      " Host");
-  dprintf(idx, format, "----------",	"---------", "--------------------");
-  egg_snprintf(format, sizeof format, "%%c%%-%us %%c %%-%us  %%s%%s\n", 
-                                  nicklen, botnicklen);
+    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;
+
+  egg_snprintf(format, sizeof format, "%%-%us   %%-%us  %%s\n",
+               nicklen, botnicklen);
+  dprintf(idx, format, " Nick", " Bot", " Host");
+  dprintf(idx, format, "----------", "---------", "--------------------");
+  egg_snprintf(format, sizeof format, "%%c%%-%us %%c %%-%us  %%s%%s\n",
+               nicklen, botnicklen);
   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(i);
-	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;
+      if ((chan == -1) || ((chan >= 0) && (dcc[i].u.chat->channel == chan))) {
+        c = geticon(i);
+        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;
         total++;
-	dprintf(idx, format, c, dcc[i].nick, 
-		(dcc[i].u.chat->channel == 0) && (chan == (-1)) ? '+' :
-		(dcc[i].u.chat->channel > GLOBAL_CHANS) &&
-		(chan == (-1)) ? '*' : ' ', botnetnick, dcc[i].host, idle);
-	if (dcc[i].u.chat->away != NULL)
-	  dprintf(idx, "   AWAY: %s\n", dcc[i].u.chat->away);
+        dprintf(idx, format, c, dcc[i].nick,
+                (dcc[i].u.chat->channel == 0) && (chan == -1) ? '+' :
+                (dcc[i].u.chat->channel > GLOBAL_CHANS) &&
+                (chan == -1) ? '*' : ' ', botnetnick, dcc[i].host, idle);
+        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))) {
+    if ((chan == -1) || ((chan >= 0) && (party[i].chan == chan))) {
       c = party[i].flag;
       if (c == '-')
-	c = ' ';
+        c = ' ';
       if (party[i].timer == 0L)
-	strcpy(idle, " [idle?]");
+        strcpy(idle, " [idle?]");
       else if (now - party[i].timer > 300) {
-	unsigned long days, hrs, mins;
+        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;
+        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;
       total++;
-      dprintf(idx, format, c, party[i].nick, 
-	      (party[i].chan == 0) && (chan == (-1)) ? '+' : ' ',
-	      party[i].bot, party[i].from, idle);
+      dprintf(idx, format, c, party[i].nick,
+              (party[i].chan == 0) && (chan == -1) ? '+' : ' ',
+              party[i].bot, party[i].from, idle);
       if (party[i].status & PLSTAT_AWAY)
-	dprintf(idx, "   %s: %s\n", MISC_AWAY,
-		party[i].away ? party[i].away : "");
+        dprintf(idx, "   %s: %s\n", MISC_AWAY,
+                party[i].away ? party[i].away : "");
     }
   }
   dprintf(idx, "Total users: %d\n", total);
@@ -585,8 +593,8 @@
   for (bot = tandbot; bot; bot = bot->next)
     if (!bot->uplink) {
       if (i) {
-	s[i++] = ',';
-	s[i++] = ' ';
+        s[i++] = ',';
+        s[i++] = ' ';
       }
       strcpy(s + i, bot->bot);
       i += strlen(bot->bot);
@@ -595,10 +603,9 @@
     dprintf(idx, "(%s %s)\n", BOT_NOTRACEINFO, 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);
+            egg_numver / 1000000,
+            egg_numver % 1000000 / 10000,
+            egg_numver % 10000 / 100, egg_numver % 100);
   else
     dprintf(idx, "%s\n", botnetnick);
   this = (tand_t *) 1;
@@ -612,116 +619,118 @@
     tothops += lev;
     for (bot = tandbot; bot; bot = bot->next)
       if (bot->uplink == this)
-	cnt++;
+        cnt++;
     if (cnt) {
       imark = 0;
       for (i = 0; i < lev; i++) {
-	if (mark[i])
-	  strcpy(work + imark, "  |  ");
-	else
-	  strcpy(work + imark, "     ");
-	imark += 5;
+        if (mark[i])
+          strcpy(work + imark, "  |  ");
+        else
+          strcpy(work + imark, "     ");
+        imark += 5;
       }
       if (cnt > 1)
-	strcpy(work + imark, "  |-");
+        strcpy(work + imark, "  |-");
       else
-	strcpy(work + imark, "  `-");
+        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;
+        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;
+        mark[lev] = 1;
       else
-	mark[lev] = 0;
+        mark[lev] = 0;
       work[0] = 0;
       last[lev] = this;
       this = bot;
       lev++;
       more = 1;
-    } else {
+    }
+    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];
-	  }
-	}
+        /* 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);
+          ((float) tothops) / ((float) tands), tands + 1);
 }
 
 /* Dump list of links to a new bot
@@ -742,80 +751,82 @@
 #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);
+                         p, bot->share, bot->ver);
     else
 #endif
       l = simple_sprintf(x, "n %s %s %c%D\n", bot->bot, p,
-			 bot->share, bot->ver);
+                         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 < GLOBAL_CHANS)) {
+        if ((dcc[i].u.chat->channel >= 0) &&
+            (dcc[i].u.chat->channel < GLOBAL_CHANS)) {
 #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(i),
-			       dcc[i].sock, dcc[i].host);
-	  else
+          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(i),
+                               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(i),
-			       dcc[i].sock, dcc[i].host);
-	  tputs(dcc[z].sock, x, l);
+            l = simple_sprintf(x, "j !%s %s %D %c%D %s\n",
+                               botnetnick, dcc[i].nick,
+                               dcc[i].u.chat->channel, geticon(i),
+                               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
+          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);
-	}
+            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);
+        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);
+        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
+        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);
+          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);
       }
     }
   }
@@ -876,56 +887,56 @@
   for (i = 0; i < dcc_total; i++) {
     if ((nick[0] == '*') || !egg_strcasecmp(dcc[i].nick, nick)) {
       if (dcc[i].type == &DCC_FORK_BOT) {
-	if (idx >= 0)
-	  dprintf(idx, "%s: %s -> %s.\n", BOT_KILLLINKATTEMPT,
-		  dcc[i].nick, dcc[i].host);
-	putlog(LOG_BOTS, "*", "%s: %s -> %s:%d",
-	       BOT_KILLLINKATTEMPT, 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", BOT_ENDLINKATTEMPT,
-		  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", BOT_BREAKLINK, 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]) {
-	  simple_sprintf(s, "%s %s (%s (%s)) (lost %d bot%s and %d user%s)",
-	  		 BOT_UNLINKEDFROM, dcc[i].nick, reason, from, bots,
-			 (bots != 1) ? "s" : "", users, (users != 1) ?
-			 "s" : "");
-	  dprintf(i, "bye %s\n", reason);
-	} else {
-	  simple_sprintf(s, "%s %s (%s) (lost %d bot%s and %d user%s)",
-	  		 BOT_UNLINKEDFROM, dcc[i].nick, from, bots,
+        if (idx >= 0)
+          dprintf(idx, "%s: %s -> %s.\n", BOT_KILLLINKATTEMPT,
+                  dcc[i].nick, dcc[i].host);
+        putlog(LOG_BOTS, "*", "%s: %s -> %s:%d",
+               BOT_KILLLINKATTEMPT, 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", BOT_ENDLINKATTEMPT, 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", BOT_BREAKLINK, 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]) {
+          simple_sprintf(s, "%s %s (%s (%s)) (lost %d bot%s and %d user%s)",
+                         BOT_UNLINKEDFROM, dcc[i].nick, reason, from, bots,
+                         (bots != 1) ? "s" : "", users, (users != 1) ?
+                         "s" : "");
+          dprintf(i, "bye %s\n", reason);
+        }
+        else {
+          simple_sprintf(s, "%s %s (%s) (lost %d bot%s and %d user%s)",
+                         BOT_UNLINKEDFROM, dcc[i].nick, from, 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;
+                         (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;
       }
     }
   }
@@ -935,19 +946,19 @@
     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)  */
+       * 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";
+                    "   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);
+        dprintf(idx, ghost, nick);
       else
-	putlog(LOG_MISC, "*", ghost, nick);
+        putlog(LOG_MISC, "*", ghost, nick);
       rembot(bot->bot);
       return 1;
     }
@@ -961,7 +972,7 @@
       /* Assert? */
       if (party[i].chan >= 0)
         check_tcl_chpt(party[i].bot, party[i].nick, party[i].sock,
-		       party[i].chan);
+                       party[i].chan);
     }
     strcpy(s, "killassoc &");
     Tcl_Eval(interp, s);
@@ -984,38 +995,43 @@
   if (!u || !(u->flags & USER_BOT)) {
     if (idx >= 0)
       dprintf(idx, "%s %s\n", nick, BOT_BOTUNKNOWN);
-  } else if (!egg_strcasecmp(nick, botnetnick)) {
+  }
+  else if (!egg_strcasecmp(nick, botnetnick)) {
     if (idx >= 0)
       dprintf(idx, "%s\n", BOT_CANTLINKMYSELF);
-  } else if (in_chain(nick) && (idx != -3)) {
+  }
+  else if (in_chain(nick) && (idx != -3)) {
     if (idx >= 0)
       dprintf(idx, "%s\n", BOT_ALREADYLINKED);
-  } else {
+  }
+  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, "%s\n", BOT_ALREADYLINKING);
-	return 0;
+          ((dcc[i].type == &DCC_FORK_BOT) || (dcc[i].type == &DCC_BOT_NEW))) {
+        if (idx >= 0)
+          dprintf(idx, "%s\n", BOT_ALREADYLINKING);
+        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 (!bi || !strlen(bi->address) || !bi->telnet_port ||
+        (bi->telnet_port <= 0)) {
       if (idx >= 0) {
-	dprintf(idx, "%s '%s'.\n", BOT_NOTELNETADDY, nick);
-	dprintf(idx, "%s .chaddr %s %s\n",
-		MISC_USEFORMAT, nick, MISC_CHADDRFORMAT);
+        dprintf(idx, "%s '%s'.\n", BOT_NOTELNETADDY, nick);
+        dprintf(idx, "%s .chaddr %s %s\n",
+                MISC_USEFORMAT, nick, MISC_CHADDRFORMAT);
       }
-    } else if (dcc_total == max_dcc) {
+    }
+    else if (dcc_total == max_dcc) {
       if (idx >= 0)
-	dprintf(idx, "%s\n", DCC_TOOMANYDCCS1);
-    } else {
+        dprintf(idx, "%s\n", DCC_TOOMANYDCCS1);
+    }
+    else {
       correct_handle(nick);
 
       if (idx > -2)
-	putlog(LOG_BOTS, "*", "%s %s at %s:%d ...", BOT_LINKING, nick,
-	       bi->address, bi->telnet_port);
+        putlog(LOG_BOTS, "*", "%s %s at %s:%d ...", BOT_LINKING, nick,
+               bi->address, bi->telnet_port);
 
       i = new_dcc(&DCC_DNSWAIT, sizeof(struct dns_info));
       dcc[i].timeval = now;
@@ -1047,7 +1063,7 @@
   strcpy(s, dcc[i].nick);
   nfree(dcc[i].u.dns->cptr);
   lostdcc(i);
-  autolink_cycle(s);          /* Check for more auto-connections */
+  autolink_cycle(s);            /* Check for more auto-connections */
 }
 
 static void botlink_resolve_success(int i)
@@ -1061,26 +1077,26 @@
   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].u.bot->port = dcc[i].port;     /* Remember where i started */
   dcc[i].sock = getsock(SOCK_STRONGCONN);
   nfree(linker);
   if (dcc[i].sock < 0 ||
       open_telnet_raw(dcc[i].sock, iptostr(htonl(dcc[i].addr)),
-		      dcc[i].port) < 0)
+                      dcc[i].port) < 0)
     failed_link(i);
 }
 
 static void failed_tandem_relay(int idx)
 {
-  int uidx = (-1), i;
+  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))
+        (dcc[i].u.relay->sock == dcc[idx].sock))
       uidx = i;
   if (uidx < 0) {
     putlog(LOG_MISC, "*", "%s  %d -> %d", BOT_CANTFINDRELAYUSER,
-	   dcc[idx].sock, dcc[idx].u.relay->sock);
+           dcc[idx].sock, dcc[idx].u.relay->sock);
     killsock(dcc[idx].sock);
     lostdcc(idx);
     return;
@@ -1104,8 +1120,8 @@
   dcc[idx].timeval = now;
   if (dcc[idx].sock < 0 ||
       open_telnet_raw(dcc[idx].sock, dcc[idx].addr ?
-				     iptostr(htonl(dcc[idx].addr)) :
-				     dcc[idx].host, dcc[idx].port) < 0)
+                      iptostr(htonl(dcc[idx].addr)) :
+                      dcc[idx].host, dcc[idx].port) < 0)
     failed_tandem_relay(idx);
 }
 
@@ -1134,9 +1150,8 @@
   bi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u);
   if (!bi || !strlen(bi->address) || !bi->relay_port || (bi->relay_port <= 0)) {
     dprintf(idx, "%s '%s'.\n", BOT_NOTELNETADDY, nick);
-    dprintf(idx, "%s .chaddr %s %s\n",
-	    MISC_USEFORMAT, nick, MISC_CHADDRFORMAT);
-
+    dprintf(idx, "%s .chaddr %s %s\n", MISC_USEFORMAT, nick,
+            MISC_CHADDRFORMAT);
     return;
   }
   i = new_dcc(&DCC_DNSWAIT, sizeof(struct dns_info));
@@ -1158,7 +1173,7 @@
   dcc[i].user = u;
   strcpy(dcc[i].host, bi->address);
   dprintf(idx, "%s %s @ %s:%d ...\n", BOT_CONNECTINGTO, nick,
-	  bi->address, bi->relay_port);
+          bi->address, bi->relay_port);
   dprintf(idx, "%s\n", BOT_BYEINFO1);
   dcc[idx].type = &DCC_PRE_RELAY;
   ci = dcc[idx].u.chat;
@@ -1180,17 +1195,17 @@
 static void tandem_relay_resolve_failure(int idx)
 {
   struct chat_info *ci;
-  register int uidx = (-1), i;
+  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)) {
+        (dcc[i].u.relay->sock == dcc[idx].sock)) {
       uidx = i;
       break;
     }
   if (uidx < 0) {
     putlog(LOG_MISC, "*", "%s  %d -> %d", BOT_CANTFINDRELAYUSER,
-	   dcc[idx].sock, dcc[idx].u.relay->sock);
+           dcc[idx].sock, dcc[idx].u.relay->sock);
     killsock(dcc[idx].sock);
     lostdcc(idx);
     return;
@@ -1224,7 +1239,7 @@
   dcc[i].u.relay->chat->current_lines = 0;
   dcc[i].timeval = now;
   if (open_telnet_raw(dcc[i].sock, iptostr(htonl(dcc[i].addr)),
-		      dcc[i].port) < 0)
+                      dcc[i].port) < 0)
     failed_tandem_relay(i);
 }
 
@@ -1232,11 +1247,11 @@
  */
 static void pre_relay(int idx, char *buf, register int i)
 {
-  register int tidx = (-1);
+  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)) {
+        (dcc[i].u.relay->sock == dcc[idx].sock)) {
       tidx = i;
       break;
     }
@@ -1244,14 +1259,14 @@
     /* 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;
+          (dcc[i].sock == dcc[idx].u.relay->sock)) {
+        tidx = i;
+        break;
       }
   }
   if (tidx < 0) {
     putlog(LOG_MISC, "*", "%s  %d -> %d", BOT_CANTFINDRELAYUSER,
-	   dcc[idx].sock, dcc[idx].u.relay->sock);
+           dcc[idx].sock, dcc[idx].u.relay->sock);
     killsock(dcc[idx].sock);
     lostdcc(idx);
     return;
@@ -1263,7 +1278,7 @@
     dprintf(idx, "%s %s.\n", BOT_ABORTRELAY1, dcc[tidx].nick);
     dprintf(idx, "%s %s.\n\n", BOT_ABORTRELAY2, botnetnick);
     putlog(LOG_MISC, "*", "%s %s -> %s", BOT_ABORTRELAY3, dcc[idx].nick,
-	   dcc[tidx].nick);
+           dcc[tidx].nick);
     dcc[idx].status = dcc[idx].u.relay->old_status;
     nfree(dcc[idx].u.relay);
     dcc[idx].u.chat = ci;
@@ -1278,11 +1293,11 @@
  */
 static void failed_pre_relay(int idx)
 {
-  register int tidx = (-1), i;
+  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)) {
+        (dcc[i].u.relay->sock == dcc[idx].sock)) {
       tidx = i;
       break;
     }
@@ -1290,20 +1305,20 @@
     /* 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;
+          (dcc[i].sock == dcc[idx].u.relay->sock)) {
+        tidx = i;
+        break;
       }
   }
   if (tidx < 0) {
     putlog(LOG_MISC, "*", "%s  %d -> %d", BOT_CANTFINDRELAYUSER,
-	   dcc[idx].sock, dcc[idx].u.relay->sock);
+           dcc[idx].sock, dcc[idx].u.relay->sock);
     killsock(dcc[idx].sock);
     lostdcc(idx);
     return;
   }
   putlog(LOG_MISC, "*", "%s [%s]%s/%d", BOT_LOSTDCCUSER, dcc[idx].nick,
-	 dcc[idx].host, dcc[idx].port);
+         dcc[idx].host, dcc[idx].port);
   putlog(LOG_MISC, "*", "(%s %s)", BOT_DROPPINGRELAY, dcc[tidx].nick);
   if ((dcc[tidx].sock != STDOUT) || backgrd) {
     if (idx > tidx) {
@@ -1314,25 +1329,25 @@
     }
     killsock(dcc[tidx].sock);
     lostdcc(tidx);
-  } else {
-    fatal("Lost my terminal?!", 0);
   }
+  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);
+  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))
+        (dcc[i].u.relay->sock == dcc[idx].sock))
       uidx = i;
   if (uidx < 0) {
     putlog(LOG_MISC, "*", "%s  %d -> %d", BOT_CANTFINDRELAYUSER,
-	   dcc[i].sock, dcc[i].u.relay->sock);
+           dcc[i].sock, dcc[i].u.relay->sock);
     killsock(dcc[i].sock);
     lostdcc(i);
     return;
@@ -1343,17 +1358,17 @@
   dprintf(uidx, "%s %s ...\n", BOT_RELAYSUCCESS, dcc[idx].nick);
   dprintf(uidx, "%s\n\n", BOT_BYEINFO2);
   putlog(LOG_MISC, "*", "%s %s -> %s", BOT_RELAYLINK,
-	 dcc[uidx].nick, dcc[idx].nick);
-  ri = dcc[uidx].u.relay;	/* YEAH */
+         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, BOT_PARTYLEFT);
+                dcc[uidx].nick, BOT_PARTYLEFT);
     if (dcc[uidx].u.chat->channel < GLOBAL_CHANS)
       botnet_send_part_idx(uidx, NULL);
     check_tcl_chpt(botnetnick, dcc[uidx].nick, dcc[uidx].sock,
-		   dcc[uidx].u.chat->channel);
+                   dcc[uidx].u.chat->channel);
   }
   check_tcl_chof(dcc[uidx].nick, dcc[uidx].sock);
   dcc[uidx].type = &DCC_RELAYING;
@@ -1378,7 +1393,7 @@
   if (dcc[j].status & STAT_TELNET)
     dprintf(j, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n");
   putlog(LOG_MISC, "*", "%s: %s -> %s", BOT_ENDRELAY1, dcc[j].nick,
-	 dcc[idx].nick);
+         dcc[idx].nick);
   dprintf(j, "\n\n*** %s %s\n", BOT_ENDRELAY2, botnetnick);
   ci = dcc[j].u.relay->chat;
   nfree(dcc[j].u.relay);
@@ -1386,13 +1401,13 @@
   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, BOT_PARTYREJOINED);
+                dcc[j].nick, BOT_PARTYREJOINED);
     if (dcc[j].u.chat->channel < GLOBAL_CHANS)
       botnet_send_join_idx(j, -1);
   }
   check_tcl_chon(dcc[j].nick, dcc[j].sock);
   check_tcl_chjn(botnetnick, dcc[j].nick, dcc[j].u.chat->channel,
-		 geticon(j), dcc[j].sock, dcc[j].host);
+                 geticon(j), dcc[j].sock, dcc[j].host);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -1402,13 +1417,13 @@
   register int j, x = dcc[idx].u.relay->sock;
 
   putlog(LOG_MISC, "*", "%s [%s]%s/%d", BOT_LOSTDCCUSER, dcc[idx].nick,
-	 dcc[idx].host, dcc[idx].port);
+         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)", BOT_DROPPEDRELAY, dcc[j].nick);
   killsock(dcc[j].sock);
-  lostdcc(j);			/* Drop connection to the bot */
+  lostdcc(j);                   /* Drop connection to the bot */
 }
 
 static void dcc_relay(int idx, char *buf, int j)
@@ -1419,30 +1434,31 @@
   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. */
+   * 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. */
+        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));
+        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");
@@ -1474,10 +1490,10 @@
   dprintf(idx, "\n(%s %s.)\n", BOT_BREAKRELAY, dcc[j].nick);
   dprintf(idx, "%s %s.\n\n", BOT_ABORTRELAY2, botnetnick);
   putlog(LOG_MISC, "*", "%s: %s -> %s", BOT_RELAYBROKEN,
-	 dcc[idx].nick, dcc[j].nick);
+         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);
+                "*** %s joined the party line.\n", dcc[idx].nick);
     if (dcc[idx].u.relay->chat->channel < GLOBAL_CHANS)
       botnet_send_join_idx(idx, -1);
   }
@@ -1488,7 +1504,7 @@
   check_tcl_chon(dcc[idx].nick, dcc[idx].sock);
   if (dcc[idx].u.chat->channel >= 0)
     check_tcl_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
-		   geticon(idx), dcc[idx].sock, dcc[idx].host);
+                   geticon(idx), dcc[idx].sock, dcc[idx].host);
   killsock(dcc[j].sock);
   lostdcc(j);
 }
@@ -1532,10 +1548,9 @@
   nfree(p);
 }
 
-struct dcc_table DCC_RELAY =
-{
+struct dcc_table DCC_RELAY = {
   "RELAY",
-  0,				/* Flags */
+  0,                            /* Flags */
   eof_dcc_relay,
   dcc_relay,
   NULL,
@@ -1556,10 +1571,9 @@
     tputs(dcc[idx].sock, buf, strlen(buf));
 }
 
-struct dcc_table DCC_RELAYING =
-{
+struct dcc_table DCC_RELAYING = {
   "RELAYING",
-  0,				/* Flags */
+  0,                            /* Flags */
   eof_dcc_relaying,
   dcc_relaying,
   NULL,
@@ -1570,10 +1584,9 @@
   out_relay
 };
 
-struct dcc_table DCC_FORK_RELAY =
-{
+struct dcc_table DCC_FORK_RELAY = {
   "FORK_RELAY",
-  0,				/* Flags */
+  0,                            /* Flags */
   failed_tandem_relay,
   cont_tandem_relay,
   &connect_timeout,
@@ -1584,10 +1597,9 @@
   NULL
 };
 
-struct dcc_table DCC_PRE_RELAY =
-{
+struct dcc_table DCC_PRE_RELAY = {
   "PRE_RELAY",
-  0,				/* Flags */
+  0,                            /* Flags */
   failed_pre_relay,
   pre_relay,
   NULL,
@@ -1609,19 +1621,19 @@
   for (i = 0; i < dcc_total; i++)
     if (dcc[i].type == &DCC_BOT)
       if (dcc[i].status & STAT_PINGED) {
-	char s[1024];
+        char s[1024];
 
-	putlog(LOG_BOTS, "*", "%s: %s", BOT_PINGTIMEOUT, 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)", BOT_PINGTIMEOUT,
-		       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);
+        putlog(LOG_BOTS, "*", "%s: %s", BOT_PINGTIMEOUT, 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)",
+                       BOT_PINGTIMEOUT, 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) {
@@ -1633,32 +1645,33 @@
       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).", BOT_DISCONNECTED,
-		   dcc[i].nick, BOT_BOTNOTLEAFLIKE);
-	    dprintf(i, "bye %s\n", BOT_BOTNOTLEAFLIKE);
-	    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)",
-	    		   BOT_DISCONNECTED, dcc[i].nick, BOT_BOTNOTLEAFLIKE,
-			   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;
+        if ((via == bot->via) && (bot != via)) {
+          /* Not leaflike behavior */
+          if (dcc[i].status & STAT_WARNED) {
+            char s[1024];
+
+            putlog(LOG_BOTS, "*", "%s %s (%s).", BOT_DISCONNECTED,
+                   dcc[i].nick, BOT_BOTNOTLEAFLIKE);
+            dprintf(i, "bye %s\n", BOT_BOTNOTLEAFLIKE);
+            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)",
+                           BOT_DISCONNECTED, dcc[i].nick, BOT_BOTNOTLEAFLIKE,
+                           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;
       }
     }
 }
@@ -1673,8 +1686,8 @@
   bots = bots_in_subtree(bot);
   users = users_in_subtree(bot);
   simple_sprintf(s, "%s: %s (lost %d bot%s and %d user%s)", BOT_BOTDROPPED,
-  		 dcc[idx].nick, bots, (bots != 1) ? "s" : "", users,
-		 (users != 1) ? "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);
@@ -1690,11 +1703,11 @@
     if (dcc[i].type == &DCC_CHAT) {
       check_tcl_chon(dcc[i].nick, dcc[i].sock);
       check_tcl_chjn(botnetnick, dcc[i].nick, dcc[i].u.chat->channel,
-		     geticon(i), dcc[i].sock, dcc[i].host);
+                     geticon(i), dcc[i].sock, dcc[i].host);
     }
   }
   for (i = 0; i < parties; i++) {
     check_tcl_chjn(party[i].bot, party[i].nick, party[i].chan,
-		   party[i].flag, party[i].sock, party[i].from);
+                   party[i].flag, party[i].sock, party[i].from);
   }
 }
Index: eggdrop1.6/src/chan.h
diff -u eggdrop1.6/src/chan.h:1.34 eggdrop1.6/src/chan.h:1.35
--- eggdrop1.6/src/chan.h:1.34	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/src/chan.h	Tue Jan 28 00:37:24 2003
@@ -3,7 +3,7 @@
  *   stuff common to chan.c and mode.c
  *   users.h needs to be loaded too
  *
- * $Id: chan.h,v 1.34 2002/12/24 02:30:04 wcc Exp $
+ * $Id: chan.h,v 1.35 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -32,9 +32,9 @@
   char userhost[UHOSTLEN];
   time_t joined;
   unsigned short flags;
-  time_t split;			/* in case they were just netsplit	*/
-  time_t last;			/* for measuring idle time		*/
-  time_t delay;			/* for delayed autoop			*/
+  time_t split; /* in case they were just netsplit */
+  time_t last;  /* for measuring idle time         */
+  time_t delay; /* for delayed autoop              */
   struct userrec *user;
   int tried_getuser;
   struct memstruct *next;
@@ -117,32 +117,29 @@
   int members;
 };
 
-#define CHANINV    0x0001	/* +i					*/
-#define CHANPRIV   0x0002	/* +p					*/
-#define CHANSEC    0x0004	/* +s					*/
-#define CHANMODER  0x0008	/* +m					*/
-#define CHANTOPIC  0x0010	/* +t					*/
-#define CHANNOMSG  0x0020	/* +n					*/
-#define CHANLIMIT  0x0040	/* -l -- used only for protecting modes	*/
-#define CHANKEY    0x0080	/* +k					*/
-#define CHANANON   0x0100	/* +a -- ircd 2.9			*/
-#define CHANQUIET  0x0200	/* +q -- ircd 2.9			*/
-#define CHANNOCLR  0x0400	/* +c -- Bahamut			*/
-#define CHANREGON  0x0800	/* +R -- Bahamut			*/
-#define CHANMODREG 0x1000	/* +M -- Bahamut			*/
-#define CHANNOCTCP 0x2000	/* +C -- QuakeNet's ircu 2.10           */
-#define CHANLONLY  0x4000	/* +r -- ircu 2.10.11                   */
+#define CHANINV    0x0001  /* i                        */
+#define CHANPRIV   0x0002  /* p                        */
+#define CHANSEC    0x0004  /* s                        */
+#define CHANMODER  0x0008  /* m                        */
+#define CHANTOPIC  0x0010  /* t                        */
+#define CHANNOMSG  0x0020  /* n                        */
+#define CHANLIMIT  0x0040  /* l                        */
+#define CHANKEY    0x0080  /* k                        */
+#define CHANANON   0x0100  /* a - ircd 2.9             */
+#define CHANQUIET  0x0200  /* q - ircd 2.9             */
+#define CHANNOCLR  0x0400  /* c - Bahamut              */
+#define CHANREGON  0x0800  /* R - Bahamut              */
+#define CHANMODREG 0x1000  /* M - Bahamut              */
+#define CHANNOCTCP 0x2000  /* C - QuakeNet's ircu 2.10 */
+#define CHANLONLY  0x4000  /* r - ircu 2.10.11         */
 
 #define MODES_PER_LINE_MAX 6
 
-/* For every channel i'm supposed to be active on */
 struct chanset_t {
   struct chanset_t *next;
-  struct chan_t channel;	/* current information			*/
-  char dname[81];               /* what the users know the channel as,
-				   like !eggdev				*/
-  char name[81];                /* what the servers know the channel
-				   as, like !ABCDEeggdev		*/
+  struct chan_t channel;
+  char dname[81];        /* display name (!eggdev)               */
+  char name[81];         /* actual name (!ABCDEeggdev)           */
   char need_op[121];
   char need_key[121];
   char need_limit[121];
@@ -170,67 +167,60 @@
   int ban_time;
   int invite_time;
   int exempt_time;
-  maskrec *bans,		/* temporary channel bans		*/
-          *exempts,		/* temporary channel exempts		*/
-          *invites;		/* temporary channel invites		*/
-  /* desired channel modes: */
-  int mode_pls_prot;		/* modes to enforce			*/
-  int mode_mns_prot;		/* modes to reject			*/
-  int limit_prot;		/* desired limit			*/
-  char key_prot[121];		/* desired password			*/
-  /* queued mode changes: */
-  char pls[21];			/* positive mode changes		*/
-  char mns[21];			/* negative mode changes		*/
-  char *key;			/* new key to set			*/
-  char *rmkey;			/* old key to remove			*/
-  int limit;			/* new limit to set			*/
-  int bytes;			/* total bytes so far			*/
-  int compat;			/* to prevent mixing old/new modes	*/
+  maskrec *bans,         /* temporary channel bans            */
+          *exempts,      /* temporary channel exempts         */
+          *invites;      /* temporary channel invites         */
+  int mode_pls_prot;     /* modes to enforce                  */
+  int mode_mns_prot;     /* modes to reject                   */
+  int limit_prot;        /* desired limit                     */
+  char key_prot[121];    /* desired password                  */
+  char pls[21];          /* positive mode changes             */
+  char mns[21];          /* negative mode changes             */
+  char *key;             /* new key to set                    */
+  char *rmkey;           /* old key to remove                 */
+  int limit;             /* new limit to set                  */
+  int bytes;             /* total bytes so far                */
+  int compat;            /* prevents mixing of old/new modes  */
   struct {
     char *op;
     int type;
-  } cmode[MODES_PER_LINE_MAX];			/* parameter-type mode changes -	*/
-  /* detect floods */
+  } cmode[MODES_PER_LINE_MAX];
   char floodwho[FLOOD_CHAN_MAX][81];
   time_t floodtime[FLOOD_CHAN_MAX];
   int floodnum[FLOOD_CHAN_MAX];
-  char deopd[NICKLEN];		/* last person deop'd (must change	*/
+  char deopd[NICKLEN];   /* last user deopped                 */
 };
 
-/* behavior modes for the channel */
-#define CHAN_ENFORCEBANS    0x0001	   /* kick people who match channel bans */
-#define CHAN_DYNAMICBANS    0x0002	   /* only activate bans when needed     */
-#define CHAN_NOUSERBANS     0x0004	   /* don't let non-bots place bans      */
-#define CHAN_OPONJOIN       0x0008	   /* op +o people as soon as they join  */
-#define CHAN_BITCH          0x0010	   /* be a tightwad with ops             */
-#define CHAN_GREET          0x0020	   /* greet people with their info line  */
-#define CHAN_PROTECTOPS     0x0040	   /* re-op any +o people who get deop'd */
-#define CHAN_LOGSTATUS      0x0080	   /* log channel status every 5 mins    */
-#define CHAN_REVENGE        0x0100	   /* get revenge on bad people          */
-#define CHAN_SECRET         0x0200	   /* don't advertise channel on botnet  */
-#define CHAN_AUTOVOICE      0x0400	   /* dish out voice stuff automatically */
-#define CHAN_CYCLE          0x0800	   /* cycle the channel if possible      */
-#define CHAN_DONTKICKOPS    0x1000	   /* never kick +o flag people -arthur2 */
-#define CHAN_INACTIVE       0x2000	   /* no irc support for this channel
-                                         - drummer                           */
-#define CHAN_PROTECTFRIENDS 0x4000	   /* re-op any +f people who get deop'd */
-#define CHAN_SHARED         0x8000	   /* channel is being shared            */
-#define CHAN_SEEN           0x10000
-#define CHAN_REVENGEBOT     0x20000	   /* revenge on actions against the bot */
-#define CHAN_NODESYNCH      0x40000
-#define CHAN_AUTOHALFOP     0x80000    /* op +h people on join               */ 
-#define CHAN_PROTECTHALFOPS 0x100000   /* op +h people on join               */ 
-#define CHAN_ACTIVE         0x1000000  /* like i'm actually on the channel
-                                          and stuff                          */
-#define CHAN_PEND           0x2000000  /* just joined; waiting for end of
-                                          WHO list                           */
-#define CHAN_FLAGGED        0x4000000  /* flagged during rehash for delete   */
-#define CHAN_STATIC         0x8000000  /* channels that are NOT dynamic      */
+#define CHAN_ENFORCEBANS    0x0001     /* +enforcebans    */
+#define CHAN_DYNAMICBANS    0x0002     /* +dynamicbans    */
+#define CHAN_NOUSERBANS     0x0004     /* -userbans       */
+#define CHAN_OPONJOIN       0x0008     /* +autoop         */
+#define CHAN_BITCH          0x0010     /* +bitch          */
+#define CHAN_GREET          0x0020     /* +greet          */
+#define CHAN_PROTECTOPS     0x0040     /* +protectops     */
+#define CHAN_LOGSTATUS      0x0080     /* +statuslog      */
+#define CHAN_REVENGE        0x0100     /* +revenge        */
+#define CHAN_SECRET         0x0200     /* +secret         */
+#define CHAN_AUTOVOICE      0x0400     /* +autovoice      */
+#define CHAN_CYCLE          0x0800     /* +cycle          */
+#define CHAN_DONTKICKOPS    0x1000     /* +dontkickops    */
+#define CHAN_INACTIVE       0x2000     /* +inactive       */
+#define CHAN_PROTECTFRIENDS 0x4000     /* +protectfriends */
+#define CHAN_SHARED         0x8000     /* +shared         */
+#define CHAN_SEEN           0x10000    /* +seen           */
+#define CHAN_REVENGEBOT     0x20000    /* +revengebot     */
+#define CHAN_NODESYNCH      0x40000    /* +nodesynch      */
+#define CHAN_AUTOHALFOP     0x80000    /* +autohalfop     */
+#define CHAN_PROTECTHALFOPS 0x100000   /* +protecthalfops */
+#define CHAN_ACTIVE         0x1000000  /* -inactive       */
+
+#define CHAN_PEND           0x2000000  /* waiting for end of WHO list      */
+#define CHAN_FLAGGED        0x4000000  /* flagged for delete during rehash */
+#define CHAN_STATIC         0x8000000  /* non-dynamic channel              */
 #define CHAN_ASKEDBANS      0x10000000
-#define CHAN_ASKEDMODES     0x20000000 /* find out key-info on IRCu          */
-#define CHAN_JUPED          0x40000000 /* Is channel juped                   */
-#define CHAN_STOP_CYCLE     0x80000000 /* Some efnetservers have defined
-                                          NO_CHANOPS_WHEN_SPLIT              */
+#define CHAN_ASKEDMODES     0x20000000 /* find out key-info on IRCu        */
+#define CHAN_JUPED          0x40000000 /* channel is juped                 */
+#define CHAN_STOP_CYCLE     0x80000000 /* NO_CHANOPS_WHEN_SPLIT servers    */
 
 #define CHAN_ASKED_EXEMPTS  0x0001
 #define CHAN_ASKED_INVITED  0x0002
@@ -245,10 +235,8 @@
 struct chanset_t *findchan(const char *name);
 struct chanset_t *findchan_by_dname(const char *name);
 
-/* is this channel +s/+p? */
-#define channel_hidden(chan) (chan->channel.mode & (CHANPRIV | CHANSEC))
-/* is this channel +t? */
-#define channel_optopic(chan) (chan->channel.mode & CHANTOPIC)
+#define channel_hidden(chan) (chan->channel.mode & (CHANPRIV | CHANSEC)) /* +s or +p ? */
+#define channel_optopic(chan) (chan->channel.mode & CHANTOPIC) /* +t? */
 
 #define channel_active(chan)  (chan->status & CHAN_ACTIVE)
 #define channel_pending(chan)  (chan->status & CHAN_PEND)
@@ -295,4 +283,4 @@
   char *msg;
 };
 
-#endif				/* _EGG_CHAN_H */
+#endif /* _EGG_CHAN_H */
Index: eggdrop1.6/src/chanprog.c
diff -u eggdrop1.6/src/chanprog.c:1.37 eggdrop1.6/src/chanprog.c:1.38
--- eggdrop1.6/src/chanprog.c:1.37	Wed Jan 22 20:13:29 2003
+++ eggdrop1.6/src/chanprog.c	Tue Jan 28 00:37:24 2003
@@ -7,7 +7,7 @@
  *   telling the current programmed settings
  *   initializing a lot of stuff and loading the tcl scripts
  *
- * $Id: chanprog.c,v 1.37 2003/01/23 02:13:29 wcc Exp $
+ * $Id: chanprog.c,v 1.38 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -40,26 +40,24 @@
 #endif
 #include "modules.h"
 
-extern struct userrec	*userlist;
-extern log_t		*logs;
-extern Tcl_Interp	*interp;
-extern char		 ver[], botnetnick[], firewall[],
-			 motdfile[], userfile[], helpdir[], tempdir[],
-			 moddir[], notify_new[], owner[], configfile[];
-extern time_t		 now, online_since;
-extern int		 backgrd, term_z, con_chan, cache_hit, cache_miss,
-			 firewallport, default_flags, max_logs, conmask,
-			 protect_readonly, make_userfile, noshare,
-			 ignore_time;
-
-tcl_timer_t	 *timer = NULL;		/* Minutely timer		*/
-tcl_timer_t	 *utimer = NULL;	/* Secondly timer		*/
-unsigned long	  timer_id = 1;		/* Next timer of any sort will
-					   have this number		*/
-struct chanset_t *chanset = NULL;	/* Channel list			*/
-char		  admin[121] = "";	/* Admin info			*/
-char		  origbotname[NICKLEN + 1];
-char		  botname[NICKLEN + 1];	/* Primary botname		*/
+extern struct userrec *userlist;
+extern log_t *logs;
+extern Tcl_Interp *interp;
+extern char ver[], botnetnick[], firewall[], motdfile[], userfile[], helpdir[],
+            tempdir[], moddir[], notify_new[], owner[], configfile[];
+extern time_t now, online_since;
+extern int backgrd, term_z, con_chan, cache_hit, cache_miss, firewallport,
+           default_flags, max_logs, conmask, protect_readonly, make_userfile,
+           noshare, ignore_time;
+
+tcl_timer_t *timer = NULL;         /* Minutely timer               */
+tcl_timer_t *utimer = NULL;        /* Secondly timer               */
+unsigned long timer_id = 1;        /* Next timer of any sort will
+                                    * have this number             */
+struct chanset_t *chanset = NULL;  /* Channel list                 */
+char admin[121] = "";              /* Admin info                   */
+char origbotname[NICKLEN + 1];
+char botname[NICKLEN + 1];         /* Primary botname              */
 
 
 /* Remove space characters from beginning and end of string
@@ -71,7 +69,7 @@
   char *p;
 
   if (*s == '\0')
-	return;
+    return;
 
   /* Wipe end of string */
   for (p = s + strlen(s) - 1; ((whitespace(*p)) && (p >= s)); p--);
@@ -86,7 +84,7 @@
  */
 memberlist *ismember(struct chanset_t *chan, char *nick)
 {
-  register memberlist	*x;
+  register memberlist *x;
 
   for (x = chan->channel.member; x && x->nick[0]; x = x->next)
     if (!rfc_casecmp(x->nick, nick))
@@ -98,7 +96,7 @@
  */
 struct chanset_t *findchan(const char *name)
 {
-  register struct chanset_t	*chan;
+  register struct chanset_t *chan;
 
   for (chan = chanset; chan; chan = chan->next)
     if (!rfc_casecmp(chan->name, name))
@@ -110,7 +108,7 @@
  */
 struct chanset_t *findchan_by_dname(const char *name)
 {
-  register struct chanset_t	*chan;
+  register struct chanset_t *chan;
 
   for (chan = chanset; chan; chan = chan->next)
     if (!rfc_casecmp(chan->dname, name))
@@ -127,9 +125,9 @@
  */
 struct userrec *check_chanlist(const char *host)
 {
-  char				*nick, *uhost, buf[UHOSTLEN];
-  register memberlist		*m;
-  register struct chanset_t	*chan;
+  char *nick, *uhost, buf[UHOSTLEN];
+  register memberlist *m;
+  register struct chanset_t *chan;
 
   strncpyz(buf, host, sizeof buf);
   uhost = buf;
@@ -137,7 +135,7 @@
   for (chan = chanset; chan; chan = chan->next)
     for (m = chan->channel.member; m && m->nick[0]; m = m->next)
       if (!rfc_casecmp(nick, m->nick) && !egg_strcasecmp(uhost, m->userhost))
-	return m->user;
+        return m->user;
   return NULL;
 }
 
@@ -145,13 +143,13 @@
  */
 struct userrec *check_chanlist_hand(const char *hand)
 {
-  register struct chanset_t	*chan;
-  register memberlist		*m;
+  register struct chanset_t *chan;
+  register memberlist *m;
 
   for (chan = chanset; chan; chan = chan->next)
     for (m = chan->channel.member; m && m->nick[0]; m = m->next)
       if (m->user && !egg_strcasecmp(m->user->handle, hand))
-	return m->user;
+        return m->user;
   return NULL;
 }
 
@@ -162,8 +160,8 @@
  */
 void clear_chanlist(void)
 {
-  register memberlist		*m;
-  register struct chanset_t	*chan;
+  register memberlist *m;
+  register struct chanset_t *chan;
 
   for (chan = chanset; chan; chan = chan->next)
     for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
@@ -179,15 +177,15 @@
  */
 void clear_chanlist_member(const char *nick)
 {
-  register memberlist		*m;
-  register struct chanset_t	*chan;
+  register memberlist *m;
+  register struct chanset_t *chan;
 
   for (chan = chanset; chan; chan = chan->next)
     for (m = chan->channel.member; m && m->nick[0]; m = m->next)
       if (!rfc_casecmp(m->nick, nick)) {
-	m->user = NULL;
-	m->tried_getuser = 0;
-	break;
+        m->user = NULL;
+        m->tried_getuser = 0;
+        break;
       }
 }
 
@@ -195,9 +193,9 @@
  */
 void set_chanlist(const char *host, struct userrec *rec)
 {
-  char				*nick, *uhost, buf[UHOSTLEN];
-  register memberlist		*m;
-  register struct chanset_t	*chan;
+  char *nick, *uhost, buf[UHOSTLEN];
+  register memberlist *m;
+  register struct chanset_t *chan;
 
   strncpyz(buf, host, sizeof buf);
   uhost = buf;
@@ -205,15 +203,15 @@
   for (chan = chanset; chan; chan = chan->next)
     for (m = chan->channel.member; m && m->nick[0]; m = m->next)
       if (!rfc_casecmp(nick, m->nick) && !egg_strcasecmp(uhost, m->userhost))
-	m->user = rec;
+        m->user = rec;
 }
 
 /* Calculate the memory we should be using
  */
 int expmem_chanprog()
 {
-  register int		 tot = 0;
-  register tcl_timer_t	*t;
+  register int tot = 0;
+  register tcl_timer_t *t;
 
   for (t = timer; t; t = t->next)
     tot += sizeof(tcl_timer_t) + strlen(t->cmd) + 1;
@@ -265,6 +263,7 @@
   char *vers_t, *uni_t;
   int i;
   time_t now2, hr, min;
+
 #if HAVE_GETRUSAGE
   struct rusage ru;
 #else
@@ -280,7 +279,8 @@
     vers_t = " ";
     uni_t = "*unknown*";
 #ifdef HAVE_UNAME
-  } else {
+  }
+  else {
     vers_t = un.release;
     uni_t = un.sysname;
   }
@@ -288,7 +288,7 @@
 
   i = count_users(userlist);
   dprintf(idx, "I am %s, running %s:  %d user%s (mem: %uk)\n",
-	  botnetnick, ver, i, i == 1 ? "" : "s",
+          botnetnick, ver, i, i == 1 ? "" : "s",
           (int) (expected_memory() / 1024));
 
   now2 = now - online_since;
@@ -320,20 +320,20 @@
   getrusage(RUSAGE_SELF, &ru);
   hr = (int) ((ru.ru_utime.tv_sec + ru.ru_stime.tv_sec) / 60);
   min = (int) ((ru.ru_utime.tv_sec + ru.ru_stime.tv_sec) - (hr * 60));
-  sprintf(s2, "CPU %02d:%02d", (int) hr, (int) min);	/* Actally min/sec */
+  sprintf(s2, "CPU %02d:%02d", (int) hr, (int) min);    /* Actally min/sec */
 #else
 # if HAVE_CLOCK
   cl = (clock() / CLOCKS_PER_SEC);
   hr = (int) (cl / 60);
   min = (int) (cl - (hr * 60));
-  sprintf(s2, "CPU %02d:%02d", (int) hr, (int) min);	/* Actually min/sec */
+  sprintf(s2, "CPU %02d:%02d", (int) hr, (int) min);    /* Actually min/sec */
 # else
   sprintf(s2, "CPU ???");
 # endif
 #endif
   dprintf(idx, "%s %s  (%s)  %s  %s %4.1f%%\n", MISC_ONLINEFOR,
-	  s, s1, s2, MISC_CACHEHIT,
-	  100.0 * ((float) cache_hit) / ((float) (cache_hit + cache_miss)));
+          s, s1, s2, MISC_CACHEHIT,
+          100.0 * ((float) cache_hit) / ((float) (cache_hit + cache_miss)));
 
   if (admin[0])
     dprintf(idx, "Admin: %s\n", admin);
@@ -343,20 +343,20 @@
 
   /* info library */
   dprintf(idx, "%s %s\n", MISC_TCLLIBRARY,
-	  ((interp) && (Tcl_Eval(interp, "info library") == TCL_OK)) ?
-	  interp->result : "*unknown*");
+          ((interp) && (Tcl_Eval(interp, "info library") == TCL_OK)) ?
+          interp->result : "*unknown*");
 
   /* info tclversion/patchlevel */
   dprintf(idx, "%s %s (%s %s)\n", MISC_TCLVERSION,
-	  ((interp) && (Tcl_Eval(interp, "info patchlevel") == TCL_OK)) ?
-	  interp->result : (Tcl_Eval(interp, "info tclversion") == TCL_OK) ?
-	  interp->result : "*unknown*", MISC_TCLHVERSION,
-	  TCL_PATCH_LEVEL ? TCL_PATCH_LEVEL : "*unknown*");
+          ((interp) && (Tcl_Eval(interp, "info patchlevel") == TCL_OK)) ?
+          interp->result : (Tcl_Eval(interp, "info tclversion") == TCL_OK) ?
+          interp->result : "*unknown*", MISC_TCLHVERSION,
+          TCL_PATCH_LEVEL ? TCL_PATCH_LEVEL : "*unknown*");
 
 #if HAVE_TCL_THREADS
   dprintf(idx, "Tcl is threaded\n");
-#endif  
-	  
+#endif
+
 }
 
 /* Show all internal state variables
@@ -365,7 +365,7 @@
 {
   char s[1024];
   int i;
-  struct flag_record fr = {FR_GLOBAL, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL, 0, 0, 0, 0, 0 };
 
   dprintf(idx, "Botnet Nickname: %s\n", botnetnick);
   if (firewall[0])
@@ -381,14 +381,14 @@
 
   build_flags(s, &fr, NULL);
   dprintf(idx, "%s [%s], %s: %s\n", MISC_NEWUSERFLAGS, s,
-	  MISC_NOTIFY, notify_new);
+          MISC_NOTIFY, notify_new);
   if (owner[0])
     dprintf(idx, "%s: %s\n", MISC_PERMOWNER, owner);
   for (i = 0; i < max_logs; i++)
     if (logs[i].filename != NULL) {
       dprintf(idx, "Logfile #%d: %s on %s (%s: %s)\n", i + 1,
-	      logs[i].filename, logs[i].chname,
-	      masktype(logs[i].mask), maskname(logs[i].mask));
+              logs[i].filename, logs[i].chname,
+              masktype(logs[i].mask), maskname(logs[i].mask));
     }
   dprintf(idx, "Ignores last %d mins\n", ignore_time);
 }
@@ -407,7 +407,7 @@
       rmspace(s);
       u = get_user_by_handle(userlist, s);
       if (u)
-	u->flags = sanity_check(u->flags | USER_OWNER);
+        u->flags = sanity_check(u->flags | USER_OWNER);
       q = p + 1;
       p = strchr(q, ',');
     }
@@ -473,9 +473,10 @@
     if (module_find("server", 0, 0))
       printf(MISC_USERFCREATE1, origbotname);
     printf("%s\n\n", MISC_USERFCREATE2);
-  } else if (make_userfile) {
-     make_userfile = 0;
-     printf("%s\n", MISC_USERFEXISTS);
+  }
+  else if (make_userfile) {
+    make_userfile = 0;
+    printf("%s\n", MISC_USERFEXISTS);
   }
   if (helpdir[0])
     if (helpdir[strlen(helpdir) - 1] != '/')
@@ -494,7 +495,7 @@
      *        overwriting an existing file / following a malicious
      *        link.
      */
-    make_rand_str(rands, 7); /* create random string */
+    make_rand_str(rands, 7);    /* create random string */
     sprintf(s, "%s.test-%u-%s", tempdir, getpid(), rands);
     f = fopen(s, "w");
     if (f == NULL)
@@ -540,8 +541,8 @@
 
 /* Add a timer
  */
-unsigned long add_timer(tcl_timer_t **stack, int elapse, char *cmd,
-			unsigned long prev_id)
+unsigned long add_timer(tcl_timer_t ** stack, int elapse, char *cmd,
+                        unsigned long prev_id)
 {
   tcl_timer_t *old = (*stack);
 
@@ -552,7 +553,7 @@
   strcpy((*stack)->cmd, cmd);
   /* If it's just being added back and already had an id,
    * don't create a new one.
-  */
+   */
   if (prev_id > 0)
     (*stack)->id = prev_id;
   else
@@ -562,7 +563,7 @@
 
 /* Remove a timer, by id
  */
-int remove_timer(tcl_timer_t **stack, unsigned long id)
+int remove_timer(tcl_timer_t ** stack, unsigned long id)
 {
   tcl_timer_t *old;
   int ok = 0;
@@ -574,7 +575,8 @@
       *stack = ((*stack)->next);
       nfree(old->cmd);
       nfree(old);
-    } else
+    }
+    else
       stack = &((*stack)->next);
   }
   return ok;
@@ -582,7 +584,7 @@
 
 /* Check timers, execute the ones that have expired.
  */
-void do_check_timers(tcl_timer_t **stack)
+void do_check_timers(tcl_timer_t ** stack)
 {
   tcl_timer_t *mark = *stack, *old = NULL;
   char x[16];
@@ -602,7 +604,8 @@
       do_tcl(x, old->cmd);
       nfree(old->cmd);
       nfree(old);
-    } else {
+    }
+    else {
       old->next = *stack;
       *stack = old;
     }
@@ -630,6 +633,7 @@
 {
   tcl_timer_t *mark;
   char mins[10], id[16], *x;
+
 #if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
   CONST char *argv[3];
 #else
@@ -664,7 +668,7 @@
   while (1) {
     while (1) {
       if ((*pb == 0) || (*pb == ',') || (*pb == ' '))
-	break;
+        break;
       pb++;
     }
     pl = (unsigned int) pb - (unsigned int) pa;
@@ -672,7 +676,7 @@
       return (1);
     while (1) {
       if ((*pb == 0) || ((*pb != ',') && (*pb != ' ')))
-	break;
+        break;
       pb++;
     }
     if (*pb == 0)
Index: eggdrop1.6/src/cmds.c
diff -u eggdrop1.6/src/cmds.c:1.86 eggdrop1.6/src/cmds.c:1.87
--- eggdrop1.6/src/cmds.c:1.86	Mon Dec 23 21:33:24 2002
+++ eggdrop1.6/src/cmds.c	Tue Jan 28 00:37:24 2003
@@ -3,7 +3,7 @@
  *   commands from a user via dcc
  *   (split in 2, this portion contains no-irc commands)
  *
- * $Id: cmds.c,v 1.86 2002/12/24 03:33:24 wcc Exp $
+ * $Id: cmds.c,v 1.87 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -29,30 +29,26 @@
 #include "modules.h"
 #include <ctype.h>
 
-extern struct chanset_t	*chanset;
-extern struct dcc_t	*dcc;
-extern struct userrec	*userlist;
-extern tcl_timer_t	*timer, *utimer;
-extern int		 dcc_total, remote_boots, backgrd, make_userfile,
-			 do_restart, conmask, require_p, must_be_owner,
-			 strict_host;
-extern unsigned long	 otraffic_irc, otraffic_irc_today,
-			 itraffic_irc, itraffic_irc_today,
-			 otraffic_bn, otraffic_bn_today,
-			 itraffic_bn, itraffic_bn_today,
-			 otraffic_dcc, otraffic_dcc_today,
-			 itraffic_dcc, itraffic_dcc_today,
-			 otraffic_trans, otraffic_trans_today,
-			 itraffic_trans, itraffic_trans_today,
-			 otraffic_unknown, otraffic_unknown_today,
-			 itraffic_unknown, itraffic_unknown_today;
-extern Tcl_Interp	*interp;
-extern char		 botnetnick[], origbotname[], ver[], network[],
-			 owner[], quit_msg[];
-extern time_t		 now, online_since;
-extern module_entry	*module_list;
+extern struct chanset_t *chanset;
+extern struct dcc_t *dcc;
+extern struct userrec *userlist;
+extern tcl_timer_t *timer, *utimer;
+extern int dcc_total, remote_boots, backgrd, make_userfile, do_restart,
+           conmask, require_p, must_be_owner, strict_host;
+extern unsigned long otraffic_irc, otraffic_irc_today, itraffic_irc,
+                     itraffic_irc_today, otraffic_bn, otraffic_bn_today,
+                     itraffic_bn, itraffic_bn_today, otraffic_dcc,
+                     otraffic_dcc_today, itraffic_dcc, itraffic_dcc_today,
+                     otraffic_trans, otraffic_trans_today, itraffic_trans,
+                     itraffic_trans_today, otraffic_unknown,
+                     otraffic_unknown_today, itraffic_unknown,
+                     itraffic_unknown_today;
+extern Tcl_Interp *interp;
+extern char botnetnick[], origbotname[], ver[], network[], owner[], quit_msg[];
+extern time_t now, online_since;
+extern module_entry *module_list;
 
-static char	*btos(unsigned long);
+static char *btos(unsigned long);
 
 
 /* Add hostmask to a bot's record if possible.
@@ -66,23 +62,24 @@
       memberlist *m = ismember(chan, nick);
 
       if (m) {
-	char s[UHOSTLEN];
-	struct userrec *u;
+        char s[UHOSTLEN];
+        struct userrec *u;
 
-	egg_snprintf(s, sizeof s, "%s!%s", m->nick, m->userhost);
-	u = get_user_by_host(s);
-	if (u) {
-	  dprintf(idx, "(Can't add hostmask for %s because it matches %s)\n",
-		  nick, u->handle);
-	  return 0;
-	}
-	if (strchr("~^+=-", m->userhost[0]))
-	  egg_snprintf(s, sizeof s, "*!%s%s", strict_host ? "?" : "", m->userhost+1);
-	else
-	  egg_snprintf(s, sizeof s, "*!%s", m->userhost);
-	dprintf(idx, "(Added hostmask for %s from %s)\n", nick, chan->dname);
-	addhost_by_handle(nick, s);
-	return 1;
+        egg_snprintf(s, sizeof s, "%s!%s", m->nick, m->userhost);
+        u = get_user_by_host(s);
+        if (u) {
+          dprintf(idx, "(Can't add hostmask for %s because it matches %s)\n",
+                  nick, u->handle);
+          return 0;
+        }
+        if (strchr("~^+=-", m->userhost[0]))
+          egg_snprintf(s, sizeof s, "*!%s%s", strict_host ? "?" : "",
+                       m->userhost + 1);
+        else
+          egg_snprintf(s, sizeof s, "*!%s", m->userhost);
+        dprintf(idx, "(Added hostmask for %s from %s)\n", nick, chan->dname);
+        addhost_by_handle(nick, s);
+        return 1;
       }
     }
   return 0;
@@ -93,151 +90,154 @@
   int i, k, ok = 0, atr = u ? u->flags : 0;
   int nicklen;
   char format[81];
-  char s[1024];			/* temp fix - 1.4 has a better one */
+  char s[1024];                 /* temp fix - 1.4 has a better one */
 
   if (!chan)
     dprintf(idx, "%s  (* = %s, + = %s, @ = %s)\n",
-		BOT_PARTYMEMBS, MISC_OWNER, MISC_MASTER, MISC_OP);
+            BOT_PARTYMEMBS, MISC_OWNER, MISC_MASTER, MISC_OP);
   else {
     simple_sprintf(s, "assoc %d", chan);
     if ((Tcl_Eval(interp, s) != TCL_OK) || !interp->result[0])
       dprintf(idx, "%s %s%d:  (* = %s, + = %s, @ = %s)\n",
-		       BOT_PEOPLEONCHAN,
-		       (chan < GLOBAL_CHANS) ? "" : "*",
-		       chan % GLOBAL_CHANS,
-		       MISC_OWNER, MISC_MASTER, MISC_OP);
+              BOT_PEOPLEONCHAN,
+              (chan < GLOBAL_CHANS) ? "" : "*",
+              chan % GLOBAL_CHANS, MISC_OWNER, MISC_MASTER, MISC_OP);
     else
       dprintf(idx, "%s '%s' (%s%d):  (* = %s, + = %s, @ = %s)\n",
-		       BOT_PEOPLEONCHAN, interp->result,
-		       (chan < GLOBAL_CHANS) ? "" : "*",
-		       chan % GLOBAL_CHANS,
-		       MISC_OWNER, MISC_MASTER, MISC_OP);
+              BOT_PEOPLEONCHAN, interp->result,
+              (chan < GLOBAL_CHANS) ? "" : "*",
+              chan % GLOBAL_CHANS, MISC_OWNER, MISC_MASTER, MISC_OP);
   }
 
   /* calculate max nicklen */
   nicklen = 0;
   for (i = 0; i < dcc_total; i++) {
-      if(strlen(dcc[i].nick) > nicklen)
-          nicklen = strlen(dcc[i].nick);
+    if (strlen(dcc[i].nick) > nicklen)
+      nicklen = strlen(dcc[i].nick);
   }
-  if(nicklen < 9) nicklen = 9;
-  
+  if (nicklen < 9)
+    nicklen = 9;
+
   for (i = 0; i < dcc_total; i++)
     if (dcc[i].type == &DCC_CHAT)
       if (dcc[i].u.chat->channel == chan) {
-	if (atr & USER_OWNER) {
-	  egg_snprintf(format, sizeof format, "  [%%.2lu]  %%c%%-%us %%s", nicklen);
-	  sprintf(s, format,
-		  dcc[i].sock, (geticon(i) == '-' ? ' ' : geticon(i)),
-		  dcc[i].nick, dcc[i].host);
-	} else {
-	  egg_snprintf(format, sizeof format, "  %%c%%-%us %%s", nicklen);
-	  sprintf(s, format,
-		  (geticon(i) == '-' ? ' ' : geticon(i)),
-		  dcc[i].nick, dcc[i].host);
-	}
-	if (atr & USER_MASTER) {
-	  if (dcc[i].u.chat->con_flags)
-	    sprintf(&s[strlen(s)], " (con:%s)",
-		    masktype(dcc[i].u.chat->con_flags));
-	}
-	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[strlen(s)], " (idle %lud%luh)", days, hrs);
-	  else if (hrs > 0)
-	    sprintf(&s[strlen(s)], " (idle %luh%lum)", hrs, mins);
-	  else
-	    sprintf(&s[strlen(s)], " (idle %lum)", mins);
-	}
-	dprintf(idx, "%s\n", s);
-	if (dcc[i].u.chat->away != NULL)
-	  dprintf(idx, "      AWAY: %s\n", dcc[i].u.chat->away);
+        if (atr & USER_OWNER) {
+          egg_snprintf(format, sizeof format, "  [%%.2lu]  %%c%%-%us %%s",
+                       nicklen);
+          sprintf(s, format, dcc[i].sock,
+                  (geticon(i) == '-' ? ' ' : geticon(i)), dcc[i].nick,
+                  dcc[i].host);
+        }
+        else {
+          egg_snprintf(format, sizeof format, "  %%c%%-%us %%s", nicklen);
+          sprintf(s, format,
+                  (geticon(i) == '-' ? ' ' : geticon(i)),
+                  dcc[i].nick, dcc[i].host);
+        }
+        if (atr & USER_MASTER) {
+          if (dcc[i].u.chat->con_flags)
+            sprintf(&s[strlen(s)], " (con:%s)",
+                    masktype(dcc[i].u.chat->con_flags));
+        }
+        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[strlen(s)], " (idle %lud%luh)", days, hrs);
+          else if (hrs > 0)
+            sprintf(&s[strlen(s)], " (idle %luh%lum)", hrs, mins);
+          else
+            sprintf(&s[strlen(s)], " (idle %lum)", mins);
+        }
+        dprintf(idx, "%s\n", s);
+        if (dcc[i].u.chat->away != NULL)
+          dprintf(idx, "      AWAY: %s\n", dcc[i].u.chat->away);
       }
   for (i = 0; i < dcc_total; i++)
     if (dcc[i].type == &DCC_BOT) {
       if (!ok) {
-	ok = 1;
-	dprintf(idx, "Bots connected:\n");
+        ok = 1;
+        dprintf(idx, "Bots connected:\n");
       }
       egg_strftime(s, 14, "%d %b %H:%M", localtime(&dcc[i].timeval));
       if (atr & USER_OWNER) {
-        egg_snprintf(format, sizeof format, "  [%%.2lu]  %%s%%c%%-%us (%%s) %%s\n", 
-			    nicklen);
-	dprintf(idx, format,
-		dcc[i].sock, dcc[i].status & STAT_CALLED ? "<-" : "->",
-		dcc[i].status & STAT_SHARE ? '+' : ' ',
-		dcc[i].nick, s, dcc[i].u.bot->version);
-      } else {
-        egg_snprintf(format, sizeof format, "  %%s%%c%%-%us (%%s) %%s\n", nicklen);
-	dprintf(idx, format,
-		dcc[i].status & STAT_CALLED ? "<-" : "->",
-		dcc[i].status & STAT_SHARE ? '+' : ' ',
-		dcc[i].nick, s, dcc[i].u.bot->version);
+        egg_snprintf(format, sizeof format,
+                     "  [%%.2lu]  %%s%%c%%-%us (%%s) %%s\n", nicklen);
+        dprintf(idx, format, dcc[i].sock,
+                dcc[i].status & STAT_CALLED ? "<-" : "->",
+                dcc[i].status & STAT_SHARE ? '+' : ' ', dcc[i].nick, s,
+                dcc[i].u.bot->version);
+      }
+      else {
+        egg_snprintf(format, sizeof format, "  %%s%%c%%-%us (%%s) %%s\n",
+                     nicklen);
+        dprintf(idx, format, dcc[i].status & STAT_CALLED ? "<-" : "->",
+                dcc[i].status & STAT_SHARE ? '+' : ' ', dcc[i].nick, s,
+                dcc[i].u.bot->version);
       }
     }
   ok = 0;
   for (i = 0; i < dcc_total; i++) {
     if ((dcc[i].type == &DCC_CHAT) && (dcc[i].u.chat->channel != chan)) {
       if (!ok) {
-	ok = 1;
-	dprintf(idx, "Other people on the bot:\n");
+        ok = 1;
+        dprintf(idx, "Other people on the bot:\n");
       }
       if (atr & USER_OWNER) {
-	egg_snprintf(format, sizeof format, "  [%%.2lu]  %%c%%-%us ", nicklen);
-	sprintf(s, format, dcc[i].sock,
-		(geticon(i) == '-' ? ' ' : geticon(i)), dcc[i].nick);
-      } else {
-	egg_snprintf(format, sizeof format, "  %%c%%-%us ", nicklen);
-	sprintf(s, format,
-		(geticon(i) == '-' ? ' ' : geticon(i)), dcc[i].nick);
+        egg_snprintf(format, sizeof format, "  [%%.2lu]  %%c%%-%us ", nicklen);
+        sprintf(s, format, dcc[i].sock,
+                (geticon(i) == '-' ? ' ' : geticon(i)), dcc[i].nick);
+      }
+      else {
+        egg_snprintf(format, sizeof format, "  %%c%%-%us ", nicklen);
+        sprintf(s, format, (geticon(i) == '-' ? ' ' : geticon(i)), dcc[i].nick);
       }
       if (atr & USER_MASTER) {
-	if (dcc[i].u.chat->channel < 0)
-	  strcat(s, "(-OFF-) ");
-	else if (!dcc[i].u.chat->channel)
-	  strcat(s, "(party) ");
-	else
-	  sprintf(&s[strlen(s)], "(%5d) ", dcc[i].u.chat->channel);
+        if (dcc[i].u.chat->channel < 0)
+          strcat(s, "(-OFF-) ");
+        else if (!dcc[i].u.chat->channel)
+          strcat(s, "(party) ");
+        else
+          sprintf(&s[strlen(s)], "(%5d) ", dcc[i].u.chat->channel);
       }
       strcat(s, dcc[i].host);
       if (atr & USER_MASTER) {
-	if (dcc[i].u.chat->con_flags)
-	  sprintf(&s[strlen(s)], " (con:%s)",
-		  masktype(dcc[i].u.chat->con_flags));
+        if (dcc[i].u.chat->con_flags)
+          sprintf(&s[strlen(s)], " (con:%s)",
+                  masktype(dcc[i].u.chat->con_flags));
       }
       if (now - dcc[i].timeval > 300) {
-	k = (now - dcc[i].timeval) / 60;
-	if (k < 60)
-	  sprintf(&s[strlen(s)], " (idle %dm)", k);
-	else
-	  sprintf(&s[strlen(s)], " (idle %dh%dm)", k / 60, k % 60);
+        k = (now - dcc[i].timeval) / 60;
+        if (k < 60)
+          sprintf(&s[strlen(s)], " (idle %dm)", k);
+        else
+          sprintf(&s[strlen(s)], " (idle %dh%dm)", k / 60, k % 60);
       }
       dprintf(idx, "%s\n", s);
       if (dcc[i].u.chat->away != NULL)
-	dprintf(idx, "      AWAY: %s\n", dcc[i].u.chat->away);
+        dprintf(idx, "      AWAY: %s\n", dcc[i].u.chat->away);
     }
     if ((atr & USER_MASTER) && (dcc[i].type->flags & DCT_SHOWWHO) &&
-	(dcc[i].type != &DCC_CHAT)) {
+        (dcc[i].type != &DCC_CHAT)) {
       if (!ok) {
-	ok = 1;
-	dprintf(idx, "Other people on the bot:\n");
+        ok = 1;
+        dprintf(idx, "Other people on the bot:\n");
       }
       if (atr & USER_OWNER) {
-	egg_snprintf(format, sizeof format, "  [%%.2lu]  %%c%%-%us (files) %%s", 
-				nicklen);
-	sprintf(s, format,
-		dcc[i].sock, dcc[i].status & STAT_CHAT ? '+' : ' ',
-		dcc[i].nick, dcc[i].host);
-      } else {
-	egg_snprintf(format, sizeof format, "  %%c%%-%us (files) %%s", nicklen);
-	sprintf(s, format,
-		dcc[i].status & STAT_CHAT ? '+' : ' ',
-		dcc[i].nick, dcc[i].host);
+        egg_snprintf(format, sizeof format, "  [%%.2lu]  %%c%%-%us (files) %%s",
+                     nicklen);
+        sprintf(s, format,
+                dcc[i].sock, dcc[i].status & STAT_CHAT ? '+' : ' ',
+                dcc[i].nick, dcc[i].host);
+      }
+      else {
+        egg_snprintf(format, sizeof format, "  %%c%%-%us (files) %%s", nicklen);
+        sprintf(s, format,
+                dcc[i].status & STAT_CHAT ? '+' : ' ',
+                dcc[i].nick, dcc[i].host);
       }
       dprintf(idx, "%s\n", s);
     }
@@ -272,26 +272,28 @@
   botnet_send_infoq(-1, s);
   s[0] = 0;
   if (module_find("server", 0, 0)) {
-    for (chan = chanset; chan; chan = chan->next) { 
+    for (chan = chanset; chan; chan = chan->next) {
       if (!channel_secret(chan)) {
-	if ((strlen(s) + strlen(chan->dname) + strlen(network)
-                   + strlen(botnetnick) + strlen(ver) + 1) >= 490) {
-          strcat(s,"++  ");
-          break; /* yeesh! */
-	}
-	strcat(s, chan->dname);
-	strcat(s, ", ");
+        if ((strlen(s) + strlen(chan->dname) + strlen(network)
+             + strlen(botnetnick) + strlen(ver) + 1) >= 490) {
+          strcat(s, "++  ");
+          break;                /* yeesh! */
+        }
+        strcat(s, chan->dname);
+        strcat(s, ", ");
       }
     }
 
     if (s[0]) {
       s[strlen(s) - 2] = 0;
       dprintf(idx, "*** [%s] %s <%s> (%s) [UP %s]\n", botnetnick,
-	      ver, network, s, s2);
-    } else
+              ver, network, s, s2);
+    }
+    else
       dprintf(idx, "*** [%s] %s <%s> (%s) [UP %s]\n", botnetnick,
-	      ver, network, BOT_NOCHANNELS, s2);
-  } else
+              ver, network, BOT_NOCHANNELS, s2);
+  }
+  else
     dprintf(idx, "*** [%s] %s <NO_IRC> [UP %s]\n", botnetnick, ver, s2);
 }
 
@@ -301,30 +303,34 @@
     putlog(LOG_CMDS, "*", "#%s# whom %s", dcc[idx].nick, par);
     answer_local_whom(idx, -1);
     return;
-  } else if (dcc[idx].u.chat->channel < 0) {
+  }
+  else if (dcc[idx].u.chat->channel < 0) {
     dprintf(idx, "You have chat turned off.\n");
     return;
   }
   putlog(LOG_CMDS, "*", "#%s# whom %s", dcc[idx].nick, par);
   if (!par[0]) {
     answer_local_whom(idx, dcc[idx].u.chat->channel);
-  } else {
+  }
+  else {
     int chan = -1;
 
     if ((par[0] < '0') || (par[0] > '9')) {
       Tcl_SetVar(interp, "chan", par, 0);
       if ((Tcl_VarEval(interp, "assoc ", "$chan", NULL) == TCL_OK) &&
-	  interp->result[0]) {
-	chan = atoi(interp->result);
+          interp->result[0]) {
+        chan = atoi(interp->result);
       }
       if (chan <= 0) {
-	dprintf(idx, "No such channel exists.\n");
-	return;
+        dprintf(idx, "No such channel exists.\n");
+        return;
       }
-    } else
+    }
+    else
       chan = atoi(par);
     if ((chan < 0) || (chan > 99999)) {
-      dprintf(idx, "Channel number out of range: must be between 0 and 99999.\n");
+      dprintf(idx,
+              "Channel number out of range: must be between 0 and 99999.\n");
       return;
     }
     answer_local_whom(idx, chan);
@@ -347,11 +353,11 @@
     not_away(idx);
   for (i = 0; i < dcc_total; i++)
     if ((dcc[i].type->flags & DCT_CHAT) &&
-	(dcc[i].u.chat->channel == dcc[idx].u.chat->channel) &&
-	((i != idx) || (dcc[i].status & STAT_ECHO)))
+        (dcc[i].u.chat->channel == dcc[idx].u.chat->channel) &&
+        ((i != idx) || (dcc[i].status & STAT_ECHO)))
       dprintf(i, "* %s %s\n", dcc[idx].nick, par);
   botnet_send_act(idx, botnetnick, dcc[idx].nick,
-		  dcc[idx].u.chat->channel, par);
+                  dcc[idx].u.chat->channel, par);
   check_tcl_act(dcc[idx].nick, dcc[idx].u.chat->channel, par);
 }
 
@@ -366,18 +372,19 @@
     else {
       i = nextbot(par);
       if (i < 0)
-	dprintf(idx, "That bot isn't connected.\n");
+        dprintf(idx, "That bot isn't connected.\n");
       else {
-	char x[40];
+        char x[40];
 
-	simple_sprintf(x, "%s%d:%s@%s",
-		       (u->flags & USER_HIGHLITE) ?
-		       ((dcc[idx].status & STAT_TELNET) ? "#" : "!") : "",
-		       dcc[idx].sock, dcc[idx].nick, botnetnick);
-	botnet_send_motd(i, x, par);
+        simple_sprintf(x, "%s%d:%s@%s",
+                       (u->flags & USER_HIGHLITE) ?
+                       ((dcc[idx].status & STAT_TELNET) ? "#" : "!") : "",
+                       dcc[idx].sock, dcc[idx].nick, botnetnick);
+        botnet_send_motd(i, x, par);
       }
     }
-  } else {
+  }
+  else {
     putlog(LOG_CMDS, "*", "#%s# motd", dcc[idx].nick);
     show_motd(idx);
   }
@@ -442,7 +449,7 @@
 
 static void cmd_help(struct userrec *u, int idx, char *par)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   get_user_flagrec(u, &fr, dcc[idx].u.chat->con_chan);
   if (par[0]) {
@@ -460,10 +467,12 @@
       if (*p)
         tellwildhelp(idx, par, &fr);
       else
-	tellallhelp(idx, "all", &fr);
-    } else
+        tellallhelp(idx, "all", &fr);
+    }
+    else
       tellhelp(idx, par, &fr, 0);
-  } else {
+  }
+  else {
     putlog(LOG_CMDS, "*", "#%s# help", dcc[idx].nick);
     if (glob_op(fr) || glob_botmast(fr) || chan_op(fr))
       tellhelp(idx, "help", &fr, 0);
@@ -497,18 +506,19 @@
     else {
       i = nextbot(par);
       if (i < 0) {
-	dprintf(idx, "That bot isn't connected.\n");
-      } else if (dcc[idx].u.chat->channel > 99999)
-	dprintf(idx, "You are on a local channel.\n");
+        dprintf(idx, "That bot isn't connected.\n");
+      }
+      else if (dcc[idx].u.chat->channel > 99999)
+        dprintf(idx, "You are on a local channel.\n");
       else {
-	char s[40];
+        char s[40];
 
-	simple_sprintf(s, "%d:%s@%s", dcc[idx].sock,
-		       dcc[idx].nick, botnetnick);
-	botnet_send_who(i, s, par, dcc[idx].u.chat->channel);
+        simple_sprintf(s, "%d:%s@%s", dcc[idx].sock, dcc[idx].nick, botnetnick);
+        botnet_send_who(i, s, par, dcc[idx].u.chat->channel);
       }
     }
-  } else {
+  }
+  else {
     putlog(LOG_CMDS, "*", "#%s# who", dcc[idx].nick);
     if (dcc[idx].u.chat->channel < 0)
       tell_who(u, idx, 0);
@@ -547,11 +557,12 @@
     if (atoi(par) > 0) {
       start = atoi(s1);
       limit = atoi(par);
-    } else
+    }
+    else
       limit = atoi(s1);
   }
   tell_users_match(idx, s, start, limit, u ? (u->flags & USER_MASTER) : 0,
-		   chname);
+                   chname);
 }
 
 static void cmd_uptime(struct userrec *u, int idx, char *par)
@@ -575,7 +586,8 @@
     dprintf(idx, "\n");
     tell_settings(idx);
     do_module_report(idx, 1, NULL);
-  } else {
+  }
+  else {
     putlog(LOG_CMDS, "*", "#%s# status", dcc[idx].nick);
     tell_verbose_status(idx);
     tell_mem_status_dcc(idx);
@@ -615,19 +627,20 @@
         return;
       }
       botnet_send_reject(i, dcc[idx].nick, botnetnick, whonick,
-			 who, par[0] ? par : dcc[idx].nick);
+                         who, par[0] ? par : dcc[idx].nick);
       putlog(LOG_BOTS, "*", "#%s# boot %s@%s (%s)", dcc[idx].nick, whonick,
-	     who, par[0] ? par : dcc[idx].nick);
-    } else
+             who, par[0] ? par : dcc[idx].nick);
+    }
+    else
       dprintf(idx, "Remote boots are disabled here.\n");
     return;
   }
   for (i = 0; i < dcc_total; i++)
-    if (!egg_strcasecmp(dcc[i].nick, who)
-        && !ok && (dcc[i].type->flags & DCT_CANBOOT)) {
+    if (!egg_strcasecmp(dcc[i].nick, who) && !ok &&
+        (dcc[i].type->flags & DCT_CANBOOT)) {
       u2 = get_user_by_handle(userlist, dcc[i].nick);
-      if (u2 && (u2->flags & USER_OWNER)
-          && egg_strcasecmp(dcc[idx].nick, who)) {
+      if (u2 && (u2->flags & USER_OWNER) &&
+          egg_strcasecmp(dcc[idx].nick, who)) {
         dprintf(idx, "You can't boot a bot owner.\n");
         return;
       }
@@ -652,14 +665,14 @@
 {
   char *nick, s[2], s1[512];
   int dest = 0, i, ok = 0, pls, md;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   module_entry *me;
 
   if (!par[0]) {
     dprintf(idx, "Your console is %s: %s (%s).\n",
-	    dcc[idx].u.chat->con_chan,
-	    masktype(dcc[idx].u.chat->con_flags),
-	    maskname(dcc[idx].u.chat->con_flags));
+            dcc[idx].u.chat->con_chan,
+            masktype(dcc[idx].u.chat->con_flags),
+            maskname(dcc[idx].u.chat->con_flags));
     return;
   }
   get_user_flagrec(u, &fr, dcc[idx].u.chat->con_chan);
@@ -671,22 +684,23 @@
   if (nick[0] && !strchr(CHANMETA "+-*", nick[0]) && glob_master(fr)) {
     for (i = 0; i < dcc_total; i++)
       if (!egg_strcasecmp(nick, dcc[i].nick) &&
-	  (dcc[i].type == &DCC_CHAT) && (!ok)) {
-	ok = 1;
-	dest = i;
+          (dcc[i].type == &DCC_CHAT) && (!ok)) {
+        ok = 1;
+        dest = i;
       }
     if (!ok) {
       dprintf(idx, "No such user on the party line!\n");
       return;
     }
     nick[0] = 0;
-  } else
+  }
+  else
     dest = idx;
   if (!nick[0])
     nick = newsplit(&par);
   /* Consider modeless channels, starting with '+' */
-  if ((nick [0] == '+' && findchan_by_dname(nick)) ||
-      (nick [0] != '+' && strchr(CHANMETA "*", nick[0]))) {
+  if ((nick[0] == '+' && findchan_by_dname(nick)) ||
+      (nick[0] != '+' && strchr(CHANMETA "*", nick[0]))) {
     if (strcmp(nick, "*") && !findchan_by_dname(nick)) {
       dprintf(idx, "Invalid console channel: %s.\n", nick);
       return;
@@ -694,7 +708,7 @@
     get_user_flagrec(u, &fr, nick);
     if (!chan_op(fr) && !(glob_op(fr) && !chan_deop(fr))) {
       dprintf(idx, "You don't have op or master access to channel %s.\n",
-	      nick);
+              nick);
       return;
     }
     strncpyz(dcc[dest].u.chat->con_chan, nick, 81);
@@ -711,54 +725,55 @@
       dcc[dest].u.chat->con_flags = 0;
     for (; *nick; nick++) {
       if (*nick == '+')
-	pls = 1;
+        pls = 1;
       else if (*nick == '-')
-	pls = 0;
+        pls = 0;
       else {
-	s[0] = *nick;
-	s[1] = 0;
-	md = logmodes(s);
-	if ((dest == idx) && !glob_master(fr) && pls) {
-	  if (chan_master(fr))
-	    md &= ~(LOG_FILES | LOG_LEV1 | LOG_LEV2 | LOG_LEV3 |
-		    LOG_LEV4 | LOG_LEV5 | LOG_LEV6 | LOG_LEV7 |
-		    LOG_LEV8 | LOG_DEBUG);
-	  else
-	    md &= ~(LOG_MISC | LOG_CMDS | LOG_FILES | LOG_LEV1 |
-		    LOG_LEV2 | LOG_LEV3 | LOG_LEV4 | LOG_LEV5 |
-		    LOG_LEV6 | LOG_LEV7 | LOG_LEV8 | LOG_WALL |
-		    LOG_DEBUG);
-	}
-	if (!glob_owner(fr) && pls)
-	  md &= ~(LOG_RAW | LOG_SRVOUT | LOG_BOTNET | LOG_BOTSHARE);
-	if (!glob_botmast(fr) && pls)
-	  md &= ~LOG_BOTS;
-	if (pls)
-	  dcc[dest].u.chat->con_flags |= md;
-	else
-	  dcc[dest].u.chat->con_flags &= ~md;
+        s[0] = *nick;
+        s[1] = 0;
+        md = logmodes(s);
+        if ((dest == idx) && !glob_master(fr) && pls) {
+          if (chan_master(fr))
+            md &= ~(LOG_FILES | LOG_LEV1 | LOG_LEV2 | LOG_LEV3 |
+                    LOG_LEV4 | LOG_LEV5 | LOG_LEV6 | LOG_LEV7 |
+                    LOG_LEV8 | LOG_DEBUG);
+          else
+            md &= ~(LOG_MISC | LOG_CMDS | LOG_FILES | LOG_LEV1 |
+                    LOG_LEV2 | LOG_LEV3 | LOG_LEV4 | LOG_LEV5 |
+                    LOG_LEV6 | LOG_LEV7 | LOG_LEV8 | LOG_WALL | LOG_DEBUG);
+        }
+        if (!glob_owner(fr) && pls)
+          md &= ~(LOG_RAW | LOG_SRVOUT | LOG_BOTNET | LOG_BOTSHARE);
+        if (!glob_botmast(fr) && pls)
+          md &= ~LOG_BOTS;
+        if (pls)
+          dcc[dest].u.chat->con_flags |= md;
+        else
+          dcc[dest].u.chat->con_flags &= ~md;
       }
     }
   }
   putlog(LOG_CMDS, "*", "#%s# console %s", dcc[idx].nick, s1);
   if (dest == idx) {
     dprintf(idx, "Set your console to %s: %s (%s).\n",
-	    dcc[idx].u.chat->con_chan,
-	    masktype(dcc[idx].u.chat->con_flags),
-	    maskname(dcc[idx].u.chat->con_flags));
-  } else {
+            dcc[idx].u.chat->con_chan,
+            masktype(dcc[idx].u.chat->con_flags),
+            maskname(dcc[idx].u.chat->con_flags));
+  }
+  else {
     dprintf(idx, "Set console of %s to %s: %s (%s).\n", dcc[dest].nick,
-	    dcc[dest].u.chat->con_chan,
-	    masktype(dcc[dest].u.chat->con_flags),
-	    maskname(dcc[dest].u.chat->con_flags));
+            dcc[dest].u.chat->con_chan,
+            masktype(dcc[dest].u.chat->con_flags),
+            maskname(dcc[dest].u.chat->con_flags));
     dprintf(dest, "%s set your console to %s: %s (%s).\n", dcc[idx].nick,
-	    dcc[dest].u.chat->con_chan,
-	    masktype(dcc[dest].u.chat->con_flags),
-	    maskname(dcc[dest].u.chat->con_flags));
+            dcc[dest].u.chat->con_chan,
+            masktype(dcc[dest].u.chat->con_flags),
+            maskname(dcc[dest].u.chat->con_flags));
   }
-  /* New style autosave -- drummer,07/25/1999*/
+  /* New style autosave -- drummer,07/25/1999 */
   if ((me = module_find("console", 1, 1))) {
     Function *func = me->funcs;
+
     (func[CONSOLE_DOSTORE]) (dest);
   }
 }
@@ -770,19 +785,20 @@
   struct bot_addr *bi;
 
   if (!par[0])
-    dprintf(idx, "Usage: +bot <handle> <address[:telnet-port[/relay-port]]> [host]\n");
+    dprintf(idx,
+            "Usage: +bot <handle> <address[:telnet-port[/relay-port]]> [host]\n");
   else {
     handle = newsplit(&par);
     addr = newsplit(&par);
     if (strlen(handle) > HANDLEN)
-      handle[HANDLEN] = 0;	/* max len = XX .. for the moment :) */
+      handle[HANDLEN] = 0;      /* max len = XX .. for the moment :) */
     if (get_user_by_handle(userlist, handle))
       dprintf(idx, "Someone already exists by that name.\n");
     else if (strchr(BADHANDCHARS, handle[0]) != NULL)
       dprintf(idx, "You can't start a botnick with '%c'.\n", handle[0]);
     else {
       if (strlen(addr) > 60)
-	addr[60] = 0;
+        addr[60] = 0;
       putlog(LOG_CMDS, "*", "#%s# +bot %s %s", dcc[idx].nick, handle, addr);
       userlist = adduser(userlist, handle, "none", "-", USER_BOT);
       u1 = get_user_by_handle(userlist, handle);
@@ -790,32 +806,33 @@
 
       q = strchr(addr, ':');
       if (!q) {
-	bi->address = user_malloc(strlen(addr) + 1);
-	strcpy(bi->address, addr);
-	bi->telnet_port = 3333;
-	bi->relay_port = 3333;
-      } else {
-	bi->address = user_malloc(q - addr + 1);
-	strncpy(bi->address, addr, q - addr);
-	bi->address[q - addr] = 0;
-	p = q + 1;
-	bi->telnet_port = atoi(p);
-	q = strchr(p, '/');
-	if (!q) {
-	  bi->relay_port = bi->telnet_port;
-	} else {
-	  bi->relay_port = atoi(q + 1);
-	}
+        bi->address = user_malloc(strlen(addr) + 1);
+        strcpy(bi->address, addr);
+        bi->telnet_port = 3333;
+        bi->relay_port = 3333;
+      }
+      else {
+        bi->address = user_malloc(q - addr + 1);
+        strncpy(bi->address, addr, q - addr);
+        bi->address[q - addr] = 0;
+        p = q + 1;
+        bi->telnet_port = atoi(p);
+        q = strchr(p, '/');
+        if (!q)
+          bi->relay_port = bi->telnet_port;
+        else
+          bi->relay_port = atoi(q + 1);
       }
       set_user(&USERENTRY_BOTADDR, u1, bi);
       dprintf(idx, "Added bot '%s' with address '%s' and no password.\n",
-	      handle, addr);
+              handle, addr);
       host = newsplit(&par);
       if (host[0]) {
-	addhost_by_handle(handle, host);
-      } else if (!add_bot_hostmask(idx, handle))
-	dprintf(idx, "You'll want to add a hostmask if this bot will ever %s",
-		"be on any channels that I'm on.\n");
+        addhost_by_handle(handle, host);
+      }
+      else if (!add_bot_hostmask(idx, handle))
+        dprintf(idx, "You'll want to add a hostmask if this bot will ever %s",
+                "be on any channels that I'm on.\n");
     }
   }
 }
@@ -837,32 +854,33 @@
     if ((newhand[i] <= 32) || (newhand[i] >= 127) || (newhand[i] == '@'))
       newhand[i] = '?';
   if (strchr(BADHANDCHARS, newhand[0]) != NULL)
-    dprintf(idx, "Bizarre quantum forces prevent nicknames from starting with '%c'.\n",
-           newhand[0]);
+    dprintf(idx,
+            "Bizarre quantum forces prevent nicknames from starting with '%c'.\n",
+            newhand[0]);
   else if (get_user_by_handle(userlist, newhand) &&
-          egg_strcasecmp(hand, newhand))
+           egg_strcasecmp(hand, newhand))
     dprintf(idx, "Somebody is already using %s.\n", newhand);
   else {
     u2 = get_user_by_handle(userlist, hand);
     atr2 = u2 ? u2->flags : 0;
-    if ((atr & USER_BOTMAST) && !(atr & USER_MASTER) &&
-       !(atr2 & USER_BOT))
+    if ((atr & USER_BOTMAST) && !(atr & USER_MASTER) && !(atr2 & USER_BOT))
       dprintf(idx, "You can't change handles for non-bots.\n");
     else if ((bot_flags(u2) & BOT_SHARE) && !(atr & USER_OWNER))
       dprintf(idx, "You can't change share bot's nick.\n");
     else if ((atr2 & USER_OWNER) && !(atr & USER_OWNER) &&
-            egg_strcasecmp(dcc[idx].nick, hand))
+             egg_strcasecmp(dcc[idx].nick, hand))
       dprintf(idx, "You can't change a bot owner's handle.\n");
     else if (isowner(hand) && egg_strcasecmp(dcc[idx].nick, hand))
       dprintf(idx, "You can't change a permanent bot owner's handle.\n");
     else if (!egg_strcasecmp(newhand, botnetnick) && (!(atr2 & USER_BOT) ||
-             nextbot(hand) != -1))
+                                                      nextbot(hand) != -1))
       dprintf(idx, "Hey! That's MY name!\n");
     else if (change_handle(u2, newhand)) {
       putlog(LOG_CMDS, "*", "#%s# chhandle %s %s", dcc[idx].nick,
-            hand, newhand);
+             hand, newhand);
       dprintf(idx, "Changed.\n");
-    } else
+    }
+    else
       dprintf(idx, "Failed.\n");
   }
 }
@@ -881,20 +899,22 @@
   for (i = 0; i < strlen(newhandle); i++)
     if ((newhandle[i] <= 32) || (newhandle[i] >= 127) || (newhandle[i] == '@'))
       newhandle[i] = '?';
-  if (strchr(BADHANDCHARS, newhandle[0]) != NULL) {
-    dprintf(idx, "Bizarre quantum forces prevent handle from starting with '%c'.\n",
-	    newhandle[0]);
-  } else if (get_user_by_handle(userlist, newhandle) &&
-	     egg_strcasecmp(dcc[idx].nick, newhandle)) {
+  if (strchr(BADHANDCHARS, newhandle[0]) != NULL)
+    dprintf(idx,
+            "Bizarre quantum forces prevent handle from starting with '%c'.\n",
+            newhandle[0]);
+  else if (get_user_by_handle(userlist, newhandle) &&
+           egg_strcasecmp(dcc[idx].nick, newhandle))
     dprintf(idx, "Somebody is already using %s.\n", newhandle);
-  } else if (!egg_strcasecmp(newhandle, botnetnick)) {
+  else if (!egg_strcasecmp(newhandle, botnetnick))
     dprintf(idx, "Hey!  That's MY name!\n");
-  } else {
+  else {
     strncpyz(oldhandle, dcc[idx].nick, sizeof oldhandle);
     if (change_handle(u, newhandle)) {
       putlog(LOG_CMDS, "*", "#%s# handle %s", oldhandle, newhandle);
       dprintf(idx, "Okay, changed.\n");
-    } else
+    }
+    else
       dprintf(idx, "Failed.\n");
   }
 }
@@ -912,31 +932,31 @@
     if (!u)
       dprintf(idx, "No such user.\n");
     else if ((atr & USER_BOTMAST) && !(atr & USER_MASTER) &&
-	     !(u->flags & USER_BOT))
+             !(u->flags & USER_BOT))
       dprintf(idx, "You can't change passwords for non-bots.\n");
     else if ((bot_flags(u) & BOT_SHARE) && !(atr & USER_OWNER))
       dprintf(idx, "You can't change a share bot's password.\n");
     else if ((u->flags & USER_OWNER) && !(atr & USER_OWNER) &&
-	     egg_strcasecmp(handle, dcc[idx].nick))
+             egg_strcasecmp(handle, dcc[idx].nick))
       dprintf(idx, "You can't change a bot owner's password.\n");
     else if (isowner(handle) && egg_strcasecmp(dcc[idx].nick, handle))
       dprintf(idx, "You can't change a permanent bot owner's password.\n");
     else if (!par[0]) {
-      putlog(LOG_CMDS, "*", "#%s# chpass %s [nothing]", dcc[idx].nick,
-	     handle);
+      putlog(LOG_CMDS, "*", "#%s# chpass %s [nothing]", dcc[idx].nick, handle);
       set_user(&USERENTRY_PASS, u, NULL);
       dprintf(idx, "Removed password.\n");
-    } else {
+    }
+    else {
       l = strlen(new = newsplit(&par));
       if (l > 16)
-	new[16] = 0;
+        new[16] = 0;
       if (l < 6)
-	dprintf(idx, "Please use at least 6 characters.\n");
+        dprintf(idx, "Please use at least 6 characters.\n");
       else {
-	set_user(&USERENTRY_PASS, u, new);
-	putlog(LOG_CMDS, "*", "#%s# chpass %s [something]", dcc[idx].nick,
-	       handle);
-	dprintf(idx, "Changed password.\n");
+        set_user(&USERENTRY_PASS, u, new);
+        putlog(LOG_CMDS, "*", "#%s# chpass %s [something]", dcc[idx].nick,
+               handle);
+        dprintf(idx, "Changed password.\n");
       }
     }
   }
@@ -950,7 +970,8 @@
   struct userrec *u1;
 
   if (!par[0]) {
-    dprintf(idx, "Usage: chaddr <botname> <address[:telnet-port[/relay-port]]>\n");
+    dprintf(idx,
+            "Usage: chaddr <botname> <address[:telnet-port[/relay-port]]>\n");
     return;
   }
   handle = newsplit(&par);
@@ -983,17 +1004,17 @@
     strcpy(bi->address, addr);
     bi->telnet_port = telnet_port;
     bi->relay_port = relay_port;
-  } else {
+  }
+  else {
     bi->address = user_malloc(q - addr + 1);
     strncpyz(bi->address, addr, q - addr + 1);
     p = q + 1;
     bi->telnet_port = atoi(p);
     q = strchr(p, '/');
-    if (!q) {
+    if (!q)
       bi->relay_port = bi->telnet_port;
-    } else {
+    else
       bi->relay_port = atoi(q + 1);
-    }
   }
   set_user(&USERENTRY_BOTADDR, u1, bi);
 }
@@ -1037,8 +1058,7 @@
   }
   dprintf(idx, "Restarting.\n");
   if (make_userfile) {
-    putlog(LOG_MISC, "*",
-	   "Uh, guess you don't need to create a new userfile.");
+    putlog(LOG_MISC, "*", "Uh, guess you don't need to create a new userfile.");
     make_userfile = 0;
   }
   write_userfile(-1);
@@ -1053,8 +1073,7 @@
   putlog(LOG_CMDS, "*", "#%s# rehash", dcc[idx].nick);
   dprintf(idx, "Rehashing.\n");
   if (make_userfile) {
-    putlog(LOG_MISC, "*",
-	   "Uh, guess you don't need to create a new userfile.");
+    putlog(LOG_MISC, "*", "Uh, guess you don't need to create a new userfile.");
     make_userfile = 0;
   }
   write_userfile(-1);
@@ -1076,11 +1095,15 @@
   putlog(LOG_CMDS, "*", "#%s# die %s", dcc[idx].nick, par);
   if (par[0]) {
     egg_snprintf(s1, sizeof s1, "BOT SHUTDOWN (%s: %s)", dcc[idx].nick, par);
-    egg_snprintf(s2, sizeof s2, "DIE BY %s!%s (%s)", dcc[idx].nick, dcc[idx].host, par);
+    egg_snprintf(s2, sizeof s2, "DIE BY %s!%s (%s)", dcc[idx].nick,
+                 dcc[idx].host, par);
     strncpyz(quit_msg, par, 1024);
-  } else {
-    egg_snprintf(s1, sizeof s1, "BOT SHUTDOWN (Authorized by %s)", dcc[idx].nick);
-    egg_snprintf(s2, sizeof s2, "DIE BY %s!%s (request)", dcc[idx].nick, dcc[idx].host);
+  }
+  else {
+    egg_snprintf(s1, sizeof s1, "BOT SHUTDOWN (Authorized by %s)",
+                 dcc[idx].nick);
+    egg_snprintf(s2, sizeof s2, "DIE BY %s!%s (request)", dcc[idx].nick,
+                 dcc[idx].host);
     strncpyz(quit_msg, dcc[idx].nick, 1024);
   }
   kill_bot(s1, s2);
@@ -1091,7 +1114,8 @@
   if (!egg_strcasecmp(par, "help")) {
     putlog(LOG_CMDS, "*", "#%s# debug help", dcc[idx].nick);
     debug_help(idx);
-  } else {
+  }
+  else {
     putlog(LOG_CMDS, "*", "#%s# debug", dcc[idx].nick);
     debug_mem_to_dcc(idx);
   }
@@ -1113,11 +1137,11 @@
   }
   for (i = 0; i < dcc_total; i++)
     if (!egg_strcasecmp(nick, dcc[i].nick) && !ok &&
-	(dcc[i].type->flags & DCT_SIMUL)) {
+        (dcc[i].type->flags & DCT_SIMUL)) {
       putlog(LOG_CMDS, "*", "#%s# simul %s %s", dcc[idx].nick, nick, par);
       if (dcc[i].type && dcc[i].type->activity) {
-	dcc[i].type->activity(i, par, strlen(par));
-	ok = 1;
+        dcc[i].type->activity(i, par, strlen(par));
+        ok = 1;
       }
     }
   if (!ok)
@@ -1263,63 +1287,60 @@
   }
   for (i = 0; i < dcc_total; i++) {
     if ((dcc[i].type->flags & DCT_MASTER) &&
-	(!egg_strcasecmp(u->handle, dcc[i].nick))) {
+        (!egg_strcasecmp(u->handle, dcc[i].nick))) {
       stat = dcc[i].status;
       if ((dcc[i].type == &DCC_CHAT) &&
-	  ((u->flags & (USER_OP | USER_MASTER | USER_OWNER |
-			USER_BOTMAST))
-	   != (oatr & (USER_OP | USER_MASTER | USER_OWNER |
-		       USER_BOTMAST)))) {
-	botnet_send_join_idx(i, -1);
+          ((u->flags & (USER_OP | USER_MASTER | USER_OWNER | USER_BOTMAST))
+           != (oatr & (USER_OP | USER_MASTER | USER_OWNER | USER_BOTMAST)))) {
+        botnet_send_join_idx(i, -1);
       }
       if ((oatr & USER_MASTER) && !(u->flags & USER_MASTER)) {
-	struct flag_record fr = {FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
+        struct flag_record fr = { FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
 
-	dcc[i].u.chat->con_flags &= ~(LOG_MISC | LOG_CMDS | LOG_RAW |
-				      LOG_FILES | LOG_LEV1 | LOG_LEV2 |
-				      LOG_LEV3 | LOG_LEV4 | LOG_LEV5 |
-				      LOG_LEV6 | LOG_LEV7 | LOG_LEV8 |
-				      LOG_WALL | LOG_DEBUG);
-	get_user_flagrec(u, &fr, NULL);
-	if (!chan_master(fr))
-	  dcc[i].u.chat->con_flags |= (LOG_MISC | LOG_CMDS);
-	dprintf(i, "*** POOF! ***\n");
-	dprintf(i, "You are no longer a master on this bot.\n");
+        dcc[i].u.chat->con_flags &= ~(LOG_MISC | LOG_CMDS | LOG_RAW |
+                                      LOG_FILES | LOG_LEV1 | LOG_LEV2 |
+                                      LOG_LEV3 | LOG_LEV4 | LOG_LEV5 |
+                                      LOG_LEV6 | LOG_LEV7 | LOG_LEV8 |
+                                      LOG_WALL | LOG_DEBUG);
+        get_user_flagrec(u, &fr, NULL);
+        if (!chan_master(fr))
+          dcc[i].u.chat->con_flags |= (LOG_MISC | LOG_CMDS);
+        dprintf(i, "*** POOF! ***\n");
+        dprintf(i, "You are no longer a master on this bot.\n");
       }
       if (!(oatr & USER_MASTER) && (u->flags & USER_MASTER)) {
-	dcc[i].u.chat->con_flags |= conmask;
-	dprintf(i, "*** POOF! ***\n");
-	dprintf(i, "You are now a master on this bot.\n");
+        dcc[i].u.chat->con_flags |= conmask;
+        dprintf(i, "*** POOF! ***\n");
+        dprintf(i, "You are now a master on this bot.\n");
       }
       if (!(oatr & USER_BOTMAST) && (u->flags & USER_BOTMAST)) {
-	dprintf(i, "### POOF! ###\n");
-	dprintf(i, "You are now a botnet master on this bot.\n");
+        dprintf(i, "### POOF! ###\n");
+        dprintf(i, "You are now a botnet master on this bot.\n");
       }
       if ((oatr & USER_BOTMAST) && !(u->flags & USER_BOTMAST)) {
-	dprintf(i, "### POOF! ###\n");
-	dprintf(i, "You are no longer a botnet master on this bot.\n");
+        dprintf(i, "### POOF! ###\n");
+        dprintf(i, "You are no longer a botnet master on this bot.\n");
       }
       if (!(oatr & USER_OWNER) && (u->flags & USER_OWNER)) {
-	dprintf(i, "@@@ POOF! @@@\n");
-	dprintf(i, "You are now an OWNER of this bot.\n");
+        dprintf(i, "@@@ POOF! @@@\n");
+        dprintf(i, "You are now an OWNER of this bot.\n");
       }
       if ((oatr & USER_OWNER) && !(u->flags & USER_OWNER)) {
-	dprintf(i, "@@@ POOF! @@@\n");
-	dprintf(i, "You are no longer an owner of this bot.\n");
+        dprintf(i, "@@@ POOF! @@@\n");
+        dprintf(i, "You are no longer an owner of this bot.\n");
       }
       if ((stat & STAT_PARTY) && (u->flags & USER_OP))
-	stat &= ~STAT_PARTY;
+        stat &= ~STAT_PARTY;
       if (!(stat & STAT_PARTY) && !(u->flags & USER_OP) &&
-	  !(u->flags & USER_MASTER))
-	stat |= STAT_PARTY;
+          !(u->flags & USER_MASTER))
+        stat |= STAT_PARTY;
       if ((stat & STAT_CHAT) && !(u->flags & USER_PARTY) &&
-	  !(u->flags & USER_MASTER) &&
-	  (!(u->flags & USER_OP) || require_p))
-	stat &= ~STAT_CHAT;
+          !(u->flags & USER_MASTER) && (!(u->flags & USER_OP) || require_p))
+        stat &= ~STAT_CHAT;
       if ((dcc[i].type->flags & DCT_FILES) && !(stat & STAT_CHAT) &&
-	  ((u->flags & USER_MASTER) || (u->flags & USER_PARTY) ||
-	   ((u->flags & USER_OP) && !require_p)))
-	stat |= STAT_CHAT;
+          ((u->flags & USER_MASTER) || (u->flags & USER_PARTY) ||
+          ((u->flags & USER_OP) && !require_p)))
+        stat |= STAT_CHAT;
       dcc[i].status = stat;
       /* Check if they no longer have access to wherever they are.
        *
@@ -1327,43 +1348,44 @@
        *       (pinvite script removes +p after 5 mins automatically)
        */
       if ((dcc[i].type->flags & DCT_FILES) && !(u->flags & USER_XFER) &&
-	  !(u->flags & USER_MASTER)) {
-	dprintf(i, "-+- POOF! -+-\n");
-	dprintf(i, "You no longer have file area access.\n\n");
-	putlog(LOG_MISC, "*", "DCC user [%s]%s removed from file system",
-	       dcc[i].nick, dcc[i].host);
-	if (dcc[i].status & STAT_CHAT) {
-	  struct chat_info *ci;
-
-	  ci = dcc[i].u.file->chat;
-	  nfree(dcc[i].u.file);
-	  dcc[i].u.chat = ci;
-	  dcc[i].status &= (~STAT_CHAT);
-	  dcc[i].type = &DCC_CHAT;
-	  if (dcc[i].u.chat->channel >= 0) {
-	    chanout_but(-1, dcc[i].u.chat->channel,
-			"*** %s has returned.\n", dcc[i].nick);
-	    if (dcc[i].u.chat->channel < GLOBAL_CHANS)
-	      botnet_send_join_idx(i, -1);
-	  }
-	} else {
-	  killsock(dcc[i].sock);
-	  lostdcc(i);
-	}
+          !(u->flags & USER_MASTER)) {
+        dprintf(i, "-+- POOF! -+-\n");
+        dprintf(i, "You no longer have file area access.\n\n");
+        putlog(LOG_MISC, "*", "DCC user [%s]%s removed from file system",
+               dcc[i].nick, dcc[i].host);
+        if (dcc[i].status & STAT_CHAT) {
+          struct chat_info *ci;
+
+          ci = dcc[i].u.file->chat;
+          nfree(dcc[i].u.file);
+          dcc[i].u.chat = ci;
+          dcc[i].status &= (~STAT_CHAT);
+          dcc[i].type = &DCC_CHAT;
+          if (dcc[i].u.chat->channel >= 0) {
+            chanout_but(-1, dcc[i].u.chat->channel,
+                        "*** %s has returned.\n", dcc[i].nick);
+            if (dcc[i].u.chat->channel < GLOBAL_CHANS)
+              botnet_send_join_idx(i, -1);
+          }
+        }
+        else {
+          killsock(dcc[i].sock);
+          lostdcc(i);
+        }
       }
     }
     if (dcc[i].type == &DCC_BOT && !egg_strcasecmp(u->handle, dcc[i].nick)) {
       if ((dcc[i].status & STAT_LEAF) && !(u->flags & BOT_LEAF))
-	dcc[i].status &= ~(STAT_LEAF | STAT_WARNED);
+        dcc[i].status &= ~(STAT_LEAF | STAT_WARNED);
       if (!(dcc[i].status & STAT_LEAF) && (u->flags & BOT_LEAF))
-	dcc[i].status |= STAT_LEAF;
+        dcc[i].status |= STAT_LEAF;
     }
   }
   return u->flags;
 }
 
 int check_dcc_chanattrs(struct userrec *u, char *chname, int chflags,
-			int ochatr)
+                        int ochatr)
 {
   int i, found = 0, atr = u ? u->flags : 0;
   struct chanset_t *chan;
@@ -1372,52 +1394,53 @@
     return 0;
   for (i = 0; i < dcc_total; i++) {
     if ((dcc[i].type->flags & DCT_MASTER) &&
-	!egg_strcasecmp(u->handle, dcc[i].nick)) {
+        !egg_strcasecmp(u->handle, dcc[i].nick)) {
       if ((dcc[i].type == &DCC_CHAT) &&
-	  ((chflags & (USER_OP | USER_MASTER | USER_OWNER))
-	   != (ochatr & (USER_OP | USER_MASTER | USER_OWNER))))
-	botnet_send_join_idx(i, -1);
+          ((chflags & (USER_OP | USER_MASTER | USER_OWNER)) !=
+          (ochatr & (USER_OP | USER_MASTER | USER_OWNER))))
+        botnet_send_join_idx(i, -1);
       if ((ochatr & USER_MASTER) && !(chflags & USER_MASTER)) {
-	if (!(atr & USER_MASTER))
-	  dcc[i].u.chat->con_flags &= ~(LOG_MISC | LOG_CMDS);
-	dprintf(i, "*** POOF! ***\n");
-	dprintf(i, "You are no longer a master on %s.\n", chname);
+        if (!(atr & USER_MASTER))
+          dcc[i].u.chat->con_flags &= ~(LOG_MISC | LOG_CMDS);
+        dprintf(i, "*** POOF! ***\n");
+        dprintf(i, "You are no longer a master on %s.\n", chname);
       }
       if (!(ochatr & USER_MASTER) && (chflags & USER_MASTER)) {
-	dcc[i].u.chat->con_flags |= conmask;
-	if (!(atr & USER_MASTER))
-	  dcc[i].u.chat->con_flags &=
-	    ~(LOG_LEV1 | LOG_LEV2 | LOG_LEV3 | LOG_LEV4 |
-	      LOG_LEV5 | LOG_LEV6 | LOG_LEV7 | LOG_LEV8 |
-	      LOG_RAW | LOG_DEBUG | LOG_WALL | LOG_FILES | LOG_SRVOUT);
-	dprintf(i, "*** POOF! ***\n");
-	dprintf(i, "You are now a master on %s.\n", chname);
+        dcc[i].u.chat->con_flags |= conmask;
+        if (!(atr & USER_MASTER))
+          dcc[i].u.chat->con_flags &= ~(LOG_LEV1 | LOG_LEV2 | LOG_LEV3 |
+                                        LOG_LEV4 | LOG_LEV5 | LOG_LEV6 |
+                                        LOG_LEV7 | LOG_LEV8 | LOG_RAW |
+                                        LOG_DEBUG | LOG_WALL | LOG_FILES |
+                                        LOG_SRVOUT);
+        dprintf(i, "*** POOF! ***\n");
+        dprintf(i, "You are now a master on %s.\n", chname);
       }
       if (!(ochatr & USER_OWNER) && (chflags & USER_OWNER)) {
-	dprintf(i, "@@@ POOF! @@@\n");
-	dprintf(i, "You are now an OWNER of %s.\n", chname);
+        dprintf(i, "@@@ POOF! @@@\n");
+        dprintf(i, "You are now an OWNER of %s.\n", chname);
       }
       if ((ochatr & USER_OWNER) && !(chflags & USER_OWNER)) {
-	dprintf(i, "@@@ POOF! @@@\n");
-	dprintf(i, "You are no longer an owner of %s.\n", chname);
+        dprintf(i, "@@@ POOF! @@@\n");
+        dprintf(i, "You are no longer an owner of %s.\n", chname);
       }
       if (((ochatr & (USER_OP | USER_MASTER | USER_OWNER)) &&
-	   (!(chflags & (USER_OP | USER_MASTER | USER_OWNER)))) ||
-	  ((chflags & (USER_OP | USER_MASTER | USER_OWNER)) &&
-	   (!(ochatr & (USER_OP | USER_MASTER | USER_OWNER))))) {
-	struct flag_record fr = {FR_CHAN, 0, 0, 0, 0, 0};
-
-	for (chan = chanset; chan && !found; chan = chan->next) {
-	  get_user_flagrec(u, &fr, chan->dname);
-	  if (fr.chan & (USER_OP | USER_MASTER | USER_OWNER))
-	    found = 1;
-	}
-	if (!chan)
-	  chan = chanset;
-	if (chan)
-	  strcpy(dcc[i].u.chat->con_chan, chan->dname);
-	else
-	  strcpy(dcc[i].u.chat->con_chan, "*");
+          (!(chflags & (USER_OP | USER_MASTER | USER_OWNER)))) ||
+          ((chflags & (USER_OP | USER_MASTER | USER_OWNER)) &&
+          (!(ochatr & (USER_OP | USER_MASTER | USER_OWNER))))) {
+        struct flag_record fr = { FR_CHAN, 0, 0, 0, 0, 0 };
+
+        for (chan = chanset; chan && !found; chan = chan->next) {
+          get_user_flagrec(u, &fr, chan->dname);
+          if (fr.chan & (USER_OP | USER_MASTER | USER_OWNER))
+            found = 1;
+        }
+        if (!chan)
+          chan = chanset;
+        if (chan)
+          strcpy(dcc[i].u.chat->con_chan, chan->dname);
+        else
+          strcpy(dcc[i].u.chat->con_chan, "*");
       }
     }
   }
@@ -1429,9 +1452,9 @@
   char *hand, *arg = NULL, *tmpchg = NULL, *chg = NULL, work[1024];
   struct chanset_t *chan = NULL;
   struct userrec *u2;
-  struct flag_record pls = {0, 0, 0, 0, 0, 0},
-  		     mns = {0, 0, 0, 0, 0, 0},
-		     user = {0, 0, 0, 0, 0, 0};
+  struct flag_record pls = { 0, 0, 0, 0, 0, 0 },
+                     mns = { 0, 0, 0, 0, 0, 0 },
+                     user = { 0, 0, 0, 0, 0, 0 };
   module_entry *me;
   int fl = -1, of = 0, ocf = 0;
 
@@ -1454,15 +1477,16 @@
       chg = arg;
       arg = newsplit(&par);
       chan = findchan_by_dname(arg);
-    } else {
+    }
+    else {
       chan = findchan_by_dname(arg);
       /* Consider modeless channels, starting with '+' */
       if (!(arg[0] == '+' && chan) &&
-          !(arg[0] != '+' && strchr (CHANMETA, arg[0]))) {
-	/* .chattr <handle> <changes> */
+          !(arg[0] != '+' && strchr(CHANMETA, arg[0]))) {
+        /* .chattr <handle> <changes> */
         chg = arg;
         chan = NULL; /* uh, !strchr (CHANMETA, channel[0]) && channel found?? */
-	arg = NULL;
+        arg = NULL;
       }
       /* .chattr <handle> <channel>: nothing to do... */
     }
@@ -1479,15 +1503,16 @@
   if (chg) {
     if (!arg && strpbrk(chg, "&|")) {
       /* .chattr <handle> *[&|]*: use console channel if found... */
-      if (!strcmp ((arg = dcc[idx].u.chat->con_chan), "*"))
+      if (!strcmp((arg = dcc[idx].u.chat->con_chan), "*"))
         arg = NULL;
       else
         chan = findchan_by_dname(arg);
       if (arg && !chan) {
-        dprintf (idx, "Invalid console channel %s.\n", arg);
-	return;
+        dprintf(idx, "Invalid console channel %s.\n", arg);
+        return;
       }
-    } else if (arg && !strpbrk(chg, "&|")) {
+    }
+    else if (arg && !strpbrk(chg, "&|")) {
       tmpchg = nmalloc(strlen(chg) + 2);
       strcpy(tmpchg, "|");
       strcat(tmpchg, chg);
@@ -1507,7 +1532,7 @@
   }
   if (chan && !glob_master(user) && !chan_master(user)) {
     dprintf(idx, "You do not have channel master privileges for channel %s.\n",
-	    par);
+            par);
     if (tmpchg)
       nfree(tmpchg);
     return;
@@ -1517,37 +1542,37 @@
     pls.match = user.match;
     break_down_flags(chg, &pls, &mns);
     /* No-one can change these flags on-the-fly */
-    pls.global &= ~(USER_BOT);
-    mns.global &= ~(USER_BOT);
+    pls.global &=~(USER_BOT);
+    mns.global &=~(USER_BOT);
 
     if (chan) {
       pls.chan &= ~(BOT_SHARE);
       mns.chan &= ~(BOT_SHARE);
     }
     if (!glob_owner(user)) {
-      pls.global &= ~(USER_OWNER | USER_MASTER | USER_BOTMAST | USER_UNSHARED);
-      mns.global &= ~(USER_OWNER | USER_MASTER | USER_BOTMAST | USER_UNSHARED);
+      pls.global &=~(USER_OWNER | USER_MASTER | USER_BOTMAST | USER_UNSHARED);
+      mns.global &=~(USER_OWNER | USER_MASTER | USER_BOTMAST | USER_UNSHARED);
 
       if (chan) {
-	pls.chan &= ~USER_OWNER;
-	mns.chan &= ~USER_OWNER;
+        pls.chan &= ~USER_OWNER;
+        mns.chan &= ~USER_OWNER;
       }
       if (!glob_master(user)) {
-	pls.global &= USER_PARTY | USER_XFER;
-	mns.global &= USER_PARTY | USER_XFER;
+        pls.global &=USER_PARTY | USER_XFER;
+        mns.global &=USER_PARTY | USER_XFER;
 
-	if (!glob_botmast(user)) {
-	  pls.global = 0;
-	  mns.global = 0;
-	}
+        if (!glob_botmast(user)) {
+          pls.global = 0;
+          mns.global = 0;
+        }
       }
     }
     if (chan && !chan_owner(user) && !glob_owner(user)) {
       pls.chan &= ~USER_MASTER;
       mns.chan &= ~USER_MASTER;
       if (!chan_master(user) && !glob_master(user)) {
-	pls.chan = 0;
-	mns.chan = 0;
+        pls.chan = 0;
+        mns.chan = 0;
       }
     }
     get_user_flagrec(u2, &user, par);
@@ -1556,12 +1581,12 @@
       user.global = sanity_check((user.global |pls.global) &~mns.global);
 
       user.udef_global = (user.udef_global | pls.udef_global)
-	& ~mns.udef_global;
+                         & ~mns.udef_global;
     }
     if (chan) {
       ocf = user.chan;
       user.chan = chan_sanity_check((user.chan | pls.chan) & ~mns.chan,
-				    user.global);
+                                    user.global);
 
       user.udef_chan = (user.udef_chan | pls.udef_chan) & ~mns.udef_chan;
     }
@@ -1569,10 +1594,10 @@
   }
   if (chan)
     putlog(LOG_CMDS, "*", "#%s# (%s) chattr %s %s",
-	   dcc[idx].nick, chan ? chan->dname : "*", hand, chg ? chg : "");
+           dcc[idx].nick, chan ? chan->dname : "*", hand, chg ? chg : "");
   else
     putlog(LOG_CMDS, "*", "#%s# chattr %s %s", dcc[idx].nick, hand,
-	   chg ? chg : "");
+           chg ? chg : "");
   /* Get current flags and display them */
   if (user.match & FR_GLOBAL) {
     user.match = FR_GLOBAL;
@@ -1594,7 +1619,7 @@
     build_flags(work, &user, NULL);
     if (work[0] != '-')
       dprintf(idx, "Channel flags for %s on %s are now +%s.\n", hand,
-	      chan->dname, work);
+              chan->dname, work);
     else
       dprintf(idx, "No flags for %s on %s.\n", hand, chan->dname);
   }
@@ -1612,9 +1637,9 @@
   char *hand, *chg = NULL, *arg = NULL, *tmpchg = NULL, work[1024];
   struct chanset_t *chan = NULL;
   struct userrec *u2;
-  struct flag_record pls = {0, 0, 0, 0, 0, 0},
-		     mns = {0, 0, 0, 0, 0, 0},
-		     user = {0, 0, 0, 0, 0, 0};
+  struct flag_record  pls = { 0, 0, 0, 0, 0, 0 },
+                      mns = { 0, 0, 0, 0, 0, 0 },
+                      user = { 0, 0, 0, 0, 0, 0 };
   int idx2;
 
   if (!par[0]) {
@@ -1629,10 +1654,11 @@
   }
   for (idx2 = 0; idx2 < dcc_total; idx2++)
     if (dcc[idx2].type != &DCC_RELAY && dcc[idx2].type != &DCC_FORK_BOT &&
-	!egg_strcasecmp(dcc[idx2].nick, hand))
+        !egg_strcasecmp(dcc[idx2].nick, hand))
       break;
   if (idx2 != dcc_total) {
-    dprintf(idx, "You may not change the attributes of a directly linked bot.\n");
+    dprintf(idx,
+            "You may not change the attributes of a directly linked bot.\n");
     return;
   }
   /* Parse args */
@@ -1643,15 +1669,16 @@
       chg = arg;
       arg = newsplit(&par);
       chan = findchan_by_dname(arg);
-    } else {
+    }
+    else {
       chan = findchan_by_dname(arg);
       /* Consider modeless channels, starting with '+' */
       if (!(arg[0] == '+' && chan) &&
-          !(arg[0] != '+' && strchr (CHANMETA, arg[0]))) {
-	/* .botattr <handle> <changes> */
+          !(arg[0] != '+' && strchr(CHANMETA, arg[0]))) {
+        /* .botattr <handle> <changes> */
         chg = arg;
         chan = NULL; /* uh, !strchr (CHANMETA, channel[0]) && channel found?? */
-	arg = NULL;
+        arg = NULL;
       }
       /* .botattr <handle> <channel>: nothing to do... */
     }
@@ -1668,18 +1695,19 @@
   if (chg) {
     if (!arg && strpbrk(chg, "&|")) {
       /* botattr <handle> *[&|]*: use console channel if found... */
-      if (!strcmp ((arg = dcc[idx].u.chat->con_chan), "*"))
+      if (!strcmp((arg = dcc[idx].u.chat->con_chan), "*"))
         arg = NULL;
       else
         chan = findchan_by_dname(arg);
       if (arg && !chan) {
-        dprintf (idx, "Invalid console channel %s.\n", arg);
-	return;
+        dprintf(idx, "Invalid console channel %s.\n", arg);
+        return;
       }
-    } else if (arg && !strpbrk(chg, "&|")) {
+    }
+    else if (arg && !strpbrk(chg, "&|")) {
       tmpchg = nmalloc(strlen(chg) + 2);
-      strcpy (tmpchg, "|");
-      strcat (tmpchg, chg);
+      strcpy(tmpchg, "|");
+      strcat(tmpchg, chg);
       chg = tmpchg;
     }
   }
@@ -1704,7 +1732,8 @@
     if (chan && glob_owner(user)) {
       pls.chan &= BOT_SHARE;
       mns.chan &= BOT_SHARE;
-    } else {
+    }
+    else {
       pls.chan = 0;
       mns.chan = 0;
     }
@@ -1723,10 +1752,10 @@
   }
   if (chan)
     putlog(LOG_CMDS, "*", "#%s# (%s) botattr %s %s",
-	   dcc[idx].nick, chan->dname, hand, chg ? chg : "");
+           dcc[idx].nick, chan->dname, hand, chg ? chg : "");
   else
     putlog(LOG_CMDS, "*", "#%s# botattr %s %s", dcc[idx].nick, hand,
-	   chg ? chg : "");
+           chg ? chg : "");
   /* get current flags and display them */
   if (!chan || pls.bot || mns.bot) {
     user.match = FR_BOT;
@@ -1744,10 +1773,9 @@
     build_flags(work, &user, NULL);
     if (work[0] != '-')
       dprintf(idx, "Bot flags for %s on %s are now +%s.\n", hand,
-	      chan->dname, work);
+              chan->dname, work);
     else
-      dprintf(idx, "There are no bot flags for %s on %s.\n",
-	      hand, chan->dname);
+      dprintf(idx, "There are no bot flags for %s on %s.\n", hand, chan->dname);
   }
   if (tmpchg)
     nfree(tmpchg);
@@ -1765,105 +1793,114 @@
     if (dcc[idx].u.chat->channel < 0) {
       dprintf(idx, "You weren't in chat anyway!\n");
       return;
-    } else {
+    }
+    else {
       dprintf(idx, "Leaving chat mode...\n");
       check_tcl_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
-		     dcc[idx].u.chat->channel);
+                     dcc[idx].u.chat->channel);
       chanout_but(-1, dcc[idx].u.chat->channel,
-		  "*** %s left the party line.\n",
-		  dcc[idx].nick);
+                  "*** %s left the party line.\n", dcc[idx].nick);
       if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
-	botnet_send_part_idx(idx, "");
+        botnet_send_part_idx(idx, "");
     }
-    dcc[idx].u.chat->channel = (-1);
-  } else {
+    dcc[idx].u.chat->channel = -1;
+  }
+  else {
     if (arg[0] == '*') {
       if (((arg[1] < '0') || (arg[1] > '9'))) {
-	if (!arg[1])
-	  newchan = 0;
-	else {
-	  Tcl_SetVar(interp, "chan", arg, 0);
-	  if ((Tcl_VarEval(interp, "assoc ", "$chan", NULL) == TCL_OK) &&
-	      interp->result[0])
-	    newchan = atoi(interp->result);
-	  else
-	    newchan = -1;
-	}
-	if (newchan < 0) {
-	  dprintf(idx, "No channel exists by that name.\n");
-	  return;
-	}
-      } else
-	newchan = GLOBAL_CHANS + atoi(arg + 1);
+        if (!arg[1])
+          newchan = 0;
+        else {
+          Tcl_SetVar(interp, "chan", arg, 0);
+          if ((Tcl_VarEval(interp, "assoc ", "$chan", NULL) == TCL_OK) &&
+              interp->result[0])
+            newchan = atoi(interp->result);
+          else
+            newchan = -1;
+        }
+        if (newchan < 0) {
+          dprintf(idx, "No channel exists by that name.\n");
+          return;
+        }
+      }
+      else
+        newchan = GLOBAL_CHANS + atoi(arg + 1);
       if (newchan < GLOBAL_CHANS || newchan > 199999) {
-	dprintf(idx, "Channel number out of range: local channels must be *0-*99999.\n");
-	return;
+        dprintf(idx,
+                "Channel number out of range: local channels must be *0-*99999.\n");
+        return;
       }
-    } else {
+    }
+    else {
       if (((arg[0] < '0') || (arg[0] > '9')) && (arg[0])) {
-	if (!egg_strcasecmp(arg, "on"))
-	  newchan = 0;
-	else {
-	  Tcl_SetVar(interp, "chan", arg, 0);
-	  if ((Tcl_VarEval(interp, "assoc ", "$chan", NULL) == TCL_OK) &&
-	      interp->result[0])
-	    newchan = atoi(interp->result);
-	  else
-	    newchan = -1;
-	}
-	if (newchan < 0) {
-	  dprintf(idx, "No channel exists by that name.\n");
-	  return;
-	}
-      } else
-	newchan = atoi(arg);
+        if (!egg_strcasecmp(arg, "on"))
+          newchan = 0;
+        else {
+          Tcl_SetVar(interp, "chan", arg, 0);
+          if ((Tcl_VarEval(interp, "assoc ", "$chan", NULL) == TCL_OK) &&
+              interp->result[0])
+            newchan = atoi(interp->result);
+          else
+            newchan = -1;
+        }
+        if (newchan < 0) {
+          dprintf(idx, "No channel exists by that name.\n");
+          return;
+        }
+      }
+      else
+        newchan = atoi(arg);
       if ((newchan < 0) || (newchan > 99999)) {
-	dprintf(idx, "Channel number out of range: must be between 0 and 99999.\n");
-	return;
+        dprintf(idx,
+                "Channel number out of range: must be between 0 and 99999.\n");
+        return;
       }
     }
     /* If coming back from being off the party line, make sure they're
      * not away.
-    */
+     */
     if ((dcc[idx].u.chat->channel < 0) && (dcc[idx].u.chat->away != NULL))
       not_away(idx);
     if (dcc[idx].u.chat->channel == newchan) {
       if (!newchan) {
-	dprintf(idx, "You're already on the party line!\n");
+        dprintf(idx, "You're already on the party line!\n");
         return;
-      } else {
-	dprintf(idx, "You're already on channel %s%d!\n",
-		(newchan < GLOBAL_CHANS) ? "" : "*", newchan % GLOBAL_CHANS);
+      }
+      else {
+        dprintf(idx, "You're already on channel %s%d!\n",
+                (newchan < GLOBAL_CHANS) ? "" : "*", newchan % GLOBAL_CHANS);
         return;
       }
-    } else {
+    }
+    else {
       oldchan = dcc[idx].u.chat->channel;
       if (oldchan >= 0)
-	check_tcl_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock, oldchan);
-      if (!oldchan) {
-	chanout_but(-1, 0, "*** %s left the party line.\n", dcc[idx].nick);
-      } else if (oldchan > 0) {
-	chanout_but(-1, oldchan, "*** %s left the channel.\n", dcc[idx].nick);
-      }
+        check_tcl_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock, oldchan);
+      if (!oldchan)
+        chanout_but(-1, 0, "*** %s left the party line.\n", dcc[idx].nick);
+      else if (oldchan > 0)
+        chanout_but(-1, oldchan, "*** %s left the channel.\n", dcc[idx].nick);
       dcc[idx].u.chat->channel = newchan;
       if (!newchan) {
-	dprintf(idx, "Entering the party line...\n");
-	chanout_but(-1, 0, "*** %s joined the party line.\n", dcc[idx].nick);
-      } else {
-	dprintf(idx, "Joining channel '%s'...\n", arg);
-	chanout_but(-1, newchan, "*** %s joined the channel.\n", dcc[idx].nick);
+        dprintf(idx, "Entering the party line...\n");
+        chanout_but(-1, 0, "*** %s joined the party line.\n", dcc[idx].nick);
+      }
+      else {
+        dprintf(idx, "Joining channel '%s'...\n", arg);
+        chanout_but(-1, newchan, "*** %s joined the channel.\n", dcc[idx].nick);
       }
       check_tcl_chjn(botnetnick, dcc[idx].nick, newchan, geticon(idx),
-		     dcc[idx].sock, dcc[idx].host);
+                     dcc[idx].sock, dcc[idx].host);
       if (newchan < GLOBAL_CHANS)
-	botnet_send_join_idx(idx, oldchan);
+        botnet_send_join_idx(idx, oldchan);
       else if (oldchan < GLOBAL_CHANS)
-	botnet_send_part_idx(idx, "");
+        botnet_send_part_idx(idx, "");
     }
   }
-  /* New style autosave here too -- rtc, 09/28/1999*/
+  /* New style autosave here too -- rtc, 09/28/1999 */
   if ((me = module_find("console", 1, 1))) {
     Function *func = me->funcs;
+
     (func[CONSOLE_DOSTORE]) (idx);
   }
 }
@@ -1874,22 +1911,25 @@
 
   if (!par[0]) {
     dprintf(idx, "Echo is currently %s.\n", dcc[idx].status & STAT_ECHO ?
-	    "on" : "off");
+            "on" : "off");
     return;
   }
   if (!egg_strcasecmp(par, "on")) {
     dprintf(idx, "Echo turned on.\n");
     dcc[idx].status |= STAT_ECHO;
-  } else if (!egg_strcasecmp(par, "off")) {
+  }
+  else if (!egg_strcasecmp(par, "off")) {
     dprintf(idx, "Echo turned off.\n");
     dcc[idx].status &= ~STAT_ECHO;
-  } else {
+  }
+  else {
     dprintf(idx, "Usage: echo <on/off>\n");
     return;
   }
-  /* New style autosave here too -- rtc, 09/28/1999*/
+  /* New style autosave here too -- rtc, 09/28/1999 */
   if ((me = module_find("console", 1, 1))) {
     Function *func = me->funcs;
+
     (func[CONSOLE_DOSTORE]) (idx);
   }
 }
@@ -1981,25 +2021,24 @@
 
   if (!par[0]) {
     dprintf(idx, "Your current strip settings are: %s (%s).\n",
-	    stripmasktype(dcc[idx].u.chat->strip_flags),
-	    stripmaskname(dcc[idx].u.chat->strip_flags));
+            stripmasktype(dcc[idx].u.chat->strip_flags),
+            stripmaskname(dcc[idx].u.chat->strip_flags));
     return;
   }
   nick = newsplit(&par);
-  if ((nick[0] != '+') && (nick[0] != '-') && u &&
-      (u->flags & USER_MASTER)) {
+  if ((nick[0] != '+') && (nick[0] != '-') && u && (u->flags & USER_MASTER)) {
     for (i = 0; i < dcc_total; i++)
-      if (!egg_strcasecmp(nick, dcc[i].nick) && dcc[i].type == &DCC_CHAT &&
-	  !ok) {
-	ok = 1;
-	dest = i;
+      if (!egg_strcasecmp(nick, dcc[i].nick) && dcc[i].type == &DCC_CHAT && !ok) {
+        ok = 1;
+        dest = i;
       }
     if (!ok) {
       dprintf(idx, "No such user on the party line!\n");
       return;
     }
     changes = par;
-  } else {
+  }
+  else {
     changes = nick;
     nick = "";
     dest = idx;
@@ -2020,9 +2059,9 @@
       s[0] = *c;
       md = stripmodes(s);
       if (pls == 1)
-	dcc[dest].u.chat->strip_flags |= md;
+        dcc[dest].u.chat->strip_flags |= md;
       else
-	dcc[dest].u.chat->strip_flags &= ~md;
+        dcc[dest].u.chat->strip_flags &= ~md;
     }
   }
   if (nick[0])
@@ -2031,28 +2070,31 @@
     putlog(LOG_CMDS, "*", "#%s# strip %s", dcc[idx].nick, changes);
   if (dest == idx) {
     dprintf(idx, "Your strip settings are: %s (%s).\n",
-	    stripmasktype(dcc[idx].u.chat->strip_flags),
-	    stripmaskname(dcc[idx].u.chat->strip_flags));
-  } else {
+            stripmasktype(dcc[idx].u.chat->strip_flags),
+            stripmaskname(dcc[idx].u.chat->strip_flags));
+  }
+  else {
     dprintf(idx, "Strip setting for %s: %s (%s).\n", dcc[dest].nick,
-	    stripmasktype(dcc[dest].u.chat->strip_flags),
-	    stripmaskname(dcc[dest].u.chat->strip_flags));
+            stripmasktype(dcc[dest].u.chat->strip_flags),
+            stripmaskname(dcc[dest].u.chat->strip_flags));
     dprintf(dest, "%s set your strip settings to: %s (%s).\n", dcc[idx].nick,
-	    stripmasktype(dcc[dest].u.chat->strip_flags),
-	    stripmaskname(dcc[dest].u.chat->strip_flags));
+            stripmasktype(dcc[dest].u.chat->strip_flags),
+            stripmaskname(dcc[dest].u.chat->strip_flags));
   }
   /* Set highlight flag here so user is able to control stripping of
    * bold also as intended -- dw 27/12/1999
    */
   if (dcc[dest].u.chat->strip_flags & STRIP_BOLD && u->flags & USER_HIGHLITE) {
     u->flags &= ~USER_HIGHLITE;
-  } else if (!(dcc[dest].u.chat->strip_flags & STRIP_BOLD) &&
-	     !(u->flags & USER_HIGHLITE)) {
+  }
+  else if (!(dcc[dest].u.chat->strip_flags & STRIP_BOLD) &&
+           !(u->flags & USER_HIGHLITE)) {
     u->flags |= USER_HIGHLITE;
   }
-  /* New style autosave here too -- rtc, 09/28/1999*/
+  /* New style autosave here too -- rtc, 09/28/1999 */
   if ((me = module_find("console", 1, 1))) {
     Function *func = me->funcs;
+
     (func[CONSOLE_DOSTORE]) (dest);
   }
 }
@@ -2060,7 +2102,7 @@
 static void cmd_su(struct userrec *u, int idx, char *par)
 {
   int atr = u ? u->flags : 0;
-  struct flag_record fr = {FR_ANYWH | FR_CHAN | FR_GLOBAL, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_ANYWH | FR_CHAN | FR_GLOBAL, 0, 0, 0, 0, 0 };
 
   u = get_user_by_handle(userlist, par);
 
@@ -2075,52 +2117,52 @@
   else {
     get_user_flagrec(u, &fr, NULL);
     if ((!glob_party(fr) && (require_p || !(glob_op(fr) || chan_op(fr)))) &&
-	!(atr & USER_BOTMAST))
+        !(atr & USER_BOTMAST))
       dprintf(idx, "No party line access permitted for %s.\n", par);
     else {
       correct_handle(par);
       putlog(LOG_CMDS, "*", "#%s# su %s", dcc[idx].nick, par);
-      if (!(atr & USER_OWNER) ||
-	  ((u->flags & USER_OWNER) && (isowner(par)) &&
-	   !(isowner(dcc[idx].nick)))) {
-	/* This check is only important for non-owners */
-	if (u_pass_match(u, "-")) {
-	  dprintf(idx, "No password set for user. You may not .su to them.\n");
-	  return;
-	}
-	if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
-	  botnet_send_part_idx(idx, "");
-	chanout_but(-1, dcc[idx].u.chat->channel,
-		    "*** %s left the party line.\n", dcc[idx].nick);
-	/* Store the old nick in the away section, for weenies who can't get
-	 * their password right ;)
-	 */
-	if (dcc[idx].u.chat->away != NULL)
-	  nfree(dcc[idx].u.chat->away);
+      if (!(atr & USER_OWNER) || ((u->flags & USER_OWNER) && (isowner(par)) &&
+          !(isowner(dcc[idx].nick)))) {
+        /* This check is only important for non-owners */
+        if (u_pass_match(u, "-")) {
+          dprintf(idx, "No password set for user. You may not .su to them.\n");
+          return;
+        }
+        if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
+          botnet_send_part_idx(idx, "");
+        chanout_but(-1, dcc[idx].u.chat->channel,
+                    "*** %s left the party line.\n", dcc[idx].nick);
+        /* Store the old nick in the away section, for weenies who can't get
+         * their password right ;)
+         */
+        if (dcc[idx].u.chat->away != NULL)
+          nfree(dcc[idx].u.chat->away);
         dcc[idx].u.chat->away = get_data_ptr(strlen(dcc[idx].nick) + 1);
-	strcpy(dcc[idx].u.chat->away, dcc[idx].nick);
+        strcpy(dcc[idx].u.chat->away, dcc[idx].nick);
         dcc[idx].u.chat->su_nick = get_data_ptr(strlen(dcc[idx].nick) + 1);
-	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
-	dcc[idx].user = u;
-	strcpy(dcc[idx].nick, par);
-	/* Display password prompt and turn off echo (send IAC WILL ECHO). */
-	dprintf(idx, "Enter password for %s%s\n", par,
-		(dcc[idx].status & STAT_TELNET) ? TLN_IAC_C TLN_WILL_C
-	       					  TLN_ECHO_C : "");
-	dcc[idx].type = &DCC_CHAT_PASS;
-      } else if (atr & USER_OWNER) {
-	if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
-	  botnet_send_part_idx(idx, "");
-	chanout_but(-1, dcc[idx].u.chat->channel,
-		    "*** %s left the party line.\n", dcc[idx].nick);
-	dprintf(idx, "Setting your username to %s.\n", par);
-	if (atr & USER_MASTER)
-	  dcc[idx].u.chat->con_flags = conmask;
+        strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
+        dcc[idx].user = u;
+        strcpy(dcc[idx].nick, par);
+        /* Display password prompt and turn off echo (send IAC WILL ECHO). */
+        dprintf(idx, "Enter password for %s%s\n", par,
+                (dcc[idx].status & STAT_TELNET) ? TLN_IAC_C TLN_WILL_C
+                TLN_ECHO_C : "");
+        dcc[idx].type = &DCC_CHAT_PASS;
+      }
+      else if (atr & USER_OWNER) {
+        if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
+          botnet_send_part_idx(idx, "");
+        chanout_but(-1, dcc[idx].u.chat->channel,
+                    "*** %s left the party line.\n", dcc[idx].nick);
+        dprintf(idx, "Setting your username to %s.\n", par);
+        if (atr & USER_MASTER)
+          dcc[idx].u.chat->con_flags = conmask;
         dcc[idx].u.chat->su_nick = get_data_ptr(strlen(dcc[idx].nick) + 1);
-	strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
-	dcc[idx].user = u;
-	strcpy(dcc[idx].nick, par);
-	dcc_chatter(idx);
+        strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
+        dcc[idx].user = u;
+        strcpy(dcc[idx].nick, par);
+        dcc_chatter(idx);
       }
     }
   }
@@ -2152,34 +2194,38 @@
   if (!par[0]) {
     if (dcc[idx].status & STAT_PAGE) {
       dprintf(idx, "Currently paging outputs to %d lines.\n",
-	      dcc[idx].u.chat->max_line);
-    } else
+              dcc[idx].u.chat->max_line);
+    }
+    else
       dprintf(idx, "You don't have paging on.\n");
     return;
   }
   a = atoi(par);
   if ((!a && !par[0]) || !egg_strcasecmp(par, "off")) {
     dcc[idx].status &= ~STAT_PAGE;
-    dcc[idx].u.chat->max_line = 0x7ffffff;	/* flush_lines needs this */
+    dcc[idx].u.chat->max_line = 0x7ffffff;      /* flush_lines needs this */
     while (dcc[idx].u.chat->buffer)
       flush_lines(idx, dcc[idx].u.chat);
     dprintf(idx, "Paging turned off.\n");
     putlog(LOG_CMDS, "*", "#%s# page off", dcc[idx].nick);
-  } else if (a > 0) {
+  }
+  else if (a > 0) {
     dprintf(idx, "Paging turned on, stopping every %d line%s.\n", a,
-        (a != 1) ? "s" : "");
+            (a != 1) ? "s" : "");
     dcc[idx].status |= STAT_PAGE;
     dcc[idx].u.chat->max_line = a;
     dcc[idx].u.chat->line_count = 0;
     dcc[idx].u.chat->current_lines = 0;
     putlog(LOG_CMDS, "*", "#%s# page %d", dcc[idx].nick, a);
-  } else {
+  }
+  else {
     dprintf(idx, "Usage: page <off or #>\n");
     return;
   }
-  /* New style autosave here too -- rtc, 09/28/1999*/
+  /* New style autosave here too -- rtc, 09/28/1999 */
   if ((me = module_find("console", 1, 1))) {
     Function *func = me->funcs;
+
     (func[CONSOLE_DOSTORE]) (idx);
   }
 }
@@ -2228,7 +2274,8 @@
       dumplots(idx, "Currently: ", interp->result);
     else
       dprintf(idx, "Ok, set.\n");
-  } else
+  }
+  else
     dprintf(idx, "Error: %s\n", interp->result);
 }
 
@@ -2242,13 +2289,14 @@
 {
   const char *p;
 
-     if (!(isowner(dcc[idx].nick)) && (must_be_owner)) {
-         dprintf(idx, MISC_NOSUCHCMD);
-         return;
-     }
+  if (!(isowner(dcc[idx].nick)) && (must_be_owner)) {
+    dprintf(idx, MISC_NOSUCHCMD);
+    return;
+  }
   if (!par[0]) {
     dprintf(idx, "%s: loadmod <module>\n", MISC_USAGE);
-  } else {
+  }
+  else {
     p = module_load(par);
     if (p)
       dprintf(idx, "%s: %s %s\n", par, MOD_LOADERROR, p);
@@ -2264,13 +2312,13 @@
 {
   char *p;
 
-     if (!(isowner(dcc[idx].nick)) && (must_be_owner)) {
-         dprintf(idx, MISC_NOSUCHCMD);
-         return;
-     }
-  if (!par[0]) {
+  if (!(isowner(dcc[idx].nick)) && (must_be_owner)) {
+    dprintf(idx, MISC_NOSUCHCMD);
+    return;
+  }
+  if (!par[0])
     dprintf(idx, "%s: unloadmod <module>\n", MISC_USAGE);
-  } else {
+  else {
     p = module_unload(par, dcc[idx].nick);
     if (p)
       dprintf(idx, "%s %s: %s\n", MOD_UNLOADERROR, par, p);
@@ -2283,48 +2331,46 @@
 
 static void cmd_pls_ignore(struct userrec *u, int idx, char *par)
 {
-  char			*who;
-  char			 s[UHOSTLEN];
-  unsigned long int	 expire_time = 0;
+  char *who, s[UHOSTLEN];
+  unsigned long int expire_time = 0;
 
   if (!par[0]) {
-    dprintf(idx,
-	    "Usage: +ignore <hostmask> [%%<XdXhXm>] [comment]\n");
+    dprintf(idx, "Usage: +ignore <hostmask> [%%<XdXhXm>] [comment]\n");
     return;
   }
 
   who = newsplit(&par);
   if (par[0] == '%') {
-    char		*p, *p_expire;
-    unsigned long int	 expire_foo;
+    char *p, *p_expire;
+    unsigned long int expire_foo;
 
     p = newsplit(&par);
     p_expire = p + 1;
     while (*(++p) != 0) {
       switch (tolower(*p)) {
       case 'd':
-	*p = 0;
-	expire_foo = strtol(p_expire, NULL, 10);
-	if (expire_foo > 365)
-	  expire_foo = 365;
-	expire_time += 86400 * expire_foo;
-	p_expire = p + 1;
-	break;
+        *p = 0;
+        expire_foo = strtol(p_expire, NULL, 10);
+        if (expire_foo > 365)
+          expire_foo = 365;
+        expire_time += 86400 * expire_foo;
+        p_expire = p + 1;
+        break;
       case 'h':
-	*p = 0;
-	expire_foo = strtol(p_expire, NULL, 10);
-	if (expire_foo > 8760)
-	  expire_foo = 8760;
-	expire_time += 3600 * expire_foo;
-	p_expire = p + 1;
-	break;
+        *p = 0;
+        expire_foo = strtol(p_expire, NULL, 10);
+        if (expire_foo > 8760)
+          expire_foo = 8760;
+        expire_time += 3600 * expire_foo;
+        p_expire = p + 1;
+        break;
       case 'm':
-	*p = 0;
-	expire_foo = strtol(p_expire, NULL, 10);
-	if (expire_foo > 525600)
-	  expire_foo = 525600;
-	expire_time += 60 * expire_foo;
-	p_expire = p + 1;
+        *p = 0;
+        expire_foo = strtol(p_expire, NULL, 10);
+        if (expire_foo > 525600)
+          expire_foo = 525600;
+        expire_time += 60 * expire_foo;
+        p_expire = p + 1;
       }
     }
   }
@@ -2341,7 +2387,8 @@
       simple_sprintf(s, "%s!*@*", who);
     else
       simple_sprintf(s, "*!%s", who);
-  } else if (!strchr(who, '@'))
+  }
+  else if (!strchr(who, '@'))
     simple_sprintf(s, "%s@*", who);
   else
     strcpy(s, who);
@@ -2367,7 +2414,8 @@
   if (delignore(buf)) {
     putlog(LOG_CMDS, "*", "#%s# -ignore %s", dcc[idx].nick, buf);
     dprintf(idx, "No longer ignoring: %s\n", buf);
-  } else
+  }
+  else
     dprintf(idx, "That ignore cannot be found.\n");
 }
 
@@ -2398,8 +2446,8 @@
   else {
     putlog(LOG_CMDS, "*", "#%s# +user %s %s", dcc[idx].nick, handle, host);
     userlist = adduser(userlist, handle, host, "-", 0);
-    dprintf(idx, "Added %s (%s) with no password and no flags.\n", handle, 
-      host[0] ? host : "no host");
+    dprintf(idx, "Added %s (%s) with no password and no flags.\n", handle,
+            host[0] ? host : "no host");
   }
 }
 
@@ -2450,12 +2498,13 @@
   if ((me = module_find("irc", 0, 0))) {
     Function *func = me->funcs;
 
-   (func[IRC_CHECK_THIS_USER]) (handle, 1, NULL);
+    (func[IRC_CHECK_THIS_USER]) (handle, 1, NULL);
   }
   if (deluser(handle)) {
     putlog(LOG_CMDS, "*", "#%s# -user %s", dcc[idx].nick, handle);
     dprintf(idx, "Deleted %s.\n", handle);
-  } else
+  }
+  else
     dprintf(idx, "Failed.\n");
 }
 
@@ -2464,8 +2513,8 @@
   char *handle, *host;
   struct userrec *u2;
   struct list_type *q;
-  struct flag_record fr2 = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0},
-                     fr  = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
+  struct flag_record fr2 = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 },
+                      fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
   module_entry *me;
 
   if (!par[0]) {
@@ -2478,7 +2527,8 @@
   if (par[0]) {
     host = newsplit(&par);
     u2 = get_user_by_handle(userlist, handle);
-  } else {
+  }
+  else {
     host = handle;
     handle = dcc[idx].nick;
     u2 = u;
@@ -2527,7 +2577,7 @@
   if ((me = module_find("irc", 0, 0))) {
     Function *func = me->funcs;
 
-   (func[IRC_CHECK_THIS_USER]) (handle, 0, NULL);
+    (func[IRC_CHECK_THIS_USER]) (handle, 0, NULL);
   }
 }
 
@@ -2535,8 +2585,8 @@
 {
   char *handle, *host;
   struct userrec *u2;
-  struct flag_record fr2 = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0},
-                     fr  = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
+  struct flag_record fr2 = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 },
+                      fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
   module_entry *me;
 
   if (!par[0]) {
@@ -2547,7 +2597,8 @@
   if (par[0]) {
     host = newsplit(&par);
     u2 = get_user_by_handle(userlist, handle);
-  } else {
+  }
+  else {
     host = handle;
     handle = dcc[idx].nick;
     u2 = u;
@@ -2560,7 +2611,7 @@
   get_user_flagrec(u, &fr, NULL);
   get_user_flagrec(u2, &fr2, NULL);
   /* check to see if user is +d or +k and don't let them remove hosts */
-  if (glob_deop(fr) || glob_kick(fr) || chan_deop(fr) || chan_kick (fr)) {
+  if (glob_deop(fr) || glob_kick(fr) || chan_deop(fr) || chan_kick(fr)) {
     dprintf(idx, "You can't remove hostmasks while having the +d or +k "
             "flag.\n");
     return;
@@ -2595,9 +2646,10 @@
     if ((me = module_find("irc", 0, 0))) {
       Function *func = me->funcs;
 
-     (func[IRC_CHECK_THIS_USER]) (handle, 2, host);
+      (func[IRC_CHECK_THIS_USER]) (handle, 2, host);
     }
-  } else
+  }
+  else
     dprintf(idx, "Failed.\n");
 }
 
@@ -2607,18 +2659,19 @@
   char *bot;
   module_entry *me;
 
-    putlog(LOG_CMDS, "*", "#%s# modules %s", dcc[idx].nick, par);
+  putlog(LOG_CMDS, "*", "#%s# modules %s", dcc[idx].nick, par);
 
-  if (!par[0]) {  
+  if (!par[0]) {
     dprintf(idx, "Modules loaded:\n");
     for (me = module_list; me; me = me->next)
       dprintf(idx, "  Module: %s (v%d.%d)\n", me->name, me->major, me->minor);
     dprintf(idx, "End of modules list.\n");
-  } else {
+  }
+  else {
     bot = newsplit(&par);
     if ((ptr = nextbot(bot)) >= 0)
       dprintf(ptr, "v %s %s %d:%s\n", botnetnick, bot, dcc[idx].sock,
-	      dcc[idx].nick);
+              dcc[idx].nick);
     else
       dprintf(idx, "No such bot online.\n");
   }
@@ -2634,17 +2687,17 @@
       itraffic_irc_today > 0) {
     dprintf(idx, "IRC:\n");
     dprintf(idx, "  out: %s", btos(otraffic_irc + otraffic_irc_today));
-              dprintf(idx, " (%s today)\n", btos(otraffic_irc_today));
+    dprintf(idx, " (%s today)\n", btos(otraffic_irc_today));
     dprintf(idx, "   in: %s", btos(itraffic_irc + itraffic_irc_today));
-              dprintf(idx, " (%s today)\n", btos(itraffic_irc_today));
+    dprintf(idx, " (%s today)\n", btos(itraffic_irc_today));
   }
   if (otraffic_bn > 0 || itraffic_bn > 0 || otraffic_bn_today > 0 ||
       itraffic_bn_today > 0) {
     dprintf(idx, "Botnet:\n");
     dprintf(idx, "  out: %s", btos(otraffic_bn + otraffic_bn_today));
-              dprintf(idx, " (%s today)\n", btos(otraffic_bn_today));
+    dprintf(idx, " (%s today)\n", btos(otraffic_bn_today));
     dprintf(idx, "   in: %s", btos(itraffic_bn + itraffic_bn_today));
-              dprintf(idx, " (%s today)\n", btos(itraffic_bn_today));
+    dprintf(idx, " (%s today)\n", btos(itraffic_bn_today));
   }
   if (otraffic_dcc > 0 || itraffic_dcc > 0 || otraffic_dcc_today > 0 ||
       itraffic_dcc_today > 0) {
@@ -2652,46 +2705,45 @@
     itmp = otraffic_dcc + otraffic_dcc_today;
     itmp2 = otraffic_dcc_today;
     dprintf(idx, "  out: %s", btos(itmp));
-              dprintf(idx, " (%s today)\n", btos(itmp2));
+    dprintf(idx, " (%s today)\n", btos(itmp2));
     dprintf(idx, "   in: %s", btos(itraffic_dcc + itraffic_dcc_today));
-              dprintf(idx, " (%s today)\n", btos(itraffic_dcc_today));
+    dprintf(idx, " (%s today)\n", btos(itraffic_dcc_today));
   }
   if (otraffic_trans > 0 || itraffic_trans > 0 || otraffic_trans_today > 0 ||
       itraffic_trans_today > 0) {
     dprintf(idx, "Transfer.mod:\n");
     dprintf(idx, "  out: %s", btos(otraffic_trans + otraffic_trans_today));
-              dprintf(idx, " (%s today)\n", btos(otraffic_trans_today));
+    dprintf(idx, " (%s today)\n", btos(otraffic_trans_today));
     dprintf(idx, "   in: %s", btos(itraffic_trans + itraffic_trans_today));
-              dprintf(idx, " (%s today)\n", btos(itraffic_trans_today));
+    dprintf(idx, " (%s today)\n", btos(itraffic_trans_today));
   }
   if (otraffic_unknown > 0 || otraffic_unknown_today > 0) {
     dprintf(idx, "Misc:\n");
     dprintf(idx, "  out: %s", btos(otraffic_unknown + otraffic_unknown_today));
-              dprintf(idx, " (%s today)\n", btos(otraffic_unknown_today));
+    dprintf(idx, " (%s today)\n", btos(otraffic_unknown_today));
     dprintf(idx, "   in: %s", btos(itraffic_unknown + itraffic_unknown_today));
-              dprintf(idx, " (%s today)\n", btos(itraffic_unknown_today));
+    dprintf(idx, " (%s today)\n", btos(itraffic_unknown_today));
   }
   dprintf(idx, "---\n");
   dprintf(idx, "Total:\n");
-  itmp = otraffic_irc + otraffic_bn + otraffic_dcc + otraffic_trans
-         + otraffic_unknown + otraffic_irc_today + otraffic_bn_today
-         + otraffic_dcc_today + otraffic_trans_today + otraffic_unknown_today;
-  itmp2 = otraffic_irc_today + otraffic_bn_today + otraffic_dcc_today
-         + otraffic_trans_today + otraffic_unknown_today;
+  itmp = otraffic_irc + otraffic_bn + otraffic_dcc + otraffic_trans +
+         otraffic_unknown + otraffic_irc_today + otraffic_bn_today +
+         otraffic_dcc_today + otraffic_trans_today + otraffic_unknown_today;
+  itmp2 = otraffic_irc_today + otraffic_bn_today + otraffic_dcc_today +
+          otraffic_trans_today + otraffic_unknown_today;
   dprintf(idx, "  out: %s", btos(itmp));
-              dprintf(idx, " (%s today)\n", btos(itmp2));
-  dprintf(idx, "   in: %s", btos(itraffic_irc + itraffic_bn + itraffic_dcc
-	  + itraffic_trans + itraffic_unknown + itraffic_irc_today
-	  + itraffic_bn_today + itraffic_dcc_today + itraffic_trans_today
-	  + itraffic_unknown_today));
-  dprintf(idx, " (%s today)\n", btos(itraffic_irc_today + itraffic_bn_today
-          + itraffic_dcc_today + itraffic_trans_today
-	  + itraffic_unknown_today));
+  dprintf(idx, " (%s today)\n", btos(itmp2));
+  dprintf(idx, "   in: %s", btos(itraffic_irc + itraffic_bn + itraffic_dcc +
+          itraffic_trans + itraffic_unknown + itraffic_irc_today +
+          itraffic_bn_today + itraffic_dcc_today + itraffic_trans_today +
+          itraffic_unknown_today));
+  dprintf(idx, " (%s today)\n", btos(itraffic_irc_today + itraffic_bn_today +
+          itraffic_dcc_today + itraffic_trans_today + itraffic_unknown_today));
   putlog(LOG_CMDS, "*", "#%s# traffic", dcc[idx].nick);
 }
 
 static char traffictxt[20];
-static char *btos(unsigned long  bytes)
+static char *btos(unsigned long bytes)
 {
   char unit[10];
   float xbytes;
@@ -2730,78 +2782,77 @@
 /* DCC CHAT COMMANDS
  */
 /* Function call should be:
- *   int cmd_whatever(idx,"parameters");
+ *   static void cmd_whatever(struct userrec *u, int idx, char *par);
  * As with msg commands, function is responsible for any logging.
  */
-cmd_t C_dcc[] =
-{
-  {"+bot",		"t",	(Function) cmd_pls_bot,		NULL},
-  {"+host",		"tm|m",	(Function) cmd_pls_host,	NULL},
-  {"+ignore",		"m",	(Function) cmd_pls_ignore,	NULL},
-  {"+user",		"m",	(Function) cmd_pls_user,	NULL},
-  {"-bot",		"t",	(Function) cmd_mns_user,	NULL},
-  {"-host",		"",	(Function) cmd_mns_host,	NULL},
-  {"-ignore",		"m",	(Function) cmd_mns_ignore,	NULL},
-  {"-user",		"m",	(Function) cmd_mns_user,	NULL},
-  {"addlog",		"to|o",	(Function) cmd_addlog,		NULL},
-  {"away",		"",	(Function) cmd_away,		NULL},
-  {"back",		"",	(Function) cmd_back,		NULL},
-  {"backup",		"m|m",	(Function) cmd_backup,		NULL},
-  {"banner",		"t",	(Function) cmd_banner,		NULL},
-  {"binds",		"m",	(Function) cmd_binds,		NULL},
-  {"boot",		"t",	(Function) cmd_boot,		NULL},
-  {"botattr",		"t",	(Function) cmd_botattr,		NULL},
-  {"botinfo",		"",	(Function) cmd_botinfo,		NULL},
-  {"bots",		"",	(Function) cmd_bots,		NULL},
-  {"bottree",		"",	(Function) cmd_bottree,		NULL},
-  {"chaddr",		"t",	(Function) cmd_chaddr,		NULL},
-  {"chat",		"",	(Function) cmd_chat,		NULL},
-  {"chattr",		"m|m",	(Function) cmd_chattr,		NULL},
-  {"chhandle",		"t",	(Function) cmd_chhandle,	NULL},
-  {"chnick",		"t",	(Function) cmd_chhandle,	NULL},
-  {"chpass",		"t",	(Function) cmd_chpass,		NULL},
-  {"comment",		"m",	(Function) cmd_comment,		NULL},
-  {"console",		"to|o",	(Function) cmd_console,		NULL},
-  {"dccstat",		"t",	(Function) cmd_dccstat,		NULL},
-  {"debug",		"m",	(Function) cmd_debug,		NULL},
-  {"die",		"n",	(Function) cmd_die,		NULL},
-  {"echo",		"",	(Function) cmd_echo,		NULL},
-  {"fixcodes",		"",	(Function) cmd_fixcodes,	NULL},
-  {"help",		"",	(Function) cmd_help,		NULL},
-  {"ignores",		"m",	(Function) cmd_ignores,		NULL},
-  {"link",		"t",	(Function) cmd_link,		NULL},
-  {"loadmod",		"n",	(Function) cmd_loadmod,		NULL},
-  {"match",		"to|o",	(Function) cmd_match,		NULL},
-  {"me",		"",	(Function) cmd_me,		NULL},
-  {"module",		"m",	(Function) cmd_module,		NULL},
-  {"modules",		"n",	(Function) cmd_modules,		NULL},
-  {"motd",		"",	(Function) cmd_motd,		NULL},
-  {"newpass",		"",	(Function) cmd_newpass,		NULL},
-  {"handle",		"",	(Function) cmd_handle,		NULL},
-  {"nick",		"",	(Function) cmd_handle,		NULL},
-  {"page",		"",	(Function) cmd_page,		NULL},
-  {"quit",		"",	(Function) NULL,		NULL},
-  {"rehash",		"m",	(Function) cmd_rehash,		NULL},
-  {"rehelp",		"n",	(Function) cmd_rehelp,		NULL},
-  {"relay",		"o",	(Function) cmd_relay,		NULL},
-  {"reload",		"m|m",	(Function) cmd_reload,		NULL},
-  {"restart",		"m",	(Function) cmd_restart,		NULL},
-  {"save",		"m|m",	(Function) cmd_save,		NULL},
-  {"set",		"n",	(Function) cmd_set,		NULL},
-  {"simul",		"n",	(Function) cmd_simul,		NULL},
-  {"status",		"m|m",	(Function) cmd_status,		NULL},
-  {"strip",		"",	(Function) cmd_strip,		NULL},
-  {"su",		"",	(Function) cmd_su,		NULL},
-  {"tcl",		"n",	(Function) cmd_tcl,		NULL},
-  {"trace",		"",	(Function) cmd_trace,		NULL},
-  {"unlink",		"t",	(Function) cmd_unlink,		NULL},
-  {"unloadmod",		"n",	(Function) cmd_unloadmod,	NULL},
-  {"uptime",		"m|m",	(Function) cmd_uptime,		NULL},
-  {"vbottree",		"",	(Function) cmd_vbottree,	NULL},
-  {"who",		"",	(Function) cmd_who,		NULL},
-  {"whois",		"to|o",	(Function) cmd_whois,		NULL},
-  {"whom",		"",	(Function) cmd_whom,		NULL},
-  {"traffic",		"m|m",	(Function) cmd_traffic,		NULL},
-  {"whoami",		"",	(Function) cmd_whoami,		NULL},
-  {NULL,		NULL,	NULL,				NULL}
+cmd_t C_dcc[] = {
+  {"+bot",      "t",    (Function) cmd_pls_bot,    NULL},
+  {"+host",     "tm|m", (Function) cmd_pls_host,   NULL},
+  {"+ignore",   "m",    (Function) cmd_pls_ignore, NULL},
+  {"+user",     "m",    (Function) cmd_pls_user,   NULL},
+  {"-bot",      "t",    (Function) cmd_mns_user,   NULL},
+  {"-host",     "",     (Function) cmd_mns_host,   NULL},
+  {"-ignore",   "m",    (Function) cmd_mns_ignore, NULL},
+  {"-user",     "m",    (Function) cmd_mns_user,   NULL},
+  {"addlog",    "to|o", (Function) cmd_addlog,     NULL},
+  {"away",      "",     (Function) cmd_away,       NULL},
+  {"back",      "",     (Function) cmd_back,       NULL},
+  {"backup",    "m|m",  (Function) cmd_backup,     NULL},
+  {"banner",    "t",    (Function) cmd_banner,     NULL},
+  {"binds",     "m",    (Function) cmd_binds,      NULL},
+  {"boot",      "t",    (Function) cmd_boot,       NULL},
+  {"botattr",   "t",    (Function) cmd_botattr,    NULL},
+  {"botinfo",   "",     (Function) cmd_botinfo,    NULL},
+  {"bots",      "",     (Function) cmd_bots,       NULL},
+  {"bottree",   "",     (Function) cmd_bottree,    NULL},
+  {"chaddr",    "t",    (Function) cmd_chaddr,     NULL},
+  {"chat",      "",     (Function) cmd_chat,       NULL},
+  {"chattr",    "m|m",  (Function) cmd_chattr,     NULL},
+  {"chhandle",  "t",    (Function) cmd_chhandle,   NULL},
+  {"chnick",    "t",    (Function) cmd_chhandle,   NULL},
+  {"chpass",    "t",    (Function) cmd_chpass,     NULL},
+  {"comment",   "m",    (Function) cmd_comment,    NULL},
+  {"console",   "to|o", (Function) cmd_console,    NULL},
+  {"dccstat",   "t",    (Function) cmd_dccstat,    NULL},
+  {"debug",     "m",    (Function) cmd_debug,      NULL},
+  {"die",       "n",    (Function) cmd_die,        NULL},
+  {"echo",      "",     (Function) cmd_echo,       NULL},
+  {"fixcodes",  "",     (Function) cmd_fixcodes,   NULL},
+  {"help",      "",     (Function) cmd_help,       NULL},
+  {"ignores",   "m",    (Function) cmd_ignores,    NULL},
+  {"link",      "t",    (Function) cmd_link,       NULL},
+  {"loadmod",   "n",    (Function) cmd_loadmod,    NULL},
+  {"match",     "to|o", (Function) cmd_match,      NULL},
+  {"me",        "",     (Function) cmd_me,         NULL},
+  {"module",    "m",    (Function) cmd_module,     NULL},
+  {"modules",   "n",    (Function) cmd_modules,    NULL},
+  {"motd",      "",     (Function) cmd_motd,       NULL},
+  {"newpass",   "",     (Function) cmd_newpass,    NULL},
+  {"handle",    "",     (Function) cmd_handle,     NULL},
+  {"nick",      "",     (Function) cmd_handle,     NULL},
+  {"page",      "",     (Function) cmd_page,       NULL},
+  {"quit",      "",     (Function) NULL,           NULL},
+  {"rehash",    "m",    (Function) cmd_rehash,     NULL},
+  {"rehelp",    "n",    (Function) cmd_rehelp,     NULL},
+  {"relay",     "o",    (Function) cmd_relay,      NULL},
+  {"reload",    "m|m",  (Function) cmd_reload,     NULL},
+  {"restart",   "m",    (Function) cmd_restart,    NULL},
+  {"save",      "m|m",  (Function) cmd_save,       NULL},
+  {"set",       "n",    (Function) cmd_set,        NULL},
+  {"simul",     "n",    (Function) cmd_simul,      NULL},
+  {"status",    "m|m",  (Function) cmd_status,     NULL},
+  {"strip",     "",     (Function) cmd_strip,      NULL},
+  {"su",        "",     (Function) cmd_su,         NULL},
+  {"tcl",       "n",    (Function) cmd_tcl,        NULL},
+  {"trace",     "",     (Function) cmd_trace,      NULL},
+  {"unlink",    "t",    (Function) cmd_unlink,     NULL},
+  {"unloadmod", "n",    (Function) cmd_unloadmod,  NULL},
+  {"uptime",    "m|m",  (Function) cmd_uptime,     NULL},
+  {"vbottree",  "",     (Function) cmd_vbottree,   NULL},
+  {"who",       "",     (Function) cmd_who,        NULL},
+  {"whois",     "to|o", (Function) cmd_whois,      NULL},
+  {"whom",      "",     (Function) cmd_whom,       NULL},
+  {"traffic",   "m|m",  (Function) cmd_traffic,    NULL},
+  {"whoami",    "",     (Function) cmd_whoami,     NULL},
+  {NULL,        NULL,   NULL,                      NULL}
 };
Index: eggdrop1.6/src/cmdt.h
diff -u eggdrop1.6/src/cmdt.h:1.6 eggdrop1.6/src/cmdt.h:1.7
--- eggdrop1.6/src/cmdt.h:1.6	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/src/cmdt.h	Tue Jan 28 00:37:24 2003
@@ -2,7 +2,7 @@
  * cmdt.h
  *   stuff for builtin commands
  *
- * $Id: cmdt.h,v 1.6 2002/12/24 02:30:04 wcc Exp $
+ * $Id: cmdt.h,v 1.7 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -39,4 +39,4 @@
   Function func;
 } botcmd_t;
 
-#endif				/* _EGG_CMDT_H */
+#endif /* _EGG_CMDT_H */
Index: eggdrop1.6/src/compat/compat.h
diff -u eggdrop1.6/src/compat/compat.h:1.5 eggdrop1.6/src/compat/compat.h:1.6
--- eggdrop1.6/src/compat/compat.h:1.5	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/compat/compat.h	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * compat.h
  *   wrap-around header for all compability functions.
  *
- * $Id: compat.h,v 1.5 2002/12/24 02:30:06 wcc Exp $
+ * $Id: compat.h,v 1.6 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -32,4 +32,4 @@
 #include "strcasecmp.h"
 #include "strftime.h"
 
-#endif	/* !__EGG_COMPAT_COMPAT_H */
+#endif /* !__EGG_COMPAT_COMPAT_H */
Index: eggdrop1.6/src/compat/gnu_strftime.c
diff -u eggdrop1.6/src/compat/gnu_strftime.c:1.1 eggdrop1.6/src/compat/gnu_strftime.c:1.2
--- eggdrop1.6/src/compat/gnu_strftime.c:1.1	Mon Sep 18 05:06:14 2000
+++ eggdrop1.6/src/compat/gnu_strftime.c	Tue Jan 28 00:37:25 2003
@@ -39,7 +39,7 @@
 #endif
 
 #include <ctype.h>
-#include <sys/types.h>		/* Some systems define `time_t' here.  */
+#include <sys/types.h>          /* Some systems define `time_t' here.  */
 
 #ifdef TIME_WITH_SYS_TIME
 # include <sys/time.h>
@@ -72,7 +72,7 @@
 #  define mbrlen(s, n, ps) mblen (s, n)
 #  define mbsinit(ps) (*(ps) == 0)
 # endif
-  static const mbstate_t mbstate_zero;
+static const mbstate_t mbstate_zero;
 #endif
 
 #if HAVE_LIMITS_H
@@ -102,8 +102,8 @@
 #  define __P(args) args
 # else
 #  define __P(args) ()
-# endif  /* GCC.  */
-#endif  /* Not __P.  */
+# endif /* GCC.  */
+#endif /* Not __P.  */
 
 #ifndef PTR
 # ifdef __STDC__
@@ -153,28 +153,28 @@
    Similarly for localtime_r.  */
 
 # if ! HAVE_TM_GMTOFF
-static struct tm *my_strftime_gmtime_r __P ((const time_t *, struct tm *));
-static struct tm *
-my_strftime_gmtime_r (t, tp)
-     const time_t *t;
-     struct tm *tp;
+static struct tm *my_strftime_gmtime_r __P((const time_t *, struct tm *));
+static struct tm *my_strftime_gmtime_r(t, tp)
+const time_t *t;
+struct tm *tp;
 {
-  struct tm *l = gmtime (t);
-  if (! l)
+  struct tm *l = gmtime(t);
+
+  if (!l)
     return 0;
   *tp = *l;
   return tp;
 }
 # endif /* ! HAVE_TM_GMTOFF */
 
-static struct tm *my_strftime_localtime_r __P ((const time_t *, struct tm *));
-static struct tm *
-my_strftime_localtime_r (t, tp)
-     const time_t *t;
-     struct tm *tp;
+static struct tm *my_strftime_localtime_r __P((const time_t *, struct tm *));
+static struct tm *my_strftime_localtime_r(t, tp)
+const time_t *t;
+struct tm *tp;
 {
-  struct tm *l = localtime (t);
-  if (! l)
+  struct tm *l = localtime(t);
+
+  if (!l)
     return 0;
   *tp = *l;
   return tp;
@@ -187,10 +187,12 @@
    introduce additional dependencies.  */
 /* The SGI compiler reportedly barfs on the trailing null
    if we use a string constant as the initializer.  28 June 1997, rms.  */
-static const char spaces[16] = /* "                " */
-  { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
-static const char zeroes[16] = /* "0000000000000000" */
-  { '0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0' };
+static const char spaces[16] =  /* "                " */
+{ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
+    ' ' };
+static const char zeroes[16] =  /* "0000000000000000" */
+{ '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
+    '0' };
 
 # define memset_space(P, Len) \
   do {									      \
@@ -269,29 +271,27 @@
    more reliable way to accept other sets of digits.  */
 #define ISDIGIT(Ch) ((unsigned int) (Ch) - '0' <= 9)
 
-static char *memcpy_lowcase __P ((char *dest, const char *src, size_t len));
+static char *memcpy_lowcase __P((char *dest, const char *src, size_t len));
 
-static char *
-memcpy_lowcase (dest, src, len)
-     char *dest;
-     const char *src;
-     size_t len;
+static char *memcpy_lowcase(dest, src, len)
+char *dest;
+const char *src;
+size_t len;
 {
   while (len-- > 0)
-    dest[len] = TOLOWER ((unsigned char) src[len]);
+    dest[len] = TOLOWER((unsigned char) src[len]);
   return dest;
 }
 
-static char *memcpy_uppcase __P ((char *dest, const char *src, size_t len));
+static char *memcpy_uppcase __P((char *dest, const char *src, size_t len));
 
-static char *
-memcpy_uppcase (dest, src, len)
-     char *dest;
-     const char *src;
-     size_t len;
+static char *memcpy_uppcase(dest, src, len)
+char *dest;
+const char *src;
+size_t len;
 {
   while (len-- > 0)
-    dest[len] = TOUPPER ((unsigned char) src[len]);
+    dest[len] = TOUPPER((unsigned char) src[len]);
   return dest;
 }
 
@@ -300,28 +300,27 @@
 /* Yield the difference between *A and *B,
    measured in seconds, ignoring leap seconds.  */
 # define tm_diff ftime_tm_diff
-static int tm_diff __P ((const struct tm *, const struct tm *));
-static int
-tm_diff (a, b)
-     const struct tm *a;
-     const struct tm *b;
+static int tm_diff __P((const struct tm *, const struct tm *));
+static int tm_diff(a, b)
+const struct tm *a;
+const struct tm *b;
 {
   /* Compute intervening leap days correctly even if year is negative.
-     Take care to avoid int overflow in leap day calculations,
-     but it's OK to assume that A and B are close to each other.  */
-  int a4 = (a->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (a->tm_year & 3);
-  int b4 = (b->tm_year >> 2) + (TM_YEAR_BASE >> 2) - ! (b->tm_year & 3);
+   * Take care to avoid int overflow in leap day calculations,
+   * but it's OK to assume that A and B are close to each other.  */
+  int a4 = (a->tm_year >> 2) + (TM_YEAR_BASE >> 2) - !(a->tm_year & 3);
+  int b4 = (b->tm_year >> 2) + (TM_YEAR_BASE >> 2) - !(b->tm_year & 3);
   int a100 = a4 / 25 - (a4 % 25 < 0);
   int b100 = b4 / 25 - (b4 % 25 < 0);
   int a400 = a100 >> 2;
   int b400 = b100 >> 2;
   int intervening_leap_days = (a4 - b4) - (a100 - b100) + (a400 - b400);
   int years = a->tm_year - b->tm_year;
-  int days = (365 * years + intervening_leap_days
-	      + (a->tm_yday - b->tm_yday));
+  int days = (365 * years + intervening_leap_days + (a->tm_yday - b->tm_yday));
+
   return (60 * (60 * (24 * days + (a->tm_hour - b->tm_hour))
-		+ (a->tm_min - b->tm_min))
-	  + (a->tm_sec - b->tm_sec));
+                + (a->tm_min - b->tm_min))
+          + (a->tm_sec - b->tm_sec));
 }
 #endif /* ! HAVE_TM_GMTOFF */
 
@@ -331,37 +330,36 @@
    year to the year day YDAY with week day WDAY.  ISO weeks start on
    Monday; the first ISO week has the year's first Thursday.  YDAY may
    be as small as YDAY_MINIMUM.  */
-#define ISO_WEEK_START_WDAY 1 /* Monday */
-#define ISO_WEEK1_WDAY 4 /* Thursday */
+#define ISO_WEEK_START_WDAY 1   /* Monday */
+#define ISO_WEEK1_WDAY 4        /* Thursday */
 #define YDAY_MINIMUM (-366)
-static int iso_week_days __P ((int, int));
+static int iso_week_days __P((int, int));
+
 #ifdef __GNUC__
 __inline__
 #endif
-static int
-iso_week_days (yday, wday)
-     int yday;
-     int wday;
+static int iso_week_days(yday, wday)
+int yday;
+int wday;
 {
   /* Add enough to the first operand of % to make it nonnegative.  */
   int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
+
   return (yday
-	  - (yday - wday + ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7
-	  + ISO_WEEK1_WDAY - ISO_WEEK_START_WDAY);
+          - (yday - wday + ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7
+          + ISO_WEEK1_WDAY - ISO_WEEK_START_WDAY);
 }
 
 
 #if !(defined _NL_CURRENT || HAVE_STRFTIME)
-static char const weekday_name[][10] =
-  {
-    "Sunday", "Monday", "Tuesday", "Wednesday",
-    "Thursday", "Friday", "Saturday"
-  };
-static char const month_name[][10] =
-  {
-    "January", "February", "March", "April", "May", "June",
-    "July", "August", "September", "October", "November", "December"
-  };
+static char const weekday_name[][10] = {
+  "Sunday", "Monday", "Tuesday", "Wednesday",
+  "Thursday", "Friday", "Saturday"
+};
+static char const month_name[][10] = {
+  "January", "February", "March", "April", "May", "June",
+  "July", "August", "September", "October", "November", "December"
+};
 #endif
 
 
@@ -381,21 +379,23 @@
 
 #if !defined _LIBC && HAVE_TZNAME && HAVE_TZSET
   /* Solaris 2.5 tzset sometimes modifies the storage returned by localtime.
-     Work around this bug by copying *tp before it might be munged.  */
-  size_t _strftime_copytm __P ((char *, size_t, const char *,
-			        const struct tm * ut_argument_spec_iso));
-  size_t
-  my_strftime (s, maxsize, format, tp ut_argument)
-      char *s;
-      size_t maxsize;
-      const char *format;
-      const struct tm *tp;
-      ut_argument_spec
-  {
-    struct tm tmcopy;
-    tmcopy = *tp;
-    return _strftime_copytm (s, maxsize, format, &tmcopy ut_argument);
-  }
+   * Work around this bug by copying *tp before it might be munged.  */
+size_t _strftime_copytm __P((char *, size_t, const char *,
+                             const struct tm *ut_argument_spec_iso));
+size_t my_strftime(s, maxsize, format, tp ut_argument)
+char *s;
+size_t maxsize;
+const char *format;
+const struct tm *tp;
+
+ut_argument_spec
+{
+  struct tm tmcopy;
+
+  tmcopy = *tp;
+  return _strftime_copytm(s, maxsize, format, &tmcopy ut_argument);
+}
+
 # undef my_strftime
 # define my_strftime(S, Maxsize, Format, Tp) \
   _strftime_copytm (S, Maxsize, Format, Tp)
@@ -408,22 +408,23 @@
    characters written.  If S is NULL, nothing will be written
    anywhere, so to determine how many characters would be
    written, use NULL for S and (size_t) UINT_MAX for MAXSIZE.  */
-size_t
-my_strftime (s, maxsize, format, tp ut_argument)
-      char *s;
-      size_t maxsize;
-      const char *format;
-      const struct tm *tp;
-      ut_argument_spec
+size_t my_strftime(s, maxsize, format, tp ut_argument)
+char *s;
+size_t maxsize;
+const char *format;
+const struct tm *tp;
+
+ut_argument_spec
 {
   int hour12 = tp->tm_hour;
+
 #ifdef _NL_CURRENT
   /* We cannot make the following values variables since we must delay
-     the evaluation of these values until really needed since some
-     expressions might not be valid in every situation.  The `struct tm'
-     might be generated by a strptime() call that initialized
-     only a few elements.  Dereference the pointers only if the format
-     requires this.  Then it is ok to fail if the pointers are invalid.  */
+   * the evaluation of these values until really needed since some
+   * expressions might not be valid in every situation.  The `struct tm'
+   * might be generated by a strptime() call that initialized
+   * only a few elements.  Dereference the pointers only if the format
+   * requires this.  Then it is ok to fail if the pointers are invalid.  */
 # define a_wkday _NL_CURRENT (LC_TIME, ABDAY_1 + tp->tm_wday)
 # define f_wkday _NL_CURRENT (LC_TIME, DAY_1 + tp->tm_wday)
 # define a_month _NL_CURRENT (LC_TIME, ABMON_1 + tp->tm_mon)
@@ -454,190 +455,255 @@
   zone = NULL;
 #if HAVE_TM_ZONE
   /* The POSIX test suite assumes that setting
-     the environment variable TZ to a new value before calling strftime()
-     will influence the result (the %Z format) even if the information in
-     TP is computed with a totally different time zone.
-     This is bogus: though POSIX allows bad behavior like this,
-     POSIX does not require it.  Do the right thing instead.  */
+   * the environment variable TZ to a new value before calling strftime()
+   * will influence the result (the %Z format) even if the information in
+   * TP is computed with a totally different time zone.
+   * This is bogus: though POSIX allows bad behavior like this,
+   * POSIX does not require it.  Do the right thing instead.  */
   zone = (const char *) tp->tm_zone;
 #endif
 #if HAVE_TZNAME
-  if (ut)
-    {
-      if (! (zone && *zone))
-	zone = "GMT";
-    }
-  else
-    {
-      /* POSIX.1 8.1.1 requires that whenever strftime() is called, the
-	 time zone names contained in the external variable `tzname' shall
-	 be set as if the tzset() function had been called.  */
+  if (ut) {
+    if (!(zone && *zone))
+      zone = "GMT";
+  }
+  else {
+    /* POSIX.1 8.1.1 requires that whenever strftime() is called, the
+     * time zone names contained in the external variable `tzname' shall
+     * be set as if the tzset() function had been called.  */
 # if HAVE_TZSET
-      tzset ();
+    tzset();
 # endif
-    }
+  }
 #endif
 
   if (hour12 > 12)
     hour12 -= 12;
-  else
-    if (hour12 == 0)
-      hour12 = 12;
-
-  for (f = format; *f != '\0'; ++f)
-    {
-      int pad = 0;		/* Padding for number ('-', '_', or 0).  */
-      int modifier;		/* Field modifier ('E', 'O', or 0).  */
-      int digits;		/* Max digits for numeric format.  */
-      int number_value; 	/* Numeric value to be printed.  */
-      int negative_number;	/* 1 if the number is negative.  */
-      const char *subfmt;
-      char *bufp;
-      char buf[1 + (sizeof (int) < sizeof (time_t)
-		    ? INT_STRLEN_BOUND (time_t)
-		    : INT_STRLEN_BOUND (int))];
-      int width = -1;
-      int to_lowcase = 0;
-      int to_uppcase = 0;
-      int change_case = 0;
-      int format_char;
+  else if (hour12 == 0)
+    hour12 = 12;
+
+  for (f = format; *f != '\0'; ++f) {
+    int pad = 0;                /* Padding for number ('-', '_', or 0).  */
+    int modifier;               /* Field modifier ('E', 'O', or 0).  */
+    int digits;                 /* Max digits for numeric format.  */
+    int number_value;           /* Numeric value to be printed.  */
+    int negative_number;        /* 1 if the number is negative.  */
+    const char *subfmt;
+    char *bufp;
+    char buf[1 + (sizeof(int) < sizeof(time_t)
+                  ? INT_STRLEN_BOUND(time_t)
+                  : INT_STRLEN_BOUND(int))];
+    int width = -1;
+    int to_lowcase = 0;
+    int to_uppcase = 0;
+    int change_case = 0;
+    int format_char;
 
 #if DO_MULTIBYTE
 
-       switch (*f)
-	{
-	case '%':
-	  break;
-
-	case '\a': case '\b': case '\t': case '\n':
-	case '\v': case '\f': case '\r':
-	case ' ': case '!': case '"': case '#': case '&': case'\'':
-	case '(': case ')': case '*': case '+': case ',': case '-':
-	case '.': case '/': case '0': case '1': case '2': case '3':
-	case '4': case '5': case '6': case '7': case '8': case '9':
-	case ':': case ';': case '<': case '=': case '>': case '?':
-	case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
-	case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
-	case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
-	case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
-	case 'Y': case 'Z': case '[': case'\\': case ']': case '^':
-	case '_': case 'a': case 'b': case 'c': case 'd': case 'e':
-	case 'f': case 'g': case 'h': case 'i': case 'j': case 'k':
-	case 'l': case 'm': case 'n': case 'o': case 'p': case 'q':
-	case 'r': case 's': case 't': case 'u': case 'v': case 'w':
-	case 'x': case 'y': case 'z': case '{': case '|': case '}':
-	case '~':
-	  /* The C Standard requires these 98 characters (plus '%') to
-	     be in the basic execution character set.  None of these
-	     characters can start a multibyte sequence, so they need
-	     not be analyzed further.  */
-	  add (1, *p = *f);
-	  continue;
-
-	default:
-	  /* Copy this multibyte sequence until we reach its end, find
-	     an error, or come back to the initial shift state.  */
-	  {
-	    mbstate_t mbstate = mbstate_zero;
-	    size_t len = 0;
-
-	    do
-	      {
-		size_t bytes = mbrlen (f + len, (size_t) -1, &mbstate);
-
-		if (bytes == 0)
-		  break;
-
-		if (bytes == (size_t) -2)
-		  {
-		    len += strlen (f + len);
-		    break;
-		  }
-
-		if (bytes == (size_t) -1)
-		  {
-		    len++;
-		    break;
-		  }
-
-		len += bytes;
-	      }
-	    while (! mbsinit (&mbstate));
-
-	    cpy (len, f);
-	    f += len - 1;
-	    continue;
-	  }
-	}
+    switch (*f) {
+    case '%':
+      break;
+
+    case '\a':
+    case '\b':
+    case '\t':
+    case '\n':
+    case '\v':
+    case '\f':
+    case '\r':
+    case ' ':
+    case '!':
+    case '"':
+    case '#':
+    case '&':
+    case '\'':
+    case '(':
+    case ')':
+    case '*':
+    case '+':
+    case ',':
+    case '-':
+    case '.':
+    case '/':
+    case '0':
+    case '1':
+    case '2':
+    case '3':
+    case '4':
+    case '5':
+    case '6':
+    case '7':
+    case '8':
+    case '9':
+    case ':':
+    case ';':
+    case '<':
+    case '=':
+    case '>':
+    case '?':
+    case 'A':
+    case 'B':
+    case 'C':
+    case 'D':
+    case 'E':
+    case 'F':
+    case 'G':
+    case 'H':
+    case 'I':
+    case 'J':
+    case 'K':
+    case 'L':
+    case 'M':
+    case 'N':
+    case 'O':
+    case 'P':
+    case 'Q':
+    case 'R':
+    case 'S':
+    case 'T':
+    case 'U':
+    case 'V':
+    case 'W':
+    case 'X':
+    case 'Y':
+    case 'Z':
+    case '[':
+    case '\\':
+    case ']':
+    case '^':
+    case '_':
+    case 'a':
+    case 'b':
+    case 'c':
+    case 'd':
+    case 'e':
+    case 'f':
+    case 'g':
+    case 'h':
+    case 'i':
+    case 'j':
+    case 'k':
+    case 'l':
+    case 'm':
+    case 'n':
+    case 'o':
+    case 'p':
+    case 'q':
+    case 'r':
+    case 's':
+    case 't':
+    case 'u':
+    case 'v':
+    case 'w':
+    case 'x':
+    case 'y':
+    case 'z':
+    case '{':
+    case '|':
+    case '}':
+    case '~':
+      /* The C Standard requires these 98 characters (plus '%') to
+       * be in the basic execution character set.  None of these
+       * characters can start a multibyte sequence, so they need
+       * not be analyzed further.  */
+      add(1, *p = *f);
+      continue;
+
+    default:
+      /* Copy this multibyte sequence until we reach its end, find
+       * an error, or come back to the initial shift state.  */
+      {
+        mbstate_t mbstate = mbstate_zero;
+        size_t len = 0;
+
+        do {
+          size_t bytes = mbrlen(f + len, (size_t) - 1, &mbstate);
+
+          if (bytes == 0)
+            break;
+
+          if (bytes == (size_t) - 2) {
+            len += strlen(f + len);
+            break;
+          }
+
+          if (bytes == (size_t) - 1) {
+            len++;
+            break;
+          }
+
+          len += bytes;
+        }
+        while (!mbsinit(&mbstate));
+
+        cpy(len, f);
+        f += len - 1;
+        continue;
+      }
+    }
 
 #else /* ! DO_MULTIBYTE */
 
-      /* Either multibyte encodings are not supported, or they are
-	 safe for formats, so any non-'%' byte can be copied through.  */
-      if (*f != '%')
-	{
-	  add (1, *p = *f);
-	  continue;
-	}
+    /* Either multibyte encodings are not supported, or they are
+     * safe for formats, so any non-'%' byte can be copied through.  */
+    if (*f != '%') {
+      add(1, *p = *f);
+      continue;
+    }
 
 #endif /* ! DO_MULTIBYTE */
 
-      /* Check for flags that can modify a format.  */
-      while (1)
-	{
-	  switch (*++f)
-	    {
-	      /* This influences the number formats.  */
-	    case '_':
-	    case '-':
-	    case '0':
-	      pad = *f;
-	      continue;
-
-	      /* This changes textual output.  */
-	    case '^':
-	      to_uppcase = 1;
-	      continue;
-	    case '#':
-	      change_case = 1;
-	      continue;
-
-	    default:
-	      break;
-	    }
-	  break;
-	}
-
-      /* As a GNU extension we allow to specify the field width.  */
-      if (ISDIGIT (*f))
-	{
-	  width = 0;
-	  do
-	    {
-	      width *= 10;
-	      width += *f - '0';
-	      ++f;
-	    }
-	  while (ISDIGIT (*f));
-	}
-
-      /* Check for modifiers.  */
-      switch (*f)
-	{
-	case 'E':
-	case 'O':
-	  modifier = *f++;
-	  break;
-
-	default:
-	  modifier = 0;
-	  break;
-	}
-
-      /* Now do the specified format.  */
-      format_char = *f;
-      switch (format_char)
-	{
+    /* Check for flags that can modify a format.  */
+    while (1) {
+      switch (*++f) {
+        /* This influences the number formats.  */
+      case '_':
+      case '-':
+      case '0':
+        pad = *f;
+        continue;
+
+        /* This changes textual output.  */
+      case '^':
+        to_uppcase = 1;
+        continue;
+      case '#':
+        change_case = 1;
+        continue;
+
+      default:
+        break;
+      }
+      break;
+    }
+
+    /* As a GNU extension we allow to specify the field width.  */
+    if (ISDIGIT(*f)) {
+      width = 0;
+      do {
+        width *= 10;
+        width += *f - '0';
+        ++f;
+      }
+      while (ISDIGIT(*f));
+    }
+
+    /* Check for modifiers.  */
+    switch (*f) {
+    case 'E':
+    case 'O':
+      modifier = *f++;
+      break;
+
+    default:
+      modifier = 0;
+      break;
+    }
+
+    /* Now do the specified format.  */
+    format_char = *f;
+    switch (format_char) {
 #define DO_NUMBER(d, v) \
 	  digits = width == -1 ? d : width;				      \
 	  number_value = v; goto do_number
@@ -645,595 +711,580 @@
 	  digits = width == -1 ? d : width;				      \
 	  number_value = v; goto do_number_spacepad
 
-	case '%':
-	  if (modifier != 0)
-	    goto bad_format;
-	  add (1, *p = *f);
-	  break;
-
-	case 'a':
-	  if (modifier != 0)
-	    goto bad_format;
-	  if (change_case)
-	    {
-	      to_uppcase = 1;
-	      to_lowcase = 0;
-	    }
+    case '%':
+      if (modifier != 0)
+        goto bad_format;
+      add(1, *p = *f);
+      break;
+
+    case 'a':
+      if (modifier != 0)
+        goto bad_format;
+      if (change_case) {
+        to_uppcase = 1;
+        to_lowcase = 0;
+      }
 #if defined _NL_CURRENT || !HAVE_STRFTIME
-	  cpy (aw_len, a_wkday);
-	  break;
+      cpy(aw_len, a_wkday);
+      break;
 #else
-	  goto underlying_strftime;
+      goto underlying_strftime;
 #endif
 
-	case 'A':
-	  if (modifier != 0)
-	    goto bad_format;
-	  if (change_case)
-	    {
-	      to_uppcase = 1;
-	      to_lowcase = 0;
-	    }
+    case 'A':
+      if (modifier != 0)
+        goto bad_format;
+      if (change_case) {
+        to_uppcase = 1;
+        to_lowcase = 0;
+      }
 #if defined _NL_CURRENT || !HAVE_STRFTIME
-	  cpy (strlen (f_wkday), f_wkday);
-	  break;
+      cpy(strlen(f_wkday), f_wkday);
+      break;
 #else
-	  goto underlying_strftime;
+      goto underlying_strftime;
 #endif
 
-	case 'b':
-	case 'h':		/* POSIX.2 extension.  */
-	  if (modifier != 0)
-	    goto bad_format;
+    case 'b':
+    case 'h':                  /* POSIX.2 extension.  */
+      if (modifier != 0)
+        goto bad_format;
 #if defined _NL_CURRENT || !HAVE_STRFTIME
-	  cpy (am_len, a_month);
-	  break;
+      cpy(am_len, a_month);
+      break;
 #else
-	  goto underlying_strftime;
+      goto underlying_strftime;
 #endif
 
-	case 'B':
-	  if (modifier != 0)
-	    goto bad_format;
-	  if (change_case)
-	    {
-	      to_uppcase = 1;
-	      to_lowcase = 0;
-	    }
+    case 'B':
+      if (modifier != 0)
+        goto bad_format;
+      if (change_case) {
+        to_uppcase = 1;
+        to_lowcase = 0;
+      }
 #if defined _NL_CURRENT || !HAVE_STRFTIME
-	  cpy (strlen (f_month), f_month);
-	  break;
+      cpy(strlen(f_month), f_month);
+      break;
 #else
-	  goto underlying_strftime;
+      goto underlying_strftime;
 #endif
 
-	case 'c':
-	  if (modifier == 'O')
-	    goto bad_format;
+    case 'c':
+      if (modifier == 'O')
+        goto bad_format;
 #ifdef _NL_CURRENT
-	  if (! (modifier == 'E'
-		 && *(subfmt = _NL_CURRENT (LC_TIME, ERA_D_T_FMT)) != '\0'))
-	    subfmt = _NL_CURRENT (LC_TIME, D_T_FMT);
+      if (!(modifier == 'E' &&
+          *(subfmt = _NL_CURRENT(LC_TIME, ERA_D_T_FMT)) != '\0'))
+        subfmt = _NL_CURRENT(LC_TIME, D_T_FMT);
 #else
 # if HAVE_STRFTIME
-	  goto underlying_strftime;
+      goto underlying_strftime;
 # else
-	  subfmt = "%a %b %e %H:%M:%S %Y";
+      subfmt = "%a %b %e %H:%M:%S %Y";
 # endif
 #endif
 
-	subformat:
-	  {
-	    char *old_start = p;
-	    size_t len = my_strftime (NULL, (size_t) -1, subfmt, tp);
-	    add (len, my_strftime (p, maxsize - i, subfmt, tp));
-
-	    if (to_uppcase)
-	      while (old_start < p)
-		{
-		  *old_start = TOUPPER ((unsigned char) *old_start);
-		  ++old_start;
-		}
-	  }
-	  break;
+    subformat:
+      {
+        char *old_start = p;
+        size_t len = my_strftime(NULL, (size_t) - 1, subfmt, tp);
+
+        add(len, my_strftime(p, maxsize - i, subfmt, tp));
+
+        if (to_uppcase)
+          while (old_start < p) {
+            *old_start = TOUPPER((unsigned char) *old_start);
+            ++old_start;
+          }
+      }
+      break;
 
 #if HAVE_STRFTIME && ! (defined _NL_CURRENT && HAVE_STRUCT_ERA_ENTRY)
-	underlying_strftime:
-	  {
-	    /* The relevant information is available only via the
-	       underlying strftime implementation, so use that.  */
-	    char ufmt[4];
-	    char *u = ufmt;
-	    char ubuf[1024]; /* enough for any single format in practice */
-	    size_t len;
-	    *u++ = '%';
-	    if (modifier != 0)
-	      *u++ = modifier;
-	    *u++ = format_char;
-	    *u = '\0';
-	    len = strftime (ubuf, sizeof ubuf, ufmt, tp);
-	    if (len == 0 && ubuf[0] != '\0')
-	      return 0;
-	    cpy (len, ubuf);
-	  }
-	  break;
-#endif
-
-	case 'C':		/* POSIX.2 extension.  */
-	  if (modifier == 'O')
-	    goto bad_format;
-	  if (modifier == 'E')
-	    {
+    underlying_strftime:
+      {
+        /* The relevant information is available only via the
+         * underlying strftime implementation, so use that.  */
+        char ufmt[4];
+        char *u = ufmt;
+        char ubuf[1024];        /* enough for any single format in practice */
+        size_t len;
+
+        *u++ = '%';
+        if (modifier != 0)
+          *u++ = modifier;
+        *u++ = format_char;
+        *u = '\0';
+        len = strftime(ubuf, sizeof ubuf, ufmt, tp);
+        if (len == 0 && ubuf[0] != '\0')
+          return 0;
+        cpy(len, ubuf);
+      }
+      break;
+#endif
+
+    case 'C':                  /* POSIX.2 extension.  */
+      if (modifier == 'O')
+        goto bad_format;
+      if (modifier == 'E') {
 #if HAVE_STRUCT_ERA_ENTRY
-	      struct era_entry *era = _nl_get_era_entry (tp);
-	      if (era)
-		{
-		  size_t len = strlen (era->name_fmt);
-		  cpy (len, era->name_fmt);
-		  break;
-		}
+        struct era_entry *era = _nl_get_era_entry(tp);
+
+        if (era) {
+          size_t len = strlen(era->name_fmt);
+
+          cpy(len, era->name_fmt);
+          break;
+        }
 #else
 # if HAVE_STRFTIME
-	      goto underlying_strftime;
+        goto underlying_strftime;
 # endif
 #endif
-	    }
+      }
+
+      {
+        int year = tp->tm_year + TM_YEAR_BASE;
 
-	  {
-	    int year = tp->tm_year + TM_YEAR_BASE;
-	    DO_NUMBER (1, year / 100 - (year % 100 < 0));
-	  }
-
-	case 'x':
-	  if (modifier == 'O')
-	    goto bad_format;
+        DO_NUMBER(1, year / 100 - (year % 100 < 0));
+      }
+
+    case 'x':
+      if (modifier == 'O')
+        goto bad_format;
 #ifdef _NL_CURRENT
-	  if (! (modifier == 'E'
-		 && *(subfmt = _NL_CURRENT (LC_TIME, ERA_D_FMT)) != '\0'))
-	    subfmt = _NL_CURRENT (LC_TIME, D_FMT);
-	  goto subformat;
+      if (!(modifier == 'E' &&
+          *(subfmt = _NL_CURRENT(LC_TIME, ERA_D_FMT)) != '\0'))
+        subfmt = _NL_CURRENT(LC_TIME, D_FMT);
+      goto subformat;
 #else
 # if HAVE_STRFTIME
-	  goto underlying_strftime;
+      goto underlying_strftime;
 # else
-	  /* Fall through.  */
+      /* Fall through.  */
 # endif
 #endif
-	case 'D':		/* POSIX.2 extension.  */
-	  if (modifier != 0)
-	    goto bad_format;
-	  subfmt = "%m/%d/%y";
-	  goto subformat;
+    case 'D':                  /* POSIX.2 extension.  */
+      if (modifier != 0)
+        goto bad_format;
+      subfmt = "%m/%d/%y";
+      goto subformat;
 
-	case 'd':
-	  if (modifier == 'E')
-	    goto bad_format;
+    case 'd':
+      if (modifier == 'E')
+        goto bad_format;
 
-	  DO_NUMBER (2, tp->tm_mday);
+      DO_NUMBER(2, tp->tm_mday);
 
-	case 'e':		/* POSIX.2 extension.  */
-	  if (modifier == 'E')
-	    goto bad_format;
+    case 'e':                  /* POSIX.2 extension.  */
+      if (modifier == 'E')
+        goto bad_format;
 
-	  DO_NUMBER_SPACEPAD (2, tp->tm_mday);
+      DO_NUMBER_SPACEPAD(2, tp->tm_mday);
 
-	  /* All numeric formats set DIGITS and NUMBER_VALUE and then
-	     jump to one of these two labels.  */
+      /* All numeric formats set DIGITS and NUMBER_VALUE and then
+       * jump to one of these two labels.  */
 
-	do_number_spacepad:
-	  /* Force `_' flag unless overwritten by `0' flag.  */
-	  if (pad != '0')
-	    pad = '_';
+    do_number_spacepad:
+      /* Force `_' flag unless overwritten by `0' flag.  */
+      if (pad != '0')
+        pad = '_';
 
-	do_number:
-	  /* Format the number according to the MODIFIER flag.  */
+    do_number:
+      /* Format the number according to the MODIFIER flag.  */
 
-	  if (modifier == 'O' && 0 <= number_value)
-	    {
+      if (modifier == 'O' && 0 <= number_value) {
 #ifdef _NL_CURRENT
-	      /* Get the locale specific alternate representation of
-		 the number NUMBER_VALUE.  If none exist NULL is returned.  */
-	      const char *cp = _nl_get_alt_digit (number_value);
-
-	      if (cp != NULL)
-		{
-		  size_t digitlen = strlen (cp);
-		  if (digitlen != 0)
-		    {
-		      cpy (digitlen, cp);
-		      break;
-		    }
-		}
+        /* Get the locale specific alternate representation of
+         * the number NUMBER_VALUE.  If none exist NULL is returned.  */
+        const char *cp = _nl_get_alt_digit(number_value);
+
+        if (cp != NULL) {
+          size_t digitlen = strlen(cp);
+
+          if (digitlen != 0) {
+            cpy(digitlen, cp);
+            break;
+          }
+        }
 #else
 # if HAVE_STRFTIME
-	      goto underlying_strftime;
+        goto underlying_strftime;
 # endif
 #endif
-	    }
-	  {
-	    unsigned int u = number_value;
+      }
+      {
+        unsigned int u = number_value;
 
-	    bufp = buf + sizeof (buf);
-	    negative_number = number_value < 0;
+        bufp = buf + sizeof(buf);
+        negative_number = number_value < 0;
 
-	    if (negative_number)
-	      u = -u;
+        if (negative_number)
+          u = -u;
 
-	    do
-	      *--bufp = u % 10 + '0';
-	    while ((u /= 10) != 0);
-  	  }
+        do
+          *--bufp = u % 10 + '0';
+        while ((u /= 10) != 0);
+      }
 
-	do_number_sign_and_padding:
-	  if (negative_number)
-	    *--bufp = '-';
+    do_number_sign_and_padding:
+      if (negative_number)
+        *--bufp = '-';
 
-	  if (pad != '-')
-	    {
-	      int padding = digits - (buf + sizeof (buf) - bufp);
+      if (pad != '-') {
+        int padding = digits - (buf + sizeof(buf) - bufp);
 
-	      if (pad == '_')
-		{
-		  while (0 < padding--)
-		    *--bufp = ' ';
-		}
-	      else
-		{
-		  bufp += negative_number;
-		  while (0 < padding--)
-		    *--bufp = '0';
-		  if (negative_number)
-		    *--bufp = '-';
-		}
-	    }
+        if (pad == '_') {
+          while (0 < padding--)
+            *--bufp = ' ';
+        }
+        else {
+          bufp += negative_number;
+          while (0 < padding--)
+            *--bufp = '0';
+          if (negative_number)
+            *--bufp = '-';
+        }
+      }
 
-	  cpy (buf + sizeof (buf) - bufp, bufp);
-	  break;
+      cpy(buf + sizeof(buf) - bufp, bufp);
+      break;
 
-	case 'F':
-	  if (modifier != 0)
-	    goto bad_format;
-	  subfmt = "%Y-%m-%d";
-	  goto subformat;
+    case 'F':
+      if (modifier != 0)
+        goto bad_format;
+      subfmt = "%Y-%m-%d";
+      goto subformat;
 
-	case 'H':
-	  if (modifier == 'E')
-	    goto bad_format;
+    case 'H':
+      if (modifier == 'E')
+        goto bad_format;
 
-	  DO_NUMBER (2, tp->tm_hour);
+      DO_NUMBER(2, tp->tm_hour);
 
-	case 'I':
-	  if (modifier == 'E')
-	    goto bad_format;
+    case 'I':
+      if (modifier == 'E')
+        goto bad_format;
 
-	  DO_NUMBER (2, hour12);
+      DO_NUMBER(2, hour12);
 
-	case 'k':		/* GNU extension.  */
-	  if (modifier == 'E')
-	    goto bad_format;
+    case 'k':                  /* GNU extension.  */
+      if (modifier == 'E')
+        goto bad_format;
 
-	  DO_NUMBER_SPACEPAD (2, tp->tm_hour);
+      DO_NUMBER_SPACEPAD(2, tp->tm_hour);
 
-	case 'l':		/* GNU extension.  */
-	  if (modifier == 'E')
-	    goto bad_format;
+    case 'l':                  /* GNU extension.  */
+      if (modifier == 'E')
+        goto bad_format;
 
-	  DO_NUMBER_SPACEPAD (2, hour12);
+      DO_NUMBER_SPACEPAD(2, hour12);
 
-	case 'j':
-	  if (modifier == 'E')
-	    goto bad_format;
+    case 'j':
+      if (modifier == 'E')
+        goto bad_format;
 
-	  DO_NUMBER (3, 1 + tp->tm_yday);
+      DO_NUMBER(3, 1 + tp->tm_yday);
 
-	case 'M':
-	  if (modifier == 'E')
-	    goto bad_format;
+    case 'M':
+      if (modifier == 'E')
+        goto bad_format;
 
-	  DO_NUMBER (2, tp->tm_min);
+      DO_NUMBER(2, tp->tm_min);
 
-	case 'm':
-	  if (modifier == 'E')
-	    goto bad_format;
+    case 'm':
+      if (modifier == 'E')
+        goto bad_format;
 
-	  DO_NUMBER (2, tp->tm_mon + 1);
+      DO_NUMBER(2, tp->tm_mon + 1);
 
-	case 'n':		/* POSIX.2 extension.  */
-	  add (1, *p = '\n');
-	  break;
+    case 'n':                  /* POSIX.2 extension.  */
+      add(1, *p = '\n');
+      break;
 
-	case 'P':
-	  to_lowcase = 1;
+    case 'P':
+      to_lowcase = 1;
 #if !defined _NL_CURRENT && HAVE_STRFTIME
-	  format_char = 'p';
+      format_char = 'p';
 #endif
-	  /* FALLTHROUGH */
+      /* FALLTHROUGH */
 
-	case 'p':
-	  if (change_case)
-	    {
-	      to_uppcase = 0;
-	      to_lowcase = 1;
-	    }
+    case 'p':
+      if (change_case) {
+        to_uppcase = 0;
+        to_lowcase = 1;
+      }
 #if defined _NL_CURRENT || !HAVE_STRFTIME
-	  cpy (ap_len, ampm);
-	  break;
+      cpy(ap_len, ampm);
+      break;
 #else
-	  goto underlying_strftime;
+      goto underlying_strftime;
 #endif
 
-	case 'R':		/* GNU extension.  */
-	  subfmt = "%H:%M";
-	  goto subformat;
+    case 'R':                  /* GNU extension.  */
+      subfmt = "%H:%M";
+      goto subformat;
 
-	case 'r':		/* POSIX.2 extension.  */
+    case 'r':                  /* POSIX.2 extension.  */
 #ifdef _NL_CURRENT
-	  if (*(subfmt = _NL_CURRENT (LC_TIME, T_FMT_AMPM)) == '\0')
+      if (*(subfmt = _NL_CURRENT(LC_TIME, T_FMT_AMPM)) == '\0')
 #endif
-	    subfmt = "%I:%M:%S %p";
-	  goto subformat;
+        subfmt = "%I:%M:%S %p";
+      goto subformat;
+
+    case 'S':
+      if (modifier == 'E')
+        goto bad_format;
+
+      DO_NUMBER(2, tp->tm_sec);
+
+    case 's':                  /* GNU extension.  */
+      {
+        struct tm ltm;
+        time_t t;
+
+        ltm = *tp;
+        t = mktime(&ltm);
+
+        /* Generate string value for T using time_t arithmetic;
+         * this works even if sizeof (long) < sizeof (time_t).  */
+
+        bufp = buf + sizeof(buf);
+        negative_number = t < 0;
+
+        do {
+          int d = t % 10;
+
+          t /= 10;
 
-	case 'S':
-	  if (modifier == 'E')
-	    goto bad_format;
-
-	  DO_NUMBER (2, tp->tm_sec);
-
-	case 's':		/* GNU extension.  */
-  	  {
-	    struct tm ltm;
-	    time_t t;
-
-	    ltm = *tp;
-	    t = mktime (&ltm);
-
-	    /* Generate string value for T using time_t arithmetic;
-	       this works even if sizeof (long) < sizeof (time_t).  */
-
-	    bufp = buf + sizeof (buf);
-	    negative_number = t < 0;
-
-	    do
-	      {
-		int d = t % 10;
-		t /= 10;
-
-		if (negative_number)
-		  {
-		    d = -d;
-
-		    /* Adjust if division truncates to minus infinity.  */
-		    if (0 < -1 % 10 && d < 0)
-		      {
-			t++;
-			d += 10;
-		      }
-		  }
-
-		*--bufp = d + '0';
-	      }
-	    while (t != 0);
-
-	    digits = 1;
-	    goto do_number_sign_and_padding;
-	  }
-
-	case 'X':
-	  if (modifier == 'O')
-	    goto bad_format;
+          if (negative_number) {
+            d = -d;
+
+            /* Adjust if division truncates to minus infinity.  */
+            if (0 < -1 % 10 && d < 0) {
+              t++;
+              d += 10;
+            }
+          }
+
+          *--bufp = d + '0';
+        }
+        while (t != 0);
+
+        digits = 1;
+        goto do_number_sign_and_padding;
+      }
+
+    case 'X':
+      if (modifier == 'O')
+        goto bad_format;
 #ifdef _NL_CURRENT
-	  if (! (modifier == 'E'
-		 && *(subfmt = _NL_CURRENT (LC_TIME, ERA_T_FMT)) != '\0'))
-	    subfmt = _NL_CURRENT (LC_TIME, T_FMT);
-	  goto subformat;
+      if (!(modifier == 'E' &&
+          *(subfmt = _NL_CURRENT(LC_TIME, ERA_T_FMT)) != '\0'))
+        subfmt = _NL_CURRENT(LC_TIME, T_FMT);
+      goto subformat;
 #else
 # if HAVE_STRFTIME
-	  goto underlying_strftime;
+      goto underlying_strftime;
 # else
-	  /* Fall through.  */
+      /* Fall through.  */
 # endif
 #endif
-	case 'T':		/* POSIX.2 extension.  */
-	  subfmt = "%H:%M:%S";
-	  goto subformat;
-
-	case 't':		/* POSIX.2 extension.  */
-	  add (1, *p = '\t');
-	  break;
-
-	case 'u':		/* POSIX.2 extension.  */
-	  DO_NUMBER (1, (tp->tm_wday - 1 + 7) % 7 + 1);
-
-	case 'U':
-	  if (modifier == 'E')
-	    goto bad_format;
-
-	  DO_NUMBER (2, (tp->tm_yday - tp->tm_wday + 7) / 7);
-
-	case 'V':
-	case 'g':		/* GNU extension.  */
-	case 'G':		/* GNU extension.  */
-	  if (modifier == 'E')
-	    goto bad_format;
-	  {
-	    int year = tp->tm_year + TM_YEAR_BASE;
-	    int days = iso_week_days (tp->tm_yday, tp->tm_wday);
-
-	    if (days < 0)
-	      {
-		/* This ISO week belongs to the previous year.  */
-		year--;
-		days = iso_week_days (tp->tm_yday + (365 + __isleap (year)),
-				      tp->tm_wday);
-	      }
-	    else
-	      {
-		int d = iso_week_days (tp->tm_yday - (365 + __isleap (year)),
-				       tp->tm_wday);
-		if (0 <= d)
-		  {
-		    /* This ISO week belongs to the next year.  */
-		    year++;
-		    days = d;
-		  }
-	      }
-
-	    switch (*f)
-	      {
-	      case 'g':
-		DO_NUMBER (2, (year % 100 + 100) % 100);
-
-	      case 'G':
-		DO_NUMBER (1, year);
-
-	      default:
-		DO_NUMBER (2, days / 7 + 1);
-	      }
-	  }
-
-	case 'W':
-	  if (modifier == 'E')
-	    goto bad_format;
-
-	  DO_NUMBER (2, (tp->tm_yday - (tp->tm_wday - 1 + 7) % 7 + 7) / 7);
-
-	case 'w':
-	  if (modifier == 'E')
-	    goto bad_format;
-
-	  DO_NUMBER (1, tp->tm_wday);
-
-	case 'Y':
-	  if (modifier == 'E')
-	    {
+    case 'T':                  /* POSIX.2 extension.  */
+      subfmt = "%H:%M:%S";
+      goto subformat;
+
+    case 't':                  /* POSIX.2 extension.  */
+      add(1, *p = '\t');
+      break;
+
+    case 'u':                  /* POSIX.2 extension.  */
+      DO_NUMBER(1, (tp->tm_wday - 1 + 7) % 7 + 1);
+
+    case 'U':
+      if (modifier == 'E')
+        goto bad_format;
+
+      DO_NUMBER(2, (tp->tm_yday - tp->tm_wday + 7) / 7);
+
+    case 'V':
+    case 'g':                  /* GNU extension.  */
+    case 'G':                  /* GNU extension.  */
+      if (modifier == 'E')
+        goto bad_format;
+      {
+        int year = tp->tm_year + TM_YEAR_BASE;
+        int days = iso_week_days(tp->tm_yday, tp->tm_wday);
+
+        if (days < 0) {
+          /* This ISO week belongs to the previous year.  */
+          year--;
+          days = iso_week_days(tp->tm_yday + (365 + __isleap(year)),
+                               tp->tm_wday);
+        }
+        else {
+          int d = iso_week_days(tp->tm_yday - (365 + __isleap(year)),
+                                tp->tm_wday);
+
+          if (0 <= d) {
+            /* This ISO week belongs to the next year.  */
+            year++;
+            days = d;
+          }
+        }
+
+        switch (*f) {
+        case 'g':
+          DO_NUMBER(2, (year % 100 + 100) % 100);
+
+        case 'G':
+          DO_NUMBER(1, year);
+
+        default:
+          DO_NUMBER(2, days / 7 + 1);
+        }
+      }
+
+    case 'W':
+      if (modifier == 'E')
+        goto bad_format;
+
+      DO_NUMBER(2, (tp->tm_yday - (tp->tm_wday - 1 + 7) % 7 + 7) / 7);
+
+    case 'w':
+      if (modifier == 'E')
+        goto bad_format;
+
+      DO_NUMBER(1, tp->tm_wday);
+
+    case 'Y':
+      if (modifier == 'E') {
 #if HAVE_STRUCT_ERA_ENTRY
-	      struct era_entry *era = _nl_get_era_entry (tp);
-	      if (era)
-		{
-		  subfmt = strchr (era->name_fmt, '\0') + 1;
-		  goto subformat;
-		}
+        struct era_entry *era = _nl_get_era_entry(tp);
+
+        if (era) {
+          subfmt = strchr(era->name_fmt, '\0') + 1;
+          goto subformat;
+        }
 #else
 # if HAVE_STRFTIME
-	      goto underlying_strftime;
+        goto underlying_strftime;
 # endif
 #endif
-	    }
-	  if (modifier == 'O')
-	    goto bad_format;
-	  else
-	    DO_NUMBER (1, tp->tm_year + TM_YEAR_BASE);
-
-	case 'y':
-	  if (modifier == 'E')
-	    {
+      }
+      if (modifier == 'O')
+        goto bad_format;
+      else
+        DO_NUMBER(1, tp->tm_year + TM_YEAR_BASE);
+
+    case 'y':
+      if (modifier == 'E') {
 #if HAVE_STRUCT_ERA_ENTRY
-	      struct era_entry *era = _nl_get_era_entry (tp);
-	      if (era)
-		{
-		  int delta = tp->tm_year - era->start_date[0];
-		  DO_NUMBER (1, (era->offset
-				 + (era->direction == '-' ? -delta : delta)));
-		}
+        struct era_entry *era = _nl_get_era_entry(tp);
+
+        if (era) {
+          int delta = tp->tm_year - era->start_date[0];
+
+          DO_NUMBER(1, (era->offset
+                        + (era->direction == '-' ? -delta : delta)));
+        }
 #else
 # if HAVE_STRFTIME
-	      goto underlying_strftime;
+        goto underlying_strftime;
 # endif
 #endif
-	    }
-	  DO_NUMBER (2, (tp->tm_year % 100 + 100) % 100);
+      }
+      DO_NUMBER(2, (tp->tm_year % 100 + 100) % 100);
 
-	case 'Z':
-	  if (change_case)
-	    {
-	      to_uppcase = 0;
-	      to_lowcase = 1;
-	    }
+    case 'Z':
+      if (change_case) {
+        to_uppcase = 0;
+        to_lowcase = 1;
+      }
 
 #if HAVE_TZNAME
-	  /* The tzset() call might have changed the value.  */
-	  if (!(zone && *zone) && tp->tm_isdst >= 0)
-	    zone = tzname[tp->tm_isdst];
-#endif
-	  if (! zone)
-	    zone = "";		/* POSIX.2 requires the empty string here.  */
-
-	  cpy (strlen (zone), zone);
-	  break;
-
-	case 'z':		/* GNU extension.  */
-	  if (tp->tm_isdst < 0)
-	    break;
+      /* The tzset() call might have changed the value.  */
+      if (!(zone && *zone) && tp->tm_isdst >= 0)
+        zone = tzname[tp->tm_isdst];
+#endif
+      if (!zone)
+        zone = "";              /* POSIX.2 requires the empty string here.  */
+
+      cpy(strlen(zone), zone);
+      break;
+
+    case 'z':                  /* GNU extension.  */
+      if (tp->tm_isdst < 0)
+        break;
+
+      {
+        int diff;
 
-	  {
-	    int diff;
 #if HAVE_TM_GMTOFF
-	    diff = tp->tm_gmtoff;
+        diff = tp->tm_gmtoff;
 #else
-	    if (ut)
-	      diff = 0;
-	    else
-	      {
-		struct tm gtm;
-		struct tm ltm;
-		time_t lt;
-
-		ltm = *tp;
-		lt = mktime (&ltm);
-
-		if (lt == (time_t) -1)
-		  {
-		    /* mktime returns -1 for errors, but -1 is also a
-		       valid time_t value.  Check whether an error really
-		       occurred.  */
-		    struct tm tm;
-
-		    if (! my_strftime_localtime_r (&lt, &tm)
-			|| ((ltm.tm_sec ^ tm.tm_sec)
-			    | (ltm.tm_min ^ tm.tm_min)
-			    | (ltm.tm_hour ^ tm.tm_hour)
-			    | (ltm.tm_mday ^ tm.tm_mday)
-			    | (ltm.tm_mon ^ tm.tm_mon)
-			    | (ltm.tm_year ^ tm.tm_year)))
-		      break;
-		  }
-
-		if (! my_strftime_gmtime_r (&lt, &gtm))
-		  break;
-
-		diff = tm_diff (&ltm, &gtm);
-	      }
-#endif
-
-	    if (diff < 0)
-	      {
-		add (1, *p = '-');
-		diff = -diff;
-	      }
-	    else
-	      add (1, *p = '+');
-
-	    diff /= 60;
-	    DO_NUMBER (4, (diff / 60) * 100 + diff % 60);
-	  }
-
-	case '\0':		/* GNU extension: % at end of format.  */
-	    --f;
-	    /* Fall through.  */
-	default:
-	  /* Unknown format; output the format, including the '%',
-	     since this is most likely the right thing to do if a
-	     multibyte string has been misparsed.  */
-	bad_format:
-	  {
-	    int flen;
-	    for (flen = 1; f[1 - flen] != '%'; flen++)
-	      continue;
-	    cpy (flen, &f[1 - flen]);
-	  }
-	  break;
-	}
+        if (ut)
+          diff = 0;
+        else {
+          struct tm gtm;
+          struct tm ltm;
+          time_t lt;
+
+          ltm = *tp;
+          lt = mktime(&ltm);
+
+          if (lt == (time_t) - 1) {
+            /* mktime returns -1 for errors, but -1 is also a
+             * valid time_t value.  Check whether an error really
+             * occurred.  */
+            struct tm tm;
+
+            if (!my_strftime_localtime_r(&lt, &tm) ||
+                ((ltm.tm_sec ^ tm.tm_sec) |
+                (ltm.tm_min ^ tm.tm_min) |
+                (ltm.tm_hour ^ tm.tm_hour) |
+                (ltm.tm_mday ^ tm.tm_mday) |
+                (ltm.tm_mon ^ tm.tm_mon) |
+                (ltm.tm_year ^ tm.tm_year)))
+              break;
+          }
+
+          if (!my_strftime_gmtime_r(&lt, &gtm))
+            break;
+
+          diff = tm_diff(&ltm, &gtm);
+        }
+#endif
+
+        if (diff < 0) {
+          add(1, *p = '-');
+          diff = -diff;
+        }
+        else
+          add(1, *p = '+');
+
+        diff /= 60;
+        DO_NUMBER(4, (diff / 60) * 100 + diff % 60);
+      }
+
+    case '\0':                 /* GNU extension: % at end of format.  */
+      --f;
+      /* Fall through.  */
+    default:
+      /* Unknown format; output the format, including the '%',
+       * since this is most likely the right thing to do if a
+       * multibyte string has been misparsed.  */
+    bad_format:
+      {
+        int flen;
+
+        for (flen = 1; f[1 - flen] != '%'; flen++)
+          continue;
+        cpy(flen, &f[1 - flen]);
+      }
+      break;
     }
+  }
 
   if (p && maxsize != 0)
     *p = '\0';
@@ -1245,13 +1296,12 @@
 /* For Emacs we have a separate interface which corresponds to the normal
    strftime function and does not have the extra information whether the
    TP arguments comes from a `gmtime' call or not.  */
-size_t
-emacs_strftime (s, maxsize, format, tp)
-      char *s;
-      size_t maxsize;
-      const char *format;
-      const struct tm *tp;
+size_t emacs_strftime(s, maxsize, format, tp)
+char *s;
+size_t maxsize;
+const char *format;
+const struct tm *tp;
 {
-  return my_strftime (s, maxsize, format, tp, 0);
+  return my_strftime(s, maxsize, format, tp, 0);
 }
 #endif
Index: eggdrop1.6/src/compat/inet_aton.c
diff -u eggdrop1.6/src/compat/inet_aton.c:1.8 eggdrop1.6/src/compat/inet_aton.c:1.9
--- eggdrop1.6/src/compat/inet_aton.c:1.8	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/compat/inet_aton.c	Tue Jan 28 00:37:25 2003
@@ -1,7 +1,7 @@
 /*
  * inet_aton.c -- provides inet_aton() if necessary.
  *
- * $Id: inet_aton.c,v 1.8 2002/12/24 02:30:06 wcc Exp $
+ * $Id: inet_aton.c,v 1.9 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Portions Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -86,7 +86,8 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)inet_addr.c	8.1 (Berkeley) 6/17/93";
-static char rcsid[] = "$-Id: inet_addr.c,v 1.11 1999/04/29 18:19:53 drepper Exp $";
+static char rcsid[] =
+  "$-Id: inet_addr.c,v 1.11 1999/04/29 18:19:53 drepper Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -100,87 +101,88 @@
  * This replaces inet_addr, the return value from which
  * cannot distinguish between failure and a local broadcast address.
  */
-int
-egg_inet_aton(cp, addr)
-	const char *cp;
-	struct in_addr *addr;
+int egg_inet_aton(cp, addr)
+const char *cp;
+struct in_addr *addr;
 {
-	static const u_32bit_t max[4] = { 0xffffffff, 0xffffff, 0xffff, 0xff };
-	register u_32bit_t val;	/* changed from u_long --david */
-	register int base;
-	register int n;
-	register char c;
-	u_32bit_t parts[4];
-	register u_32bit_t *pp = parts;
-
-	egg_bzero(parts, sizeof (parts));
-
-	c = *cp;
-	for (;;) {
-		/*
-		 * Collect number up to ``.''.
-		 * Values are specified as for C:
-		 * 0x=hex, 0=octal, isdigit=decimal.
-		 */
-		if (!isdigit(c))
-			goto ret_0;
-		base = 10;
-		if (c == '0') {
-			c = *++cp;
-			if (c == 'x' || c == 'X')
-				base = 16, c = *++cp;
-			else
-				base = 8;
-		}
-		val = 0;
-		for (;;) {
-			if (isascii(c) && isdigit(c)) {
-				val = (val * base) + (c - '0');
-				c = *++cp;
-			} else if (base == 16 && isascii(c) && isxdigit(c)) {
-				val = (val << 4) |
-					(c + 10 - (islower(c) ? 'a' : 'A'));
-				c = *++cp;
-			} else
-				break;
-		}
-		if (c == '.') {
-			/*
-			 * Internet format:
-			 *	a.b.c.d
-			 *	a.b.c	(with c treated as 16 bits)
-			 *	a.b	(with b treated as 24 bits)
-			 */
-			if (pp >= parts + 3)
-				goto ret_0;
-			*pp++ = val;
-			c = *++cp;
-		} else
-			break;
-	}
-	/*
-	 * Check for trailing characters.
-	 */
-	if (c != '\0' && (!isascii(c) || !isspace(c)))
-		goto ret_0;
-	/*
-	 * Concoct the address according to
-	 * the number of parts specified.
-	 */
-	n = pp - parts + 1;
-
-	if (n == 0	/* initial nondigit */
-	    || parts[0] > 0xff || parts[1] > 0xff || parts[2] > 0xff
-	    || val > max[n - 1])
-	  goto ret_0;
-
-	val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
-
-	if (addr)
-		addr->s_addr = htonl(val);
-	return (1);
+  static const u_32bit_t max[4] = { 0xffffffff, 0xffffff, 0xffff, 0xff };
+  register u_32bit_t val;       /* changed from u_long --david */
+  register int base;
+  register int n;
+  register char c;
+  u_32bit_t parts[4];
+  register u_32bit_t *pp = parts;
+
+  egg_bzero(parts, sizeof(parts));
+
+  c = *cp;
+  for (;;) {
+    /*
+     * Collect number up to ``.''.
+     * Values are specified as for C:
+     * 0x=hex, 0=octal, isdigit=decimal.
+     */
+    if (!isdigit(c))
+      goto ret_0;
+    base = 10;
+    if (c == '0') {
+      c = *++cp;
+      if (c == 'x' || c == 'X')
+        base = 16, c = *++cp;
+      else
+        base = 8;
+    }
+    val = 0;
+    for (;;) {
+      if (isascii(c) && isdigit(c)) {
+        val = (val * base) + (c - '0');
+        c = *++cp;
+      }
+      else if (base == 16 && isascii(c) && isxdigit(c)) {
+        val = (val << 4) | (c + 10 - (islower(c) ? 'a' : 'A'));
+        c = *++cp;
+      }
+      else
+        break;
+    }
+    if (c == '.') {
+      /*
+       * Internet format:
+       *      a.b.c.d
+       *      a.b.c   (with c treated as 16 bits)
+       *      a.b     (with b treated as 24 bits)
+       */
+      if (pp >= parts + 3)
+        goto ret_0;
+      *pp++ = val;
+      c = *++cp;
+    }
+    else
+      break;
+  }
+  /*
+   * Check for trailing characters.
+   */
+  if (c != '\0' && (!isascii(c) || !isspace(c)))
+    goto ret_0;
+  /*
+   * Concoct the address according to
+   * the number of parts specified.
+   */
+  n = pp - parts + 1;
+
+  if (n == 0 ||                 /* initial nondigit */
+      parts[0] > 0xff || parts[1] > 0xff || parts[2] > 0xff ||
+      val > max[n - 1])
+    goto ret_0;
+
+  val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
+
+  if (addr)
+    addr->s_addr = htonl(val);
+  return (1);
 
 ret_0:
-	return (0);
+  return (0);
 }
 #endif /* HAVE_INET_ATON */
Index: eggdrop1.6/src/compat/inet_aton.h
diff -u eggdrop1.6/src/compat/inet_aton.h:1.5 eggdrop1.6/src/compat/inet_aton.h:1.6
--- eggdrop1.6/src/compat/inet_aton.h:1.5	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/compat/inet_aton.h	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * inet_aton.h
  *   prototypes for inet_aton.c
  *
- * $Id: inet_aton.h,v 1.5 2002/12/24 02:30:06 wcc Exp $
+ * $Id: inet_aton.h,v 1.6 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -37,4 +37,4 @@
 #  define egg_inet_aton	inet_aton
 #endif
 
-#endif	/* !__EGG_COMPAT_INET_ATON_H */
+#endif /* !__EGG_COMPAT_INET_ATON_H */
Index: eggdrop1.6/src/compat/memcpy.h
diff -u eggdrop1.6/src/compat/memcpy.h:1.5 eggdrop1.6/src/compat/memcpy.h:1.6
--- eggdrop1.6/src/compat/memcpy.h:1.5	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/compat/memcpy.h	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * memcpy.h
  *   prototypes for memcpy.c
  *
- * $Id: memcpy.h,v 1.5 2002/12/24 02:30:06 wcc Exp $
+ * $Id: memcpy.h,v 1.6 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -35,4 +35,4 @@
 #  define egg_memcpy	memcpy
 #endif
 
-#endif	/* !__EGG_COMPAT_MEMCPY_H */
+#endif /* !__EGG_COMPAT_MEMCPY_H */
Index: eggdrop1.6/src/compat/memset.h
diff -u eggdrop1.6/src/compat/memset.h:1.5 eggdrop1.6/src/compat/memset.h:1.6
--- eggdrop1.6/src/compat/memset.h:1.5	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/compat/memset.h	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * memset.h
  *   prototypes for memset.c
  *
- * $Id: memset.h,v 1.5 2002/12/24 02:30:06 wcc Exp $
+ * $Id: memset.h,v 1.6 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -39,4 +39,4 @@
  */
 #define egg_bzero(dest, n)	egg_memset(dest, 0, n)
 
-#endif	/* !__EGG_COMPAT_MEMSET_H */
+#endif /* !__EGG_COMPAT_MEMSET_H */
Index: eggdrop1.6/src/compat/snprintf.c
diff -u eggdrop1.6/src/compat/snprintf.c:1.7 eggdrop1.6/src/compat/snprintf.c:1.8
--- eggdrop1.6/src/compat/snprintf.c:1.7	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/compat/snprintf.c	Tue Jan 28 00:37:25 2003
@@ -1,7 +1,7 @@
 /*
  * snprintf.c - a portable implementation of snprintf and vsnprintf
  *
- * $Id: snprintf.c,v 1.7 2002/12/24 02:30:06 wcc Exp $
+ * $Id: snprintf.c,v 1.8 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Portions Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -98,16 +98,16 @@
 #      include <std_args.h>
 #    endif
 #  endif
-#  define HAVE_STDARGS		/* let's hope that works everywhere (mj) */
+#  define HAVE_STDARGS          /* let's hope that works everywhere (mj) */
 #  define VA_LOCAL_DECL	va_list ap
 #  define VA_START(f)	va_start(ap, f)
-#  define VA_SHIFT(v,t)	;	/* no-op for ANSI */
+#  define VA_SHIFT(v,t)	;       /* no-op for ANSI */
 #  define VA_END	va_end(ap)
 #else
 #  include <varargs.h>
 #  undef HAVE_STDARGS
 #  define VA_LOCAL_DECL	va_list ap
-#  define VA_START(f)	va_start(ap)	/* f is ignored! */
+#  define VA_START(f)	va_start(ap)    /* f is ignored! */
 #  define VA_SHIFT(v,t)	v = va_arg(ap,t)
 #  define VA_END	va_end(ap)
 #endif
@@ -118,16 +118,14 @@
 #define LDOUBLE	double
 #endif
 
-static void dopr(char *buffer, size_t maxlen, const char *format,
-		 va_list args);
-static void fmtstr(char *buffer, size_t * currlen, size_t maxlen,
-		   char *value, int flags, int min, int max);
-static void fmtint(char *buffer, size_t * currlen, size_t maxlen,
-		   long value, int base, int min, int max, int flags);
-static void fmtfp(char *buffer, size_t * currlen, size_t maxlen,
-		  LDOUBLE fvalue, int min, int max, int flags);
-static void dopr_outch(char *buffer, size_t * currlen, size_t maxlen,
-		       char c);
+static void dopr(char *buffer, size_t maxlen, const char *format, va_list args);
+static void fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value,
+                   int flags, int min, int max);
+static void fmtint(char *buffer, size_t *currlen, size_t maxlen, long value,
+                   int base, int min, int max, int flags);
+static void fmtfp(char *buffer, size_t *currlen, size_t maxlen, LDOUBLE fvalue,
+                  int min, int max, int flags);
+static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c);
 
 /*
  * dopr(): poor man's version of doprintf
@@ -160,8 +158,7 @@
 #define char_to_int(p) (p - '0')
 #define MAX(p,q) ((p >= q) ? p : q)
 
-static void dopr(char *buffer, size_t maxlen, const char *format,
-		 va_list args)
+static void dopr(char *buffer, size_t maxlen, const char *format, va_list args)
 {
   char ch;
   long value;
@@ -186,86 +183,93 @@
     switch (state) {
     case DP_S_DEFAULT:
       if (ch == '%')
-	state = DP_S_FLAGS;
+        state = DP_S_FLAGS;
       else
-	dopr_outch(buffer, &currlen, maxlen, ch);
+        dopr_outch(buffer, &currlen, maxlen, ch);
       ch = *format++;
       break;
     case DP_S_FLAGS:
       switch (ch) {
       case '-':
-	flags |= DP_F_MINUS;
-	ch = *format++;
-	break;
+        flags |= DP_F_MINUS;
+        ch = *format++;
+        break;
       case '+':
-	flags |= DP_F_PLUS;
-	ch = *format++;
-	break;
+        flags |= DP_F_PLUS;
+        ch = *format++;
+        break;
       case ' ':
-	flags |= DP_F_SPACE;
-	ch = *format++;
-	break;
+        flags |= DP_F_SPACE;
+        ch = *format++;
+        break;
       case '#':
-	flags |= DP_F_NUM;
-	ch = *format++;
-	break;
+        flags |= DP_F_NUM;
+        ch = *format++;
+        break;
       case '0':
-	flags |= DP_F_ZERO;
-	ch = *format++;
-	break;
+        flags |= DP_F_ZERO;
+        ch = *format++;
+        break;
       default:
-	state = DP_S_MIN;
-	break;
+        state = DP_S_MIN;
+        break;
       }
       break;
     case DP_S_MIN:
       if (isdigit(ch)) {
-	min = 10 * min + char_to_int(ch);
-	ch = *format++;
-      } else if (ch == '*') {
-	min = va_arg(args, int);
-	ch = *format++;
-	state = DP_S_DOT;
-      } else
-	state = DP_S_DOT;
+        min = 10 * min + char_to_int(ch);
+        ch = *format++;
+      }
+      else if (ch == '*') {
+        min = va_arg(args, int);
+
+        ch = *format++;
+        state = DP_S_DOT;
+      }
+      else
+        state = DP_S_DOT;
       break;
     case DP_S_DOT:
       if (ch == '.') {
-	state = DP_S_MAX;
-	ch = *format++;
-      } else
-	state = DP_S_MOD;
+        state = DP_S_MAX;
+        ch = *format++;
+      }
+      else
+        state = DP_S_MOD;
       break;
     case DP_S_MAX:
       if (isdigit(ch)) {
-	if (max < 0)
-	  max = 0;
-	max = 10 * max + char_to_int(ch);
-	ch = *format++;
-      } else if (ch == '*') {
-	max = va_arg(args, int);
-	ch = *format++;
-	state = DP_S_MOD;
-      } else
-	state = DP_S_MOD;
+        if (max < 0)
+          max = 0;
+        max = 10 * max + char_to_int(ch);
+        ch = *format++;
+      }
+      else if (ch == '*') {
+        max = va_arg(args, int);
+
+        ch = *format++;
+        state = DP_S_MOD;
+      }
+      else
+        state = DP_S_MOD;
       break;
     case DP_S_MOD:
       /* Currently, we don't support Long Long, bummer */
       switch (ch) {
       case 'h':
-	cflags = DP_C_SHORT;
-	ch = *format++;
-	break;
+        cflags = DP_C_SHORT;
+        ch = *format++;
+        break;
       case 'l':
-	cflags = DP_C_LONG;
-	ch = *format++;
-	break;
+        cflags = DP_C_LONG;
+        ch = *format++;
+        break;
       case 'L':
-	cflags = DP_C_LDOUBLE;
-	ch = *format++;
-	break;
+        cflags = DP_C_LDOUBLE;
+        ch = *format++;
+        break;
       default:
-	break;
+        break;
       }
       state = DP_S_CONV;
       break;
@@ -273,109 +277,131 @@
       switch (ch) {
       case 'd':
       case 'i':
-	if (cflags == DP_C_SHORT)
-	  value = va_arg(args, short int);
-	else if (cflags == DP_C_LONG)
-	  value = va_arg(args, long int);
-	else
-	  value = va_arg(args, int);
-	fmtint(buffer, &currlen, maxlen, value, 10, min, max, flags);
-	break;
+        if (cflags == DP_C_SHORT)
+          value = va_arg(args, short int);
+
+        else if (cflags == DP_C_LONG)
+          value = va_arg(args, long int);
+
+        else
+          value = va_arg(args, int);
+
+        fmtint(buffer, &currlen, maxlen, value, 10, min, max, flags);
+        break;
       case 'o':
-	flags |= DP_F_UNSIGNED;
-	if (cflags == DP_C_SHORT)
-	  value = va_arg(args, unsigned short int);
-	else if (cflags == DP_C_LONG)
-	  value = va_arg(args, unsigned long int);
-	else
-	  value = va_arg(args, unsigned int);
-	fmtint(buffer, &currlen, maxlen, value, 8, min, max, flags);
-	break;
+        flags |= DP_F_UNSIGNED;
+        if (cflags == DP_C_SHORT)
+          value = va_arg(args, unsigned short int);
+
+        else if (cflags == DP_C_LONG)
+          value = va_arg(args, unsigned long int);
+
+        else
+          value = va_arg(args, unsigned int);
+
+        fmtint(buffer, &currlen, maxlen, value, 8, min, max, flags);
+        break;
       case 'u':
-	flags |= DP_F_UNSIGNED;
-	if (cflags == DP_C_SHORT)
-	  value = va_arg(args, unsigned short int);
-	else if (cflags == DP_C_LONG)
-	  value = va_arg(args, unsigned long int);
-	else
-	  value = va_arg(args, unsigned int);
-	fmtint(buffer, &currlen, maxlen, value, 10, min, max, flags);
-	break;
+        flags |= DP_F_UNSIGNED;
+        if (cflags == DP_C_SHORT)
+          value = va_arg(args, unsigned short int);
+
+        else if (cflags == DP_C_LONG)
+          value = va_arg(args, unsigned long int);
+
+        else
+          value = va_arg(args, unsigned int);
+
+        fmtint(buffer, &currlen, maxlen, value, 10, min, max, flags);
+        break;
       case 'X':
-	flags |= DP_F_UP;
+        flags |= DP_F_UP;
       case 'x':
-	flags |= DP_F_UNSIGNED;
-	if (cflags == DP_C_SHORT)
-	  value = va_arg(args, unsigned short int);
-	else if (cflags == DP_C_LONG)
-	  value = va_arg(args, unsigned long int);
-	else
-	  value = va_arg(args, unsigned int);
-	fmtint(buffer, &currlen, maxlen, value, 16, min, max, flags);
-	break;
+        flags |= DP_F_UNSIGNED;
+        if (cflags == DP_C_SHORT)
+          value = va_arg(args, unsigned short int);
+
+        else if (cflags == DP_C_LONG)
+          value = va_arg(args, unsigned long int);
+
+        else
+          value = va_arg(args, unsigned int);
+
+        fmtint(buffer, &currlen, maxlen, value, 16, min, max, flags);
+        break;
       case 'f':
-	if (cflags == DP_C_LDOUBLE)
-	  fvalue = va_arg(args, LDOUBLE);
-	else
-	  fvalue = va_arg(args, double);
-	/* um, floating point? */
-	fmtfp(buffer, &currlen, maxlen, fvalue, min, max, flags);
-	break;
+        if (cflags == DP_C_LDOUBLE)
+          fvalue = va_arg(args, LDOUBLE);
+        else
+          fvalue = va_arg(args, double);
+
+        /* um, floating point? */
+        fmtfp(buffer, &currlen, maxlen, fvalue, min, max, flags);
+        break;
       case 'E':
-	flags |= DP_F_UP;
+        flags |= DP_F_UP;
       case 'e':
-	if (cflags == DP_C_LDOUBLE)
-	  fvalue = va_arg(args, LDOUBLE);
-	else
-	  fvalue = va_arg(args, double);
-	break;
+        if (cflags == DP_C_LDOUBLE)
+          fvalue = va_arg(args, LDOUBLE);
+        else
+          fvalue = va_arg(args, double);
+
+        break;
       case 'G':
-	flags |= DP_F_UP;
+        flags |= DP_F_UP;
       case 'g':
-	if (cflags == DP_C_LDOUBLE)
-	  fvalue = va_arg(args, LDOUBLE);
-	else
-	  fvalue = va_arg(args, double);
-	break;
+        if (cflags == DP_C_LDOUBLE)
+          fvalue = va_arg(args, LDOUBLE);
+        else
+          fvalue = va_arg(args, double);
+
+        break;
       case 'c':
-	dopr_outch(buffer, &currlen, maxlen, va_arg(args, int));
-	break;
+        dopr_outch(buffer, &currlen, maxlen, va_arg(args, int));
+
+        break;
       case 's':
-	strvalue = va_arg(args, char *);
-	if (max < 0)
-	  max = maxlen;		/* ie, no max */
-	fmtstr(buffer, &currlen, maxlen, strvalue, flags, min, max);
-	break;
+        strvalue = va_arg(args, char *);
+
+        if (max < 0)
+          max = maxlen;         /* ie, no max */
+        fmtstr(buffer, &currlen, maxlen, strvalue, flags, min, max);
+        break;
       case 'p':
-	strvalue = va_arg(args, void *);
-	fmtint(buffer, &currlen, maxlen, (long) strvalue, 16, min, max,
-	       flags);
-	break;
+        strvalue = va_arg(args, void *);
+
+        fmtint(buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags);
+        break;
       case 'n':
-	if (cflags == DP_C_SHORT) {
-	  short int *num;
-	  num = va_arg(args, short int *);
-	  *num = currlen;
-	} else if (cflags == DP_C_LONG) {
-	  long int *num;
-	  num = va_arg(args, long int *);
-	  *num = currlen;
-	} else {
-	  int *num;
-	  num = va_arg(args, int *);
-	  *num = currlen;
-	}
-	break;
+        if (cflags == DP_C_SHORT) {
+          short int *num;
+          num = va_arg(args, short int *);
+
+          *num = currlen;
+        }
+        else if (cflags == DP_C_LONG) {
+          long int *num;
+          num = va_arg(args, long int *);
+
+          *num = currlen;
+        }
+        else {
+          int *num;
+          num = va_arg(args, int *);
+
+          *num = currlen;
+        }
+        break;
       case '%':
-	dopr_outch(buffer, &currlen, maxlen, ch);
-	break;
+        dopr_outch(buffer, &currlen, maxlen, ch);
+        break;
       case 'w':
-	/* not supported yet, treat as next char */
-	ch = *format++;
-	break;
+        /* not supported yet, treat as next char */
+        ch = *format++;
+        break;
       default:
-	/* Unknown, skip */
-	break;
+        /* Unknown, skip */
+        break;
       }
       ch = *format++;
       state = DP_S_DEFAULT;
@@ -386,7 +412,7 @@
       break;
     default:
       /* hmm? */
-      break;			/* some picky compilers need this */
+      break;                    /* some picky compilers need this */
     }
   }
   if (currlen < maxlen - 1)
@@ -395,23 +421,22 @@
     buffer[maxlen - 1] = '\0';
 }
 
-static void fmtstr(char *buffer, size_t * currlen, size_t maxlen,
-		   char *value, int flags, int min, int max)
+static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
+                   char *value, int flags, int min, int max)
 {
-  int padlen,
-      strln;			/* amount to pad */
+  int padlen, strln;            /* amount to pad */
   int cnt = 0;
 
   if (value == 0) {
     value = "<NULL>";
   }
 
-  for (strln = 0; value[strln]; ++strln);	/* strlen */
+  for (strln = 0; value[strln]; ++strln);       /* strlen */
   padlen = min - strln;
   if (padlen < 0)
     padlen = 0;
   if (flags & DP_F_MINUS)
-    padlen = -padlen;		/* Left Justify */
+    padlen = -padlen;           /* Left Justify */
 
   while ((padlen > 0) && (cnt < max)) {
     dopr_outch(buffer, currlen, maxlen, ' ');
@@ -431,15 +456,15 @@
 
 /* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
 
-static void fmtint(char *buffer, size_t * currlen, size_t maxlen,
-		   long value, int base, int min, int max, int flags)
+static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
+                   long value, int base, int min, int max, int flags)
 {
   int signvalue = 0;
   unsigned long uvalue;
   char convert[20];
   int place = 0;
-  int spadlen = 0;		/* amount to space pad */
-  int zpadlen = 0;		/* amount to zero pad */
+  int spadlen = 0;              /* amount to space pad */
+  int zpadlen = 0;              /* amount to zero pad */
   int caps = 0;
 
   if (max < 0)
@@ -451,18 +476,19 @@
     if (value < 0) {
       signvalue = '-';
       uvalue = -value;
-    } else if (flags & DP_F_PLUS)	/* Do a sign (+/i) */
+    }
+    else if (flags & DP_F_PLUS) /* Do a sign (+/i) */
       signvalue = '+';
     else if (flags & DP_F_SPACE)
       signvalue = ' ';
   }
 
   if (flags & DP_F_UP)
-    caps = 1;			/* Should characters be upper case? */
+    caps = 1;                   /* Should characters be upper case? */
 
   do {
     convert[place++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef")
-	[uvalue % (unsigned) base];
+      [uvalue % (unsigned) base];
     uvalue = (uvalue / (unsigned) base);
   }
   while (uvalue && (place < 20));
@@ -481,12 +507,12 @@
     spadlen = 0;
   }
   if (flags & DP_F_MINUS)
-    spadlen = -spadlen;		/* Left Justifty */
+    spadlen = -spadlen;         /* Left Justifty */
 
 #ifdef DEBUG_SNPRINTF
   dprint(1,
-	 (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
-	  zpadlen, spadlen, min, max, place));
+         (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
+          zpadlen, spadlen, min, max, place));
 #endif
 
   /* Spaces */
@@ -552,8 +578,8 @@
   return intpart;
 }
 
-static void fmtfp(char *buffer, size_t * currlen, size_t maxlen,
-		  LDOUBLE fvalue, int min, int max, int flags)
+static void fmtfp(char *buffer, size_t *currlen, size_t maxlen,
+                  LDOUBLE fvalue, int min, int max, int flags)
 {
   int signvalue = 0;
   LDOUBLE ufvalue;
@@ -561,7 +587,7 @@
   char fconvert[20];
   int iplace = 0;
   int fplace = 0;
-  int padlen = 0;		/* amount to pad */
+  int padlen = 0;               /* amount to pad */
   int zpadlen = 0;
   int caps = 0;
   long intpart;
@@ -578,14 +604,14 @@
 
   if (fvalue < 0)
     signvalue = '-';
-  else if (flags & DP_F_PLUS)	/* Do a sign (+/i) */
+  else if (flags & DP_F_PLUS)   /* Do a sign (+/i) */
     signvalue = '+';
   else if (flags & DP_F_SPACE)
     signvalue = ' ';
 
 #if 0
   if (flags & DP_F_UP)
-    caps = 1;			/* Should characters be upper case? */
+    caps = 1;                   /* Should characters be upper case? */
 #endif
 
   intpart = ufvalue;
@@ -610,7 +636,7 @@
   /* Convert integer part */
   do {
     iconvert[iplace++] =
-	(caps ? "0123456789ABCDEF" : "0123456789abcdef")[intpart % 10];
+      (caps ? "0123456789ABCDEF" : "0123456789abcdef")[intpart % 10];
     intpart = (intpart / 10);
   }
   while (intpart && (iplace < 20));
@@ -621,7 +647,7 @@
   /* Convert fractional part */
   do {
     fconvert[fplace++] =
-	(caps ? "0123456789ABCDEF" : "0123456789abcdef")[fracpart % 10];
+      (caps ? "0123456789ABCDEF" : "0123456789abcdef")[fracpart % 10];
     fracpart = (fracpart / 10);
   }
   while (fracpart && (fplace < 20));
@@ -637,7 +663,7 @@
   if (padlen < 0)
     padlen = 0;
   if (flags & DP_F_MINUS)
-    padlen = -padlen;		/* Left Justifty */
+    padlen = -padlen;           /* Left Justifty */
 
   if ((flags & DP_F_ZERO) && (padlen > 0)) {
     if (signvalue) {
@@ -682,8 +708,7 @@
   }
 }
 
-static void dopr_outch(char *buffer, size_t * currlen, size_t maxlen,
-		       char c)
+static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
 {
   if (*currlen < maxlen)
     buffer[(*currlen)++] = c;
@@ -695,13 +720,14 @@
   dopr(str, count, fmt, args);
   return (strlen(str));
 }
-#endif				/* !HAVE_VSNPRINTF */
+#endif /* !HAVE_VSNPRINTF */
 
 #ifndef HAVE_SNPRINTF
 #  ifdef HAVE_STDARGS
 int egg_snprintf(char *str, size_t count, const char *fmt, ...)
 #  else
-int egg_snprintf(va_alist) va_dcl
+int egg_snprintf(va_alist)
+va_dcl
 #  endif
 {
 #  ifndef HAVE_STDARGS
@@ -713,10 +739,12 @@
 
   VA_START(fmt);
   VA_SHIFT(str, char *);
+
   VA_SHIFT(count, size_t);
   VA_SHIFT(fmt, char *);
+
   (void) egg_vsnprintf(str, count, fmt, ap);
   VA_END;
   return (strlen(str));
 }
-#endif				/* !HAVE_SNPRINTF */
+#endif /* !HAVE_SNPRINTF */
Index: eggdrop1.6/src/compat/snprintf.h
diff -u eggdrop1.6/src/compat/snprintf.h:1.9 eggdrop1.6/src/compat/snprintf.h:1.10
--- eggdrop1.6/src/compat/snprintf.h:1.9	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/compat/snprintf.h	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * snprintf.h
  *   header file for snprintf.c
  *
- * $Id: snprintf.h,v 1.9 2002/12/24 02:30:06 wcc Exp $
+ * $Id: snprintf.h,v 1.10 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -50,4 +50,4 @@
 #  define egg_snprintf	snprintf
 #endif
 
-#endif	/* !_EGG_COMPAT_SNPRINTF_H_ */
+#endif /* !_EGG_COMPAT_SNPRINTF_H_ */
Index: eggdrop1.6/src/compat/strcasecmp.h
diff -u eggdrop1.6/src/compat/strcasecmp.h:1.5 eggdrop1.6/src/compat/strcasecmp.h:1.6
--- eggdrop1.6/src/compat/strcasecmp.h:1.5	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/compat/strcasecmp.h	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * strcasecmp.h
  *   prototypes for strcasecmp.c
  *
- * $Id: strcasecmp.h,v 1.5 2002/12/24 02:30:06 wcc Exp $
+ * $Id: strcasecmp.h,v 1.6 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -43,4 +43,4 @@
 #  define egg_strncasecmp	strncasecmp
 #endif
 
-#endif	/* !__EGG_COMPAT_STRCASECMP_H */
+#endif /* !__EGG_COMPAT_STRCASECMP_H */
Index: eggdrop1.6/src/compat/strftime.c
diff -u eggdrop1.6/src/compat/strftime.c:1.4 eggdrop1.6/src/compat/strftime.c:1.5
--- eggdrop1.6/src/compat/strftime.c:1.4	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/compat/strftime.c	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * strftime.c
  *   Portable strftime implementation. Uses GNU's strftime().
  *
- * $Id: strftime.c,v 1.4 2002/12/24 02:30:06 wcc Exp $
+ * $Id: strftime.c,v 1.5 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -32,4 +32,4 @@
 #  define strftime	egg_strftime
 
 #  include "gnu_strftime.c"
-#endif	/* !HAVE_STRFTIME */
+#endif /* !HAVE_STRFTIME */
Index: eggdrop1.6/src/compat/strftime.h
diff -u eggdrop1.6/src/compat/strftime.h:1.4 eggdrop1.6/src/compat/strftime.h:1.5
--- eggdrop1.6/src/compat/strftime.h:1.4	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/compat/strftime.h	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * strftime.h
  *   header file for strftime.c
  *
- * $Id: strftime.h,v 1.4 2002/12/24 02:30:06 wcc Exp $
+ * $Id: strftime.h,v 1.5 2003/01/28 06:37:25 wcc Exp $
  */
 /* 
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -34,9 +34,9 @@
  */
 #ifndef HAVE_STRFTIME
 size_t egg_strftime(char *s, size_t maxsize, const char *format,
-		    const struct tm *tp);
+                    const struct tm *tp);
 #else
 #  define egg_strftime	strftime
 #endif
 
-#endif	/* !_EGG_COMPAT_STRFTIME_H_ */
+#endif /* !_EGG_COMPAT_STRFTIME_H_ */
Index: eggdrop1.6/src/dcc.c
diff -u eggdrop1.6/src/dcc.c:1.59 eggdrop1.6/src/dcc.c:1.60
--- eggdrop1.6/src/dcc.c:1.59	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/src/dcc.c	Tue Jan 28 00:37:24 2003
@@ -4,7 +4,7 @@
  *   disconnect on a dcc socket
  *   ...and that's it!  (but it's a LOT)
  *
- * $Id: dcc.c,v 1.59 2002/12/24 02:30:04 wcc Exp $
+ * $Id: dcc.c,v 1.60 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -34,36 +34,35 @@
 /* Includes for botnet md5 challenge/response code <cybah> */
 #include "md5/md5.h"
 
-extern struct userrec	*userlist;
-extern struct chanset_t	*chanset;
-extern Tcl_Interp	*interp;
-extern time_t		 now;
-extern int		 egg_numver, connect_timeout, conmask, backgrd,
-			 max_dcc, make_userfile, default_flags, debug_output,
-			 ignore_time, par_telnet_flood;
-extern char		 botnetnick[], ver[], origbotname[], notify_new[];
-
-
-struct dcc_t *dcc = NULL;	/* DCC list				   */
-int	dcc_total = 0;		/* Total dcc's				   */
-char	tempdir[121] = "";	/* Temporary directory
-				   (default: current directory)		   */
-int	require_p = 0;		/* Require 'p' access to get on the
-				   party line?				   */
-int	allow_new_telnets = 0;	/* Allow people to introduce themselves
-				   via telnet				   */
-int	stealth_telnets = 0;	/* Be paranoid? <cybah>			   */
-int	use_telnet_banner = 0;	/* Display telnet banner?		   */
-char	network[41] = "unknown-net"; /* Name of the IRC network you're on  */
-int	password_timeout = 180;	/* Time to wait for a password from a user */
-int	bot_timeout = 60;	/* Bot timeout value			   */
-int	identtimeout = 5;	/* Timeout value for ident lookups	   */
-int	dupwait_timeout = 5;	/* Timeout for rejecting duplicate entries */
-int	protect_telnet = 1;	/* Even bother with ident lookups :)	   */
-int	flood_telnet_thr = 5;	/* Number of telnet connections to be
-				   considered a flood			   */
-int	flood_telnet_time = 60;	/* In how many seconds?			   */
-char	bannerfile[121] = "text/banner"; /* File displayed on telnet login */
+extern struct userrec *userlist;
+extern struct chanset_t *chanset;
+extern Tcl_Interp *interp;
+extern time_t now;
+extern char botnetnick[], ver[], origbotname[], notify_new[];
+extern int egg_numver, connect_timeout, conmask, backgrd, max_dcc,
+           make_userfile, default_flags, debug_output, ignore_time,
+           par_telnet_flood;
+
+struct dcc_t *dcc = NULL;       /* DCC list                                */
+int dcc_total = 0;              /* Total dcc's                             */
+char tempdir[121] = "";         /* Temporary directory
+                                 * (default: current directory)            */
+int require_p = 0;              /* Require 'p' access to get on the
+                                 * party line?                             */
+int allow_new_telnets = 0;      /* Allow people to introduce themselves
+                                 * via telnet                              */
+int stealth_telnets = 0;        /* Be paranoid? <cybah>                    */
+int use_telnet_banner = 0;      /* Display telnet banner?                  */
+char network[41] = "unknown-net";       /* Name of the IRC network you're on  */
+int password_timeout = 180;     /* Time to wait for a password from a user */
+int bot_timeout = 60;           /* Bot timeout value                       */
+int identtimeout = 5;           /* Timeout value for ident lookups         */
+int dupwait_timeout = 5;        /* Timeout for rejecting duplicate entries */
+int protect_telnet = 1;         /* Even bother with ident lookups :)       */
+int flood_telnet_thr = 5;       /* Number of telnet connections to be
+                                 * considered a flood                      */
+int flood_telnet_time = 60;     /* In how many seconds?                    */
+char bannerfile[121] = "text/banner";   /* File displayed on telnet login */
 
 static void dcc_telnet_hostresolved(int);
 static void dcc_telnet_got_ident(int, char *);
@@ -82,32 +81,32 @@
       p++;
       mark = 2;
       if (!*p)
-	mark = 1;		/* bogus */
+        mark = 1;               /* bogus */
       if ((*p >= TLN_WILL) && (*p <= TLN_DONT)) {
-	mark = 3;
-	if (!*(p + 1))
-	  mark = 2;		/* bogus */
+        mark = 3;
+        if (!*(p + 1))
+          mark = 2;             /* bogus */
       }
       if (*p == TLN_WILL) {
-	/* WILL X -> response: DONT X */
-	/* except WILL ECHO which we just smile and ignore */
-	if (*(p + 1) != TLN_ECHO) {
-	  write(sock, TLN_IAC_C TLN_DONT_C, 2);
-	  write(sock, p + 1, 1);
-	}
+        /* WILL X -> response: DONT X */
+        /* except WILL ECHO which we just smile and ignore */
+        if (*(p + 1) != TLN_ECHO) {
+          write(sock, TLN_IAC_C TLN_DONT_C, 2);
+          write(sock, p + 1, 1);
+        }
       }
       if (*p == TLN_DO) {
-	/* DO X -> response: WONT X */
-	/* except DO ECHO which we just smile and ignore */
-	if (*(p + 1) != TLN_ECHO) {
-	  write(sock, TLN_IAC_C TLN_WONT_C, 2);
-	  write(sock, p + 1, 1);
-	}
+        /* DO X -> response: WONT X */
+        /* except DO ECHO which we just smile and ignore */
+        if (*(p + 1) != TLN_ECHO) {
+          write(sock, TLN_IAC_C TLN_WONT_C, 2);
+          write(sock, p + 1, 1);
+        }
       }
       if (*p == TLN_AYT) {
-	/* "are you there?" */
-	/* response is: "hell yes!" */
-	write(sock, "\r\nHell, yes!\r\n", 14);
+        /* "are you there?" */
+        /* response is: "hell yes!" */
+        write(sock, "\r\nHell, yes!\r\n", 14);
       }
       /* Anything else can probably be ignored */
       p += mark - 1;
@@ -165,16 +164,18 @@
 
     work = newsplit(&par);
     dcc[idx].u.bot->numver = atoi(work);
-  } else
+  }
+  else
     dcc[idx].u.bot->numver = 0;
 
 #ifndef NO_OLD_BOTNET
   if (b_numver(idx) < NEAT_BOTNET) {
 #if HANDLEN != 9
-    putlog(LOG_BOTS, "*", "Non-matching handle lengths with %s, they use 9 characters.",
-	   dcc[idx].nick);
+    putlog(LOG_BOTS, "*",
+           "Non-matching handle lengths with %s, they use 9 characters.",
+           dcc[idx].nick);
     dprintf(idx, "error Non-matching handle length: mine %d, yours 9\n",
-	    HANDLEN);
+            HANDLEN);
     dprintf(idx, "bye %s\n", "bad handlen");
     killsock(dcc[idx].sock);
     lostdcc(idx);
@@ -182,15 +183,17 @@
 #else
     dprintf(idx, "thisbot %s\n", botnetnick);
 #endif
-  } else {
+  }
+  else {
 #endif
     dprintf(idx, "tb %s\n", botnetnick);
     l = atoi(newsplit(&par));
     if (l != HANDLEN) {
-      putlog(LOG_BOTS, "*", "Non-matching handle lengths with %s, they use %d characters.", 
-	     dcc[idx].nick, l);  
+      putlog(LOG_BOTS, "*",
+             "Non-matching handle lengths with %s, they use %d characters.",
+             dcc[idx].nick, l);
       dprintf(idx, "error Non-matching handle length: mine %d, yours %d\n",
-	      HANDLEN, l);
+              HANDLEN, l);
       dprintf(idx, "bye %s\n", "bad handlen");
       killsock(dcc[idx].sock);
       lostdcc(idx);
@@ -203,12 +206,11 @@
   putlog(LOG_BOTS, "*", DCC_LINKED, dcc[idx].nick);
   chatout("*** Linked to %s\n", dcc[idx].nick);
   botnet_send_nlinked(idx, dcc[idx].nick, botnetnick, '!',
-		      dcc[idx].u.bot->numver);
+                      dcc[idx].u.bot->numver);
   touch_laston(dcc[idx].user, "linked", now);
   dump_links(idx);
   dcc[idx].type = &DCC_BOT;
-  addbot(dcc[idx].nick, dcc[idx].nick, botnetnick, '-',
-	 dcc[idx].u.bot->numver);
+  addbot(dcc[idx].nick, dcc[idx].nick, botnetnick, '-', dcc[idx].u.bot->numver);
   check_tcl_link(dcc[idx].nick, botnetnick);
   egg_snprintf(x, sizeof x, "v %d", dcc[idx].u.bot->numver);
   bot_share(idx, x);
@@ -225,12 +227,12 @@
       strcpy(s1, dcc[idx].u.bot->linker);
       add_note(s1, botnetnick, s, -2, 0);
     }
-    if (dcc[idx].u.bot->numver >= (-1))
+    if (dcc[idx].u.bot->numver >= -1)
       putlog(LOG_BOTS, "*", DCC_LINKFAIL, dcc[idx].nick);
     killsock(dcc[idx].sock);
     strcpy(s, dcc[idx].nick);
     lostdcc(idx);
-    autolink_cycle(s);		/* Check for more auto-connections */
+    autolink_cycle(s);          /* Check for more auto-connections */
     return;
   }
 
@@ -241,8 +243,8 @@
   dcc[idx].timeval = now;
   if (dcc[idx].sock < 0 ||
       open_telnet_raw(dcc[idx].sock, dcc[idx].addr ?
-		      iptostr(htonl(dcc[idx].addr)) : dcc[idx].host,
-		      dcc[idx].port) < 0) {
+                      iptostr(htonl(dcc[idx].addr)) : dcc[idx].host,
+                      dcc[idx].port) < 0) {
     failed_link(idx);
   }
 }
@@ -257,28 +259,27 @@
     /* Disconnect all +a bots because we just got a hub */
     for (i = 0; i < dcc_total; i++) {
       if ((i != idx) && (bot_flags(dcc[i].user) & BOT_ALT)) {
-	if ((dcc[i].type == &DCC_FORK_BOT) ||
-	    (dcc[i].type == &DCC_BOT_NEW)) {
-	  killsock(dcc[i].sock);
-	  lostdcc(i);
-	}
+        if ((dcc[i].type == &DCC_FORK_BOT) || (dcc[i].type == &DCC_BOT_NEW)) {
+          killsock(dcc[i].sock);
+          lostdcc(i);
+        }
       }
     }
     /* Just those currently in the process of linking */
     if (in_chain(dcc[idx].nick)) {
       i = nextbot(dcc[idx].nick);
       if (i > 0) {
-	bots = bots_in_subtree(findbot(dcc[idx].nick));
-	users = users_in_subtree(findbot(dcc[idx].nick));
-	egg_snprintf(x, sizeof x,
-		      "Unlinked %s (restructure) (lost %d bot%s and %d user%s)",
-		      dcc[i].nick, bots, (bots != 1) ? "s" : "",
-		      users, (users != 1) ? "s" : "");
-	chatout("*** %s\n", x);
-	botnet_send_unlinked(i, dcc[i].nick, x);
-	dprintf(i, "bye %s\n", "restructure");
-	killsock(dcc[i].sock);
-	lostdcc(i);
+        bots = bots_in_subtree(findbot(dcc[idx].nick));
+        users = users_in_subtree(findbot(dcc[idx].nick));
+        egg_snprintf(x, sizeof x,
+                     "Unlinked %s (restructure) (lost %d bot%s and %d user%s)",
+                     dcc[i].nick, bots, (bots != 1) ? "s" : "",
+                     users, (users != 1) ? "s" : "");
+        chatout("*** %s\n", x);
+        botnet_send_unlinked(i, dcc[i].nick, x);
+        dprintf(i, "bye %s\n", "restructure");
+        killsock(dcc[i].sock);
+        lostdcc(i);
       }
     }
   }
@@ -298,10 +299,10 @@
  */
 static void dcc_bot_digest(int idx, char *challenge, char *password)
 {
-  MD5_CTX       md5context;
-  char          digest_string[33];       /* 32 for digest in hex + null */
+  MD5_CTX md5context;
+  char digest_string[33];       /* 32 for digest in hex + null */
   unsigned char digest[16];
-  int           i;
+  int i;
 
   MD5_Init(&md5context);
   MD5_Update(&md5context, (unsigned char *) challenge, strlen(challenge));
@@ -309,10 +310,10 @@
   MD5_Final(digest, &md5context);
 
   for (i = 0; i < 16; i++)
-    sprintf(digest_string + (i*2), "%.2x", digest[i]);
+    sprintf(digest_string + (i * 2), "%.2x", digest[i]);
   dprintf(idx, "digest %s\n", digest_string);
   putlog(LOG_BOTS, "*", "Received challenge from %s... sending response ...",
-	 dcc[idx].nick);
+         dcc[idx].nick);
 }
 
 static void dcc_bot_new(int idx, char *buf, int x)
@@ -322,32 +323,32 @@
 
   strip_telnet(dcc[idx].sock, buf, &x);
   code = newsplit(&buf);
-  if (!egg_strcasecmp(code, "*hello!")) {
+  if (!egg_strcasecmp(code, "*hello!"))
     greet_new_bot(idx);
-  } else if (!egg_strcasecmp(code, "version") || !egg_strcasecmp(code, "v")) {
+  else if (!egg_strcasecmp(code, "version") || !egg_strcasecmp(code, "v"))
     bot_version(idx, buf);
-  } else if (!egg_strcasecmp(code, "badpass")) {
+  else if (!egg_strcasecmp(code, "badpass"))
     /* We entered the wrong password */
     putlog(LOG_BOTS, "*", DCC_BADPASS, dcc[idx].nick);
-  } else if (!egg_strcasecmp(code, "passreq")) {
+  else if (!egg_strcasecmp(code, "passreq")) {
     char *pass = get_user(&USERENTRY_PASS, u);
 
     if (!pass || !strcmp(pass, "-")) {
       putlog(LOG_BOTS, "*", DCC_PASSREQ, dcc[idx].nick);
       dprintf(idx, "-\n");
-    } else {
+    }
+    else {
       /* Determine if the other end supports an MD5 digest instead of a
        * cleartext password. <Cybah>
        */
-      if(buf && buf[0] && strchr(buf, '<') && strchr(buf+1, '>')) {
+      if (buf && buf[0] && strchr(buf, '<') && strchr(buf + 1, '>'))
         dcc_bot_digest(idx, buf, pass);
-      } else {
+      else
         dprintf(idx, "%s\n", pass);
-      }
     }
-  } else if (!egg_strcasecmp(code, "error")) {
-    putlog(LOG_BOTS, "*", DCC_LINKERROR, dcc[idx].nick, buf);
   }
+  else if (!egg_strcasecmp(code, "error"))
+    putlog(LOG_BOTS, "*", DCC_LINKERROR, dcc[idx].nick, buf);
   /* Ignore otherwise */
 }
 
@@ -361,7 +362,7 @@
 static void timeout_dcc_bot_new(int idx)
 {
   putlog(LOG_BOTS, "*", DCC_TIMEOUT, dcc[idx].nick,
-	 dcc[idx].host, dcc[idx].port);
+         dcc[idx].host, dcc[idx].port);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -385,8 +386,7 @@
   nfree(x);
 }
 
-struct dcc_table DCC_BOT_NEW =
-{
+struct dcc_table DCC_BOT_NEW = {
   "BOT_NEW",
   0,
   eof_dcc_bot_new,
@@ -418,16 +418,18 @@
   if (msg) {
     *msg = 0;
     msg++;
-  } else
+  }
+  else
     msg = "";
   for (f = i = 0; C_bot[i].name && !f; i++) {
     int y = egg_strcasecmp(code, C_bot[i].name);
 
     if (!y) {
       /* Found a match */
-      (C_bot[i].func)(idx, msg);
+      (C_bot[i].func) (idx, msg);
       f = 1;
-    } else if (y < 0)
+    }
+    else if (y < 0)
       return;
   }
 }
@@ -440,9 +442,9 @@
   bots = bots_in_subtree(findbot(dcc[idx].nick));
   users = users_in_subtree(findbot(dcc[idx].nick));
   egg_snprintf(x, sizeof x,
-	       "Lost bot: %s (lost %d bot%s and %d user%s)",
-  		 dcc[idx].nick, bots, (bots != 1) ? "s" : "", users,
-		 (users != 1) ? "s" : "");
+               "Lost bot: %s (lost %d bot%s and %d user%s)",
+               dcc[idx].nick, bots, (bots != 1) ? "s" : "", users,
+               (users != 1) ? "s" : "");
   putlog(LOG_BOTS, "*", "%s.", x);
   chatout("*** %s\n", x);
   botnet_send_unlinked(idx, dcc[idx].nick, x);
@@ -472,8 +474,7 @@
   sprintf(buf, "conn  bot");
 }
 
-struct dcc_table DCC_BOT =
-{
+struct dcc_table DCC_BOT = {
   "BOT",
   DCT_BOT,
   eof_dcc_bot,
@@ -486,8 +487,7 @@
   NULL
 };
 
-struct dcc_table DCC_FORK_BOT =
-{
+struct dcc_table DCC_FORK_BOT = {
   "FORK_BOT",
   0,
   failed_link,
@@ -509,18 +509,18 @@
  */
 static int dcc_bot_check_digest(int idx, char *remote_digest)
 {
-  MD5_CTX       md5context;
-  char          digest_string[33];       /* 32 for digest in hex + null */
+  MD5_CTX md5context;
+  char digest_string[33];       /* 32 for digest in hex + null */
   unsigned char digest[16];
-  int           i;
-  char          *password = get_user(&USERENTRY_PASS, dcc[idx].user);
+  int i;
+  char *password = get_user(&USERENTRY_PASS, dcc[idx].user);
 
   MD5_Init(&md5context);
 
   egg_snprintf(digest_string, 33, "<%x%x@", getpid(),
-	       (unsigned int) dcc[idx].timeval);
+               (unsigned int) dcc[idx].timeval);
   MD5_Update(&md5context, (unsigned char *) digest_string,
-	    strlen(digest_string));
+             strlen(digest_string));
   MD5_Update(&md5context, (unsigned char *) botnetnick, strlen(botnetnick));
   MD5_Update(&md5context, (unsigned char *) ">", 1);
   MD5_Update(&md5context, (unsigned char *) password, strlen(password));
@@ -533,7 +533,7 @@
   if (!strcmp(digest_string, remote_digest))
     return 1;
   putlog(LOG_BOTS, "*", "Response (password hash) from %s incorrect",
-	 dcc[idx].nick);
+         dcc[idx].nick);
   return 0;
 }
 
@@ -546,7 +546,7 @@
 
   /* Check for MD5 digest from remote _bot_. <cybah> */
   if ((atr & USER_BOT) && !egg_strncasecmp(buf, "digest ", 7)) {
-    if(dcc_bot_check_digest(idx, buf+7)) {
+    if (dcc_bot_check_digest(idx, buf + 7)) {
       nfree(dcc[idx].u.chat);
       dcc[idx].type = &DCC_BOT_NEW;
       dcc[idx].u.bot = get_data_ptr(sizeof(struct bot_info));
@@ -554,7 +554,8 @@
       dprintf(idx, "*hello!\n");
       greet_new_bot(idx);
       return;
-    } else {
+    }
+    else {
       /* Invalid password/digest */
       dprintf(idx, "badpass\n");
       putlog(LOG_MISC, "*", DCC_BADLOGIN, dcc[idx].nick, dcc[idx].host,
@@ -574,13 +575,14 @@
       dcc[idx].status = STAT_CALLED;
       dprintf(idx, "*hello!\n");
       greet_new_bot(idx);
-    } else {
+    }
+    else {
       /* Log entry for successful login -slennox 3/28/1999 */
       putlog(LOG_MISC, "*", DCC_LOGGEDIN, dcc[idx].nick,
-	     dcc[idx].host, dcc[idx].port);
+             dcc[idx].host, dcc[idx].port);
       if (dcc[idx].u.chat->away) {
-	nfree(dcc[idx].u.chat->away);
-	dcc[idx].u.chat->away = NULL;
+        nfree(dcc[idx].u.chat->away);
+        dcc[idx].u.chat->away = NULL;
       }
       dcc[idx].type = &DCC_CHAT;
       dcc[idx].status &= ~STAT_CHAT;
@@ -588,20 +590,21 @@
       dcc[idx].u.chat->channel = -2;
       /* Turn echo back on for telnet sessions (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, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n");
       dcc_chatter(idx);
     }
-  } else {
+  }
+  else {
     if (atr & USER_BOT)
       dprintf(idx, "badpass\n");
     else
       dprintf(idx, DCC_HOUSTON);
     putlog(LOG_MISC, "*", DCC_BADLOGIN, dcc[idx].nick,
-	   dcc[idx].host, dcc[idx].port);
-    if (dcc[idx].u.chat->away) {	/* su from a dumb user */
+           dcc[idx].host, dcc[idx].port);
+    if (dcc[idx].u.chat->away) {        /* su from a dumb user */
       /* Turn echo back on for telnet sessions (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, TLN_IAC_C TLN_WONT_C TLN_ECHO_C "\n");
       dcc[idx].user = get_user_by_handle(userlist, dcc[idx].u.chat->away);
       strcpy(dcc[idx].nick, dcc[idx].u.chat->away);
       nfree(dcc[idx].u.chat->away);
@@ -610,9 +613,10 @@
       dcc[idx].u.chat->su_nick = NULL;
       dcc[idx].type = &DCC_CHAT;
       if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
-	botnet_send_join_idx(idx, -1);
+        botnet_send_join_idx(idx, -1);
       chanout_but(-1, dcc[idx].u.chat->channel, DCC_JOIN, dcc[idx].nick);
-    } else {
+    }
+    else {
       killsock(dcc[idx].sock);
       lostdcc(idx);
     }
@@ -622,7 +626,7 @@
 static void eof_dcc_general(int idx)
 {
   putlog(LOG_MISC, "*", DCC_LOSTDCC, dcc[idx].nick,
-	 dcc[idx].host, dcc[idx].port);
+         dcc[idx].host, dcc[idx].port);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -630,8 +634,7 @@
 static void tout_dcc_chat_pass(int idx)
 {
   dprintf(idx, "Timeout.\n");
-  putlog(LOG_MISC, "*", DCC_PWDTIMEOUT, dcc[idx].nick,
-	 dcc[idx].host);
+  putlog(LOG_MISC, "*", DCC_PWDTIMEOUT, dcc[idx].nick, dcc[idx].host);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -672,9 +675,9 @@
       struct msgq *r, *q;
 
       for (r = dcc[idx].u.chat->buffer; r; r = q) {
-	q = r->next;
-	nfree(r->msg);
-	nfree(r);
+        q = r->next;
+        nfree(r->msg);
+        nfree(r);
       }
     }
     if (p->away) {
@@ -695,62 +698,63 @@
 
   while (*text) {
     switch (*text) {
-    case 2:			/* Bold text */
+    case 2:                    /* Bold text */
       if (flags & STRIP_BOLD) {
-	text++;
-	continue;
+        text++;
+        continue;
       }
       break;
-    case 3:			/* mIRC colors? */
+    case 3:                    /* mIRC colors? */
       if (flags & STRIP_COLOR) {
-	if (isdigit(text[1])) {	/* Is the first char a number? */
-	  text += 2;		/* Skip over the ^C and the first digit */
-	  if (isdigit(*text))
-	    text++;		/* Is this a double digit number? */
-	  if (*text == ',') {	/* Do we have a background color next? */
-	    if (isdigit(text[1]))
-	      text += 2;	/* Skip over the first background digit */
-	    if (isdigit(*text))
-	      text++;		/* Is it a double digit? */
-	  }
-	} else
-	  text++;
-	continue;
+        if (isdigit(text[1])) { /* Is the first char a number? */
+          text += 2;            /* Skip over the ^C and the first digit */
+          if (isdigit(*text))
+            text++;             /* Is this a double digit number? */
+          if (*text == ',') {   /* Do we have a background color next? */
+            if (isdigit(text[1]))
+              text += 2;        /* Skip over the first background digit */
+            if (isdigit(*text))
+              text++;           /* Is it a double digit? */
+          }
+        }
+        else
+          text++;
+        continue;
       }
       break;
     case 7:
       if (flags & STRIP_BELLS) {
-	text++;
-	continue;
+        text++;
+        continue;
       }
       break;
-    case 0x16:			/* Reverse video */
+    case 0x16:                 /* Reverse video */
       if (flags & STRIP_REV) {
-	text++;
-	continue;
+        text++;
+        continue;
       }
       break;
-    case 0x1f:			/* Underlined text */
+    case 0x1f:                 /* Underlined text */
       if (flags & STRIP_UNDER) {
-	text++;
-	continue;
+        text++;
+        continue;
       }
       break;
     case 033:
       if (flags & STRIP_ANSI) {
-	text++;
-	if (*text == '[') {
-	  text++;
-	  while ((*text == ';') || isdigit(*text))
-	    text++;
-	  if (*text)
-	    text++;		/* also kill the following char */
-	}
-	continue;
+        text++;
+        if (*text == '[') {
+          text++;
+          while ((*text == ';') || isdigit(*text))
+            text++;
+          if (*text)
+            text++;             /* also kill the following char */
+        }
+        continue;
       }
       break;
     }
-    *dd++ = *text++;		/* Move on to the next char */
+    *dd++ = *text++;            /* Move on to the next char */
   }
   *dd = 0;
 }
@@ -760,7 +764,7 @@
   int l = strlen(line);
   struct msgq *p, *q;
   struct chat_info *c = (dcc[idx].type == &DCC_CHAT) ? dcc[idx].u.chat :
-  dcc[idx].u.file->chat;
+                        dcc[idx].u.file->chat;
 
   if (c->current_lines > 1000) {
     /* They're probably trying to fill up the bot nuke the sods :) */
@@ -777,7 +781,8 @@
   if ((c->line_count < c->max_line) && (c->buffer == NULL)) {
     c->line_count++;
     tputs(dcc[idx].sock, line, l);
-  } else {
+  }
+  else {
     c->current_lines++;
     if (c->buffer == NULL)
       q = NULL;
@@ -811,8 +816,7 @@
     tputs(dcc[idx].sock, y, strlen(y));
 }
 
-struct dcc_table DCC_CHAT_PASS =
-{
+struct dcc_table DCC_CHAT_PASS = {
   "CHAT_PASS",
   0,
   eof_dcc_general,
@@ -849,14 +853,14 @@
 static void eof_dcc_chat(int idx)
 {
   putlog(LOG_MISC, "*", DCC_LOSTDCC, dcc[idx].nick,
-	 dcc[idx].host, dcc[idx].port);
+         dcc[idx].host, dcc[idx].port);
   if (dcc[idx].u.chat->channel >= 0) {
     chanout_but(idx, dcc[idx].u.chat->channel, "*** %s lost dcc link.\n",
-		dcc[idx].nick);
+                dcc[idx].nick);
     if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
       botnet_send_part_idx(idx, "lost dcc link");
     check_tcl_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
-		   dcc[idx].u.chat->channel);
+                   dcc[idx].u.chat->channel);
   }
   check_tcl_chof(dcc[idx].nick, dcc[idx].sock);
   killsock(dcc[idx].sock);
@@ -881,139 +885,142 @@
     d = buf;
     while (*v)
       switch (*v) {
-      case 7:			/* Beep - no more than 3 */
-	nathan++;
-	if (nathan > 3)
-	  v++;
-	else
-	  *d++ = *v++;
-	break;
-      case 8:			/* Backspace - for lame telnet's :) */
-	if (d > buf) {
-	  d--;
-	}
-	v++;
-	break;
-      case 27:			/* ESC - ansi code? */
-	doron = check_ansi(v);
-	/* If it's valid, append a return-to-normal code at the end */
-	if (!doron) {
-	  *d++ = *v++;
-	  fixed = 1;
-	} else
-	  v += doron;
-	break;
-      case '\r':		/* Weird pseudo-linefeed */
-	v++;
-	break;
+      case 7:                  /* Beep - no more than 3 */
+        nathan++;
+        if (nathan > 3)
+          v++;
+        else
+          *d++ = *v++;
+        break;
+      case 8:                  /* Backspace - for lame telnet's :) */
+        if (d > buf) {
+          d--;
+        }
+        v++;
+        break;
+      case 27:                 /* ESC - ansi code? */
+        doron = check_ansi(v);
+        /* If it's valid, append a return-to-normal code at the end */
+        if (!doron) {
+          *d++ = *v++;
+          fixed = 1;
+        }
+        else
+          v += doron;
+        break;
+      case '\r':               /* Weird pseudo-linefeed */
+        v++;
+        break;
       default:
-	*d++ = *v++;
+        *d++ = *v++;
       }
     if (fixed)
       strcpy(d, "\033[0m");
     else
       *d = 0;
-    if (buf[0]) {		/* Nothing to say - maybe paging... */
+    if (buf[0]) {               /* Nothing to say - maybe paging... */
       if ((buf[0] == '.') || (dcc[idx].u.chat->channel < 0)) {
-	if (buf[0] == '.')
-	  buf++;
-	v = newsplit(&buf);
-	rmspace(buf);
-	if (check_tcl_dcc(v, idx, buf)) {
-	  if (dcc[idx].u.chat->channel >= 0)
-	    check_tcl_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
-			   dcc[idx].u.chat->channel);
-	  check_tcl_chof(dcc[idx].nick, dcc[idx].sock);
-	  dprintf(idx, "*** Ja mata!\n");
-	  flush_lines(idx, dcc[idx].u.chat);
-	  putlog(LOG_MISC, "*", DCC_CLOSED, dcc[idx].nick,
-		 dcc[idx].host);
-	  if (dcc[idx].u.chat->channel >= 0) {
-	    chanout_but(-1, dcc[idx].u.chat->channel,
-			"*** %s left the party line%s%s\n",
-			dcc[idx].nick, buf[0] ? ": " : ".", buf);
-	    if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
-	      botnet_send_part_idx(idx, buf);
-	  }
-	  if (dcc[idx].u.chat->su_nick) {
-	    dcc[idx].user = get_user_by_handle(userlist,
-					       dcc[idx].u.chat->su_nick);
-	    strcpy(dcc[idx].nick, dcc[idx].u.chat->su_nick);
-	    dcc[idx].type = &DCC_CHAT;
-	    dprintf(idx, "Returning to real nick %s!\n",
-		    dcc[idx].u.chat->su_nick);
-	    nfree(dcc[idx].u.chat->su_nick);
-	    dcc[idx].u.chat->su_nick = NULL;
-	    dcc_chatter(idx);
-	    if (dcc[idx].u.chat->channel < GLOBAL_CHANS &&
-		dcc[idx].u.chat->channel >= 0)
-	      botnet_send_join_idx(idx, -1);
-	    return;
-	  } else if ((dcc[idx].sock != STDOUT) || backgrd) {
-	    killsock(dcc[idx].sock);
-	    lostdcc(idx);
-	    return;
-	  } else {
-	    dprintf(DP_STDOUT, "\n### SIMULATION RESET\n\n");
-	    dcc_chatter(idx);
-	    return;
-	  }
-	}
-      } else if (buf[0] == ',') {
-	int me = 0;
-
-	if ((buf[1] == 'm') && (buf[2] == 'e') && buf[3] == ' ')
-	  me = 1;
-	for (i = 0; i < dcc_total; i++) {
-	  int ok = 0;
-
-	  if (dcc[i].type->flags & DCT_MASTER) {
-	    if ((dcc[i].type != &DCC_CHAT) ||
-		(dcc[i].u.chat->channel >= 0))
-	      if ((i != idx) || (dcc[idx].status & STAT_ECHO))
-		ok = 1;
-	  }
-	  if (ok) {
-	    struct userrec *u = get_user_by_handle(userlist, dcc[i].nick);
-
-	    if (u && (u->flags & USER_MASTER)) {
-	      if (me)
-		dprintf(i, "-> %s%s\n", dcc[idx].nick, buf + 3);
-	      else
-		dprintf(i, "-%s-> %s\n", dcc[idx].nick, buf + 1);
-	    }
-	  }
-	}
-      } else if (buf[0] == '\'') {
-	int me = 0;
-
-	if ((buf[1] == 'm') && (buf[2] == 'e') &&
-	    ((buf[3] == ' ') || (buf[3] == '\'') || (buf[3] == ',')))
-	  me = 1;
-	for (i = 0; i < dcc_total; i++) {
-	  if (dcc[i].type->flags & DCT_CHAT) {
-	    if (me)
-	      dprintf(i, "=> %s%s\n", dcc[idx].nick, buf + 3);
-	    else
-	      dprintf(i, "=%s=> %s\n", dcc[idx].nick, buf + 1);
-	  }
-	}
-      } else {
-	if (dcc[idx].u.chat->away != NULL)
-	  not_away(idx);
-	if (dcc[idx].status & STAT_ECHO)
-	  chanout_but(-1, dcc[idx].u.chat->channel,
-		      "<%s> %s\n", dcc[idx].nick, buf);
-	else
-	  chanout_but(idx, dcc[idx].u.chat->channel, "<%s> %s\n",
-		      dcc[idx].nick, buf);
-	botnet_send_chan(-1, botnetnick, dcc[idx].nick,
-			 dcc[idx].u.chat->channel, buf);
-	check_tcl_chat(dcc[idx].nick, dcc[idx].u.chat->channel, buf);
+        if (buf[0] == '.')
+          buf++;
+        v = newsplit(&buf);
+        rmspace(buf);
+        if (check_tcl_dcc(v, idx, buf)) {
+          if (dcc[idx].u.chat->channel >= 0)
+            check_tcl_chpt(botnetnick, dcc[idx].nick, dcc[idx].sock,
+                           dcc[idx].u.chat->channel);
+          check_tcl_chof(dcc[idx].nick, dcc[idx].sock);
+          dprintf(idx, "*** Ja mata!\n");
+          flush_lines(idx, dcc[idx].u.chat);
+          putlog(LOG_MISC, "*", DCC_CLOSED, dcc[idx].nick, dcc[idx].host);
+          if (dcc[idx].u.chat->channel >= 0) {
+            chanout_but(-1, dcc[idx].u.chat->channel,
+                        "*** %s left the party line%s%s\n",
+                        dcc[idx].nick, buf[0] ? ": " : ".", buf);
+            if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
+              botnet_send_part_idx(idx, buf);
+          }
+          if (dcc[idx].u.chat->su_nick) {
+            dcc[idx].user = get_user_by_handle(userlist,
+                                               dcc[idx].u.chat->su_nick);
+            strcpy(dcc[idx].nick, dcc[idx].u.chat->su_nick);
+            dcc[idx].type = &DCC_CHAT;
+            dprintf(idx, "Returning to real nick %s!\n",
+                    dcc[idx].u.chat->su_nick);
+            nfree(dcc[idx].u.chat->su_nick);
+            dcc[idx].u.chat->su_nick = NULL;
+            dcc_chatter(idx);
+            if (dcc[idx].u.chat->channel < GLOBAL_CHANS &&
+                dcc[idx].u.chat->channel >= 0)
+              botnet_send_join_idx(idx, -1);
+            return;
+          }
+          else if ((dcc[idx].sock != STDOUT) || backgrd) {
+            killsock(dcc[idx].sock);
+            lostdcc(idx);
+            return;
+          }
+          else {
+            dprintf(DP_STDOUT, "\n### SIMULATION RESET\n\n");
+            dcc_chatter(idx);
+            return;
+          }
+        }
+      }
+      else if (buf[0] == ',') {
+        int me = 0;
+
+        if ((buf[1] == 'm') && (buf[2] == 'e') && buf[3] == ' ')
+          me = 1;
+        for (i = 0; i < dcc_total; i++) {
+          int ok = 0;
+
+          if ((dcc[i].type->flags & DCT_MASTER) &&
+              ((dcc[i].type != &DCC_CHAT) || (dcc[i].u.chat->channel >= 0)) &&
+              ((i != idx) || (dcc[idx].status & STAT_ECHO)))
+            ok = 1;
+          if (ok) {
+            struct userrec *u = get_user_by_handle(userlist, dcc[i].nick);
+
+            if (u && (u->flags & USER_MASTER)) {
+              if (me)
+                dprintf(i, "-> %s%s\n", dcc[idx].nick, buf + 3);
+              else
+                dprintf(i, "-%s-> %s\n", dcc[idx].nick, buf + 1);
+            }
+          }
+        }
+      }
+      else if (buf[0] == '\'') {
+        int me = 0;
+
+        if ((buf[1] == 'm') && (buf[2] == 'e') &&
+            ((buf[3] == ' ') || (buf[3] == '\'') || (buf[3] == ',')))
+          me = 1;
+        for (i = 0; i < dcc_total; i++) {
+          if (dcc[i].type->flags & DCT_CHAT) {
+            if (me)
+              dprintf(i, "=> %s%s\n", dcc[idx].nick, buf + 3);
+            else
+              dprintf(i, "=%s=> %s\n", dcc[idx].nick, buf + 1);
+          }
+        }
+      }
+      else {
+        if (dcc[idx].u.chat->away != NULL)
+          not_away(idx);
+        if (dcc[idx].status & STAT_ECHO)
+          chanout_but(-1, dcc[idx].u.chat->channel,
+                      "<%s> %s\n", dcc[idx].nick, buf);
+        else
+          chanout_but(idx, dcc[idx].u.chat->channel, "<%s> %s\n",
+                      dcc[idx].nick, buf);
+        botnet_send_chan(-1, botnetnick, dcc[idx].nick,
+                         dcc[idx].u.chat->channel, buf);
+        check_tcl_chat(dcc[idx].nick, dcc[idx].u.chat->channel, buf);
       }
     }
   }
-  if (dcc[idx].type == &DCC_CHAT)	/* Could have change to files */
+  if (dcc[idx].type == &DCC_CHAT)       /* Could have change to files */
     if (dcc[idx].status & STAT_PAGE)
       flush_lines(idx, dcc[idx].u.chat);
 }
@@ -1030,11 +1037,10 @@
   simple_sprintf(buf + i, "/%d", dcc[idx].u.chat->channel);
 }
 
-struct dcc_table DCC_CHAT =
-{
+struct dcc_table DCC_CHAT = {
   "CHAT",
   DCT_CHAT | DCT_MASTER | DCT_SHOWWHO | DCT_VALIDIDX | DCT_SIMUL |
-  DCT_CANBOOT | DCT_REMOTEWHO,
+    DCT_CANBOOT | DCT_REMOTEWHO,
   eof_dcc_chat,
   dcc_chat,
   NULL,
@@ -1053,12 +1059,12 @@
  */
 static int detect_telnet_flood(char *floodhost)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
 
   get_user_flagrec(get_user_by_host(floodhost), &fr, NULL);
   if (!flood_telnet_thr || (glob_friend(fr) && !par_telnet_flood))
-    return 0;			/* No flood protection */
-  if (egg_strcasecmp(lasttelnethost, floodhost)) {	/* New... */
+    return 0;                   /* No flood protection */
+  if (egg_strcasecmp(lasttelnethost, floodhost)) {      /* New... */
     strcpy(lasttelnethost, floodhost);
     lasttelnettime = now;
     lasttelnets = 0;
@@ -1071,14 +1077,14 @@
     return 0;
   }
   lasttelnets++;
-  if (lasttelnets >= flood_telnet_thr) {	/* FLOOD! */
+  if (lasttelnets >= flood_telnet_thr) {        /* FLOOD! */
     /* Reset counters */
     lasttelnets = 0;
     lasttelnettime = 0;
     lasttelnethost[0] = 0;
     putlog(LOG_MISC, "*", IRC_TELNETFLOOD, floodhost);
     addignore(floodhost, origbotname, "Telnet connection flood",
-	      now + (60 * ignore_time));
+              now + (60 * ignore_time));
     return 1;
   }
   return 0;
@@ -1142,11 +1148,11 @@
   for (idx = 0; idx < dcc_total; idx++)
     if ((dcc[idx].type == &DCC_TELNET) &&
         (dcc[idx].sock == dcc[i].u.dns->ibuf)) {
-       break;
+      break;
     }
   if (dcc_total == idx) {
     putlog(LOG_BOTS, "*", "Lost listening socket while resolving %s",
-	   dcc[i].host);
+           dcc[i].host);
     killsock(dcc[i].sock);
     lostdcc(i);
     return;
@@ -1178,7 +1184,8 @@
       strcpy(s, "DNS lookup failed for ident");
     else
       neterror(s);
-  } else {
+  }
+  else {
     j = new_dcc(&DCC_IDENT, 0);
     if (j < 0) {
       killsock(sock);
@@ -1203,8 +1210,7 @@
 
 static void eof_dcc_telnet(int idx)
 {
-  putlog(LOG_MISC, "*", DCC_PORTDIE,
-	 dcc[idx].port);
+  putlog(LOG_MISC, "*", DCC_PORTDIE, dcc[idx].port);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -1212,11 +1218,10 @@
 static void display_telnet(int idx, char *buf)
 {
   sprintf(buf, "lstn  %d%s", dcc[idx].port,
-	  (dcc[idx].status & LSTN_PUBLIC) ? " pub" : "");
+          (dcc[idx].status & LSTN_PUBLIC) ? " pub" : "");
 }
 
-struct dcc_table DCC_TELNET =
-{
+struct dcc_table DCC_TELNET = {
   "TELNET",
   DCT_LISTEN,
   eof_dcc_telnet,
@@ -1256,7 +1261,8 @@
     putlog(LOG_BOTS, "*", DCC_DUPLICATE, x);
     killsock(dcc[idx].sock);
     lostdcc(idx);
-  } else {
+  }
+  else {
     /* Ha! Now it's gone and we can grant this bot access. */
     dcc_telnet_pass(idx, dcc[idx].u.dupwait->atr);
   }
@@ -1288,8 +1294,7 @@
   }
 }
 
-struct dcc_table DCC_DUPWAIT =
-{
+struct dcc_table DCC_DUPWAIT = {
   "DUPWAIT",
   DCT_VALIDIDX,
   eof_dcc_dupwait,
@@ -1313,7 +1318,7 @@
   Assert(who);
   for (idx = 0; idx < dcc_total; idx++)
     if ((dcc[idx].type == &DCC_DUPWAIT) &&
-	!egg_strcasecmp(dcc[idx].nick, who)) {
+        !egg_strcasecmp(dcc[idx].nick, who)) {
       dcc_telnet_pass(idx, dcc[idx].u.dupwait->atr);
       break;
     }
@@ -1322,7 +1327,7 @@
 static void dcc_telnet_id(int idx, char *buf, int atr)
 {
   int ok = 0;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
 
   strip_telnet(dcc[idx].sock, buf, &atr);
   buf[HANDLEN] = 0;
@@ -1352,8 +1357,8 @@
     return;
   }
   dcc[idx].status &= ~(STAT_BOTONLY | STAT_USRONLY);
-  if ((!egg_strcasecmp(buf, "NEW")) &&
-      ((allow_new_telnets) || (make_userfile))) {
+  if ((!egg_strcasecmp(buf, "NEW")) && ((allow_new_telnets) ||
+      (make_userfile))) {
     dcc[idx].type = &DCC_TELNET_NEW;
     dcc[idx].timeval = now;
     dprintf(idx, "\n");
@@ -1385,7 +1390,8 @@
       killsock(dcc[idx].sock);
       lostdcc(idx);
       return;
-    } else if (in_chain(dcc[idx].nick)) {
+    }
+    else if (in_chain(dcc[idx].nick)) {
       struct chat_info *ci;
 
       ci = dcc[idx].u.chat;
@@ -1402,7 +1408,7 @@
 static void dcc_telnet_pass(int idx, int atr)
 {
   int ok = 0;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
 
   get_user_flagrec(dcc[idx].user, &fr, NULL);
   /* No password set? */
@@ -1447,7 +1453,8 @@
       ok = 1;
     else if (glob_party(fr))
       ok = 1;
-  } else if (glob_party(fr)) {
+  }
+  else if (glob_party(fr)) {
     ok = 1;
     dcc[idx].status |= STAT_PARTY;
   }
@@ -1474,7 +1481,8 @@
      */
     putlog(LOG_BOTS, "*", "Challenging %s...", dcc[idx].nick);
     dprintf(idx, "passreq <%x%x@%s>\n", getpid(), dcc[idx].timeval, botnetnick);
-  } else {
+  }
+  else {
     /* NOTE: The MD5 digest used above to prevent cleartext passwords being
      *       sent across the net will _only_ work when we have the cleartext
      *       password. User passwords are encrypted (with blowfish usually)
@@ -1490,8 +1498,7 @@
 
 static void eof_dcc_telnet_id(int idx)
 {
-  putlog(LOG_MISC, "*", DCC_LOSTCON, dcc[idx].host,
-	 dcc[idx].port);
+  putlog(LOG_MISC, "*", DCC_LOSTCON, dcc[idx].host, dcc[idx].port);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -1509,8 +1516,7 @@
   sprintf(buf, "t-in  waited %lus", now - dcc[idx].timeval);
 }
 
-struct dcc_table DCC_TELNET_ID =
-{
+struct dcc_table DCC_TELNET_ID = {
   "TELNET_ID",
   0,
   eof_dcc_telnet_id,
@@ -1537,42 +1543,46 @@
   if (!ok) {
     dprintf(idx, "\nYou can't use weird symbols in your nick.\n");
     dprintf(idx, "Try another one please:\n");
-  } else if (strchr("-,+*=:!.@#;$", buf[0]) != NULL) {
+  }
+  else if (strchr("-,+*=:!.@#;$", buf[0]) != NULL) {
     dprintf(idx, "\nYou can't start your nick with the character '%c'\n",
-	    buf[0]);
+            buf[0]);
     dprintf(idx, "Try another one please:\n");
-  } else if (get_user_by_handle(userlist, buf)) {
+  }
+  else if (get_user_by_handle(userlist, buf)) {
     dprintf(idx, "\nSorry, that nickname is taken already.\n");
     dprintf(idx, "Try another one please:\n");
     return;
-  } else if (!egg_strcasecmp(buf, botnetnick)) {
+  }
+  else if (!egg_strcasecmp(buf, botnetnick))
     dprintf(idx, "Sorry, can't use my name for a nick.\n");
-  } else {
+  else {
     strcpy(dcc[idx].nick, buf);
     if (make_userfile)
-      userlist = adduser(userlist, buf, "-telnet!*@*", "-",
-			 sanity_check(default_flags | USER_PARTY |
-				      USER_MASTER | USER_OWNER));
+      userlist = adduser(userlist,
+                 buf, "-telnet!*@*", "-", sanity_check(default_flags |
+                 USER_PARTY | USER_MASTER | USER_OWNER));
     else {
       p = strchr(dcc[idx].host, '@');
       if (p) {
-	q = p;
-	*q = 0;
-	p++;
-	r = strchr(p, '.');
-	if (!r)
-	  simple_sprintf(work, "-telnet!%s@%s", dcc[idx].host, p);
-	else
-	  simple_sprintf(work, "-telnet!%s@*%s", dcc[idx].host, r);
-	*q = '@';
-      } else
-	simple_sprintf(work, "-telnet!*@*%s", dcc[idx].host);
+        q = p;
+        *q = 0;
+        p++;
+        r = strchr(p, '.');
+        if (!r)
+          simple_sprintf(work, "-telnet!%s@%s", dcc[idx].host, p);
+        else
+          simple_sprintf(work, "-telnet!%s@*%s", dcc[idx].host, r);
+        *q = '@';
+      }
+      else
+        simple_sprintf(work, "-telnet!*@*%s", dcc[idx].host);
       userlist = adduser(userlist, buf, work, "-",
-			 sanity_check(USER_PARTY | default_flags));
+                         sanity_check(USER_PARTY | default_flags));
     }
     reaffirm_owners();
     dcc[idx].status = STAT_ECHO | STAT_TELNET;
-    dcc[idx].type = &DCC_CHAT;	/* Just so next line will work */
+    dcc[idx].type = &DCC_CHAT;  /* Just so next line will work */
     dcc[idx].user = get_user_by_handle(userlist, buf);
     check_dcc_attrs(dcc[idx].user, USER_PARTY | default_flags);
     dcc[idx].type = &DCC_TELNET_PW;
@@ -1611,7 +1621,7 @@
     return;
   }
   putlog(LOG_MISC, "*", DCC_NEWUSER, dcc[idx].nick, dcc[idx].host,
-	 dcc[idx].port);
+         dcc[idx].port);
   if (notify_new[0]) {
     char s[121], s1[121], s2[121];
 
@@ -1645,7 +1655,7 @@
 static void eof_dcc_telnet_pw(int idx)
 {
   putlog(LOG_MISC, "*", DCC_LOSTNEWUSR2, dcc[idx].nick, dcc[idx].host,
-	 dcc[idx].port);
+         dcc[idx].port);
   deluser(dcc[idx].nick);
   killsock(dcc[idx].sock);
   lostdcc(idx);
@@ -1654,8 +1664,7 @@
 static void tout_dcc_telnet_new(int idx)
 {
   dprintf(idx, "Guess you're not there.  Bye.\n");
-  putlog(LOG_MISC, "*", DCC_TIMEOUTUSER, dcc[idx].host,
-	 dcc[idx].port);
+  putlog(LOG_MISC, "*", DCC_TIMEOUTUSER, dcc[idx].host, dcc[idx].port);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -1664,7 +1673,7 @@
 {
   dprintf(idx, "Guess you're not there.  Bye.\n");
   putlog(LOG_MISC, "*", DCC_TIMEOUTUSR2, dcc[idx].nick,
-	 dcc[idx].host, dcc[idx].port);
+         dcc[idx].host, dcc[idx].port);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -1679,8 +1688,7 @@
   sprintf(buf, "newp  waited %lus", now - dcc[idx].timeval);
 }
 
-struct dcc_table DCC_TELNET_NEW =
-{
+struct dcc_table DCC_TELNET_NEW = {
   "TELNET_NEW",
   0,
   eof_dcc_telnet_new,
@@ -1693,8 +1701,7 @@
   out_dcc_general
 };
 
-struct dcc_table DCC_TELNET_PW =
-{
+struct dcc_table DCC_TELNET_PW = {
   "TELNET_PW",
   0,
   eof_dcc_telnet_pw,
@@ -1730,12 +1737,12 @@
     return;
 
   dcc[idx].timeval = now;
-  oldsock = dcc[idx].sock;	/* Remember the socket number.	*/
+  oldsock = dcc[idx].sock;      /* Remember the socket number.  */
   if (call_tcl_func(dcc[idx].u.script->command, dcc[idx].sock, buf)) {
     void *old_other = NULL;
 
     /* Check whether the socket and dcc entry are still valid. They
-       might have been killed by `killdcc'. */
+     * might have been killed by `killdcc'. */
     if (dcc[idx].sock != oldsock || idx > max_dcc)
       return;
 
@@ -1751,11 +1758,11 @@
     }
     if (dcc[idx].type == &DCC_CHAT) {
       if (dcc[idx].u.chat->channel >= 0) {
-	chanout_but(-1, dcc[idx].u.chat->channel, DCC_JOIN, dcc[idx].nick);
-	if (dcc[idx].u.chat->channel < 10000)
-	  botnet_send_join_idx(idx, -1);
-	check_tcl_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
-		       geticon(idx), dcc[idx].sock, dcc[idx].host);
+        chanout_but(-1, dcc[idx].u.chat->channel, DCC_JOIN, dcc[idx].nick);
+        if (dcc[idx].u.chat->channel < 10000)
+          botnet_send_join_idx(idx, -1);
+        check_tcl_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
+                       geticon(idx), dcc[idx].sock, dcc[idx].host);
       }
       check_tcl_chon(dcc[idx].nick, dcc[idx].sock);
     }
@@ -1784,8 +1791,7 @@
   if (dcc[idx].type && dcc[idx].type->eof)
     dcc[idx].type->eof(idx);
   else {
-    putlog(LOG_MISC, "*", DCC_DEADSOCKET, dcc[idx].sock,
-	   dcc[idx].type->name);
+    putlog(LOG_MISC, "*", DCC_DEADSOCKET, dcc[idx].sock, dcc[idx].type->name);
     killsock(dcc[idx].sock);
     lostdcc(idx);
   }
@@ -1825,8 +1831,7 @@
     tputs(dcc[idx].sock, buf, strlen(buf));
 }
 
-struct dcc_table DCC_SCRIPT =
-{
+struct dcc_table DCC_SCRIPT = {
   "SCRIPT",
   DCT_VALIDIDX,
   eof_dcc_script,
@@ -1854,8 +1859,7 @@
   strcpy(buf, "sock  (stranded)");
 }
 
-struct dcc_table DCC_SOCKET =
-{
+struct dcc_table DCC_SOCKET = {
   "SOCKET",
   DCT_VALIDIDX,
   eof_dcc_socket,
@@ -1873,8 +1877,7 @@
   strcpy(buf, "lost");
 }
 
-struct dcc_table DCC_LOST =
-{
+struct dcc_table DCC_LOST = {
   "LOST",
   0,
   NULL,
@@ -1899,13 +1902,13 @@
   putlog(LOG_MISC, "*", DCC_LOSTCONN, dcc[idx].host, dcc[idx].port);
   for (i = 0; i < dcc_total; i++)
     if ((dcc[i].type == &DCC_IDENT) &&
-	(dcc[i].u.ident_sock == dcc[idx].sock)) {
-      killsock(dcc[i].sock);	/* Cleanup ident socket */
+        (dcc[i].u.ident_sock == dcc[idx].sock)) {
+      killsock(dcc[i].sock);    /* Cleanup ident socket */
       dcc[i].u.other = 0;
       lostdcc(i);
       break;
     }
-  killsock(dcc[idx].sock);	/* Cleanup waiting socket */
+  killsock(dcc[idx].sock);      /* Cleanup waiting socket */
   dcc[idx].u.other = 0;
   lostdcc(idx);
 }
@@ -1915,8 +1918,7 @@
   sprintf(buf, "idtw  waited %lus", now - dcc[idx].timeval);
 }
 
-struct dcc_table DCC_IDENTWAIT =
-{
+struct dcc_table DCC_IDENTWAIT = {
   "IDENTWAIT",
   0,
   eof_dcc_identwait,
@@ -1941,10 +1943,10 @@
     return;
   }
   rmspace(uid);
-  uid[20] = 0;			/* 20 character ident max */
+  uid[20] = 0;                  /* 20 character ident max */
   for (i = 0; i < dcc_total; i++)
     if ((dcc[i].type == &DCC_IDENTWAIT) &&
-	(dcc[i].sock == dcc[idx].u.ident_sock)) {
+        (dcc[i].sock == dcc[idx].u.ident_sock)) {
       simple_sprintf(buf1, "%s@%s", uid, dcc[idx].host);
       dcc_telnet_got_ident(i, buf1);
     }
@@ -1960,7 +1962,7 @@
 
   for (i = 0; i < dcc_total; i++)
     if ((dcc[i].type == &DCC_IDENTWAIT) &&
-	(dcc[i].sock == dcc[idx].u.ident_sock)) {
+        (dcc[i].sock == dcc[idx].u.ident_sock)) {
       putlog(LOG_MISC, "*", DCC_EOFIDENT);
       simple_sprintf(buf, "telnet@%s", dcc[idx].host);
       dcc_telnet_got_ident(i, buf);
@@ -1975,8 +1977,7 @@
   sprintf(buf, "idnt  (sock %d)", dcc[idx].u.ident_sock);
 }
 
-struct dcc_table DCC_IDENT =
-{
+struct dcc_table DCC_IDENT = {
   "IDENT",
   0,
   eof_dcc_ident,
@@ -1996,7 +1997,7 @@
 
   for (idx = 0; idx < dcc_total; idx++)
     if ((dcc[idx].type == &DCC_TELNET) &&
-	(dcc[idx].sock == dcc[i].u.ident_sock))
+        (dcc[idx].sock == dcc[i].u.ident_sock))
       break;
   dcc[i].u.other = 0;
   if (dcc_total == idx) {
@@ -2044,7 +2045,7 @@
     return;
   }
   /* Do not buffer data anymore. All received and stored data is passed
-     over to the dcc functions from now on.  */
+   * over to the dcc functions from now on.  */
   sockoptions(dcc[i].sock, EGG_OPTION_UNSET, SOCK_BUFFER);
 
   dcc[i].type = &DCC_TELNET_ID;
Index: eggdrop1.6/src/dccutil.c
diff -u eggdrop1.6/src/dccutil.c:1.44 eggdrop1.6/src/dccutil.c:1.45
--- eggdrop1.6/src/dccutil.c:1.44	Mon Jan 20 18:11:29 2003
+++ eggdrop1.6/src/dccutil.c	Tue Jan 28 00:37:24 2003
@@ -6,7 +6,7 @@
  *   memory management for dcc structures
  *   timeout checking for dcc connections
  *
- * $Id: dccutil.c,v 1.44 2003/01/21 00:11:29 wcc Exp $
+ * $Id: dccutil.c,v 1.45 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -34,16 +34,16 @@
 #include "modules.h"
 #include "tandem.h"
 
-extern struct dcc_t	*dcc;
-extern int		 dcc_total, max_dcc, dcc_flood_thr, backgrd, MAXSOCKS;
-extern char		 botnetnick[], version[];
-extern time_t		 now;
-extern sock_list	*socklist;
-extern Tcl_Interp	*interp;
-
-char	motdfile[121] = "text/motd";	/* File where the motd is stored */
-int	connect_timeout = 15;		/* How long to wait before a telnet
-					   connection times out */
+extern struct dcc_t *dcc;
+extern int dcc_total, max_dcc, dcc_flood_thr, backgrd, MAXSOCKS;
+extern char botnetnick[], version[];
+extern time_t now;
+extern sock_list *socklist;
+extern Tcl_Interp *interp;
+
+char motdfile[121] = "text/motd";       /* File where the motd is stored */
+int connect_timeout = 15;       /* How long to wait before a telnet
+                                 * connection times out */
 
 int reserved_port_min = 0;
 int reserved_port_max = 0;
@@ -62,7 +62,7 @@
   MAXSOCKS = max_dcc + 10;
   if (socklist)
     socklist = (sock_list *) nrealloc((void *) socklist,
-				      sizeof(sock_list) * MAXSOCKS);
+               sizeof(sock_list) * MAXSOCKS);
   else
     socklist = (sock_list *) nmalloc(sizeof(sock_list) * MAXSOCKS);
   for (; osock < MAXSOCKS; osock++)
@@ -109,6 +109,7 @@
 
   idx = EGG_VARARGS_START(int, arg1, va);
   format = va_arg(va, char *);
+
   egg_vsnprintf(buf, 1023, format, va);
   va_end(va);
   /* We can not use the return value vsnprintf() to determine where
@@ -118,13 +119,14 @@
    */
   /* We actually can, since if it's < 0 or >= sizeof(buf), we know it wrote
    * sizeof(buf) bytes. But we're not doing that anyway.
-  */
-  buf[sizeof(buf)-1] = 0;
+   */
+  buf[sizeof(buf) - 1] = 0;
   len = strlen(buf);
 
   if (idx < 0) {
     tputs(-idx, buf, len);
-  } else if (idx > 0x7FF0) {
+  }
+  else if (idx > 0x7FF0) {
     switch (idx) {
     case DP_LOG:
       putlog(LOG_MISC, "*", "%s", buf);
@@ -145,8 +147,9 @@
       break;
     }
     return;
-  } else {
-    if (len > 500) {		/* Truncate to fit */
+  }
+  else {
+    if (len > 500) {            /* Truncate to fit */
       buf[500] = 0;
       strcat(buf, "\n");
       len = 501;
@@ -155,9 +158,10 @@
       char *p = add_cr(buf);
 
       tputs(dcc[idx].sock, p, strlen(p));
-    } else if (dcc[idx].type && dcc[idx].type->output) {
+    }
+    else if (dcc[idx].type && dcc[idx].type->output)
       dcc[idx].type->output(idx, buf, dcc[idx].u.other);
-    } else
+    else
       tputs(dcc[idx].sock, buf, len);
   }
 }
@@ -170,6 +174,7 @@
   va_list va;
 
   format = EGG_VARARGS_START(char *, arg1, va);
+
   egg_vsnprintf(s, 511, format, va);
   va_end(va);
   len = strlen(s);
@@ -196,6 +201,7 @@
   x = EGG_VARARGS_START(int, arg1, va);
   chan = va_arg(va, int);
   format = va_arg(va, char *);
+
   egg_vsnprintf(s, 511, format, va);
   va_end(va);
   len = strlen(s);
@@ -213,7 +219,7 @@
 void dcc_chatter(int idx)
 {
   int i, j;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
 
   get_user_flagrec(dcc[idx].user, &fr, NULL);
   show_motd(idx);
@@ -224,7 +230,7 @@
   check_tcl_chon(dcc[idx].nick, dcc[idx].sock);
   /* Still there? */
   if ((idx >= dcc_total) || (dcc[idx].sock != j))
-    return;			/* Nope */
+    return;                     /* Nope */
   /* Tcl script may have taken control */
   if (dcc[idx].type == &DCC_CHAT) {
     if (!strcmp(dcc[idx].u.chat->con_chan, "***"))
@@ -235,22 +241,21 @@
        * so dont bother sending them
        */
       if (i == -2)
-	i = 0;
+        i = 0;
       dcc[idx].u.chat->channel = i;
-      if (dcc[idx].u.chat->channel >= 0) {
-	if (dcc[idx].u.chat->channel < GLOBAL_CHANS) {
-	  botnet_send_join_idx(idx, -1);
-	}
-      }
+      if ((dcc[idx].u.chat->channel >= 0) &&
+          (dcc[idx].u.chat->channel < GLOBAL_CHANS))
+        botnet_send_join_idx(idx, -1);
       check_tcl_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
-		     geticon(idx), dcc[idx].sock, dcc[idx].host);
+                     geticon(idx), dcc[idx].sock, dcc[idx].host);
     }
     /* But *do* bother with sending it locally */
     if (!dcc[idx].u.chat->channel) {
       chanout_but(-1, 0, "*** %s joined the party line.\n", dcc[idx].nick);
-    } else if (dcc[idx].u.chat->channel > 0) {
+    }
+    else if (dcc[idx].u.chat->channel > 0) {
       chanout_but(-1, dcc[idx].u.chat->channel,
-		  "*** %s joined the channel.\n", dcc[idx].nick);
+                  "*** %s joined the channel.\n", dcc[idx].nick);
     }
   }
 }
@@ -274,7 +279,8 @@
           break;
         }
       }
-      if (ok) unlink(dcc[n].u.xfer->filename);
+      if (ok)
+        unlink(dcc[n].u.xfer->filename);
     }
   }
 }
@@ -285,7 +291,8 @@
 void lostdcc(int n)
 {
   /* Make sure it's a valid dcc index. */
-  if (n < 0 || n >= max_dcc) return;
+  if (n < 0 || n >= max_dcc)
+    return;
 
   if (dcc[n].type && dcc[n].type->kill)
     dcc[n].type->kill(n, dcc[n].u.other);
@@ -293,7 +300,7 @@
     nfree(dcc[n].u.other);
   egg_bzero(&dcc[n], sizeof(struct dcc_t));
 
-  dcc[n].sock = (-1);
+  dcc[n].sock = -1;
   dcc[n].type = &DCC_LOST;
 }
 
@@ -314,7 +321,7 @@
   if (n < dcc_total)
     egg_memcpy(&dcc[n], &dcc[dcc_total], sizeof(struct dcc_t));
   else
-    egg_bzero(&dcc[n], sizeof(struct dcc_t)); /* drummer */
+    egg_bzero(&dcc[n], sizeof(struct dcc_t));   /* drummer */
 }
 
 /* Clean up sockets that were just left for dead.
@@ -326,7 +333,7 @@
   for (i = 0; i < dcc_total; i++) {
     if (dcc[i].type == &DCC_LOST) {
       dcc[i].type = NULL;
-      dcc[i].sock = (-1);
+      dcc[i].sock = -1;
       removedcc(i);
       i--;
     }
@@ -346,19 +353,20 @@
   /* calculate max nicklen */
   nicklen = 0;
   for (i = 0; i < dcc_total; i++) {
-      if(strlen(dcc[i].nick) > nicklen)
-          nicklen = strlen(dcc[i].nick);
+    if (strlen(dcc[i].nick) > nicklen)
+      nicklen = strlen(dcc[i].nick);
   }
-  if(nicklen < 9) nicklen = 9;
-  
-  egg_snprintf(format, sizeof format, "%%-4s %%-8s %%-5s %%-%us %%-17s %%s\n", 
-                          nicklen);
-  dprintf(zidx, format, "SOCK", "ADDR",     "PORT",  "NICK", "HOST", "TYPE");
-  dprintf(zidx, format, "----", "--------", "-----", "---------", 
-                        "-----------------", "----");
+  if (nicklen < 9)
+    nicklen = 9;
 
-  egg_snprintf(format, sizeof format, "%%-4d %%08X %%5d %%-%us %%-17s %%s\n", 
-                          nicklen);
+  egg_snprintf(format, sizeof format, "%%-4s %%-8s %%-5s %%-%us %%-17s %%s\n",
+               nicklen);
+  dprintf(zidx, format, "SOCK", "ADDR", "PORT", "NICK", "HOST", "TYPE");
+  dprintf(zidx, format, "----", "--------", "-----", "---------",
+          "-----------------", "----");
+
+  egg_snprintf(format, sizeof format, "%%-4d %%08X %%5d %%-%us %%-17s %%s\n",
+               nicklen);
   /* Show server */
   for (i = 0; i < dcc_total; i++) {
     j = strlen(dcc[i].host);
@@ -372,8 +380,8 @@
       sprintf(other, "?:%lX  !! ERROR !!", (long) dcc[i].type);
       break;
     }
-    dprintf(zidx, format, dcc[i].sock, dcc[i].addr, dcc[i].port, dcc[i].nick, 
-			  dcc[i].host + j, other);
+    dprintf(zidx, format, dcc[i].sock, dcc[i].addr, dcc[i].port, dcc[i].nick,
+            dcc[i].host + j, other);
   }
 }
 
@@ -387,7 +395,7 @@
   }
   if (dcc[idx].u.chat->channel >= 0) {
     chanout_but(-1, dcc[idx].u.chat->channel,
-		"*** %s is no longer away.\n", dcc[idx].nick);
+                "*** %s is no longer away.\n", dcc[idx].nick);
     if (dcc[idx].u.chat->channel < GLOBAL_CHANS) {
       botnet_send_away(-1, botnetnick, dcc[idx].sock, NULL, idx);
     }
@@ -414,7 +422,7 @@
   strcpy(dcc[idx].u.chat->away, s);
   if (dcc[idx].u.chat->channel >= 0) {
     chanout_but(-1, dcc[idx].u.chat->channel,
-		"*** %s is now away: %s\n", dcc[idx].nick, s);
+                "*** %s is now away: %s\n", dcc[idx].nick, s);
     if (dcc[idx].u.chat->channel < GLOBAL_CHANS) {
       botnet_send_away(-1, botnetnick, dcc[idx].sock, s, idx);
     }
@@ -428,6 +436,7 @@
 void *_get_data_ptr(int size, char *file, int line)
 {
   char *p;
+
 #ifdef DEBUG_MEM
   char x[1024];
 
@@ -511,7 +520,7 @@
   }
 }
 
-int detect_dcc_flood(time_t * timer, struct chat_info *chat, int idx)
+int detect_dcc_flood(time_t *timer, struct chat_info *chat, int idx)
 {
   time_t t;
 
@@ -521,30 +530,31 @@
   if (*timer != t) {
     *timer = t;
     chat->msgs_per_sec = 0;
-  } else {
+  }
+  else {
     chat->msgs_per_sec++;
     if (chat->msgs_per_sec > dcc_flood_thr) {
       /* FLOOD */
       dprintf(idx, "*** FLOOD: %s.\n", IRC_GOODBYE);
       /* Evil assumption here that flags&DCT_CHAT implies chat type */
-      if ((dcc[idx].type->flags & DCT_CHAT) && chat &&
-	  (chat->channel >= 0)) {
-	char x[1024];
-
-	egg_snprintf(x, sizeof x, DCC_FLOODBOOT, dcc[idx].nick);
-	chanout_but(idx, chat->channel, "*** %s", x);
-	if (chat->channel < GLOBAL_CHANS)
-	  botnet_send_part_idx(idx, x);
+      if ((dcc[idx].type->flags & DCT_CHAT) && chat && (chat->channel >= 0)) {
+        char x[1024];
+
+        egg_snprintf(x, sizeof x, DCC_FLOODBOOT, dcc[idx].nick);
+        chanout_but(idx, chat->channel, "*** %s", x);
+        if (chat->channel < GLOBAL_CHANS)
+          botnet_send_part_idx(idx, x);
       }
       check_tcl_chof(dcc[idx].nick, dcc[idx].sock);
       if ((dcc[idx].sock != STDOUT) || backgrd) {
-	killsock(dcc[idx].sock);
-	lostdcc(idx);
-      } else {
-	dprintf(DP_STDOUT, "\n### SIMULATION RESET ###\n\n");
-	dcc_chatter(idx);
+        killsock(dcc[idx].sock);
+        lostdcc(idx);
       }
-      return 1;			/* <- flood */
+      else {
+        dprintf(DP_STDOUT, "\n### SIMULATION RESET ###\n\n");
+        dcc_chatter(idx);
+      }
+      return 1;                 /* <- flood */
     }
   }
   return 0;
@@ -562,12 +572,11 @@
   /* If it's a partyliner (chatterer :) */
   /* Horrible assumption that DCT_CHAT using structure uses same format
    * as DCC_CHAT */
-  if ((dcc[idx].type->flags & DCT_CHAT) &&
-      (dcc[idx].u.chat->channel >= 0)) {
+  if ((dcc[idx].type->flags & DCT_CHAT) && (dcc[idx].u.chat->channel >= 0)) {
     char x[1024];
 
     egg_snprintf(x, sizeof x, DCC_BOOTED3, by, dcc[idx].nick,
-		 reason[0] ? ": " : "", reason);
+                 reason[0] ? ": " : "", reason);
     chanout_but(idx, dcc[idx].u.chat->channel, "*** %s.\n", x);
     if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
       botnet_send_part_idx(idx, x);
@@ -577,7 +586,8 @@
     killsock(dcc[idx].sock);
     lostdcc(idx);
     /* Entry must remain in the table so it can be logged by the caller */
-  } else {
+  }
+  else {
     dprintf(DP_STDOUT, "\n### SIMULATION RESET\n\n");
     dcc_chatter(idx);
   }
Index: eggdrop1.6/src/dns.c
diff -u eggdrop1.6/src/dns.c:1.25 eggdrop1.6/src/dns.c:1.26
--- eggdrop1.6/src/dns.c:1.25	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/src/dns.c	Tue Jan 28 00:37:24 2003
@@ -4,7 +4,7 @@
  *   provides the code used by the bot if the DNS module is not loaded
  *   DNS Tcl commands
  *
- * $Id: dns.c,v 1.25 2002/12/24 02:30:04 wcc Exp $
+ * $Id: dns.c,v 1.26 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Written by Fabian Knittel <fknittel at gmx.de>
@@ -35,14 +35,14 @@
 
 #include "dns.h"
 
-extern struct dcc_t	*dcc;
-extern int		 dcc_total;
-extern int		 resolve_timeout;
-extern time_t		 now;
-extern jmp_buf		 alarmret;
-extern Tcl_Interp	*interp;
+extern struct dcc_t *dcc;
+extern int dcc_total;
+extern int resolve_timeout;
+extern time_t now;
+extern jmp_buf alarmret;
+extern Tcl_Interp *interp;
 
-devent_t	*dns_events = NULL;
+devent_t *dns_events = NULL;
 
 
 /*
@@ -57,7 +57,7 @@
 void eof_dcc_dnswait(int idx)
 {
   putlog(LOG_MISC, "*", "Lost connection while resolving hostname [%s/%d]",
-	 iptostr(htonl(dcc[idx].addr)), dcc[idx].port);
+         iptostr(htonl(dcc[idx].addr)), dcc[idx].port);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -95,8 +95,7 @@
   }
 }
 
-struct dcc_table DCC_DNSWAIT =
-{
+struct dcc_table DCC_DNSWAIT = {
   "DNSWAIT",
   DCT_VALIDIDX,
   eof_dcc_dnswait,
@@ -180,11 +179,11 @@
 
   for (de = dns_events; de; de = de->next) {
     if (de->type && (de->type == &DNS_DCCEVENT_IPBYHOST) &&
-	(de->lookup == RES_IPBYHOST)) {
+        (de->lookup == RES_IPBYHOST)) {
       if (de->res_data.hostname &&
-	  !egg_strcasecmp(de->res_data.hostname, hostn))
-	/* No need to add anymore. */
-	return;
+          !egg_strcasecmp(de->res_data.hostname, hostn))
+        /* No need to add anymore. */
+        return;
     }
   }
 
@@ -210,10 +209,10 @@
 
   for (de = dns_events; de; de = de->next) {
     if (de->type && (de->type == &DNS_DCCEVENT_HOSTBYIP) &&
-	(de->lookup == RES_HOSTBYIP)) {
+        (de->lookup == RES_HOSTBYIP)) {
       if (de->res_data.ip_addr == ip)
-	/* No need to add anymore. */
-	return;
+        /* No need to add anymore. */
+        return;
     }
   }
 
@@ -242,7 +241,7 @@
   devent_tclinfo_t *tclinfo = (devent_tclinfo_t *) other;
 
   if (Tcl_VarEval(interp, tclinfo->proc, " ", iptostr(htonl(ip)), " ",
-		  hostn, ok ? " 1" : " 0", tclinfo->paras, NULL) == TCL_ERROR)
+                  hostn, ok ? " 1" : " 0", tclinfo->paras, NULL) == TCL_ERROR)
     putlog(LOG_MISC, "*", DCC_TCLERROR, tclinfo->proc, interp->result);
 
   /* Free the memory. It will be unused after this event call. */
@@ -303,7 +302,8 @@
   if (paras) {
     tclinfo->paras = nmalloc(strlen(paras) + 1);
     strcpy(tclinfo->paras, paras);
-  } else
+  }
+  else
     tclinfo->paras = NULL;
   de->other = tclinfo;
 
@@ -334,7 +334,8 @@
   if (paras) {
     tclinfo->paras = nmalloc(strlen(paras) + 1);
     strcpy(tclinfo->paras, paras);
-  } else
+  }
+  else
     tclinfo->paras = NULL;
   de->other = tclinfo;
 
@@ -369,19 +370,19 @@
   while (de) {
     nde = de->next;
     if ((de->lookup == RES_HOSTBYIP) &&
-	(!de->res_data.ip_addr || (de->res_data.ip_addr == ip))) {
+        (!de->res_data.ip_addr || (de->res_data.ip_addr == ip))) {
       /* Remove the event from the list here, to avoid conflicts if one of
        * the event handlers re-adds another event. */
       if (ode)
-	ode->next = de->next;
+        ode->next = de->next;
       else
-	dns_events = de->next;
+        dns_events = de->next;
 
       if (de->type && de->type->event)
-	de->type->event(ip, hostn, ok, de->other);
+        de->type->event(ip, hostn, ok, de->other);
       else
-	putlog(LOG_MISC, "*", "(!) Unknown DNS event type found: %s",
-	       (de->type && de->type->name) ? de->type->name : "<empty>");
+        putlog(LOG_MISC, "*", "(!) Unknown DNS event type found: %s",
+               (de->type && de->type->name) ? de->type->name : "<empty>");
       nfree(de);
       de = ode;
     }
@@ -396,24 +397,23 @@
 
   while (de) {
     nde = de->next;
-    if ((de->lookup == RES_IPBYHOST) &&
-	(!de->res_data.hostname ||
-	 !egg_strcasecmp(de->res_data.hostname, hostn))) {
+    if ((de->lookup == RES_IPBYHOST) && (!de->res_data.hostname ||
+        !egg_strcasecmp(de->res_data.hostname, hostn))) {
       /* Remove the event from the list here, to avoid conflicts if one of
        * the event handlers re-adds another event. */
       if (ode)
-	ode->next = de->next;
+        ode->next = de->next;
       else
-	dns_events = de->next;
+        dns_events = de->next;
 
       if (de->type && de->type->event)
-	de->type->event(ip, hostn, ok, de->other);
+        de->type->event(ip, hostn, ok, de->other);
       else
-	putlog(LOG_MISC, "*", "(!) Unknown DNS event type found: %s",
-	       (de->type && de->type->name) ? de->type->name : "<empty>");
+        putlog(LOG_MISC, "*", "(!) Unknown DNS event type found: %s",
+               (de->type && de->type->name) ? de->type->name : "<empty>");
 
       if (de->res_data.hostname)
-	nfree(de->res_data.hostname);
+        nfree(de->res_data.hostname);
       nfree(de);
       de = ode;
     }
@@ -437,11 +437,12 @@
     alarm(resolve_timeout);
     hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET);
     alarm(0);
-    if (hp) {
+    if (hp)
       strncpyz(s, hp->h_name, sizeof s);
-    } else
+    else
       strcpy(s, iptostr(addr));
-  } else {
+  }
+  else {
     hp = NULL;
     strcpy(s, iptostr(addr));
   }
@@ -503,10 +504,9 @@
   /* This function should be using BADARGS, FIXME -poptix */
   if (argc < 3) {
     Tcl_AppendResult(irp, "wrong # args: should be \"", argv[0],
-		     " ip-address/hostname proc ?args...?\"", NULL);
+                     " ip-address/hostname proc ?args...?\"", NULL);
     return TCL_ERROR;
   }
-
   if (argc > 3) {
     int l = 0, p;
 
@@ -532,8 +532,7 @@
   return TCL_OK;
 }
 
-tcl_cmds tcldns_cmds[] =
-{
-  {"dnslookup",	tcl_dnslookup},
-  {NULL,	NULL}
+tcl_cmds tcldns_cmds[] = {
+  {"dnslookup", tcl_dnslookup},
+  {NULL,                 NULL}
 };
Index: eggdrop1.6/src/dns.h
diff -u eggdrop1.6/src/dns.h:1.8 eggdrop1.6/src/dns.h:1.9
--- eggdrop1.6/src/dns.h:1.8	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/src/dns.h	Tue Jan 28 00:37:24 2003
@@ -2,7 +2,7 @@
  * dns.h
  *   stuff used by dns.c
  *
- * $Id: dns.h,v 1.8 2002/12/24 02:30:04 wcc Exp $
+ * $Id: dns.h,v 1.9 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Written by Fabian Knittel <fknittel at gmx.de>
@@ -29,24 +29,24 @@
 
 typedef struct {
   char *name;
-  int  (*expmem)(void *);
-  void (*event)(IP, char *, int, void *);
+  int (*expmem) (void *);
+  void (*event) (IP, char *, int, void *);
 } devent_type;
 
 typedef struct {
-  char *proc;			/* Tcl proc			  */
-  char *paras;			/* Additional parameters	  */
+  char *proc;                   /* Tcl proc                       */
+  char *paras;                  /* Additional parameters          */
 } devent_tclinfo_t;
 
 typedef struct devent_str {
-  struct devent_str *next;	/* Pointer to next dns_event	  */
-  devent_type	*type;
-  u_8bit_t	lookup;		/* RES_IPBYHOST or RES_HOSTBYIP	  */
+  struct devent_str *next;      /* Pointer to next dns_event      */
+  devent_type *type;
+  u_8bit_t lookup;              /* RES_IPBYHOST or RES_HOSTBYIP   */
   union {
-    IP		ip_addr;	/* IP address			  */
-    char	*hostname; 	/* Hostname			  */
+    IP ip_addr;                 /* IP address                     */
+    char *hostname;             /* Hostname                       */
   } res_data;
-  void		*other;		/* Data specific to the event type */
+  void *other;                  /* Data specific to the event type */
 } devent_t;
 
-#endif	/* _EGG_DNS_H */
+#endif /* _EGG_DNS_H */
Index: eggdrop1.6/src/eggdrop.h
diff -u eggdrop1.6/src/eggdrop.h:1.42 eggdrop1.6/src/eggdrop.h:1.43
--- eggdrop1.6/src/eggdrop.h:1.42	Wed Jan 22 20:41:48 2003
+++ eggdrop1.6/src/eggdrop.h	Tue Jan 28 00:37:24 2003
@@ -4,7 +4,7 @@
  *
  *   IF YOU ALTER THIS FILE, YOU NEED TO RECOMPILE THE BOT.
  *
- * $Id: eggdrop.h,v 1.42 2003/01/23 02:41:48 wcc Exp $
+ * $Id: eggdrop.h,v 1.43 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -61,24 +61,24 @@
  *       configuration file instead.
  */
 
-#define HANDLEN		  9	/* valid values 9->NICKMAX		*/
-#define NICKMAX		 32	/* valid values HANDLEN->32		*/
+#define HANDLEN		  9     /* valid values 9->NICKMAX              */
+#define NICKMAX		 32     /* valid values HANDLEN->32             */
 
 
 /* Handy string lengths */
 
-#define UHOSTMAX	160	/* reasonable, i think?			*/
-#define DIRMAX		512	/* paranoia				*/
-#define LOGLINEMAX	767	/* for misc.c/putlog() <cybah>		*/
+#define UHOSTMAX	160     /* reasonable, i think?                 */
+#define DIRMAX		512     /* paranoia                             */
+#define LOGLINEMAX	767     /* for misc.c/putlog() <cybah>          */
 #define BADHANDCHARS	"-,+*=:!.@#;$%&"
 
 
 /* Language stuff */
 
-#define LANGDIR	"./language"	/* language file directory		*/
-#define BASELANG "english"	/* language which always gets loaded
-				   before all other languages. You do
-				   not want to change this.		*/
+#define LANGDIR	"./language"    /* language file directory              */
+#define BASELANG "english"      /* language which always gets loaded
+                                 * before all other languages. You do
+                                 * not want to change this.             */
 
 
 /*
@@ -158,7 +158,7 @@
 #  define random() (rand()/16)
 #endif
 
-#if !HAVE_SIGACTION		/* old "weird signals" */
+#if !HAVE_SIGACTION             /* old "weird signals" */
 #  define sigaction sigvec
 #  ifndef sa_handler
 #    define sa_handler sv_handler
@@ -207,20 +207,20 @@
 
 /* 32 bit type */
 #if (SIZEOF_INT == 4)
-typedef unsigned int		u_32bit_t;
+typedef unsigned int u_32bit_t;
 #else
 #  if (SIZEOF_LONG == 4)
-typedef unsigned long		u_32bit_t;
+typedef unsigned long u_32bit_t;
 #  else
 #    include "cant/find/32bit/type"
 #  endif
 #endif
 
-typedef unsigned short int	u_16bit_t;
-typedef unsigned char		u_8bit_t;
+typedef unsigned short int u_16bit_t;
+typedef unsigned char u_8bit_t;
 
 /* IP type */
-typedef u_32bit_t		IP;
+typedef u_32bit_t IP;
 
 #define debug0(x)		putlog(LOG_DEBUG,"*",x)
 #define debug1(x,a1)		putlog(LOG_DEBUG,"*",x,a1)
@@ -258,18 +258,18 @@
 struct userrec;
 
 struct dcc_t {
-  long sock;			/* This should be a long to keep 64-bit
-				   machines sane			 */
-  IP addr;			/* IP address in host byte order	 */
+  long sock;                    /* This should be a long to keep 64-bit
+                                 * machines sane                         */
+  IP addr;                      /* IP address in host byte order         */
   unsigned int port;
   struct userrec *user;
   char nick[NICKLEN];
   char host[UHOSTLEN];
   struct dcc_table *type;
-  time_t timeval;		/* Use for any timing stuff
-				   - this is used for timeout checking	*/
-  unsigned long status;		/* A LOT of dcc types have status
-				   thingos, this makes it more avaliabe	*/
+  time_t timeval;               /* Use for any timing stuff
+                                 * - this is used for timeout checking  */
+  unsigned long status;         /* A LOT of dcc types have status
+                                 * thingos, this makes it more avaliabe */
   union {
     struct chat_info *chat;
     struct file_info *file;
@@ -282,21 +282,21 @@
     struct dupwait_info *dupwait;
     int ident_sock;
     void *other;
-  } u;				/* Special use depending on type	*/
+  } u;                          /* Special use depending on type        */
 };
 
 struct chat_info {
-  char *away;			/* non-NULL if user is away		*/
-  int msgs_per_sec;		/* used to stop flooding		*/
-  int con_flags;		/* with console: what to show		*/
-  int strip_flags;		/* what codes to strip (b,r,u,c,a,g,*)	*/
-  char con_chan[81];		/* with console: what channel to view	*/
-  int channel;			/* 0=party line, -1=off			*/
-  struct msgq *buffer;		/* a buffer of outgoing lines
-				   (for .page cmd)			*/
-  int max_line;			/* maximum lines at once		*/
-  int line_count;		/* number of lines sent since last page	*/
-  int current_lines;		/* number of lines total stored		*/
+  char *away;                   /* non-NULL if user is away             */
+  int msgs_per_sec;             /* used to stop flooding                */
+  int con_flags;                /* with console: what to show           */
+  int strip_flags;              /* what codes to strip (b,r,u,c,a,g,*)  */
+  char con_chan[81];            /* with console: what channel to view   */
+  int channel;                  /* 0=party line, -1=off                 */
+  struct msgq *buffer;          /* a buffer of outgoing lines
+                                 * (for .page cmd)                      */
+  int max_line;                 /* maximum lines at once                */
+  int line_count;               /* number of lines sent since last page */
+  int current_lines;            /* number of lines total stored         */
   char *su_nick;
 };
 
@@ -308,44 +308,44 @@
 struct xfer_info {
   char *filename;
   char *origname;
-  char dir[DIRLEN];		/* used when uploads go to the current dir */
+  char dir[DIRLEN];             /* used when uploads go to the current dir */
   unsigned long length;
   unsigned long acked;
-  char buf[4];			/* you only need 5 bytes!		   */
-  unsigned char sofar;		/* how much of the byte count received	   */
-  char from[NICKLEN];		/* [GET] user who offered the file	   */
-  FILE *f;			/* pointer to file being sent/received	   */
-  unsigned int type;		/* xfer connection type, see enum below	   */
-  unsigned short ack_type;	/* type of ack				   */
-  unsigned long offset;		/* offset from beginning of file, during
-				   resend.				   */
-  unsigned long block_pending;	/* bytes of this DCC block which weren't
-				   sent yet.				   */
-  time_t start_time;		/* Time when a xfer was started.	   */
-};
-
-enum {				/* transfer connection handling a ...	*/
-	XFER_SEND,		/*  ... normal file-send to s.o.	*/
-	XFER_RESEND,		/*  ... file-resend to s.o.		*/
-	XFER_RESEND_PEND,	/*  ... (as above) and waiting for info	*/
-	XFER_RESUME,		/*  ... file-send-resume to s.o.	*/
-	XFER_RESUME_PEND,	/*  ... (as above) and waiting for conn */
-	XFER_GET		/*  ... file-get from s.o.		*/
+  char buf[4];                  /* you only need 5 bytes!                  */
+  unsigned char sofar;          /* how much of the byte count received     */
+  char from[NICKLEN];           /* [GET] user who offered the file         */
+  FILE *f;                      /* pointer to file being sent/received     */
+  unsigned int type;            /* xfer connection type, see enum below    */
+  unsigned short ack_type;      /* type of ack                             */
+  unsigned long offset;         /* offset from beginning of file, during
+                                 * resend.                                 */
+  unsigned long block_pending;  /* bytes of this DCC block which weren't
+                                 * sent yet.                               */
+  time_t start_time;            /* Time when a xfer was started.           */
+};
+
+enum {                          /* transfer connection handling a ...   */
+  XFER_SEND,                    /*  ... normal file-send to s.o.        */
+  XFER_RESEND,                  /*  ... file-resend to s.o.             */
+  XFER_RESEND_PEND,             /*  ... (as above) and waiting for info */
+  XFER_RESUME,                  /*  ... file-send-resume to s.o.        */
+  XFER_RESUME_PEND,             /*  ... (as above) and waiting for conn */
+  XFER_GET                      /*  ... file-get from s.o.              */
 };
 
 enum {
-	XFER_ACK_UNKNOWN,	/* We don't know how blocks are acked.	*/
-	XFER_ACK_WITH_OFFSET,	/* Skipped data is also counted as
-				   received.				*/
-	XFER_ACK_WITHOUT_OFFSET	/* Skipped data is NOT counted in ack.	*/
+  XFER_ACK_UNKNOWN,             /* We don't know how blocks are acked.  */
+  XFER_ACK_WITH_OFFSET,         /* Skipped data is also counted as
+                                 * received.                            */
+  XFER_ACK_WITHOUT_OFFSET       /* Skipped data is NOT counted in ack.  */
 };
 
 struct bot_info {
-  char version[121];		/* channel/version info			*/
-  char linker[NOTENAMELEN + 1];	/* who requested this link		*/
-  int  numver;
-  int  port;			/* base port				*/
-  int  uff_flags;		/* user file feature flags		*/
+  char version[121];            /* channel/version info                 */
+  char linker[NOTENAMELEN + 1]; /* who requested this link              */
+  int numver;
+  int port;                     /* base port                            */
+  int uff_flags;                /* user file feature flags              */
 };
 
 struct relay_info {
@@ -366,87 +366,87 @@
 };
 
 struct dns_info {
-  void (*dns_success)(int);	/* is called if the dns request succeeds   */
-  void (*dns_failure)(int);	/* is called if it fails		   */
-  char *host;			/* hostname				   */
-  char *cbuf;			/* temporary buffer. Memory will be free'd
-				   as soon as dns_info is free'd	   */
-  char *cptr;			/* temporary pointer			   */
-  IP ip;			/* IP address				   */
-  int ibuf;			/* temporary buffer for one integer	   */
-  char dns_type;		/* lookup type, e.g. RES_HOSTBYIP	   */
-  struct dcc_table *type;	/* type of the dcc table we are making the
-				   lookup for				   */
+  void (*dns_success) (int);    /* is called if the dns request succeeds   */
+  void (*dns_failure) (int);    /* is called if it fails                   */
+  char *host;                   /* hostname                                */
+  char *cbuf;                   /* temporary buffer. Memory will be free'd
+                                 * as soon as dns_info is free'd           */
+  char *cptr;                   /* temporary pointer                       */
+  IP ip;                        /* IP address                              */
+  int ibuf;                     /* temporary buffer for one integer        */
+  char dns_type;                /* lookup type, e.g. RES_HOSTBYIP          */
+  struct dcc_table *type;       /* type of the dcc table we are making the
+                                 * lookup for                              */
 };
 
 /* Flags for dns_type
  */
-#define RES_HOSTBYIP  1		/* hostname to IP address		*/
-#define RES_IPBYHOST  2		/* IP address to hostname		*/
+#define RES_HOSTBYIP  1         /* hostname to IP address               */
+#define RES_IPBYHOST  2         /* IP address to hostname               */
 
 struct dupwait_info {
-  int atr;			/* the bots attributes			*/
-  struct chat_info *chat;	/* holds current chat data		*/
+  int atr;                      /* the bots attributes                  */
+  struct chat_info *chat;       /* holds current chat data              */
 };
 
 /* Flags about dcc types
  */
-#define DCT_CHAT      0x00000001	/* this dcc type receives botnet
-					   chatter			    */
-#define DCT_MASTER    0x00000002	/* received master chatter	    */
-#define DCT_SHOWWHO   0x00000004	/* show the user in .who	    */
-#define DCT_REMOTEWHO 0x00000008	/* show in remote who		    */
-#define DCT_VALIDIDX  0x00000010	/* valid idx for outputting to
-					   in tcl			    */
-#define DCT_SIMUL     0x00000020	/* can be tcl_simul'd		    */
-#define DCT_CANBOOT   0x00000040	/* can be booted		    */
-#define DCT_GETNOTES  DCT_CHAT		/* can receive notes		    */
-#define DCT_FILES     0x00000080	/* gratuitous hack ;)		    */
-#define DCT_FORKTYPE  0x00000100	/* a forking type		    */
-#define DCT_BOT       0x00000200	/* a bot connection of some sort... */
-#define DCT_FILETRAN  0x00000400	/* a file transfer of some sort	    */
-#define DCT_FILESEND  0x00000800	/* a sending file transfer,
-					   getting = !this		    */
-#define DCT_LISTEN    0x00001000	/* a listening port of some sort    */
+#define DCT_CHAT      0x00000001        /* this dcc type receives botnet
+                                         * chatter                          */
+#define DCT_MASTER    0x00000002        /* received master chatter          */
+#define DCT_SHOWWHO   0x00000004        /* show the user in .who            */
+#define DCT_REMOTEWHO 0x00000008        /* show in remote who               */
+#define DCT_VALIDIDX  0x00000010        /* valid idx for outputting to
+                                         * in tcl                           */
+#define DCT_SIMUL     0x00000020        /* can be tcl_simul'd               */
+#define DCT_CANBOOT   0x00000040        /* can be booted                    */
+#define DCT_GETNOTES  DCT_CHAT  /* can receive notes                */
+#define DCT_FILES     0x00000080        /* gratuitous hack ;)               */
+#define DCT_FORKTYPE  0x00000100        /* a forking type                   */
+#define DCT_BOT       0x00000200        /* a bot connection of some sort... */
+#define DCT_FILETRAN  0x00000400        /* a file transfer of some sort     */
+#define DCT_FILESEND  0x00000800        /* a sending file transfer,
+                                         * getting = !this                  */
+#define DCT_LISTEN    0x00001000        /* a listening port of some sort    */
 
 /* For dcc chat & files:
  */
-#define STAT_ECHO    0x00001	/* echo commands back?			*/
-#define STAT_DENY    0x00002	/* bad username (ignore password & deny
-				   access)				*/
-#define STAT_CHAT    0x00004	/* in file-system but may return	*/
-#define STAT_TELNET  0x00008	/* connected via telnet			*/
-#define STAT_PARTY   0x00010	/* only on party line via 'p' flag	*/
-#define STAT_BOTONLY 0x00020	/* telnet on bots-only connect		*/
-#define STAT_USRONLY 0x00040	/* telnet on users-only connect		*/
-#define STAT_PAGE    0x00080	/* page output to the user		*/
+#define STAT_ECHO    0x00001    /* echo commands back?                  */
+#define STAT_DENY    0x00002    /* bad username (ignore password & deny
+                                 * access)                              */
+#define STAT_CHAT    0x00004    /* in file-system but may return        */
+#define STAT_TELNET  0x00008    /* connected via telnet                 */
+#define STAT_PARTY   0x00010    /* only on party line via 'p' flag      */
+#define STAT_BOTONLY 0x00020    /* telnet on bots-only connect          */
+#define STAT_USRONLY 0x00040    /* telnet on users-only connect         */
+#define STAT_PAGE    0x00080    /* page output to the user              */
 
 /* For stripping out mIRC codes
  */
-#define STRIP_COLOR  0x00001	/* remove mIRC color codes		*/
-#define STRIP_BOLD   0x00002	/* remove bold codes			*/
-#define STRIP_REV    0x00004	/* remove reverse video codes		*/
-#define STRIP_UNDER  0x00008	/* remove underline codes		*/
-#define STRIP_ANSI   0x00010	/* remove ALL ansi codes		*/
-#define STRIP_BELLS  0x00020	/* remote ctrl-g's			*/
-#define STRIP_ALL    0x00040	/* remove every damn thing!		*/
+#define STRIP_COLOR  0x00001    /* remove mIRC color codes              */
+#define STRIP_BOLD   0x00002    /* remove bold codes                    */
+#define STRIP_REV    0x00004    /* remove reverse video codes           */
+#define STRIP_UNDER  0x00008    /* remove underline codes               */
+#define STRIP_ANSI   0x00010    /* remove ALL ansi codes                */
+#define STRIP_BELLS  0x00020    /* remote ctrl-g's                      */
+#define STRIP_ALL    0x00040    /* remove every damn thing!             */
 
 /* for dcc bot links: */
-#define STAT_PINGED  0x00001	/* waiting for ping to return		 */
-#define STAT_SHARE   0x00002	/* sharing user data with the bot	 */
-#define STAT_CALLED  0x00004	/* this bot called me			 */
-#define STAT_OFFERED 0x00008	/* offered her the user file		 */
-#define STAT_SENDING 0x00010	/* in the process of sending a user list */
-#define STAT_GETTING 0x00020	/* in the process of getting a user list */
-#define STAT_WARNED  0x00040	/* warned him about unleaflike behavior  */
-#define STAT_LEAF    0x00080	/* this bot is a leaf only		 */
-#define STAT_LINKING 0x00100	/* the bot is currently going through
-				   the linking stage			 */
-#define STAT_AGGRESSIVE   0x200	/* aggressively sharing with this bot	 */
+#define STAT_PINGED  0x00001    /* waiting for ping to return            */
+#define STAT_SHARE   0x00002    /* sharing user data with the bot        */
+#define STAT_CALLED  0x00004    /* this bot called me                    */
+#define STAT_OFFERED 0x00008    /* offered her the user file             */
+#define STAT_SENDING 0x00010    /* in the process of sending a user list */
+#define STAT_GETTING 0x00020    /* in the process of getting a user list */
+#define STAT_WARNED  0x00040    /* warned him about unleaflike behavior  */
+#define STAT_LEAF    0x00080    /* this bot is a leaf only               */
+#define STAT_LINKING 0x00100    /* the bot is currently going through
+                                 * the linking stage                     */
+#define STAT_AGGRESSIVE   0x200 /* aggressively sharing with this bot    */
 
 /* Flags for listening sockets
  */
-#define LSTN_PUBLIC  0x000001	/* No access restrictions		*/
+#define LSTN_PUBLIC  0x000001   /* No access restrictions               */
 
 /* chan & global */
 #define FLOOD_PRIVMSG    0
@@ -468,45 +468,45 @@
 /* Structure for internal logs */
 typedef struct {
   char *filename;
-  unsigned int mask;		/* what to send to this log		    */
-  char *chname;			/* which channel			    */
-  char szlast[LOGLINELEN];	/* for 'Last message repeated n times'
-				   stuff in misc.c/putlog() <cybah>	    */
-  int repeats;			/* number of times szLast has been repeated */
-  unsigned int flags;		/* other flags <rtc>			    */
-  FILE *f;			/* existing file			    */
+  unsigned int mask;            /* what to send to this log                 */
+  char *chname;                 /* which channel                            */
+  char szlast[LOGLINELEN];      /* for 'Last message repeated n times'
+                                 * stuff in misc.c/putlog() <cybah>         */
+  int repeats;                  /* number of times szLast has been repeated */
+  unsigned int flags;           /* other flags <rtc>                        */
+  FILE *f;                      /* existing file                            */
 } log_t;
 
 /* Logfile display flags
  */
-#define LOG_MSGS     0x000001	/* m   msgs/notice/ctcps		*/
-#define LOG_PUBLIC   0x000002	/* p   public msg/notice/ctcps		*/
-#define LOG_JOIN     0x000004	/* j   channel joins/parts/etc		*/
-#define LOG_MODES    0x000008	/* k   mode changes/kicks/bans		*/
-#define LOG_CMDS     0x000010	/* c   user dcc or msg commands		*/
-#define LOG_MISC     0x000020	/* o   other misc bot things		*/
-#define LOG_BOTS     0x000040	/* b   bot notices			*/
-#define LOG_RAW      0x000080	/* r   raw server stuff coming in	*/
-#define LOG_FILES    0x000100	/* x   file transfer commands and stats	*/
-#define LOG_LEV1     0x000200	/* 1   user log level			*/
-#define LOG_LEV2     0x000400	/* 2   user log level			*/
-#define LOG_LEV3     0x000800	/* 3   user log level			*/
-#define LOG_LEV4     0x001000	/* 4   user log level			*/
-#define LOG_LEV5     0x002000	/* 5   user log level			*/
-#define LOG_LEV6     0x004000	/* 6   user log level			*/
-#define LOG_LEV7     0x008000	/* 7   user log level			*/
-#define LOG_LEV8     0x010000	/* 8   user log level			*/
-#define LOG_SERV     0x020000	/* s   server information		*/
-#define LOG_DEBUG    0x040000	/* d   debug				*/
-#define LOG_WALL     0x080000	/* w   wallops				*/
-#define LOG_SRVOUT   0x100000	/* v   server output			*/
-#define LOG_BOTNET   0x200000	/* t   botnet traffic			*/
-#define LOG_BOTSHARE 0x400000	/* h   share traffic			*/
-#define LOG_ALL      0x7fffff	/* (dump to all logfiles)		*/
+#define LOG_MSGS     0x000001   /* m   msgs/notice/ctcps                */
+#define LOG_PUBLIC   0x000002   /* p   public msg/notice/ctcps          */
+#define LOG_JOIN     0x000004   /* j   channel joins/parts/etc          */
+#define LOG_MODES    0x000008   /* k   mode changes/kicks/bans          */
+#define LOG_CMDS     0x000010   /* c   user dcc or msg commands         */
+#define LOG_MISC     0x000020   /* o   other misc bot things            */
+#define LOG_BOTS     0x000040   /* b   bot notices                      */
+#define LOG_RAW      0x000080   /* r   raw server stuff coming in       */
+#define LOG_FILES    0x000100   /* x   file transfer commands and stats */
+#define LOG_LEV1     0x000200   /* 1   user log level                   */
+#define LOG_LEV2     0x000400   /* 2   user log level                   */
+#define LOG_LEV3     0x000800   /* 3   user log level                   */
+#define LOG_LEV4     0x001000   /* 4   user log level                   */
+#define LOG_LEV5     0x002000   /* 5   user log level                   */
+#define LOG_LEV6     0x004000   /* 6   user log level                   */
+#define LOG_LEV7     0x008000   /* 7   user log level                   */
+#define LOG_LEV8     0x010000   /* 8   user log level                   */
+#define LOG_SERV     0x020000   /* s   server information               */
+#define LOG_DEBUG    0x040000   /* d   debug                            */
+#define LOG_WALL     0x080000   /* w   wallops                          */
+#define LOG_SRVOUT   0x100000   /* v   server output                    */
+#define LOG_BOTNET   0x200000   /* t   botnet traffic                   */
+#define LOG_BOTSHARE 0x400000   /* h   share traffic                    */
+#define LOG_ALL      0x7fffff   /* (dump to all logfiles)               */
 
 /* Internal logfile flags
  */
-#define LF_EXPIRING 0x000001	/* Logfile will be closed soon		*/
+#define LF_EXPIRING 0x000001    /* Logfile will be closed soon          */
 
 #define FILEDB_HIDE     1
 #define FILEDB_UNHIDE   2
@@ -515,24 +515,24 @@
 
 /* Socket flags:
  */
-#define SOCK_UNUSED     0x0001	/* empty socket				*/
-#define SOCK_BINARY     0x0002	/* do not buffer input			*/
-#define SOCK_LISTEN     0x0004	/* listening port			*/
-#define SOCK_CONNECT    0x0008	/* connection attempt			*/
-#define SOCK_NONSOCK    0x0010	/* used for file i/o on debug		*/
-#define SOCK_STRONGCONN 0x0020	/* don't report success until sure	*/
-#define SOCK_EOFD       0x0040	/* it EOF'd recently during a write	*/
-#define SOCK_PROXYWAIT	0x0080	/* waiting for SOCKS traversal		*/
-#define SOCK_PASS	0x0100	/* passed on; only notify in case
-				   of traffic				*/
-#define SOCK_VIRTUAL	0x0200	/* not-connected socket (dont read it!)	*/
-#define SOCK_BUFFER	0x0400	/* buffer data; don't notify dcc funcs	*/
+#define SOCK_UNUSED     0x0001  /* empty socket                         */
+#define SOCK_BINARY     0x0002  /* do not buffer input                  */
+#define SOCK_LISTEN     0x0004  /* listening port                       */
+#define SOCK_CONNECT    0x0008  /* connection attempt                   */
+#define SOCK_NONSOCK    0x0010  /* used for file i/o on debug           */
+#define SOCK_STRONGCONN 0x0020  /* don't report success until sure      */
+#define SOCK_EOFD       0x0040  /* it EOF'd recently during a write     */
+#define SOCK_PROXYWAIT	0x0080  /* waiting for SOCKS traversal          */
+#define SOCK_PASS	0x0100  /* passed on; only notify in case
+                                 * of traffic                           */
+#define SOCK_VIRTUAL	0x0200  /* not-connected socket (dont read it!) */
+#define SOCK_BUFFER	0x0400  /* buffer data; don't notify dcc funcs  */
 
 /* Flags to sock_has_data
  */
 enum {
-  SOCK_DATA_OUTGOING,		/* Data in out-queue?			*/
-  SOCK_DATA_INCOMING		/* Data in in-queue?			*/
+  SOCK_DATA_OUTGOING,           /* Data in out-queue?                   */
+  SOCK_DATA_INCOMING            /* Data in in-queue?                    */
 };
 
 /* Fake idx's for dprintf - these should be ridiculously large +ve nums
@@ -551,14 +551,14 @@
 #define QUICK           1
 
 /* Return codes for add_note */
-#define NOTE_ERROR      0	/* error			*/
-#define NOTE_OK         1	/* success			*/
-#define NOTE_STORED     2	/* not online; stored		*/
-#define NOTE_FULL       3	/* too many notes stored	*/
-#define NOTE_TCL        4	/* tcl binding caught it	*/
-#define NOTE_AWAY       5	/* away; stored			*/
-#define NOTE_FWD        6	/* away; forwarded		*/
-#define NOTE_REJECT     7	/* ignore mask matched		*/
+#define NOTE_ERROR      0       /* error                        */
+#define NOTE_OK         1       /* success                      */
+#define NOTE_STORED     2       /* not online; stored           */
+#define NOTE_FULL       3       /* too many notes stored        */
+#define NOTE_TCL        4       /* tcl binding caught it        */
+#define NOTE_AWAY       5       /* away; stored                 */
+#define NOTE_FWD        6       /* away; forwarded              */
+#define NOTE_REJECT     7       /* ignore mask matched          */
 
 #define STR_PROTECT     2
 #define STR_DIR         1
@@ -571,37 +571,37 @@
  * queued on them
  */
 typedef struct {
-  int		 sock;
-  short		 flags;
-  char		*inbuf;
-  char		*outbuf;
-  unsigned long  outbuflen;	/* Outbuf could be binary data	*/
-  unsigned long	 inbuflen;	/* Inbuf could be binary data	*/
+  int sock;
+  short flags;
+  char *inbuf;
+  char *outbuf;
+  unsigned long outbuflen;      /* Outbuf could be binary data  */
+  unsigned long inbuflen;       /* Inbuf could be binary data   */
 } sock_list;
 
 enum {
-  EGG_OPTION_SET	= 1,	/* Set option(s).		*/
-  EGG_OPTION_UNSET	= 2	/* Unset option(s).		*/
+  EGG_OPTION_SET = 1,           /* Set option(s).               */
+  EGG_OPTION_UNSET = 2          /* Unset option(s).             */
 };
 
 /* Telnet codes.  See "TELNET Protocol Specification" (RFC 854) and
  * "TELNET Echo Option" (RFC 875) for details.
  */
 
-#define TLN_AYT		246		/* Are You There	*/
+#define TLN_AYT		246     /* Are You There        */
 
-#define TLN_WILL	251		/* Will			*/
+#define TLN_WILL	251     /* Will                 */
 #define TLN_WILL_C	"\373"
-#define TLN_WONT	252		/* Won't		*/
+#define TLN_WONT	252     /* Won't                */
 #define TLN_WONT_C	"\374"
-#define TLN_DO		253		/* Do			*/
+#define TLN_DO		253     /* Do                   */
 #define TLN_DO_C	"\375"
-#define TLN_DONT	254		/* Don't		*/
+#define TLN_DONT	254     /* Don't                */
 #define TLN_DONT_C	"\376"
-#define TLN_IAC		255		/* Interpret As Command	*/
+#define TLN_IAC		255     /* Interpret As Command */
 #define TLN_IAC_C	"\377"
 
-#define TLN_ECHO	1		/* Echo			*/
+#define TLN_ECHO	1       /* Echo                 */
 #define TLN_ECHO_C	"\001"
 
-#endif				/* _EGG_EGGDROP_H */
+#endif /* _EGG_EGGDROP_H */
Index: eggdrop1.6/src/flags.c
diff -u eggdrop1.6/src/flags.c:1.21 eggdrop1.6/src/flags.c:1.22
--- eggdrop1.6/src/flags.c:1.21	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/src/flags.c	Tue Jan 28 00:37:24 2003
@@ -2,7 +2,7 @@
  * flags.c -- handles:
  *   all the flag matching/conversion functions in one neat package :)
  *
- * $Id: flags.c,v 1.21 2002/12/24 02:30:04 wcc Exp $
+ * $Id: flags.c,v 1.22 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -26,11 +26,10 @@
 #include "main.h"
 
 
-extern int		 use_console_r, debug_output, require_p, noshare,
-			 allow_dk_cmds;
-extern struct dcc_t	*dcc;
+extern int use_console_r, debug_output, require_p, noshare, allow_dk_cmds;
+extern struct dcc_t *dcc;
 
-int	use_console_r = 0;	/* Allow users to set their console +r	*/
+int use_console_r = 0;          /* Allow users to set their console +r  */
 
 
 int logmodes(char *s)
@@ -133,7 +132,7 @@
 
 char *masktype(int x)
 {
-  static char s[24];		/* Change this if you change the levels */
+  static char s[24];            /* Change this if you change the levels */
   char *p = s;
 
   if (x & LOG_MSGS)
@@ -190,7 +189,7 @@
 
 char *maskname(int x)
 {
-  static char s[207];		/* Change this if you change the levels */
+  static char s[207];           /* Change this if you change the levels */
   int i = 0;
 
   s[0] = 0;
@@ -302,7 +301,7 @@
     chatr |= USER_MASTER;
   /* Master implies op */
   if (chatr & USER_MASTER)
-    chatr |= USER_OP ;
+    chatr |= USER_OP;
   /* Can't be +s on chan unless you're a bot */
   if (!(atr & USER_BOT))
     chatr &= ~BOT_SHARE;
@@ -320,7 +319,7 @@
  */
 char geticon(int idx)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
 
   if (!dcc[idx].user)
     return '-';
@@ -339,11 +338,11 @@
 }
 
 void break_down_flags(const char *string, struct flag_record *plus,
-		      struct flag_record *minus)
+                      struct flag_record *minus)
 {
-  struct flag_record	*which = plus;
-  int			 mode = 0;	/* 0 = glob, 1 = chan, 2 = bot */
-  int			 flags = plus->match;
+  struct flag_record *which = plus;
+  int mode = 0;                 /* 0 = glob, 1 = chan, 2 = bot */
+  int flags = plus->match;
 
   if (!(flags & FR_GLOBAL)) {
     if (flags & FR_BOT)
@@ -351,14 +350,14 @@
     else if (flags & FR_CHAN)
       mode = 1;
     else
-      return;			/* We dont actually want any..huh? */
+      return;                   /* We dont actually want any..huh? */
   }
   egg_bzero(plus, sizeof(struct flag_record));
 
   if (minus)
     egg_bzero(minus, sizeof(struct flag_record));
 
-  plus->match = FR_OR;		/* Default binding type OR */
+  plus->match = FR_OR;          /* Default binding type OR */
   while (*string) {
     switch (*string) {
     case '+':
@@ -370,53 +369,55 @@
     case '|':
     case '&':
       if (!mode) {
-	if (*string == '|')
-	  plus->match = FR_OR;
-	else
-	  plus->match = FR_AND;
+        if (*string == '|')
+          plus->match = FR_OR;
+        else
+          plus->match = FR_AND;
       }
       which = plus;
       mode++;
       if ((mode == 2) && !(flags & (FR_CHAN | FR_BOT)))
-	string = "";
+        string = "";
       else if (mode == 3)
-	mode = 1;
+        mode = 1;
       break;
     default:
       if ((*string >= 'a') && (*string <= 'z')) {
-	switch (mode) {
-	case 0:
-	  which->global |=1 << (*string - 'a');
-
-	  break;
-	case 1:
-	  which->chan |= 1 << (*string - 'a');
-	  break;
-	case 2:
-	  which->bot |= 1 << (*string - 'a');
-	}
-      } else if ((*string >= 'A') && (*string <= 'Z')) {
-	switch (mode) {
-	case 0:
-	  which->udef_global |= 1 << (*string - 'A');
-	  break;
-	case 1:
-	  which->udef_chan |= 1 << (*string - 'A');
-	  break;
-	}
-      } else if ((*string >= '0') && (*string <= '9')) {
-	switch (mode) {
-	  /* Map 0->9 to A->K for glob/chan so they are not lost */
-	case 0:
-	  which->udef_global |= 1 << (*string - '0');
-	  break;
-	case 1:
-	  which->udef_chan |= 1 << (*string - '0');
-	  break;
-	case 2:
-	  which->bot |= BOT_FLAG0 << (*string - '0');
-	  break;
-	}
+        switch (mode) {
+        case 0:
+          which->global |=1 << (*string - 'a');
+
+          break;
+        case 1:
+          which->chan |= 1 << (*string - 'a');
+          break;
+        case 2:
+          which->bot |= 1 << (*string - 'a');
+        }
+      }
+      else if ((*string >= 'A') && (*string <= 'Z')) {
+        switch (mode) {
+        case 0:
+          which->udef_global |= 1 << (*string - 'A');
+          break;
+        case 1:
+          which->udef_chan |= 1 << (*string - 'A');
+          break;
+        }
+      }
+      else if ((*string >= '0') && (*string <= '9')) {
+        switch (mode) {
+          /* Map 0->9 to A->K for glob/chan so they are not lost */
+        case 0:
+          which->udef_global |= 1 << (*string - '0');
+          break;
+        case 1:
+          which->udef_chan |= 1 << (*string - '0');
+          break;
+        case 2:
+          which->bot |= BOT_FLAG0 << (*string - '0');
+          break;
+        }
       }
     }
     string++;
@@ -480,20 +481,21 @@
 }
 
 int build_flags(char *string, struct flag_record *plus,
-		struct flag_record *minus)
+                struct flag_record *minus)
 {
   char *old = string;
 
   if (plus->match & FR_GLOBAL) {
-    if (minus && (plus->global || plus->udef_global))
+    if (minus && (plus->global ||plus->udef_global))
       *string++ = '+';
     string += flag2str(string, plus->global, plus->udef_global);
 
-    if (minus && (minus->global || minus->udef_global)) {
+    if (minus && (minus->global ||minus->udef_global)) {
       *string++ = '-';
       string += flag2str(string, minus->global, minus->udef_global);
     }
-  } else if (plus->match & FR_BOT) {
+  }
+  else if (plus->match & FR_BOT) {
     if (minus && plus->bot)
       *string++ = '+';
     string += bot2str(string, plus->bot);
@@ -532,24 +534,22 @@
   return string - old;
 }
 
-int flagrec_ok(struct flag_record *req,
-	       struct flag_record *have)
+int flagrec_ok(struct flag_record *req, struct flag_record *have)
 {
-  if (req->match & FR_AND) {
+  if (req->match & FR_AND)
     return flagrec_eq(req, have);
-  } else if (req->match & FR_OR) {
+  else if (req->match & FR_OR) {
     int hav = have->global;
 
     /* Exception 1 - global +d/+k cant use -|-, unless they are +p */
-    if (!req->chan && !req->global && !req->udef_global &&
-	!req->udef_chan) {
+    if (!req->chan && !req->global &&!req->udef_global && !req->udef_chan) {
       if (!allow_dk_cmds) {
-	if (glob_party(*have))
-	  return 1;
-	if (glob_kick(*have) || chan_kick(*have))
-	  return 0;		/* +k cant use -|- commands */
-	if (glob_deop(*have) || chan_deop(*have))
-	  return 0;		/* neither can +d's */
+        if (glob_party(*have))
+          return 1;
+        if (glob_kick(*have) || chan_kick(*have))
+          return 0;             /* +k cant use -|- commands */
+        if (glob_deop(*have) || chan_deop(*have))
+          return 0;             /* neither can +d's */
       }
       return 1;
     }
@@ -568,7 +568,7 @@
       return 1;
     return 0;
   }
-  return 0;			/* fr0k3 binding, dont pass it */
+  return 0;                     /* fr0k3 binding, dont pass it */
 }
 
 int flagrec_eq(struct flag_record *req, struct flag_record *have)
@@ -576,46 +576,47 @@
   if (req->match & FR_AND) {
     if (req->match & FR_GLOBAL) {
       if ((req->global &have->global) !=req->global)
-	return 0;
+        return 0;
       if ((req->udef_global & have->udef_global) != req->udef_global)
-	return 0;
+        return 0;
     }
     if (req->match & FR_BOT)
       if ((req->bot & have->bot) != req->bot)
-	return 0;
+        return 0;
     if (req->match & FR_CHAN) {
       if ((req->chan & have->chan) != req->chan)
-	return 0;
+        return 0;
       if ((req->udef_chan & have->udef_chan) != req->udef_chan)
-	return 0;
+        return 0;
     }
     return 1;
-  } else if (req->match & FR_OR) {
-    if (!req->chan && !req->global && !req->udef_chan &&
-	!req->udef_global && !req->bot)
+  }
+  else if (req->match & FR_OR) {
+    if (!req->chan && !req->global &&!req->udef_chan &&
+        !req->udef_global && !req->bot)
       return 1;
     if (req->match & FR_GLOBAL) {
       if (have->global &req->global)
-	return 1;
+        return 1;
       if (have->udef_global & req->udef_global)
-	return 1;
+        return 1;
     }
     if (req->match & FR_BOT)
       if (have->bot & req->bot)
-	return 1;
+        return 1;
     if (req->match & FR_CHAN) {
       if (have->chan & req->chan)
-	return 1;
+        return 1;
       if (have->udef_chan & req->udef_chan)
-	return 1;
+        return 1;
     }
     return 0;
   }
-  return 0;			/* fr0k3 binding, dont pass it */
+  return 0;                     /* fr0k3 binding, dont pass it */
 }
 
 void set_user_flagrec(struct userrec *u, struct flag_record *fr,
-		      const char *chname)
+                      const char *chname)
 {
   struct chanuserrec *cr = NULL;
   int oldflags = fr->match;
@@ -640,7 +641,7 @@
   if ((oldflags & FR_CHAN) && chname) {
     for (cr = u->chanrec; cr; cr = cr->next)
       if (!rfc_casecmp(chname, cr->channel))
-	break;
+        break;
     ch = findchan_by_dname(chname);
     if (!cr && ch) {
       cr = user_malloc(sizeof(struct chanuserrec));
@@ -654,9 +655,9 @@
       cr->flags = fr->chan;
       cr->flags_udef = fr->udef_chan;
       if (!noshare && !(u->flags & USER_UNSHARED) && channel_shared(ch)) {
-	fr->match = FR_CHAN;
-	build_flags(buffer, fr, NULL);
-	shareout(ch, "a %s %s %s\n", u->handle, buffer, chname);
+        fr->match = FR_CHAN;
+        build_flags(buffer, fr, NULL);
+        shareout(ch, "a %s %s %s\n", u->handle, buffer, chname);
       }
     }
   }
@@ -666,45 +667,52 @@
 /* Always pass the dname (display name) to this function for chname <cybah>
  */
 void get_user_flagrec(struct userrec *u, struct flag_record *fr,
-		      const char *chname)
+                      const char *chname)
 {
   struct chanuserrec *cr = NULL;
 
   if (!u) {
     fr->global = fr->udef_global = fr->chan = fr->udef_chan = fr->bot = 0;
+
     return;
   }
   if (fr->match & FR_GLOBAL) {
     fr->global = u->flags;
+
     fr->udef_global = u->flags_udef;
-  } else {
+  }
+  else {
     fr->global = 0;
+
     fr->udef_global = 0;
   }
   if (fr->match & FR_BOT) {
     fr->bot = (long) get_user(&USERENTRY_BOTFL, u);
-  } else
+  }
+  else
     fr->bot = 0;
   if (fr->match & FR_CHAN) {
     if (fr->match & FR_ANYWH) {
       fr->chan = u->flags;
       fr->udef_chan = u->flags_udef;
       for (cr = u->chanrec; cr; cr = cr->next)
-	if (findchan_by_dname(cr->channel)) {
-	  fr->chan |= cr->flags;
-	  fr->udef_chan |= cr->flags_udef;
-	}
-    } else {
+        if (findchan_by_dname(cr->channel)) {
+          fr->chan |= cr->flags;
+          fr->udef_chan |= cr->flags_udef;
+        }
+    }
+    else {
       if (chname)
-	for (cr = u->chanrec; cr; cr = cr->next)
-	  if (!rfc_casecmp(chname, cr->channel))
-	    break;
+        for (cr = u->chanrec; cr; cr = cr->next)
+          if (!rfc_casecmp(chname, cr->channel))
+            break;
       if (cr) {
-	fr->chan = cr->flags;
-	fr->udef_chan = cr->flags_udef;
-      } else {
-	fr->chan = 0;
-	fr->udef_chan = 0;
+        fr->chan = cr->flags;
+        fr->udef_chan = cr->flags_udef;
+      }
+      else {
+        fr->chan = 0;
+        fr->udef_chan = 0;
       }
     }
   }
@@ -712,7 +720,7 @@
 
 static int botfl_unpack(struct userrec *u, struct user_entry *e)
 {
-  struct flag_record fr = {FR_BOT, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_BOT, 0, 0, 0, 0, 0 };
 
   break_down_flags(e->u.list->extra, &fr, NULL);
   list_type_kill(e->u.list);
@@ -723,12 +731,12 @@
 static int botfl_pack(struct userrec *u, struct user_entry *e)
 {
   char x[100];
-  struct flag_record fr = {FR_BOT, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_BOT, 0, 0, 0, 0, 0 };
 
   fr.bot = e->u.ulong;
   e->u.list = user_malloc(sizeof(struct list_type));
   e->u.list->next = NULL;
-  e->u.list->extra = user_malloc (build_flags (x, &fr, NULL) + 1);
+  e->u.list->extra = user_malloc(build_flags(x, &fr, NULL) + 1);
   strcpy(e->u.list->extra, x);
   return 1;
 }
@@ -740,10 +748,10 @@
 }
 
 static int botfl_write_userfile(FILE *f, struct userrec *u,
-				struct user_entry *e)
+                                struct user_entry *e)
 {
   char x[100];
-  struct flag_record fr = {FR_BOT, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_BOT, 0, 0, 0, 0, 0 };
 
   fr.bot = e->u.ulong;
   build_flags(x, &fr, NULL);
@@ -757,8 +765,8 @@
   register long atr = ((long) buf & BOT_VALID);
 
   if (!(u->flags & USER_BOT))
-    return 1;			/* Don't even bother trying to set the
-				   flags for a non-bot */
+    return 1;                   /* Don't even bother trying to set the
+                                 * flags for a non-bot */
 
   if ((atr & BOT_HUB) && (atr & BOT_ALT))
     atr &= ~BOT_ALT;
@@ -777,10 +785,10 @@
 }
 
 static int botfl_tcl_get(Tcl_Interp *interp, struct userrec *u,
-			 struct user_entry *e, int argc, char **argv)
+                         struct user_entry *e, int argc, char **argv)
 {
   char x[100];
-  struct flag_record fr = {FR_BOT, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_BOT, 0, 0, 0, 0, 0 };
 
   fr.bot = e->u.ulong;
   build_flags(x, &fr, NULL);
@@ -789,9 +797,9 @@
 }
 
 static int botfl_tcl_set(Tcl_Interp *irp, struct userrec *u,
-			 struct user_entry *e, int argc, char **argv)
+                         struct user_entry *e, int argc, char **argv)
 {
-  struct flag_record fr = {FR_BOT, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_BOT, 0, 0, 0, 0, 0 };
 
   BADARGS(4, 4, " handle BOTFL flags");
   if (u->flags & USER_BOT) {
@@ -809,7 +817,7 @@
 
 static void botfl_display(int idx, struct user_entry *e)
 {
-  struct flag_record fr = {FR_BOT, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_BOT, 0, 0, 0, 0, 0 };
   char x[100];
 
   fr.bot = e->u.ulong;
@@ -817,9 +825,8 @@
   dprintf(idx, "  BOT FLAGS: %s\n", x);
 }
 
-struct user_entry_type USERENTRY_BOTFL =
-{
-  0,				/* always 0 ;) */
+struct user_entry_type USERENTRY_BOTFL = {
+  0,                            /* always 0 ;) */
   0,
   def_dupuser,
   botfl_unpack,
Index: eggdrop1.6/src/flags.h
diff -u eggdrop1.6/src/flags.h:1.11 eggdrop1.6/src/flags.h:1.12
--- eggdrop1.6/src/flags.h:1.11	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/src/flags.h	Tue Jan 28 00:37:24 2003
@@ -1,7 +1,7 @@
 /*
  * flags.h
  *
- * $Id: flags.h,v 1.11 2002/12/24 02:30:04 wcc Exp $
+ * $Id: flags.h,v 1.12 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -57,83 +57,83 @@
  *   + user defined A-Z
  *   unused letters: bchijpstwx
  */
-#define USER_VALID 0x03fbfeff /* all USER_ flags in use              */
-#define CHAN_VALID 0x03777c79 /* all flags that can be chan specific */
-#define BOT_VALID  0x7fe689C1 /* all BOT_ flags in use               */
-
-
-#define USER_AUTOOP        0x00000001 /* a  auto-op                           */
-#define USER_BOT           0x00000002 /* b  user is a bot                     */
-#define USER_COMMON        0x00000004 /* c  user is actually a public site    */
-#define USER_DEOP          0x00000008 /* d  user is global de-op              */
-#define USER_EXEMPT        0x00000010 /* e  exempted from stopnethack         */
-#define USER_FRIEND        0x00000020 /* f  user is global friend             */
-#define USER_GVOICE        0x00000040 /* g  auto-voice                        */
-#define USER_HIGHLITE      0x00000080 /* h  highlighting (bold)               */
-#define USER_I             0x00000100 /* i  unused                            */
-#define USER_JANITOR       0x00000200 /* j  user is file area master          */
-#define USER_KICK          0x00000400 /* k  user is global auto-kick          */
-#define USER_HALFOP        0x00000800 /* l  user is +h on all channels        */
-#define USER_MASTER        0x00001000 /* m  user has full bot access          */
-#define USER_OWNER         0x00002000 /* n  user is the bot owner             */
-#define USER_OP            0x00004000 /* o  user is +o on all channels        */
-#define USER_PARTY         0x00008000 /* p  user has party line access        */
-#define USER_QUIET         0x00010000 /* q  user is global de-voice           */
-#define USER_DEHALFOP      0x00020000 /* r  user is global de-halfop          */
-#define USER_S             0x00040000 /* s  unused                            */
-#define USER_BOTMAST       0x00080000 /* t  user is botnet master             */
-#define USER_UNSHARED      0x00100000 /* u  not shared with sharebots         */
-#define USER_VOICE         0x00200000 /* v  user is +v on all channels        */
-#define USER_WASOPTEST     0x00400000 /* w  wasop test needed for stopnethack */
-#define USER_XFER          0x00800000 /* x  user has file area access         */
-#define USER_AUTOHALFOP    0x01000000 /* y  auto-halfop                       */
-#define USER_WASHALFOPTEST 0x02000000 /* z  washalfop test needed for
-                                            stopnethack                       */
-#define USER_DEFAULT       0x40000000 /* use default-flags                    */
+#define USER_VALID 0x03fbfeff   /* all USER_ flags in use              */
+#define CHAN_VALID 0x03777c79   /* all flags that can be chan specific */
+#define BOT_VALID  0x7fe689C1   /* all BOT_ flags in use               */
+
+
+#define USER_AUTOOP        0x00000001   /* a  auto-op                           */
+#define USER_BOT           0x00000002   /* b  user is a bot                     */
+#define USER_COMMON        0x00000004   /* c  user is actually a public site    */
+#define USER_DEOP          0x00000008   /* d  user is global de-op              */
+#define USER_EXEMPT        0x00000010   /* e  exempted from stopnethack         */
+#define USER_FRIEND        0x00000020   /* f  user is global friend             */
+#define USER_GVOICE        0x00000040   /* g  auto-voice                        */
+#define USER_HIGHLITE      0x00000080   /* h  highlighting (bold)               */
+#define USER_I             0x00000100   /* i  unused                            */
+#define USER_JANITOR       0x00000200   /* j  user is file area master          */
+#define USER_KICK          0x00000400   /* k  user is global auto-kick          */
+#define USER_HALFOP        0x00000800   /* l  user is +h on all channels        */
+#define USER_MASTER        0x00001000   /* m  user has full bot access          */
+#define USER_OWNER         0x00002000   /* n  user is the bot owner             */
+#define USER_OP            0x00004000   /* o  user is +o on all channels        */
+#define USER_PARTY         0x00008000   /* p  user has party line access        */
+#define USER_QUIET         0x00010000   /* q  user is global de-voice           */
+#define USER_DEHALFOP      0x00020000   /* r  user is global de-halfop          */
+#define USER_S             0x00040000   /* s  unused                            */
+#define USER_BOTMAST       0x00080000   /* t  user is botnet master             */
+#define USER_UNSHARED      0x00100000   /* u  not shared with sharebots         */
+#define USER_VOICE         0x00200000   /* v  user is +v on all channels        */
+#define USER_WASOPTEST     0x00400000   /* w  wasop test needed for stopnethack */
+#define USER_XFER          0x00800000   /* x  user has file area access         */
+#define USER_AUTOHALFOP    0x01000000   /* y  auto-halfop                       */
+#define USER_WASHALFOPTEST 0x02000000   /* z  washalfop test needed for
+                                         * stopnethack                       */
+#define USER_DEFAULT       0x40000000   /* use default-flags                    */
 
 /* Flags specifically for bots
  */
-#define BOT_ALT       0x00000001	/* a  auto-link here if all +h's
-					      fail			 */
-#define BOT_BOT       0x00000002	/* b  sanity bot flag		 */
-#define BOT_C         0x00000004	/* c  unused			 */
-#define BOT_D         0x00000008	/* d  unused			 */
-#define BOT_E         0x00000010	/* e  unused			 */
-#define BOT_F         0x00000020	/* f  unused			 */
-#define BOT_GLOBAL    0x00000040	/* g  all channel are shared	 */
-#define BOT_HUB       0x00000080	/* h  auto-link to ONE of these
-					      bots			 */
-#define BOT_ISOLATE   0x00000100	/* i  isolate party line from
-					      botnet			 */
-#define BOT_J         0x00000200	/* j  unused			 */
-#define BOT_K         0x00000400	/* k  unused			 */
-#define BOT_LEAF      0x00000800	/* l  may not link other bots	 */
-#define BOT_M         0x00001000	/* m  unused			 */
-#define BOT_N         0x00002000	/* n  unused			 */
-#define BOT_O         0x00004000	/* o  unused			 */
-#define BOT_PASSIVE   0x00008000	/* p  share passively with this
-					      bot			 */
-#define BOT_Q         0x00010000	/* q  unused */
-#define BOT_REJECT    0x00020000	/* r  automatically reject
-					      anywhere			 */
-#define BOT_AGGRESSIVE 0x00040000	/* s  bot shares user files	 */
-#define BOT_T         0x00080000	/* t  unused			 */
-#define BOT_U         0x00100000	/* u  unused			 */
-#define BOT_V         0x00200000	/* v  unused			 */
-#define BOT_W         0x00400000	/* w  unused			 */
-#define BOT_X         0x00800000	/* x  unused			 */
-#define BOT_Y         0x01000000	/* y  unused			 */
-#define BOT_Z         0x02000000	/* z  unused			 */
-#define BOT_FLAG0     0x00200000	/* 0  user-defined flag #0	 */
-#define BOT_FLAG1     0x00400000	/* 1  user-defined flag #1	 */
-#define BOT_FLAG2     0x00800000	/* 2  user-defined flag #2	 */
-#define BOT_FLAG3     0x01000000	/* 3  user-defined flag #3	 */
-#define BOT_FLAG4     0x02000000	/* 4  user-defined flag #4	 */
-#define BOT_FLAG5     0x04000000	/* 5  user-defined flag #5	 */
-#define BOT_FLAG6     0x08000000	/* 6  user-defined flag #6	 */
-#define BOT_FLAG7     0x10000000	/* 7  user-defined flag #7	 */
-#define BOT_FLAG8     0x20000000	/* 8  user-defined flag #8	 */
-#define BOT_FLAG9     0x40000000	/* 9  user-defined flag #9	 */
+#define BOT_ALT       0x00000001        /* a  auto-link here if all +h's
+                                         * fail                  */
+#define BOT_BOT       0x00000002        /* b  sanity bot flag            */
+#define BOT_C         0x00000004        /* c  unused                     */
+#define BOT_D         0x00000008        /* d  unused                     */
+#define BOT_E         0x00000010        /* e  unused                     */
+#define BOT_F         0x00000020        /* f  unused                     */
+#define BOT_GLOBAL    0x00000040        /* g  all channel are shared     */
+#define BOT_HUB       0x00000080        /* h  auto-link to ONE of these
+                                         * bots                  */
+#define BOT_ISOLATE   0x00000100        /* i  isolate party line from
+                                         * botnet                        */
+#define BOT_J         0x00000200        /* j  unused                     */
+#define BOT_K         0x00000400        /* k  unused                     */
+#define BOT_LEAF      0x00000800        /* l  may not link other bots    */
+#define BOT_M         0x00001000        /* m  unused                     */
+#define BOT_N         0x00002000        /* n  unused                     */
+#define BOT_O         0x00004000        /* o  unused                     */
+#define BOT_PASSIVE   0x00008000        /* p  share passively with this
+                                         * bot                   */
+#define BOT_Q         0x00010000        /* q  unused */
+#define BOT_REJECT    0x00020000        /* r  automatically reject
+                                         * anywhere                      */
+#define BOT_AGGRESSIVE 0x00040000       /* s  bot shares user files      */
+#define BOT_T         0x00080000        /* t  unused                     */
+#define BOT_U         0x00100000        /* u  unused                     */
+#define BOT_V         0x00200000        /* v  unused                     */
+#define BOT_W         0x00400000        /* w  unused                     */
+#define BOT_X         0x00800000        /* x  unused                     */
+#define BOT_Y         0x01000000        /* y  unused                     */
+#define BOT_Z         0x02000000        /* z  unused                     */
+#define BOT_FLAG0     0x00200000        /* 0  user-defined flag #0       */
+#define BOT_FLAG1     0x00400000        /* 1  user-defined flag #1       */
+#define BOT_FLAG2     0x00800000        /* 2  user-defined flag #2       */
+#define BOT_FLAG3     0x01000000        /* 3  user-defined flag #3       */
+#define BOT_FLAG4     0x02000000        /* 4  user-defined flag #4       */
+#define BOT_FLAG5     0x04000000        /* 5  user-defined flag #5       */
+#define BOT_FLAG6     0x08000000        /* 6  user-defined flag #6       */
+#define BOT_FLAG7     0x10000000        /* 7  user-defined flag #7       */
+#define BOT_FLAG8     0x20000000        /* 8  user-defined flag #8       */
+#define BOT_FLAG9     0x40000000        /* 9  user-defined flag #9       */
 
 #define BOT_SHARE    (BOT_AGGRESSIVE|BOT_PASSIVE)
 
@@ -195,6 +195,6 @@
 int chan_sanity_check(int, int);
 char geticon(int);
 
-#endif				/* MAKING_MODS */
+#endif /* MAKING_MODS */
 
-#endif				/* _EGG_FLAGS_H */
+#endif /* _EGG_FLAGS_H */
Index: eggdrop1.6/src/lang.h
diff -u eggdrop1.6/src/lang.h:1.28 eggdrop1.6/src/lang.h:1.29
--- eggdrop1.6/src/lang.h:1.28	Mon Dec 23 20:30:04 2002
+++ eggdrop1.6/src/lang.h	Tue Jan 28 00:37:24 2003
@@ -2,7 +2,7 @@
  * lang.h
  *   Conversion definitions for language support
  *
- * $Id: lang.h,v 1.28 2002/12/24 02:30:04 wcc Exp $
+ * $Id: lang.h,v 1.29 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -507,4 +507,4 @@
 #define DCC_MYBOTNETNICK	get_language(0xe32)
 #define DCC_LOSTDUP		get_language(0xe33)
 
-#endif				/* _EGG_LANG_H */
+#endif /* _EGG_LANG_H */
Index: eggdrop1.6/src/language.c
diff -u eggdrop1.6/src/language.c:1.19 eggdrop1.6/src/language.c:1.20
--- eggdrop1.6/src/language.c:1.19	Wed Jan 22 20:13:29 2003
+++ eggdrop1.6/src/language.c	Tue Jan 28 00:37:24 2003
@@ -2,7 +2,7 @@
  * language.c -- handles:
  *   language support code
  *
- * $Id: language.c,v 1.19 2003/01/23 02:13:29 wcc Exp $
+ * $Id: language.c,v 1.20 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -65,7 +65,7 @@
 
 #include "main.h"
 
-extern struct dcc_t	*dcc;
+extern struct dcc_t *dcc;
 
 
 typedef struct lang_st {
@@ -85,9 +85,9 @@
   struct lang_t *next;
 } lang_tab;
 
-static lang_tab	*langtab[64];
-static lang_sec	*langsection = NULL;
-static lang_pri	*langpriority = NULL;
+static lang_tab *langtab[64];
+static lang_sec *langsection = NULL;
+static lang_pri *langpriority = NULL;
 
 static int del_lang(char *);
 static int add_message(int, char *);
@@ -114,7 +114,7 @@
     if (!strcmp(lang, lp->lang)) {
       /* Already at the front? */
       if (!lpo)
-	return;
+        return;
       lpo->next = lp->next;
       lp->next = lpo;
       langpriority = lp;
@@ -147,7 +147,7 @@
     /* Found the language? */
     if (!strcmp(lang, lp->lang)) {
       if (lpo)
-	lpo->next = lp->next;
+        lpo->next = lp->next;
       else
         langpriority = lp->next;
       if (lp->lang)
@@ -181,7 +181,8 @@
   if (l) {
     l->next = nmalloc(sizeof(lang_tab));
     l = l->next;
-  } else
+  }
+  else
     l = langtab[lidx & 63] = nmalloc(sizeof(lang_tab));
   l->idx = lidx;
   l->text = nmalloc(strlen(ltext) + 1);
@@ -199,13 +200,13 @@
   char *langfile;
 
   for (ls = langsection; ls && ls->section; ls = ls->next) {
-      langfile = get_langfile(ls);
-      /* Found a language with a more preferred language? */
-      if (langfile) {
-        read_lang(langfile);
-        nfree(langfile);
-      }
+    langfile = get_langfile(ls);
+    /* Found a language with a more preferred language? */
+    if (langfile) {
+      read_lang(langfile);
+      nfree(langfile);
     }
+  }
 }
 
 /* Parse a language file
@@ -225,7 +226,7 @@
   FLANG = fopen(langfile, "r");
   if (FLANG == NULL) {
     putlog(LOG_MISC, "*", "LANG: unexpected: reading from file %s failed.",
-	   langfile);
+           langfile);
     return;
   }
 
@@ -236,61 +237,66 @@
       ltext = nrealloc(ltext, 512);
       if (sscanf(lbuf, "%s", ltext) != EOF) {
 #ifdef LIBSAFE_HACKS
-	if (sscanf(lbuf, "0x%x,%500c", &lidx, ltext) != 1) {
+        if (sscanf(lbuf, "0x%x,%500c", &lidx, ltext) != 1) {
 #else
-	if (sscanf(lbuf, "0x%x,%500c", &lidx, ltext) != 2) {
+        if (sscanf(lbuf, "0x%x,%500c", &lidx, ltext) != 2) {
 #endif
-	  putlog(LOG_MISC, "*", "Malformed text line in %s at %d.",
-		 langfile, lline);
-	} else {
-	  ltexts++;
-	  ctmp = strchr(ltext, '\n');
-	  *ctmp = 0;
-	  while (ltext[strlen(ltext) - 1] == '\\') {
-	    ltext[strlen(ltext) - 1] = 0;
-	    if (fgets(lbuf, 511, FLANG)) {
-	      lline++;
-	      ctmp = strchr(lbuf, '\n');
-	      *ctmp = 0;
-	      ltext = nrealloc(ltext, strlen(lbuf) + strlen(ltext) + 1);
-	      strcpy(strchr(ltext, 0), lbuf);
-	    }
-	  }
-	}
-	/* We gotta fix \n's here as, being arguments to sprintf(),
-	 * they won't get translated.
-	 */
-	ctmp = ltext;
-	ctmp1 = ltext;
-	while (*ctmp1) {
-	  if ((*ctmp1 == '\\') && (*(ctmp1 + 1) == 'n')) {
-	    *ctmp = '\n';
-	    ctmp1++;
-	  } else if ((*ctmp1 == '\\') && (*(ctmp1 + 1) == 't')) {
-	    *ctmp = '\t';
-	    ctmp1++;
-	  } else
-	    *ctmp = *ctmp1;
-	  ctmp++;
-	  ctmp1++;
-	}
-	*ctmp = '\0';
-	if (add_message(lidx, ltext)) {
-	  lupdate++;
-	} else
-	  ladd++;
+          putlog(LOG_MISC, "*", "Malformed text line in %s at %d.",
+                 langfile, lline);
+        }
+        else {
+          ltexts++;
+          ctmp = strchr(ltext, '\n');
+          *ctmp = 0;
+          while (ltext[strlen(ltext) - 1] == '\\') {
+            ltext[strlen(ltext) - 1] = 0;
+            if (fgets(lbuf, 511, FLANG)) {
+              lline++;
+              ctmp = strchr(lbuf, '\n');
+              *ctmp = 0;
+              ltext = nrealloc(ltext, strlen(lbuf) + strlen(ltext) + 1);
+              strcpy(strchr(ltext, 0), lbuf);
+            }
+          }
+        }
+        /* We gotta fix \n's here as, being arguments to sprintf(),
+         * they won't get translated.
+         */
+        ctmp = ltext;
+        ctmp1 = ltext;
+        while (*ctmp1) {
+          if ((*ctmp1 == '\\') && (*(ctmp1 + 1) == 'n')) {
+            *ctmp = '\n';
+            ctmp1++;
+          }
+          else if ((*ctmp1 == '\\') && (*(ctmp1 + 1) == 't')) {
+            *ctmp = '\t';
+            ctmp1++;
+          }
+          else
+            *ctmp = *ctmp1;
+          ctmp++;
+          ctmp1++;
+        }
+        *ctmp = '\0';
+        if (add_message(lidx, ltext)) {
+          lupdate++;
+        }
+        else
+          ladd++;
       }
-    } else {
+    }
+    else {
       ctmp = strchr(lbuf, '\n');
       if (lskip && (strlen(lbuf) == 1 || *(ctmp - 1) != '\\'))
-	lskip = 0;
+        lskip = 0;
     }
   }
   nfree(ltext);
   fclose(FLANG);
 
   debug3("LANG: %d messages of %d lines loaded from %s", ltexts, lline,
-	 langfile);
+         langfile);
   debug2("LANG: %d adds, %d updates to message table", ladd, lupdate);
 }
 
@@ -311,9 +317,9 @@
  */
 void add_lang_section(char *section)
 {
-  char		*langfile = NULL;
-  lang_sec	*ls, *ols = NULL;
-  int		 ok = 0;
+  char *langfile = NULL;
+  lang_sec *ls, *ols = NULL;
+  int ok = 0;
 
   for (ls = langsection; ls; ols = ls, ls = ls->next)
     /* Already know of that section? */
@@ -346,7 +352,7 @@
   if (!langfile) {
     if (!ok)
       putlog(LOG_MISC, "*", "LANG: No lang files found for section %s.",
-	     section);
+             section);
     return;
   }
   read_lang(langfile);
@@ -360,12 +366,12 @@
   for (ls = langsection, ols = NULL; ls; ols = ls, ls = ls->next)
     if (ls->section && !strcmp(ls->section, section)) {
       if (ols)
-	ols->next = ls->next;
+        ols->next = ls->next;
       else
-	langsection = ls->next;
+        langsection = ls->next;
       nfree(ls->section);
       if (ls->lang)
-	nfree(ls->lang);
+        nfree(ls->lang);
       nfree(ls);
       debug1("LANG: Section unloaded: %s", section);
       return 1;
@@ -380,7 +386,8 @@
 
   if (!ldir)
     ldir = LANGDIR;
-  langfile = nmalloc(strlen(ldir) + strlen(sec->section) + strlen(language)+8);
+  langfile = nmalloc(strlen(ldir) + strlen(sec->section) + strlen(language) +
+             8);
   sprintf(langfile, "%s/%s.%s.lang", ldir, sec->section, language);
 
   if (file_readable(langfile)) {
@@ -456,7 +463,7 @@
   }
   if (idx != DP_LOG)
     putlog(LOG_CMDS, "*", "#%s# language %s", dcc[idx].nick, par);
-  buf = nmalloc(strlen(par)+1);
+  buf = nmalloc(strlen(par) + 1);
   strcpy(buf, par);
   if (!split_lang(buf, &lang, &section)) {
     nfree(buf);
@@ -579,14 +586,14 @@
   for (ls = langsection; ls; ls = ls->next) {
     size += sizeof(lang_sec);
     if (ls->section)
-      size += strlen(ls->section)+1;
+      size += strlen(ls->section) + 1;
     if (ls->lang)
-      size += strlen(ls->lang)+1;
+      size += strlen(ls->lang) + 1;
   }
   for (lp = langpriority; lp; lp = lp->next) {
     size += sizeof(lang_pri);
     if (lp->lang)
-      size += strlen(lp->lang)+1;
+      size += strlen(lp->lang) + 1;
   }
   return size;
 }
@@ -618,12 +625,12 @@
   dprintf(idx, "   Table size   : %d bytes\n", expmem_language());
   dprintf(idx, "   Text messages: %d\n", ltexts);
   dprintf(idx, "   %d used, %d unused, maxdepth %d, avg %f\n",
-	  used, empty, maxdepth, (float) ltexts / 64.0);
+          used, empty, maxdepth, (float) ltexts / 64.0);
   if (lp) {
     int c = 0;
 
     dprintf(idx, "   Supported languages:");
-    for (; lp; lp = lp->next) {  
+    for (; lp; lp = lp->next) {
       dprintf(idx, "%s %s", c ? "," : "", lp->lang);
       c = 1;
     }
@@ -634,7 +641,7 @@
     dprintf(idx, "   ==============================\n");
     for (; ls; ls = ls->next)
       dprintf(idx, "   %-20s %s\n", ls->section,
-	      ls->lang ? ls->lang : "<none>");
+              ls->lang ? ls->lang : "<none>");
   }
   return 0;
 }
@@ -645,17 +652,20 @@
 {
   char *lang, *section, *buf;
 
-  putlog(LOG_MISC, "*", "The Tcl command 'language' is obsolete. Use 'addlang' instead.");
+  putlog(LOG_MISC, "*",
+         "The Tcl command 'language' is obsolete. Use 'addlang' instead.");
   BADARGS(2, 2, " language");
 
-  buf = nmalloc(strlen(argv[1])+1);
+  buf = nmalloc(strlen(argv[1]) + 1);
   strcpy(buf, argv[1]);
+  
   if (!split_lang(buf, &lang, &section)) {
     Tcl_AppendResult(irp, "Invalid parameter", NULL);
     nfree(buf);
     return TCL_ERROR;
   }
   add_lang(lang);
+
   add_lang_section(section);
   nfree(buf);
   recheck_lang_sections();
@@ -710,28 +720,26 @@
   return TCL_OK;
 }
 
-static cmd_t langdcc[] =
-{
-  {"language",	"n",	cmd_loadlanguage,	NULL},
-  {"+lang",	"n",	cmd_plslang,		NULL},
-  {"-lang",	"n",	cmd_mnslang,		NULL},
-  {"+lsec",	"n",	cmd_plslsec,		NULL},
-  {"-lsec",	"n",	cmd_mnslsec,		NULL},
-  {"ldump",	"n",	cmd_languagedump,	NULL},
-  {"lstat",	"n",	cmd_languagestatus,	NULL},
-  {"relang",	"n",	cmd_relang,		NULL},
-  {NULL,	NULL,	NULL,			NULL}
+static cmd_t langdcc[] = {
+  {"language", "n",  cmd_loadlanguage,   NULL},
+  {"+lang",    "n",  cmd_plslang,        NULL},
+  {"-lang",    "n",  cmd_mnslang,        NULL},
+  {"+lsec",    "n",  cmd_plslsec,        NULL},
+  {"-lsec",    "n",  cmd_mnslsec,        NULL},
+  {"ldump",    "n",  cmd_languagedump,   NULL},
+  {"lstat",    "n",  cmd_languagestatus, NULL},
+  {"relang",   "n",  cmd_relang,         NULL},
+  {NULL,       NULL, NULL,               NULL}
 };
 
-static tcl_cmds langtcls[] =
-{
-  {"language",		tcl_language},
-  {"addlang",		tcl_plslang},
-  {"dellang",		tcl_mnslang},
-  {"addlangsection",	tcl_addlangsection},
-  {"dellangsection",	tcl_dellangsection},
-  {"relang",		tcl_relang},
-  {NULL,		NULL}
+static tcl_cmds langtcls[] = {
+  {"language",             tcl_language},
+  {"addlang",               tcl_plslang},
+  {"dellang",               tcl_mnslang},
+  {"addlangsection", tcl_addlangsection},
+  {"dellangsection", tcl_dellangsection},
+  {"relang",                 tcl_relang},
+  {NULL,                           NULL}
 };
 
 void init_language(int flag)
@@ -751,7 +759,8 @@
     if (deflang)
       add_lang(deflang);
     add_lang_section("core");
-  } else {
+  }
+  else {
     add_tcl_commands(langtcls);
     add_builtins(H_dcc, langdcc);
   }
Index: eggdrop1.6/src/main.c
diff -u eggdrop1.6/src/main.c:1.92 eggdrop1.6/src/main.c:1.93
--- eggdrop1.6/src/main.c:1.92	Wed Jan 22 20:41:48 2003
+++ eggdrop1.6/src/main.c	Tue Jan 28 00:37:24 2003
@@ -5,7 +5,7 @@
  *   command line arguments
  *   context and assert debugging
  *
- * $Id: main.c,v 1.92 2003/01/23 02:41:48 wcc Exp $
+ * $Id: main.c,v 1.93 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -48,9 +48,9 @@
 #include <netdb.h>
 #include <setjmp.h>
 
-#ifdef STOP_UAC				/* osf/1 complains a lot */
+#ifdef STOP_UAC                 /* osf/1 complains a lot */
 #include <sys/sysinfo.h>
-#define UAC_NOPRINT    0x00000001	/* Don't report unaligned fixups */
+#define UAC_NOPRINT    0x00000001       /* Don't report unaligned fixups */
 #endif
 /* Some systems have a working sys/wait.h even though configure will
  * decide it's not bsd compatable.  Oh well.
@@ -70,17 +70,15 @@
 #define _POSIX_SOURCE 1
 #endif
 
-extern char		 origbotname[], userfile[], botnetnick[];
-extern int		 dcc_total, conmask, cache_hit, cache_miss,
-			 max_logs, quick_logs;
-extern struct dcc_t	*dcc;
-extern struct userrec	*userlist;
-extern struct chanset_t	*chanset;
-extern log_t		*logs;
-extern Tcl_Interp	*interp;
-extern tcl_timer_t	*timer,
-			*utimer;
-extern jmp_buf		 alarmret;
+extern char origbotname[], userfile[], botnetnick[];
+extern int dcc_total, conmask, cache_hit, cache_miss, max_logs, quick_logs;
+extern struct dcc_t *dcc;
+extern struct userrec *userlist;
+extern struct chanset_t *chanset;
+extern log_t *logs;
+extern Tcl_Interp *interp;
+extern tcl_timer_t *timer, *utimer;
+extern jmp_buf alarmret;
 
 
 /*
@@ -90,78 +88,78 @@
  * modified versions of this bot.
  */
 
-char	egg_version[1024] = "1.6.14";
-int	egg_numver = 1061400;
+char egg_version[1024] = "1.6.14";
+int egg_numver = 1061400;
 
-char	notify_new[121] = "";	/* Person to send a note to for new users */
-int	default_flags = 0;	/* Default user flags and */
-int	default_uflags = 0;	/* Default userdefinied flags for people
-				   who say 'hello' or for .adduser */
-
-int	backgrd = 1;		/* Run in the background? */
-int	con_chan = 0;		/* Foreground: constantly display channel
-				   stats? */
-int	term_z = 0;		/* Foreground: use the terminal as a party
-				   line? */
-char	configfile[121] = "eggdrop.conf"; /* Name of the config file */
-char	helpdir[121] = "help/";	/* Directory of help files (if used) */
-char	textdir[121] = "text/";	/* Directory for text files that get dumped */
-int	keep_all_logs = 0;	/* Never erase logfiles, no matter how old
-				   they are? */
-char	logfile_suffix[21] = ".%d%b%Y"; /* Format of logfile suffix. */
-time_t	online_since;		/* Unix-time that the bot loaded up */
-int	make_userfile = 0;	/* Using bot in make-userfile mode? (first
-				   user to 'hello' becomes master) */
-char	owner[121] = "";	/* Permanent owner(s) of the bot */
-char	pid_file[120];		/* Name of the file for the pid to be
-				   stored in */
-int	save_users_at = 0;	/* How many minutes past the hour to
-				   save the userfile? */
-int	notify_users_at = 0;	/* How many minutes past the hour to
-				   notify users of notes? */
-int	switch_logfiles_at = 300; /* When (military time) to switch logfiles */
-char	version[81];		/* Version info (long form) */
-char	ver[41];		/* Version info (short form) */
-char	egg_xtra[2048];		/* Patch info */
-int	use_stderr = 1;		/* Send stuff to stderr instead of logfiles? */
-int	do_restart = 0;		/* .restart has been called, restart asap */
-int	die_on_sighup = 0;	/* die if bot receives SIGHUP */
-int	die_on_sigterm = 1;	/* die if bot receives SIGTERM */
-int	resolve_timeout = 15;	/* hostname/address lookup timeout */
-char	quit_msg[1024];		/* quit message */
-time_t	now;			/* duh, now :) */
+char notify_new[121] = "";      /* Person to send a note to for new users */
+int default_flags = 0;          /* Default user flags and */
+int default_uflags = 0;         /* Default userdefinied flags for people
+                                 * who say 'hello' or for .adduser */
+
+int backgrd = 1;                /* Run in the background? */
+int con_chan = 0;               /* Foreground: constantly display channel
+                                 * stats? */
+int term_z = 0;                 /* Foreground: use the terminal as a party
+                                 * line? */
+char configfile[121] = "eggdrop.conf";  /* Name of the config file */
+char helpdir[121] = "help/";    /* Directory of help files (if used) */
+char textdir[121] = "text/";    /* Directory for text files that get dumped */
+int keep_all_logs = 0;          /* Never erase logfiles, no matter how old
+                                 * they are? */
+char logfile_suffix[21] = ".%d%b%Y";    /* Format of logfile suffix. */
+time_t online_since;            /* Unix-time that the bot loaded up */
+int make_userfile = 0;          /* Using bot in make-userfile mode? (first
+                                 * user to 'hello' becomes master) */
+char owner[121] = "";           /* Permanent owner(s) of the bot */
+char pid_file[120];             /* Name of the file for the pid to be
+                                 * stored in */
+int save_users_at = 0;          /* How many minutes past the hour to
+                                 * save the userfile? */
+int notify_users_at = 0;        /* How many minutes past the hour to
+                                 * notify users of notes? */
+int switch_logfiles_at = 300;   /* When (military time) to switch logfiles */
+char version[81];               /* Version info (long form) */
+char ver[41];                   /* Version info (short form) */
+char egg_xtra[2048];            /* Patch info */
+int use_stderr = 1;             /* Send stuff to stderr instead of logfiles? */
+int do_restart = 0;             /* .restart has been called, restart asap */
+int die_on_sighup = 0;          /* die if bot receives SIGHUP */
+int die_on_sigterm = 1;         /* die if bot receives SIGTERM */
+int resolve_timeout = 15;       /* hostname/address lookup timeout */
+char quit_msg[1024];            /* quit message */
+time_t now;                     /* duh, now :) */
 
 /* Traffic stats
  */
-unsigned long	otraffic_irc = 0;
-unsigned long	otraffic_irc_today = 0;
-unsigned long	otraffic_bn = 0;
-unsigned long	otraffic_bn_today = 0;
-unsigned long	otraffic_dcc = 0;
-unsigned long	otraffic_dcc_today = 0;
-unsigned long	otraffic_filesys = 0;
-unsigned long	otraffic_filesys_today = 0;
-unsigned long	otraffic_trans = 0;
-unsigned long	otraffic_trans_today = 0;
-unsigned long	otraffic_unknown = 0;
-unsigned long	otraffic_unknown_today = 0;
-unsigned long	itraffic_irc = 0;
-unsigned long	itraffic_irc_today = 0;
-unsigned long	itraffic_bn = 0;
-unsigned long	itraffic_bn_today = 0;
-unsigned long	itraffic_dcc = 0;
-unsigned long	itraffic_dcc_today = 0;
-unsigned long	itraffic_trans = 0;
-unsigned long	itraffic_trans_today = 0;
-unsigned long	itraffic_unknown = 0;
-unsigned long	itraffic_unknown_today = 0;
+unsigned long otraffic_irc = 0;
+unsigned long otraffic_irc_today = 0;
+unsigned long otraffic_bn = 0;
+unsigned long otraffic_bn_today = 0;
+unsigned long otraffic_dcc = 0;
+unsigned long otraffic_dcc_today = 0;
+unsigned long otraffic_filesys = 0;
+unsigned long otraffic_filesys_today = 0;
+unsigned long otraffic_trans = 0;
+unsigned long otraffic_trans_today = 0;
+unsigned long otraffic_unknown = 0;
+unsigned long otraffic_unknown_today = 0;
+unsigned long itraffic_irc = 0;
+unsigned long itraffic_irc_today = 0;
+unsigned long itraffic_bn = 0;
+unsigned long itraffic_bn_today = 0;
+unsigned long itraffic_dcc = 0;
+unsigned long itraffic_dcc_today = 0;
+unsigned long itraffic_trans = 0;
+unsigned long itraffic_trans_today = 0;
+unsigned long itraffic_unknown = 0;
+unsigned long itraffic_unknown_today = 0;
 
 #ifdef DEBUG_CONTEXT
 /* Context storage for fatal crashes */
-char	cx_file[16][30];
-char	cx_note[16][256];
-int	cx_line[16];
-int	cx_ptr = 0;
+char cx_file[16][30];
+char cx_note[16][256];
+int cx_line[16];
+int cx_ptr = 0;
 #endif
 
 
@@ -182,10 +180,18 @@
 }
 
 
-int expmem_chanprog(), expmem_users(), expmem_misc(), expmem_dccutil(),
- expmem_botnet(), expmem_tcl(), expmem_tclhash(), expmem_net(),
- expmem_modules(int), expmem_language(), expmem_tcldcc(),
- expmem_tclmisc();
+int expmem_chanprog();
+int expmem_users();
+int expmem_misc();
+int expmem_dccutil();
+int expmem_botnet();
+int expmem_tcl();
+int expmem_tclhash();
+int expmem_net();
+int expmem_modules(int);
+int expmem_language();
+int expmem_tcldcc();
+int expmem_tclmisc();
 
 /* For mem.c : calculate memory we SHOULD be using
  */
@@ -193,10 +199,10 @@
 {
   int tot;
 
-  tot = expmem_chanprog() + expmem_users() + expmem_misc() +
-    expmem_dccutil() + expmem_botnet() + expmem_tcl() + expmem_tclhash() +
-    expmem_net() + expmem_modules(0) + expmem_language() + expmem_tcldcc() +
-    expmem_tclmisc();
+  tot = expmem_chanprog() + expmem_users() + expmem_misc() + expmem_dccutil() +
+        expmem_botnet() + expmem_tcl() + expmem_tclhash() + expmem_net() +
+        expmem_modules(0) + expmem_language() + expmem_tcldcc() +
+        expmem_tclmisc();
   return tot;
 }
 
@@ -206,20 +212,20 @@
 
   for (i = 0; i < dcc_total; i++)
     if (dcc[i].type && dcc[i].type->timeout_val &&
-	((now - dcc[i].timeval) > *(dcc[i].type->timeout_val))) {
+        ((now - dcc[i].timeval) > *(dcc[i].type->timeout_val))) {
       if (dcc[i].type->timeout)
-	dcc[i].type->timeout(i);
+        dcc[i].type->timeout(i);
       else if (dcc[i].type->eof)
-	dcc[i].type->eof(i);
+        dcc[i].type->eof(i);
       else
-	continue;
+        continue;
       /* Only timeout 1 socket per cycle, too risky for more */
       return;
     }
 }
 
 #ifdef DEBUG_CONTEXT
-static int	nested_debug = 0;
+static int nested_debug = 0;
 
 void write_debug()
 {
@@ -245,25 +251,27 @@
       dprintf(-x, "Context: ");
       cx_ptr = cx_ptr & 15;
       for (y = ((cx_ptr + 1) & 15); y != cx_ptr; y = ((y + 1) & 15))
-	dprintf(-x, "%s/%d,\n         ", cx_file[y], cx_line[y]);
+        dprintf(-x, "%s/%d,\n         ", cx_file[y], cx_line[y]);
       dprintf(-x, "%s/%d\n\n", cx_file[y], cx_line[y]);
       killsock(x);
       close(x);
     }
     bg_send_quit(BG_ABORT);
-    exit(1);			/* Dont even try & tell people about, that may
-				   have caused the fault last time. */
-  } else
+    exit(1);                    /* Dont even try & tell people about, that may
+                                 * have caused the fault last time. */
+  }
+  else
     nested_debug = 1;
   putlog(LOG_MISC, "*", "* Last context: %s/%d [%s]", cx_file[cx_ptr],
-	 cx_line[cx_ptr], cx_note[cx_ptr][0] ? cx_note[cx_ptr] : "");
+         cx_line[cx_ptr], cx_note[cx_ptr][0] ? cx_note[cx_ptr] : "");
   putlog(LOG_MISC, "*", "* Please REPORT this BUG!");
   putlog(LOG_MISC, "*", "* Check doc/BUG-REPORT on how to do so.");
   x = creat("DEBUG", 0644);
   setsock(x, SOCK_NONSOCK);
   if (x < 0) {
     putlog(LOG_MISC, "*", "* Failed to write DEBUG");
-  } else {
+  }
+  else {
     strncpyz(s, ctime(&now), sizeof s);
     dprintf(-x, "Debug (%s) written %s\n", ver, s);
     dprintf(-x, "Full Patch List: %s\n", egg_xtra);
@@ -273,15 +281,15 @@
 
     /* info library */
     dprintf(-x, "Tcl library: %s\n",
-	    ((interp) && (Tcl_Eval(interp, "info library") == TCL_OK)) ?
-	    interp->result : "*unknown*");
+            ((interp) && (Tcl_Eval(interp, "info library") == TCL_OK)) ?
+            interp->result : "*unknown*");
 
     /* info tclversion/patchlevel */
     dprintf(-x, "Tcl version: %s (header version %s)\n",
-	    ((interp) && (Tcl_Eval(interp, "info patchlevel") == TCL_OK)) ?
-     interp->result : (Tcl_Eval(interp, "info tclversion") == TCL_OK) ?
-     interp->result : "*unknown*", TCL_PATCH_LEVEL ? TCL_PATCH_LEVEL :
-     "*unknown*");
+            ((interp) && (Tcl_Eval(interp, "info patchlevel") == TCL_OK)) ?
+            interp->result : (Tcl_Eval(interp, "info tclversion") == TCL_OK) ?
+            interp->result : "*unknown*", TCL_PATCH_LEVEL ? TCL_PATCH_LEVEL :
+            "*unknown*");
 
 #if HAVE_TCL_THREADS
     dprintf(-x, "Tcl is threaded\n");
@@ -301,9 +309,9 @@
     cx_ptr = cx_ptr & 15;
     for (y = ((cx_ptr + 1) & 15); y != cx_ptr; y = ((y + 1) & 15))
       dprintf(-x, "%s/%d, [%s]\n         ", cx_file[y], cx_line[y],
-	      (cx_note[y][0]) ? cx_note[y] : "");
+              (cx_note[y][0]) ? cx_note[y] : "");
     dprintf(-x, "%s/%d [%s]\n\n", cx_file[cx_ptr], cx_line[cx_ptr],
-	    (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : "");
+            (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : "");
     tell_dcc(-x);
     dprintf(-x, "\n");
     debug_mem_to_dcc(-x);
@@ -357,9 +365,9 @@
   if (die_on_sigterm) {
     botnet_send_chat(-1, botnetnick, "ACK, I've been terminated!");
     fatal("TERMINATE SIGNAL -- SIGNING OFF", 0);
-  } else {
-    putlog(LOG_MISC, "*", "RECEIVED TERMINATE SIGNAL (IGNORING)");
   }
+  else
+    putlog(LOG_MISC, "*", "RECEIVED TERMINATE SIGNAL (IGNORING)");
 }
 
 static void got_quit(int z)
@@ -375,7 +383,8 @@
   check_tcl_event("sighup");
   if (die_on_sighup) {
     fatal("HANGUP SIGNAL -- SIGNING OFF", 0);
-  } else
+  }
+  else
     putlog(LOG_MISC, "*", "Received HUP signal: rehashing...");
   do_restart = -2;
   return;
@@ -397,7 +406,7 @@
   check_tcl_event("sigill");
 #ifdef DEBUG_CONTEXT
   putlog(LOG_MISC, "*", "* Context: %s/%d [%s]", cx_file[cx_ptr],
-	 cx_line[cx_ptr], (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : "");
+         cx_line[cx_ptr], (cx_note[cx_ptr][0]) ? cx_note[cx_ptr] : "");
 #endif
 }
 
@@ -410,7 +419,8 @@
   p = strrchr(file, '/');
   if (!module) {
     strncpyz(x, p ? p + 1 : file, sizeof x);
-  } else
+  }
+  else
     egg_snprintf(x, 31, "%s:%s", module, p ? p + 1 : file);
   cx_ptr = ((cx_ptr + 1) & 15);
   strcpy(cx_file[cx_ptr], x);
@@ -421,14 +431,15 @@
 /* Called from the ContextNote macro.
  */
 void eggContextNote(const char *file, int line, const char *module,
-		    const char *note)
+                    const char *note)
 {
   char x[31], *p;
 
   p = strrchr(file, '/');
   if (!module) {
     strncpyz(x, p ? p + 1 : file, sizeof x);
-  } else
+  }
+  else
     egg_snprintf(x, 31, "%s:%s", module, p ? p + 1 : file);
   cx_ptr = ((cx_ptr + 1) & 15);
   strcpy(cx_file[cx_ptr], x);
@@ -461,39 +472,40 @@
   if (s[0] == '-')
     for (i = 1; i < strlen(s); i++) {
       switch (s[i]) {
-	case 'n':
-	backgrd = 0;
-	  break;
-        case 'c':
-	con_chan = 1;
-	term_z = 0;
-	  break;
-	case 't':
-	con_chan = 0;
-	term_z = 1;
-	  break;
-	case 'm':
-	make_userfile = 1;
-	  break;
-	case 'v':
-	  strncpyz(x, egg_version, sizeof x);
-	newsplit(&z);
-	newsplit(&z);
-	printf("%s\n", version);
-	if (z[0])
-	  printf("  (patches: %s)\n", z);
-	bg_send_quit(BG_ABORT);
-	exit(0);
- 	  break; /* this should never be reached */
-	case 'h':
-	printf("\n%s\n\n", version);
-	printf(EGG_USAGE);
-	printf("\n");
-	bg_send_quit(BG_ABORT);
-	exit(0);
-	  break; /* this should never be reached */
+      case 'n':
+        backgrd = 0;
+        break;
+      case 'c':
+        con_chan = 1;
+        term_z = 0;
+        break;
+      case 't':
+        con_chan = 0;
+        term_z = 1;
+        break;
+      case 'm':
+        make_userfile = 1;
+        break;
+      case 'v':
+        strncpyz(x, egg_version, sizeof x);
+        newsplit(&z);
+        newsplit(&z);
+        printf("%s\n", version);
+        if (z[0])
+          printf("  (patches: %s)\n", z);
+        bg_send_quit(BG_ABORT);
+        exit(0);
+        break;                  /* this should never be reached */
+      case 'h':
+        printf("\n%s\n\n", version);
+        printf(EGG_USAGE);
+        printf("\n");
+        bg_send_quit(BG_ABORT);
+        exit(0);
+        break;                  /* this should never be reached */
       }
-  } else
+    }
+  else
     strncpyz(configfile, s, sizeof configfile);
 }
 
@@ -507,9 +519,9 @@
 }
 
 /* Timer info */
-static int		lastmin = 99;
-static time_t		then;
-static struct tm	nowtm;
+static int lastmin = 99;
+static time_t then;
+static struct tm nowtm;
 
 /* Called once a second.
  *
@@ -520,9 +532,9 @@
   static int cnt = 0;
   int miltime;
 
-  do_check_timers(&utimer);	/* Secondly timers */
+  do_check_timers(&utimer);     /* Secondly timers */
   cnt++;
-  if (cnt >= 10) {		/* Every 10 seconds */
+  if (cnt >= 10) {              /* Every 10 seconds */
     cnt = 0;
     check_expired_dcc();
     if (con_chan && !backgrd) {
@@ -541,7 +553,7 @@
     lastmin = (lastmin + 1) % 60;
     call_hook(HOOK_MINUTELY);
     check_expired_ignores();
-    autolink_cycle(NULL);	/* Attempt autolinks */
+    autolink_cycle(NULL);       /* Attempt autolinks */
     /* In case for some reason more than 1 min has passed: */
     while (nowtm.tm_min != lastmin) {
       /* Timer drift, dammit */
@@ -553,26 +565,26 @@
     if (i > 1)
       putlog(LOG_MISC, "*", "(!) timer drift -- spun %d minutes", i);
     miltime = (nowtm.tm_hour * 100) + (nowtm.tm_min);
-    if (((int) (nowtm.tm_min / 5) * 5) == (nowtm.tm_min)) {	/* 5 min */
+    if (((int) (nowtm.tm_min / 5) * 5) == (nowtm.tm_min)) {     /* 5 min */
       call_hook(HOOK_5MINUTELY);
       check_botnet_pings();
       if (!quick_logs) {
-	flushlogs();
-	check_logsize();
+        flushlogs();
+        check_logsize();
       }
-      if (!miltime) {	/* At midnight */
-	char s[25];
-	int j;
-
-	strncpyz(s, ctime(&now), sizeof s);
-	putlog(LOG_ALL, "*", "--- %.11s%s", s, s + 20);
-	call_hook(HOOK_BACKUP);
-	for (j = 0; j < max_logs; j++) {
-	  if (logs[j].filename != NULL && logs[j].f != NULL) {
-	    fclose(logs[j].f);
-	    logs[j].f = NULL;
-	  }
-	}
+      if (!miltime) {           /* At midnight */
+        char s[25];
+        int j;
+
+        strncpyz(s, ctime(&now), sizeof s);
+        putlog(LOG_ALL, "*", "--- %.11s%s", s, s + 20);
+        call_hook(HOOK_BACKUP);
+        for (j = 0; j < max_logs; j++) {
+          if (logs[j].filename != NULL && logs[j].f != NULL) {
+            fclose(logs[j].f);
+            logs[j].f = NULL;
+          }
+        }
       }
     }
     if (nowtm.tm_min == notify_users_at)
@@ -583,19 +595,19 @@
     if (miltime == switch_logfiles_at) {
       call_hook(HOOK_DAILY);
       if (!keep_all_logs) {
-	putlog(LOG_MISC, "*", MISC_LOGSWITCH);
-	for (i = 0; i < max_logs; i++)
-	  if (logs[i].filename) {
-	    char s[1024];
-
-	    if (logs[i].f) {
-	      fclose(logs[i].f);
-	      logs[i].f = NULL;
-	    }
-	    egg_snprintf(s, sizeof s, "%s.yesterday", logs[i].filename);
-	    unlink(s);
-	    movefile(logs[i].filename, s);
-	  }
+        putlog(LOG_MISC, "*", MISC_LOGSWITCH);
+        for (i = 0; i < max_logs; i++)
+          if (logs[i].filename) {
+            char s[1024];
+
+            if (logs[i].f) {
+              fclose(logs[i].f);
+              logs[i].f = NULL;
+            }
+            egg_snprintf(s, sizeof s, "%s.yesterday", logs[i].filename);
+            unlink(s);
+            movefile(logs[i].filename, s);
+          }
       }
     }
   }
@@ -669,9 +681,15 @@
 
 #include "mod/static.h"
 #endif
-int init_mem(), init_dcc_max(), init_userent(), init_misc(), init_bots(),
- init_net(), init_modules(), init_tcl(int, char **),
- init_language(int);
+int init_mem();
+int init_dcc_max();
+int init_userent();
+int init_misc();
+int init_bots();
+int init_net();
+int init_modules();
+int init_tcl(int, char **);
+int init_language(int);
 
 void patch(const char *str)
 {
@@ -686,7 +704,7 @@
 
 static inline void garbage_collect(void)
 {
-  static u_8bit_t	run_cnt = 0;
+  static u_8bit_t run_cnt = 0;
 
   if (run_cnt == 3)
     garbage_collect_tclhash();
@@ -723,8 +741,9 @@
 #include "patch.h"
   /* Version info! */
   egg_snprintf(ver, sizeof ver, "eggdrop v%s", egg_version);
-  egg_snprintf(version, sizeof version, "Eggdrop v%s (C) 1997 Robey Pointer (C) 2003 Eggheads",
-	       egg_version);
+  egg_snprintf(version, sizeof version,
+               "Eggdrop v%s (C) 1997 Robey Pointer (C) 2003 Eggheads",
+               egg_version);
   /* Now add on the patchlevel (for Tcl) */
   sprintf(&egg_version[strlen(egg_version)], " %u", egg_numver);
   strcat(egg_version, egg_xtra);
@@ -810,19 +829,19 @@
   for (chan = chanset; chan; chan = chan->next)
     i++;
   putlog(LOG_MISC, "*", "=== %s: %d channels, %d users.",
-	 botnetnick, i, count_users(userlist));
+         botnetnick, i, count_users(userlist));
   cache_miss = 0;
   cache_hit = 0;
   if (!pid_file[0])
-  egg_snprintf(pid_file, sizeof pid_file, "pid.%s", botnetnick);
+    egg_snprintf(pid_file, sizeof pid_file, "pid.%s", botnetnick);
 
   /* Check for pre-existing eggdrop! */
   f = fopen(pid_file, "r");
   if (f != NULL) {
     fgets(s, 10, f);
     xx = atoi(s);
-    kill(xx, SIGCHLD);		/* Meaningless kill to determine if pid
-				   is used */
+    kill(xx, SIGCHLD);          /* Meaningless kill to determine if pid
+                                 * is used */
     if (errno != ESRCH) {
       printf(EGG_RUNNING1, botnetnick);
       printf(EGG_RUNNING2, pid_file);
@@ -835,7 +854,8 @@
   if (backgrd) {
 #ifndef CYGWIN_HACKS
     bg_do_split();
-  } else {			/* !backgrd */
+  }
+  else {                        /* !backgrd */
 #endif
     xx = getpid();
     if (xx != 0) {
@@ -847,13 +867,15 @@
       if (fp != NULL) {
         fprintf(fp, "%u\n", xx);
         if (fflush(fp)) {
-	  /* Let the bot live since this doesn't appear to be a botchk */
-	  printf(EGG_NOWRITE, pid_file);
-	  fclose(fp);
-	  unlink(pid_file);
-        } else
- 	  fclose(fp);
-      } else
+          /* Let the bot live since this doesn't appear to be a botchk */
+          printf(EGG_NOWRITE, pid_file);
+          fclose(fp);
+          unlink(pid_file);
+        }
+        else
+          fclose(fp);
+      }
+      else
         printf(EGG_NOWRITE, pid_file);
 #ifdef CYGWIN_HACKS
       printf("Launched into the background  (pid: %d)\n\n", xx);
@@ -861,7 +883,7 @@
     }
   }
 
-  use_stderr = 0;		/* Stop writing to stderr now */
+  use_stderr = 0;               /* Stop writing to stderr now */
   if (backgrd) {
     /* Ok, try to disassociate from controlling terminal (finger cross) */
 #if HAVE_SETPGID && !defined(CYGWIN_HACKS)
@@ -894,14 +916,14 @@
       userlist = adduser(userlist, "HQ", "none", "-", USER_PARTY);
       dcc[n].user = get_user_by_handle(userlist, "HQ");
     }
-    setsock(STDOUT, 0);		/* Entry in net table */
+    setsock(STDOUT, 0);         /* Entry in net table */
     dprintf(n, "\n### ENTERING DCC CHAT SIMULATION ###\n\n");
     dcc_chatter(n);
   }
 
   then = now;
   online_since = now;
-  autolink_cycle(NULL);		/* Hurry and connect to tandem bots */
+  autolink_cycle(NULL);         /* Hurry and connect to tandem bots */
   add_help_reference("cmds1.help");
   add_help_reference("cmds2.help");
   add_help_reference("core.help");
@@ -931,8 +953,8 @@
      * calls to periodic_timers
      */
     now = time(NULL);
-    random();			/* Woop, lets really jumble things */
-    if (now != then) {		/* Once a second */
+    random();                   /* Woop, lets really jumble things */
+    if (now != then) {          /* Once a second */
       call_hook(HOOK_SECONDLY);
       then = now;
     }
@@ -945,146 +967,151 @@
       dcc_remove_lost();
 
       /* Check for server or dcc activity. */
-      dequeue_sockets();		
-    } else
+      dequeue_sockets();
+    }
+    else
       socket_cleanup--;
 
     /* Free unused structures. */
     garbage_collect();
 
-    xx = sockgets(buf, &i); 
-    if (xx >= 0) {		/* Non-error */
+    xx = sockgets(buf, &i);
+    if (xx >= 0) {              /* Non-error */
       int idx;
 
       for (idx = 0; idx < dcc_total; idx++)
-	if (dcc[idx].sock == xx) {
-	  if (dcc[idx].type && dcc[idx].type->activity) {
-	    /* Traffic stats */
-	    if (dcc[idx].type->name) {
-	      if (!strncmp(dcc[idx].type->name, "BOT", 3))
-		itraffic_bn_today += strlen(buf) + 1;
-	      else if (!strcmp(dcc[idx].type->name, "SERVER"))
-		itraffic_irc_today += strlen(buf) + 1;
-	      else if (!strncmp(dcc[idx].type->name, "CHAT", 4))
-		itraffic_dcc_today += strlen(buf) + 1;
-	      else if (!strncmp(dcc[idx].type->name, "FILES", 5))
-		itraffic_dcc_today += strlen(buf) + 1;
-	      else if (!strcmp(dcc[idx].type->name, "SEND"))
-		itraffic_trans_today += strlen(buf) + 1;
-	      else if (!strncmp(dcc[idx].type->name, "GET", 3))
-		itraffic_trans_today += strlen(buf) + 1;
-	      else
-		itraffic_unknown_today += strlen(buf) + 1;
-	    }
-	    dcc[idx].type->activity(idx, buf, i);
-	  } else
-	    putlog(LOG_MISC, "*",
-		   "!!! untrapped dcc activity: type %s, sock %d",
-		   dcc[idx].type->name, dcc[idx].sock);
-	  break;
-	}
-    } else if (xx == -1) {	/* EOF from someone */
+        if (dcc[idx].sock == xx) {
+          if (dcc[idx].type && dcc[idx].type->activity) {
+            /* Traffic stats */
+            if (dcc[idx].type->name) {
+              if (!strncmp(dcc[idx].type->name, "BOT", 3))
+                itraffic_bn_today += strlen(buf) + 1;
+              else if (!strcmp(dcc[idx].type->name, "SERVER"))
+                itraffic_irc_today += strlen(buf) + 1;
+              else if (!strncmp(dcc[idx].type->name, "CHAT", 4))
+                itraffic_dcc_today += strlen(buf) + 1;
+              else if (!strncmp(dcc[idx].type->name, "FILES", 5))
+                itraffic_dcc_today += strlen(buf) + 1;
+              else if (!strcmp(dcc[idx].type->name, "SEND"))
+                itraffic_trans_today += strlen(buf) + 1;
+              else if (!strncmp(dcc[idx].type->name, "GET", 3))
+                itraffic_trans_today += strlen(buf) + 1;
+              else
+                itraffic_unknown_today += strlen(buf) + 1;
+            }
+            dcc[idx].type->activity(idx, buf, i);
+          }
+          else
+            putlog(LOG_MISC, "*",
+                   "!!! untrapped dcc activity: type %s, sock %d",
+                   dcc[idx].type->name, dcc[idx].sock);
+          break;
+        }
+    }
+    else if (xx == -1) {        /* EOF from someone */
       int idx;
 
       if (i == STDOUT && !backgrd)
-	fatal("END OF FILE ON TERMINAL", 0);
+        fatal("END OF FILE ON TERMINAL", 0);
       for (idx = 0; idx < dcc_total; idx++)
-	if (dcc[idx].sock == i) {
-	  if (dcc[idx].type && dcc[idx].type->eof)
-	    dcc[idx].type->eof(idx);
-	  else {
-	    putlog(LOG_MISC, "*",
-		   "*** ATTENTION: DEAD SOCKET (%d) OF TYPE %s UNTRAPPED",
-		   i, dcc[idx].type ? dcc[idx].type->name : "*UNKNOWN*");
-	    killsock(i);
-	    lostdcc(idx);
-	  }
-	  idx = dcc_total + 1;
-	}
+        if (dcc[idx].sock == i) {
+          if (dcc[idx].type && dcc[idx].type->eof)
+            dcc[idx].type->eof(idx);
+          else {
+            putlog(LOG_MISC, "*",
+                   "*** ATTENTION: DEAD SOCKET (%d) OF TYPE %s UNTRAPPED",
+                   i, dcc[idx].type ? dcc[idx].type->name : "*UNKNOWN*");
+            killsock(i);
+            lostdcc(idx);
+          }
+          idx = dcc_total + 1;
+        }
       if (idx == dcc_total) {
-	putlog(LOG_MISC, "*",
-	       "(@) EOF socket %d, not a dcc socket, not anything.", i);
-	close(i);
-	killsock(i);
+        putlog(LOG_MISC, "*",
+               "(@) EOF socket %d, not a dcc socket, not anything.", i);
+        close(i);
+        killsock(i);
       }
-    } else if (xx == -2 && errno != EINTR) {	/* select() error */
+    }
+    else if (xx == -2 && errno != EINTR) {      /* select() error */
       putlog(LOG_MISC, "*", "* Socket error #%d; recovering.", errno);
       for (i = 0; i < dcc_total; i++) {
-	if ((fcntl(dcc[i].sock, F_GETFD, 0) == -1) && (errno == EBADF)) {
-	  putlog(LOG_MISC, "*",
-		 "DCC socket %d (type %d, name '%s') expired -- pfft",
-		 dcc[i].sock, dcc[i].type, dcc[i].nick);
-	  killsock(dcc[i].sock);
-	  lostdcc(i);
-	  i--;
-	}
+        if ((fcntl(dcc[i].sock, F_GETFD, 0) == -1) && (errno == EBADF)) {
+          putlog(LOG_MISC, "*",
+                 "DCC socket %d (type %d, name '%s') expired -- pfft",
+                 dcc[i].sock, dcc[i].type, dcc[i].nick);
+          killsock(dcc[i].sock);
+          lostdcc(i);
+          i--;
+        }
       }
-    } else if (xx == -3) {
+    }
+    else if (xx == -3) {
       call_hook(HOOK_IDLE);
-      socket_cleanup = 0;	/* If we've been idle, cleanup & flush */
+      socket_cleanup = 0;       /* If we've been idle, cleanup & flush */
     }
 
     if (do_restart) {
       if (do_restart == -2)
-	rehash();
+        rehash();
       else {
-	/* Unload as many modules as possible */
-	int f = 1;
-	module_entry *p;
-	Function x;
-	char xx[256];
-
- 	/* oops, I guess we should call this event before tcl is restarted */
-   	check_tcl_event("prerestart");
-
-	while (f) {
-	  f = 0;
-	  for (p = module_list; p != NULL; p = p->next) {
-	    dependancy *d = dependancy_list;
-	    int ok = 1;
-
-	    while (ok && d) {
-	      if (d->needed == p)
-		ok = 0;
-	      d = d->next;
-	    }
-	    if (ok) {
-	      strcpy(xx, p->name);
-	      if (module_unload(xx, botnetnick) == NULL) {
-		f = 1;
-		break;
-	      }
-	    }
-	  }
-	}
-
-	for (f = 0, p = module_list; p; p = p->next) {
-	  if (!strcmp(p->name, "eggdrop") || !strcmp(p->name, "encryption") ||
-	      !strcmp(p->name, "uptime"))
-	    f = 0;
-	  else 
-	    f = 1;
-	}
-	if (f)
-	  /* Should be only 3 modules now - eggdrop, encryption, and uptime */
-	  putlog(LOG_MISC, "*", MOD_STAGNANT);
-
-	flushlogs();
-	kill_tcl();
-	init_tcl(argc, argv);
-	init_language(0);
-
-	/* this resets our modules which we didn't unload (encryption and uptime) */
-	for (p = module_list; p; p = p->next) {
-	  if (p->funcs) {
-	    x = p->funcs[MODCALL_START];
-	    x(NULL);
-	  }
-	}
-
-	rehash();
-	restart_chons();
-	call_hook(HOOK_LOADED);
+        /* Unload as many modules as possible */
+        int f = 1;
+        module_entry *p;
+        Function x;
+        char xx[256];
+
+        /* oops, I guess we should call this event before tcl is restarted */
+        check_tcl_event("prerestart");
+
+        while (f) {
+          f = 0;
+          for (p = module_list; p != NULL; p = p->next) {
+            dependancy *d = dependancy_list;
+            int ok = 1;
+
+            while (ok && d) {
+              if (d->needed == p)
+                ok = 0;
+              d = d->next;
+            }
+            if (ok) {
+              strcpy(xx, p->name);
+              if (module_unload(xx, botnetnick) == NULL) {
+                f = 1;
+                break;
+              }
+            }
+          }
+        }
+
+        for (f = 0, p = module_list; p; p = p->next) {
+          if (!strcmp(p->name, "eggdrop") || !strcmp(p->name, "encryption") ||
+              !strcmp(p->name, "uptime"))
+            f = 0;
+          else
+            f = 1;
+        }
+        if (f)
+          /* Should be only 3 modules now - eggdrop, encryption, and uptime */
+          putlog(LOG_MISC, "*", MOD_STAGNANT);
+
+        flushlogs();
+        kill_tcl();
+        init_tcl(argc, argv);
+        init_language(0);
+
+        /* this resets our modules which we didn't unload (encryption and uptime) */
+        for (p = module_list; p; p = p->next) {
+          if (p->funcs) {
+            x = p->funcs[MODCALL_START];
+            x(NULL);
+          }
+        }
+
+        rehash();
+        restart_chons();
+        call_hook(HOOK_LOADED);
       }
       do_restart = 0;
     }
Index: eggdrop1.6/src/main.h
diff -u eggdrop1.6/src/main.h:1.20 eggdrop1.6/src/main.h:1.21
--- eggdrop1.6/src/main.h:1.20	Mon Dec 23 20:30:05 2002
+++ eggdrop1.6/src/main.h	Tue Jan 28 00:37:24 2003
@@ -2,7 +2,7 @@
  * main.h
  *   include file to include most other include files
  *
- * $Id: main.h,v 1.20 2002/12/24 02:30:05 wcc Exp $
+ * $Id: main.h,v 1.21 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -82,9 +82,10 @@
 
 #ifndef MAKING_MODS
 extern struct dcc_table DCC_CHAT, DCC_BOT, DCC_LOST, DCC_SCRIPT, DCC_BOT_NEW,
- DCC_RELAY, DCC_RELAYING, DCC_FORK_RELAY, DCC_PRE_RELAY, DCC_CHAT_PASS,
- DCC_FORK_BOT, DCC_SOCKET, DCC_TELNET_ID, DCC_TELNET_NEW, DCC_TELNET_PW,
- DCC_TELNET, DCC_IDENT, DCC_IDENTWAIT, DCC_DNSWAIT;
+                        DCC_RELAY, DCC_RELAYING, DCC_FORK_RELAY, DCC_PRE_RELAY,
+                        DCC_CHAT_PASS, DCC_FORK_BOT, DCC_SOCKET, DCC_TELNET_ID,
+                        DCC_TELNET_NEW, DCC_TELNET_PW, DCC_TELNET, DCC_IDENT,
+                        DCC_IDENTWAIT, DCC_DNSWAIT;
 
 #endif
 
@@ -108,9 +109,9 @@
 #ifdef BORGCUBES
 
 /* For net.c */
-#  define O_NONBLOCK	00000004    /* POSIX non-blocking I/O		   */
+#  define O_NONBLOCK	00000004        /* POSIX non-blocking I/O              */
 
-#endif				/* BORGUBES */
+#endif /* BORGUBES */
 
 
-#endif				/* _EGG_MAIN_H */
+#endif /* _EGG_MAIN_H */
Index: eggdrop1.6/src/match.c
diff -u eggdrop1.6/src/match.c:1.7 eggdrop1.6/src/match.c:1.8
--- eggdrop1.6/src/match.c:1.7	Wed Jan 22 20:13:29 2003
+++ eggdrop1.6/src/match.c	Tue Jan 28 00:37:24 2003
@@ -2,7 +2,7 @@
  * match.c
  *   wildcard matching functions
  *
- * $Id: match.c,v 1.7 2003/01/23 02:13:29 wcc Exp $
+ * $Id: match.c,v 1.8 2003/01/28 06:37:24 wcc Exp $
  *
  * Once this code was working, I added support for % so that I could
  * use the same code both in Eggdrop and in my IrcII client.
@@ -45,88 +45,88 @@
     return NOMATCH;
 
   while (*n) {
-    if (*m == WILDT) {		/* Match >=1 space */
-      space = 0;		/* Don't need any spaces */
+    if (*m == WILDT) {          /* Match >=1 space */
+      space = 0;                /* Don't need any spaces */
       do {
-	m++;
-	space++;
-      }				/* Tally 1 more space ... */
-      while ((*m == WILDT) || (*m == ' '));	/*  for each space or ~ */
-      sofar += space;		/* Each counts as exact */
+        m++;
+        space++;
+      }                         /* Tally 1 more space ... */
+      while ((*m == WILDT) || (*m == ' '));     /*  for each space or ~ */
+      sofar += space;           /* Each counts as exact */
       while (*n == ' ') {
-	n++;
-	space--;
-      }				/* Do we have enough? */
+        n++;
+        space--;
+      }                         /* Do we have enough? */
       if (space <= 0)
-	continue;		/* Had enough spaces! */
+        continue;               /* Had enough spaces! */
     }
     /* Do the fallback       */
     else {
       switch (*m) {
       case 0:
-	do
-	  m--;			/* Search backwards */
-	while ((m > ma) && (*m == '?'));	/* For first non-? char */
-	if ((m > ma) ? ((*m == '*') && (m[-1] != QUOTE)) : (*m == '*'))
-	  return PERMATCH;		/* nonquoted * = match */
-	break;
+        do
+          m--;                  /* Search backwards */
+        while ((m > ma) && (*m == '?'));        /* For first non-? char */
+        if ((m > ma) ? ((*m == '*') && (m[-1] != QUOTE)) : (*m == '*'))
+          return PERMATCH;      /* nonquoted * = match */
+        break;
       case WILDP:
-	while (*(++m) == WILDP);	/* Zap redundant %s */
-	if (*m != WILDS) {	/* Don't both if next=* */
-	  if (*n != ' ') {	/* WILDS can't match ' ' */
-	    lpm = m;
-	    lpn = n;		/* Save '%' fallback spot */
-	    saved += sofar;
-	    sofar = 0;		/* And save tally count */
-	  }
-	  continue;		/* Done with '%' */
-	}
-	/* FALL THROUGH */
+        while (*(++m) == WILDP);        /* Zap redundant %s */
+        if (*m != WILDS) {      /* Don't both if next=* */
+          if (*n != ' ') {      /* WILDS can't match ' ' */
+            lpm = m;
+            lpn = n;            /* Save '%' fallback spot */
+            saved += sofar;
+            sofar = 0;          /* And save tally count */
+          }
+          continue;             /* Done with '%' */
+        }
+        /* FALL THROUGH */
       case WILDS:
-	do
-	  m++;			/* Zap redundant wilds */
-	while ((*m == WILDS) || (*m == WILDP));
-	lsm = m;
-	lsn = n;
-	lpm = 0;		/* Save '*' fallback spot */
-	match += (saved + sofar);	/* Save tally count */
-	saved = sofar = 0;
-	continue;		/* Done with '*' */
+        do
+          m++;                  /* Zap redundant wilds */
+        while ((*m == WILDS) || (*m == WILDP));
+        lsm = m;
+        lsn = n;
+        lpm = 0;                /* Save '*' fallback spot */
+        match += (saved + sofar);       /* Save tally count */
+        saved = sofar = 0;
+        continue;               /* Done with '*' */
       case WILDQ:
-	m++;
-	n++;
-	continue;		/* Match one char */
+        m++;
+        n++;
+        continue;               /* Match one char */
       case QUOTE:
-	m++;			/* Handle quoting */
+        m++;                    /* Handle quoting */
       }
-      if (rfc_toupper(*m) == rfc_toupper(*n)) {		/* If matching */
-	m++;
-	n++;
-	sofar++;
-	continue;		/* Tally the match */
+      if (rfc_toupper(*m) == rfc_toupper(*n)) { /* If matching */
+        m++;
+        n++;
+        sofar++;
+        continue;               /* Tally the match */
       }
 #ifdef WILDT
     }
 #endif
-    if (lpm) {			/* Try to fallback on '%' */
+    if (lpm) {                  /* Try to fallback on '%' */
       n = ++lpn;
       m = lpm;
-      sofar = 0;		/* Restore position */
+      sofar = 0;                /* Restore position */
       if ((*n | 32) == 32)
-	lpm = 0;		/* Can't match 0 or ' ' */
-      continue;			/* Next char, please */
+        lpm = 0;                /* Can't match 0 or ' ' */
+      continue;                 /* Next char, please */
     }
-    if (lsm) {			/* Try to fallback on '*' */
+    if (lsm) {                  /* Try to fallback on '*' */
       n = ++lsn;
-      m = lsm;			/* Restore position */
+      m = lsm;                  /* Restore position */
       saved = sofar = 0;
-      continue;			/* Next char, please */
+      continue;                 /* Next char, please */
     }
-    return NOMATCH;		/* No fallbacks=No match */
+    return NOMATCH;             /* No fallbacks=No match */
   }
   while ((*m == WILDS) || (*m == WILDP))
-    m++;			/* Zap leftover %s & *s */
-  return (*m) ? NOMATCH : PERMATCH;	/* End of both = match */
+    m++;                        /* Zap leftover %s & *s */
+  return (*m) ? NOMATCH : PERMATCH;     /* End of both = match */
 }
 
 int _wild_match(register unsigned char *m, register unsigned char *n)
@@ -140,43 +140,43 @@
     return NOMATCH;
   /* find the end of each string */
   while (*(++m));
-    m--;
+  m--;
   while (*(++n));
-    n--;
+  n--;
 
   while (n >= na) {
     switch (*m) {
-    case WILDS:  /* Matches anything */
+    case WILDS:                /* Matches anything */
       do
-        m--;  /* Zap redundant wilds */
+        m--;                    /* Zap redundant wilds */
       while ((m >= ma) && (*m == WILDS));
       lsm = m;
       lsn = n;
       match += sofar;
-      sofar = 0;  /* Update fallback pos */
-      continue;  /* Next char, please */
+      sofar = 0;                /* Update fallback pos */
+      continue;                 /* Next char, please */
     case WILDQ:
       m--;
       n--;
-      continue;  /* '?' always matches */
+      continue;                 /* '?' always matches */
     }
-    if (rfc_toupper(*m) == rfc_toupper(*n)) {  /* If matching char */
+    if (rfc_toupper(*m) == rfc_toupper(*n)) {   /* If matching char */
       m--;
       n--;
-      sofar++;  /* Tally the match */
-      continue;  /* Next char, please */
+      sofar++;                  /* Tally the match */
+      continue;                 /* Next char, please */
     }
-    if (lsm) {  /* To to fallback on '*' */
+    if (lsm) {                  /* To to fallback on '*' */
       n = --lsn;
       m = lsm;
       if (n < na)
-	lsm = 0;  /* Rewind to saved pos */
+        lsm = 0;                /* Rewind to saved pos */
       sofar = 0;
-      continue;  /* Next char, please */
+      continue;                 /* Next char, please */
     }
-    return NOMATCH;  /* No fallback=No match */
+    return NOMATCH;             /* No fallback=No match */
   }
   while ((m >= ma) && (*m == WILDS))
-    m--;  /* Zap leftover %s & *s */
-  return (m >= ma) ? NOMATCH : MATCH;  /* Start of both = match */
+    m--;                        /* Zap leftover %s & *s */
+  return (m >= ma) ? NOMATCH : MATCH;   /* Start of both = match */
 }
Index: eggdrop1.6/src/md5/md5.h
diff -u eggdrop1.6/src/md5/md5.h:1.4 eggdrop1.6/src/md5/md5.h:1.5
--- eggdrop1.6/src/md5/md5.h:1.4	Tue Sep 25 18:21:44 2001
+++ eggdrop1.6/src/md5/md5.h	Tue Jan 28 00:37:25 2003
@@ -13,10 +13,10 @@
 typedef unsigned long MD5_u32plus;
 
 typedef struct {
-	MD5_u32plus lo, hi;
-	MD5_u32plus a, b, c, d;
-	unsigned char buffer[64];
-	MD5_u32plus block[16];
+  MD5_u32plus lo, hi;
+  MD5_u32plus a, b, c, d;
+  unsigned char buffer[64];
+  MD5_u32plus block[16];
 } MD5_CTX;
 
 extern void MD5_Init(MD5_CTX *ctx);
Index: eggdrop1.6/src/md5/md5c.c
diff -u eggdrop1.6/src/md5/md5c.c:1.7 eggdrop1.6/src/md5/md5c.c:1.8
--- eggdrop1.6/src/md5/md5c.c:1.7	Tue Sep 25 18:21:44 2001
+++ eggdrop1.6/src/md5/md5c.c	Tue Jan 28 00:37:25 2003
@@ -68,203 +68,203 @@
  */
 static void *body(MD5_CTX *ctx, void *data, unsigned long size)
 {
-	unsigned char *ptr;
-	MD5_u32plus a, b, c, d;
-	MD5_u32plus saved_a, saved_b, saved_c, saved_d;
-
-	ptr = data;
-
-	a = ctx->a;
-	b = ctx->b;
-	c = ctx->c;
-	d = ctx->d;
-
-	do {
-		saved_a = a;
-		saved_b = b;
-		saved_c = c;
-		saved_d = d;
+  unsigned char *ptr;
+  MD5_u32plus a, b, c, d;
+  MD5_u32plus saved_a, saved_b, saved_c, saved_d;
+
+  ptr = data;
+
+  a = ctx->a;
+  b = ctx->b;
+  c = ctx->c;
+  d = ctx->d;
+
+  do {
+    saved_a = a;
+    saved_b = b;
+    saved_c = c;
+    saved_d = d;
 
 /* Round 1 */
-		STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
-		STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
-		STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
-		STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
-		STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
-		STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
-		STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
-		STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
-		STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
-		STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
-		STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
-		STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
-		STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
-		STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
-		STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
-		STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
+    STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
+      STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
+      STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
+      STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
+      STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
+      STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
+      STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
+      STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
+      STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
+      STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
+      STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
+      STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
+      STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
+      STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
+      STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
+      STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
 
 /* Round 2 */
-		STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
-		STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
-		STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
-		STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
-		STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
-		STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
-		STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
-		STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
-		STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
-		STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
-		STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
-		STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
-		STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
-		STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
-		STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
-		STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
+      STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
+      STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
+      STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
+      STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
+      STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
+      STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
+      STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
+      STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
+      STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
+      STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
+      STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
+      STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
+      STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
+      STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
+      STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
+      STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
 
 /* Round 3 */
-		STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
-		STEP(H, d, a, b, c, GET(8), 0x8771f681, 11)
-		STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
-		STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23)
-		STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
-		STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11)
-		STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
-		STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23)
-		STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
-		STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11)
-		STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
-		STEP(H, b, c, d, a, GET(6), 0x04881d05, 23)
-		STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
-		STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11)
-		STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
-		STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23)
+      STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
+      STEP(H, d, a, b, c, GET(8), 0x8771f681, 11)
+      STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
+      STEP(H, b, c, d, a, GET(14), 0xfde5380c, 23)
+      STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
+      STEP(H, d, a, b, c, GET(4), 0x4bdecfa9, 11)
+      STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
+      STEP(H, b, c, d, a, GET(10), 0xbebfbc70, 23)
+      STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
+      STEP(H, d, a, b, c, GET(0), 0xeaa127fa, 11)
+      STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
+      STEP(H, b, c, d, a, GET(6), 0x04881d05, 23)
+      STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
+      STEP(H, d, a, b, c, GET(12), 0xe6db99e5, 11)
+      STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
+      STEP(H, b, c, d, a, GET(2), 0xc4ac5665, 23)
 
 /* Round 4 */
-		STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
-		STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
-		STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
-		STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
-		STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
-		STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
-		STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
-		STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
-		STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
-		STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
-		STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
-		STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
-		STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
-		STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10)
-		STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15)
-		STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21)
-
-		a += saved_a;
-		b += saved_b;
-		c += saved_c;
-		d += saved_d;
-
-		ptr += 64;
-	} while (size -= 64);
-
-	ctx->a = a;
-	ctx->b = b;
-	ctx->c = c;
-	ctx->d = d;
+      STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
+      STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
+      STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
+      STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
+      STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
+      STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
+      STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
+      STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
+      STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
+      STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
+      STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
+      STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
+      STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
+      STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10)
+      STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15)
+      STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21)
+
+      a += saved_a;
+    b += saved_b;
+    c += saved_c;
+    d += saved_d;
+
+    ptr += 64;
+  } while (size -= 64);
+
+  ctx->a = a;
+  ctx->b = b;
+  ctx->c = c;
+  ctx->d = d;
 
-	return ptr;
+  return ptr;
 }
 
 void MD5_Init(MD5_CTX *ctx)
 {
-	ctx->a = 0x67452301;
-	ctx->b = 0xefcdab89;
-	ctx->c = 0x98badcfe;
-	ctx->d = 0x10325476;
+  ctx->a = 0x67452301;
+  ctx->b = 0xefcdab89;
+  ctx->c = 0x98badcfe;
+  ctx->d = 0x10325476;
 
-	ctx->lo = 0;
-	ctx->hi = 0;
+  ctx->lo = 0;
+  ctx->hi = 0;
 }
 
 void MD5_Update(MD5_CTX *ctx, void *data, unsigned long size)
 {
-	MD5_u32plus saved_lo;
-	unsigned long used, free;
+  MD5_u32plus saved_lo;
+  unsigned long used, free;
 
-	saved_lo = ctx->lo;
-	if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
-		ctx->hi++;
-	ctx->hi += size >> 29;
-
-	used = saved_lo & 0x3f;
-
-	if (used) {
-		free = 64 - used;
-
-		if (size < free) {
-			memcpy(&ctx->buffer[used], data, size);
-			return;
-		}
-
-		memcpy(&ctx->buffer[used], data, free);
-		(unsigned char *)data += free;
-		size -= free;
-		body(ctx, ctx->buffer, 64);
-	}
-
-	if (size >= 64) {
-		data = body(ctx, data, size & ~(unsigned long)0x3f);
-		size &= 0x3f;
-	}
+  saved_lo = ctx->lo;
+  if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
+    ctx->hi++;
+  ctx->hi += size >> 29;
+
+  used = saved_lo & 0x3f;
+
+  if (used) {
+    free = 64 - used;
+
+    if (size < free) {
+      memcpy(&ctx->buffer[used], data, size);
+      return;
+    }
+
+    memcpy(&ctx->buffer[used], data, free);
+    (unsigned char *) data += free;
+    size -= free;
+    body(ctx, ctx->buffer, 64);
+  }
+
+  if (size >= 64) {
+    data = body(ctx, data, size & ~(unsigned long) 0x3f);
+    size &= 0x3f;
+  }
 
-	memcpy(ctx->buffer, data, size);
+  memcpy(ctx->buffer, data, size);
 }
 
 void MD5_Final(unsigned char *result, MD5_CTX *ctx)
 {
-	unsigned long used, free;
+  unsigned long used, free;
 
-	used = ctx->lo & 0x3f;
+  used = ctx->lo & 0x3f;
 
-	ctx->buffer[used++] = 0x80;
+  ctx->buffer[used++] = 0x80;
 
-	free = 64 - used;
+  free = 64 - used;
 
-	if (free < 8) {
-		memset(&ctx->buffer[used], 0, free);
-		body(ctx, ctx->buffer, 64);
-		used = 0;
-		free = 64;
-	}
-
-	memset(&ctx->buffer[used], 0, free - 8);
-
-	ctx->lo <<= 3;
-	ctx->buffer[56] = ctx->lo;
-	ctx->buffer[57] = ctx->lo >> 8;
-	ctx->buffer[58] = ctx->lo >> 16;
-	ctx->buffer[59] = ctx->lo >> 24;
-	ctx->buffer[60] = ctx->hi;
-	ctx->buffer[61] = ctx->hi >> 8;
-	ctx->buffer[62] = ctx->hi >> 16;
-	ctx->buffer[63] = ctx->hi >> 24;
-
-	body(ctx, ctx->buffer, 64);
-
-	result[0] = ctx->a;
-	result[1] = ctx->a >> 8;
-	result[2] = ctx->a >> 16;
-	result[3] = ctx->a >> 24;
-	result[4] = ctx->b;
-	result[5] = ctx->b >> 8;
-	result[6] = ctx->b >> 16;
-	result[7] = ctx->b >> 24;
-	result[8] = ctx->c;
-	result[9] = ctx->c >> 8;
-	result[10] = ctx->c >> 16;
-	result[11] = ctx->c >> 24;
-	result[12] = ctx->d;
-	result[13] = ctx->d >> 8;
-	result[14] = ctx->d >> 16;
-	result[15] = ctx->d >> 24;
+  if (free < 8) {
+    memset(&ctx->buffer[used], 0, free);
+    body(ctx, ctx->buffer, 64);
+    used = 0;
+    free = 64;
+  }
+
+  memset(&ctx->buffer[used], 0, free - 8);
+
+  ctx->lo <<= 3;
+  ctx->buffer[56] = ctx->lo;
+  ctx->buffer[57] = ctx->lo >> 8;
+  ctx->buffer[58] = ctx->lo >> 16;
+  ctx->buffer[59] = ctx->lo >> 24;
+  ctx->buffer[60] = ctx->hi;
+  ctx->buffer[61] = ctx->hi >> 8;
+  ctx->buffer[62] = ctx->hi >> 16;
+  ctx->buffer[63] = ctx->hi >> 24;
+
+  body(ctx, ctx->buffer, 64);
+
+  result[0] = ctx->a;
+  result[1] = ctx->a >> 8;
+  result[2] = ctx->a >> 16;
+  result[3] = ctx->a >> 24;
+  result[4] = ctx->b;
+  result[5] = ctx->b >> 8;
+  result[6] = ctx->b >> 16;
+  result[7] = ctx->b >> 24;
+  result[8] = ctx->c;
+  result[9] = ctx->c >> 8;
+  result[10] = ctx->c >> 16;
+  result[11] = ctx->c >> 24;
+  result[12] = ctx->d;
+  result[13] = ctx->d >> 8;
+  result[14] = ctx->d >> 16;
+  result[15] = ctx->d >> 24;
 
-	memset(ctx, 0, sizeof(ctx));
+  memset(ctx, 0, sizeof(ctx));
 }
Index: eggdrop1.6/src/mem.c
diff -u eggdrop1.6/src/mem.c:1.18 eggdrop1.6/src/mem.c:1.19
--- eggdrop1.6/src/mem.c:1.18	Mon Dec 23 20:30:05 2002
+++ eggdrop1.6/src/mem.c	Tue Jan 28 00:37:24 2003
@@ -3,7 +3,7 @@
  *   memory allocation and deallocation
  *   keeping track of what memory is being used by whom
  *
- * $Id: mem.c,v 1.18 2002/12/24 02:30:05 wcc Exp $
+ * $Id: mem.c,v 1.19 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -24,7 +24,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#define MEMTBLSIZE 25000	/* yikes! */
+#define MEMTBLSIZE 25000        /* yikes! */
 #define COMPILING_MEM
 
 #include "main.h"
@@ -36,17 +36,17 @@
 #include "mod/modvals.h"
 
 
-extern module_entry	*module_list;
+extern module_entry *module_list;
 
 #ifdef DEBUG_MEM
-unsigned long	memused = 0;
-static int	lastused = 0;
+unsigned long memused = 0;
+static int lastused = 0;
 
 struct {
-  void	*ptr;
-  int	 size;
-  short	 line;
-  char	 file[20];
+  void *ptr;
+  int size;
+  short line;
+  char file[20];
 } memtbl[MEMTBLSIZE];
 #endif
 
@@ -89,10 +89,10 @@
 
   per = ((lastused * 1.0) / (MEMTBLSIZE * 1.0)) * 100.0;
   dprintf(DP_HELP, "NOTICE %s :Memory table usage: %d/%d (%.1f%% full)\n",
-	  nick, lastused, MEMTBLSIZE, per);
+          nick, lastused, MEMTBLSIZE, per);
 #endif
   dprintf(DP_HELP, "NOTICE %s :Think I'm using about %dk.\n", nick,
-	  (int) (expected_memory() / 1024));
+          (int) (expected_memory() / 1024));
 }
 
 void tell_mem_status_dcc(int idx)
@@ -101,16 +101,16 @@
   int exp;
   float per;
 
-  exp = expected_memory();	/* in main.c ? */
+  exp = expected_memory();      /* in main.c ? */
   per = ((lastused * 1.0) / (MEMTBLSIZE * 1.0)) * 100.0;
   dprintf(idx, "Memory table: %d/%d (%.1f%% full)\n", lastused, MEMTBLSIZE,
-	  per);
+          per);
   per = ((exp * 1.0) / (memused * 1.0)) * 100.0;
   if (per != 100.0)
     dprintf(idx, "Memory fault: only accounting for %d/%ld (%.1f%%)\n",
-	    exp, memused, per);
+            exp, memused, per);
   dprintf(idx, "Memory table itself occupies an additional %dk static\n",
-	  (int) (sizeof(memtbl) / 1024));
+          (int) (sizeof(memtbl) / 1024));
 #endif
 }
 
@@ -175,9 +175,10 @@
       use[12] += l;
     else if (p) {
       for (me = module_list; me; me = me->next)
-	if (!strcmp(fn, me->name))
-	  me->mem_work += l;
-    } else
+        if (!strcmp(fn, me->name))
+          me->mem_work += l;
+    }
+    else
       dprintf(idx, "Not logging file %s!\n", fn);
   }
   for (i = 0; i < MAX_MEM; i++) {
@@ -222,36 +223,36 @@
       strcpy(fn, "dns.c");
       break;
     }
-    if (use[i] == exp[i]) {
+    if (use[i] == exp[i])
       dprintf(idx, "File '%-10s' accounted for %lu/%lu (ok)\n", fn, exp[i],
-	      use[i]);
-    } else {
+              use[i]);
+    else {
       dprintf(idx, "File '%-10s' accounted for %lu/%lu (debug follows:)\n",
-	      fn, exp[i], use[i]);
+              fn, exp[i], use[i]);
       strcpy(sofar, "   ");
       for (j = 0; j < lastused; j++) {
-	if ((p = strchr(memtbl[j].file, ':')))
-	  *p = 0;
-	if (!egg_strcasecmp(memtbl[j].file, fn)) {
-	  if (p)
-	    sprintf(&sofar[strlen(sofar)], "%-10s/%-4d:(%04d) ",
-		    p + 1, memtbl[j].line, memtbl[j].size);
-	  else
-	    sprintf(&sofar[strlen(sofar)], "%-4d:(%04d) ",
-		    memtbl[j].line, memtbl[j].size);
-
-	  if (strlen(sofar) > 60) {
-	    sofar[strlen(sofar) - 1] = 0;
-	    dprintf(idx, "%s\n", sofar);
-	    strcpy(sofar, "   ");
-	  }
-	}
-	if (p)
-	  *p = ':';
+        if ((p = strchr(memtbl[j].file, ':')))
+          *p = 0;
+        if (!egg_strcasecmp(memtbl[j].file, fn)) {
+          if (p)
+            sprintf(&sofar[strlen(sofar)], "%-10s/%-4d:(%04d) ",
+                    p + 1, memtbl[j].line, memtbl[j].size);
+          else
+            sprintf(&sofar[strlen(sofar)], "%-4d:(%04d) ",
+                    memtbl[j].line, memtbl[j].size);
+
+          if (strlen(sofar) > 60) {
+            sofar[strlen(sofar) - 1] = 0;
+            dprintf(idx, "%s\n", sofar);
+            strcpy(sofar, "   ");
+          }
+        }
+        if (p)
+          *p = ':';
       }
       if (sofar[0]) {
-	sofar[strlen(sofar) - 1] = 0;
-	dprintf(idx, "%s\n", sofar);
+        sofar[strlen(sofar) - 1] = 0;
+        dprintf(idx, "%s\n", sofar);
       }
     }
   }
@@ -261,32 +262,32 @@
 
     if ((f != NULL) && (f[MODCALL_EXPMEM] != NULL))
       expt = f[MODCALL_EXPMEM] ();
-    if (me->mem_work == expt) {
+    if (me->mem_work == expt)
       dprintf(idx, "Module '%-10s' accounted for %lu/%lu (ok)\n", me->name,
-	      expt, me->mem_work);
-    } else {
+              expt, me->mem_work);
+    else {
       dprintf(idx, "Module '%-10s' accounted for %lu/%lu (debug follows:)\n",
-	      me->name, expt, me->mem_work);
+              me->name, expt, me->mem_work);
       strcpy(sofar, "   ");
       for (j = 0; j < lastused; j++) {
-	strcpy(fn, memtbl[j].file);
-	if ((p = strchr(fn, ':')) != NULL) {
-	  *p = 0;
-	  if (!egg_strcasecmp(fn, me->name)) {
-	    sprintf(&sofar[strlen(sofar)], "%-10s/%-4d:(%04X) ", p + 1,
-		    memtbl[j].line, memtbl[j].size);
-	    if (strlen(sofar) > 60) {
-	      sofar[strlen(sofar) - 1] = 0;
-	      dprintf(idx, "%s\n", sofar);
-	      strcpy(sofar, "   ");
-	    }
-	    *p = ':';
-	  }
-	}
+        strcpy(fn, memtbl[j].file);
+        if ((p = strchr(fn, ':')) != NULL) {
+          *p = 0;
+          if (!egg_strcasecmp(fn, me->name)) {
+            sprintf(&sofar[strlen(sofar)], "%-10s/%-4d:(%04X) ", p + 1,
+                    memtbl[j].line, memtbl[j].size);
+            if (strlen(sofar) > 60) {
+              sofar[strlen(sofar) - 1] = 0;
+              dprintf(idx, "%s\n", sofar);
+              strcpy(sofar, "   ");
+            }
+            *p = ':';
+          }
+        }
       }
       if (sofar[0]) {
-	sofar[strlen(sofar) - 1] = 0;
-	dprintf(idx, "%s\n", sofar);
+        sofar[strlen(sofar) - 1] = 0;
+        dprintf(idx, "%s\n", sofar);
       }
     }
   }
@@ -299,16 +300,17 @@
 
 void *n_malloc(int size, const char *file, int line)
 {
-  void	*x;
+  void *x;
+
 #ifdef DEBUG_MEM
-  int	 i = 0;
-  char	*p;
+  int i = 0;
+  char *p;
 #endif
 
   x = (void *) malloc(size);
   if (x == NULL) {
     putlog(LOG_MISC, "*", "*** FAILED MALLOC %s (%d) (%d): %s", file, line,
-	   size, strerror(errno));
+           size, strerror(errno));
     fatal("Memory allocation failed", 0);
   }
 #ifdef DEBUG_MEM
@@ -333,6 +335,7 @@
 {
   void *x;
   int i = 0;
+
 #ifdef DEBUG_MEM
   char *p;
 #endif
@@ -351,7 +354,7 @@
   for (i = 0; (i < lastused) && (memtbl[i].ptr != ptr); i++);
   if (i == lastused) {
     putlog(LOG_MISC, "*", "*** ATTEMPTING TO REALLOC NON-MALLOC'D PTR: %s (%d)",
-	   file, line);
+           file, line);
     return NULL;
   }
   memused -= memtbl[i].size;
@@ -372,7 +375,7 @@
 
   if (ptr == NULL) {
     putlog(LOG_MISC, "*", "*** ATTEMPTING TO FREE NULL PTR: %s (%d)",
-	   file, line);
+           file, line);
     i = i;
     return;
   }
@@ -382,7 +385,7 @@
     for (i = 0; (i < lastused) && (memtbl[i].ptr != ptr); i++);
     if (i == lastused) {
       putlog(LOG_MISC, "*", "*** ATTEMPTING TO FREE NON-MALLOC'D PTR: %s (%d)",
-	     file, line);
+             file, line);
       return;
     }
     memused -= memtbl[i].size;
Index: eggdrop1.6/src/misc.c
diff -u eggdrop1.6/src/misc.c:1.56 eggdrop1.6/src/misc.c:1.57
--- eggdrop1.6/src/misc.c:1.56	Mon Jan 20 18:53:27 2003
+++ eggdrop1.6/src/misc.c	Tue Jan 28 00:37:24 2003
@@ -7,7 +7,7 @@
  *   help system
  *   motd display and %var substitution
  *
- * $Id: misc.c,v 1.56 2003/01/21 00:53:27 wcc Exp $
+ * $Id: misc.c,v 1.57 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -40,24 +40,24 @@
 #endif
 #include "stat.h"
 
-extern struct dcc_t	*dcc;
-extern struct chanset_t	*chanset;
-extern char		 helpdir[], version[], origbotname[], botname[],
-			 admin[], network[], motdfile[], ver[], botnetnick[],
-			 bannerfile[], logfile_suffix[], textdir[];
-extern int		 backgrd, con_chan, term_z, use_stderr, dcc_total,
-			 keep_all_logs, quick_logs, strict_host;
-extern time_t		 now;
-extern Tcl_Interp	*interp;
-
-
-int	 shtime = 1;		/* Whether or not to display the time
-				   with console output */
-log_t	*logs = 0;		/* Logfiles */
-int	 max_logs = 5;		/* Current maximum log files */
-int	 max_logsize = 0;	/* Maximum logfile size, 0 for no limit */
-int	 conmask = LOG_MODES | LOG_CMDS | LOG_MISC; /* Console mask */
-int	 debug_output = 0;	/* Disply output to server to LOG_SERVEROUT */
+extern struct dcc_t *dcc;
+extern struct chanset_t *chanset;
+extern char helpdir[], version[], origbotname[], botname[], admin[], network[],
+            motdfile[], ver[], botnetnick[], bannerfile[], logfile_suffix[],
+            textdir[];
+extern int backgrd, con_chan, term_z, use_stderr, dcc_total, keep_all_logs,
+           quick_logs, strict_host;
+extern time_t now;
+extern Tcl_Interp *interp;
+
+
+int shtime = 1;                 /* Whether or not to display the time
+                                 * with console output */
+log_t *logs = 0;                /* Logfiles */
+int max_logs = 5;               /* Current maximum log files */
+int max_logsize = 0;            /* Maximum logfile size, 0 for no limit */
+int conmask = LOG_MODES | LOG_CMDS | LOG_MISC;  /* Console mask */
+int debug_output = 0;           /* Disply output to server to LOG_SERVEROUT */
 
 struct help_list_t {
   struct help_list_t *next;
@@ -294,23 +294,26 @@
       nw[0] = '*';
       p = q - 7;
       i = 1;
-    } else
+    }
+    else
       i = 0;
     while (*p != '@') {
       if (!fl && strchr("~+-^=", *p)) {
         if (strict_host)
-	  nw[i] = '?';
-	else
-	  i--;
-      } else
-	nw[i] = *p;
+          nw[i] = '?';
+        else
+          i--;
+      }
+      else
+        nw[i] = *p;
       fl++;
       p++;
       i++;
     }
     nw[i++] = '@';
     q++;
-  } else {
+  }
+  else {
     nw[0] = '*';
     nw[1] = '@';
     i = 2;
@@ -323,50 +326,53 @@
     /* TLD or 2 part host */
     strcpy(nw, q);
   else {
-    if (e == NULL) {		/* IPv6 address?		*/
+    if (e == NULL) {            /* IPv6 address?                */
       const char *mask_str;
 
       f = strrchr(q, ':');
-      if (strchr(f, '.')) {	/* IPv4 wrapped in an IPv6?	*/
-	f = strrchr(f, '.');
-	mask_str = ".*";
-      } else 			/* ... no, true IPv6.		*/
-	mask_str = ":*";
+      if (strchr(f, '.')) {     /* IPv4 wrapped in an IPv6?     */
+        f = strrchr(f, '.');
+        mask_str = ".*";
+      }
+      else                      /* ... no, true IPv6.               */
+        mask_str = ":*";
       strncpy(nw, q, f - q);
       /* No need to nw[f-q] = 0 here, as the strcpy below will
        * terminate the string for us.
        */
       nw += (f - q);
       strcpy(nw, mask_str);
-    } else {
+    }
+    else {
       for (f = e; *f; f++);
       f--;
-      if (*f >= '0' && *f <= '9') {	/* Numeric IP address */
-	while (*f != '.')
-	  f--;
-	strncpy(nw, q, f - q);
-	/* No need to nw[f-q] = 0 here, as the strcpy below will
-	 * terminate the string for us.
-	 */
-	nw += (f - q);
-	strcpy(nw, ".*");
-      } else {				/* Normal host >= 3 parts */
-	/*    a.b.c  -> *.b.c
-	 *    a.b.c.d ->  *.b.c.d if tld is a country (2 chars)
-	 *             OR   *.c.d if tld is com/edu/etc (3 chars)
-	 *    a.b.c.d.e -> *.c.d.e   etc
-	 */
-	const char *x = strchr(e + 1, '.');
-
-	if (!x)
-	  x = p;
-	else if (strchr(x + 1, '.'))
-	  x = e;
-	else if (strlen(x) == 3)
-	  x = p;
-	else
-	  x = e;
-	sprintf(nw, "*%s", x);
+      if (*f >= '0' && *f <= '9') {     /* Numeric IP address */
+        while (*f != '.')
+          f--;
+        strncpy(nw, q, f - q);
+        /* No need to nw[f-q] = 0 here, as the strcpy below will
+         * terminate the string for us.
+         */
+        nw += (f - q);
+        strcpy(nw, ".*");
+      }
+      else {                    /* Normal host >= 3 parts */
+        /*    a.b.c  -> *.b.c
+         *    a.b.c.d ->  *.b.c.d if tld is a country (2 chars)
+         *             OR   *.c.d if tld is com/edu/etc (3 chars)
+         *    a.b.c.d.e -> *.c.d.e   etc
+         */
+        const char *x = strchr(e + 1, '.');
+
+        if (!x)
+          x = p;
+        else if (strchr(x + 1, '.'))
+          x = e;
+        else if (strlen(x) == 3)
+          x = p;
+        else
+          x = e;
+        sprintf(nw, "*%s", x);
       }
     }
   }
@@ -376,8 +382,8 @@
  */
 void dumplots(int idx, const char *prefix, char *data)
 {
-  char		*p = data, *q, *n, c;
-  const int	 max_data_len = 500 - strlen(prefix);
+  char *p = data, *q, *n, c;
+  const int max_data_len = 500 - strlen(prefix);
 
   if (!*data) {
     dprintf(idx, "%s\n", prefix);
@@ -393,19 +399,20 @@
       dprintf(idx, "%s%s\n", prefix, p);
       *n = '\n';
       p = n + 1;
-    } else {
+    }
+    else {
       /* Search backwards for the last space */
       while (*q != ' ' && q != p)
-	q--;
+        q--;
       if (q == p)
-	q = p + max_data_len;
+        q = p + max_data_len;
       c = *q;
       *q = 0;
       dprintf(idx, "%s%s\n", prefix, p);
       *q = c;
       p = q;
       if (c == ' ')
-	p++;
+        p++;
     }
   }
   /* Last trailing bit: split by linefeeds if possible */
@@ -418,7 +425,7 @@
     n = strchr(p, '\n');
   }
   if (*p)
-    dprintf(idx, "%s%s\n", prefix, p);	/* Last trailing bit */
+    dprintf(idx, "%s%s\n", prefix, p);  /* Last trailing bit */
 }
 
 /* Convert an interval (in seconds) to one of:
@@ -513,9 +520,9 @@
       s2 = ct;
       /* replace spaces by underscores */
       while (s2[0]) {
-	if (s2[0] == ' ')
-	  s2[0] = '_';
-	s2++;
+        if (s2[0] == ' ')
+          s2[0] = '_';
+        s2++;
       }
     }
   }
@@ -528,51 +535,52 @@
   if (!use_stderr) {
     for (i = 0; i < max_logs; i++) {
       if ((logs[i].filename != NULL) && (logs[i].mask & type) &&
-	  ((chname[0] == '*') || (logs[i].chname[0] == '*') ||
-	   (!rfc_casecmp(chname, logs[i].chname)))) {
-	if (logs[i].f == NULL) {
-	  /* Open this logfile */
-	  if (keep_all_logs) {
-	    egg_snprintf(s1, 256, "%s%s", logs[i].filename, ct);
-	    logs[i].f = fopen(s1, "a+");
-	  } else
-	    logs[i].f = fopen(logs[i].filename, "a+");
-	}
-	if (logs[i].f != NULL) {
-	  /* Check if this is the same as the last line added to
-	   * the log. <cybah>
-	   */
-	  if (!egg_strcasecmp(out + tsl, logs[i].szlast)) {
-	    /* It is a repeat, so increment repeats */
-	    logs[i].repeats++;
-	  } else {
-	    /* Not a repeat, check if there were any repeat
-	     * lines previously...
-	     */
-	    if (logs[i].repeats > 0) {
-	      /* Yep.. so display 'last message repeated x times'
-	       * then reset repeats. We want the current time here,
-	       * so put that in the file first.
-	       */
-	      fprintf(logs[i].f, stamp);
-	      fprintf(logs[i].f, MISC_LOGREPEAT, logs[i].repeats);
-	      logs[i].repeats = 0;
-	      /* No need to reset logs[i].szlast here
-	       * because we update it later on...
-	       */
-	    }
-	    fputs(out, logs[i].f);
-	    strncpyz(logs[i].szlast, out + tsl, LOGLINEMAX);
-	  }
-	}
+          ((chname[0] == '*') || (logs[i].chname[0] == '*') ||
+           (!rfc_casecmp(chname, logs[i].chname)))) {
+        if (logs[i].f == NULL) {
+          /* Open this logfile */
+          if (keep_all_logs) {
+            egg_snprintf(s1, 256, "%s%s", logs[i].filename, ct);
+            logs[i].f = fopen(s1, "a+");
+          }
+          else
+            logs[i].f = fopen(logs[i].filename, "a+");
+        }
+        if (logs[i].f != NULL) {
+          /* Check if this is the same as the last line added to
+           * the log. <cybah>
+           */
+          if (!egg_strcasecmp(out + tsl, logs[i].szlast))
+            /* It is a repeat, so increment repeats */
+            logs[i].repeats++;
+          else {
+            /* Not a repeat, check if there were any repeat
+             * lines previously...
+             */
+            if (logs[i].repeats > 0) {
+              /* Yep.. so display 'last message repeated x times'
+               * then reset repeats. We want the current time here,
+               * so put that in the file first.
+               */
+              fprintf(logs[i].f, stamp);
+              fprintf(logs[i].f, MISC_LOGREPEAT, logs[i].repeats);
+              logs[i].repeats = 0;
+              /* No need to reset logs[i].szlast here
+               * because we update it later on...
+               */
+            }
+            fputs(out, logs[i].f);
+            strncpyz(logs[i].szlast, out + tsl, LOGLINEMAX);
+          }
+        }
       }
     }
   }
   for (i = 0; i < dcc_total; i++)
     if ((dcc[i].type == &DCC_CHAT) && (dcc[i].u.chat->con_flags & type)) {
       if ((chname[0] == '*') || (dcc[i].u.chat->con_chan[0] == '*') ||
-	  (!rfc_casecmp(chname, dcc[i].u.chat->con_chan)))
-	dprintf(i, "%s", out);
+          (!rfc_casecmp(chname, dcc[i].u.chat->con_chan)))
+        dprintf(i, "%s", out);
     }
   if ((!backgrd) && (!con_chan) && (!term_z))
     dprintf(DP_STDOUT, "%s", out);
@@ -589,8 +597,8 @@
  */
 void logsuffix_change(char *s)
 {
-  int	 i;
-  char	*s2 = logfile_suffix;
+  int i;
+  char *s2 = logfile_suffix;
 
   debug0("Logfile suffix changed. Closing all open logs.");
   strcpy(logfile_suffix, s);
@@ -612,29 +620,30 @@
 {
   struct stat ss;
   int i;
+
 /* int x=1; */
-  char buf[1024];		/* Should be plenty */
+  char buf[1024];               /* Should be plenty */
 
   if (!keep_all_logs && max_logsize > 0) {
     for (i = 0; i < max_logs; i++) {
       if (logs[i].filename) {
-	if (stat(logs[i].filename, &ss) != 0) {
-	  break;
-	}
-	if ((ss.st_size >> 10) > max_logsize) {
-	  if (logs[i].f) {
-	    /* write to the log before closing it huh.. */
-	    putlog(LOG_MISC, "*", MISC_CLOGS, logs[i].filename, ss.st_size);
-	    fflush(logs[i].f);
-	    fclose(logs[i].f);
-	    logs[i].f = NULL;
-	  }
-
-	  egg_snprintf(buf, sizeof buf, "%s.yesterday", logs[i].filename);
-	  buf[1023] = 0;
-	  unlink(buf);
-	  movefile(logs[i].filename, buf);
-	}
+        if (stat(logs[i].filename, &ss) != 0) {
+          break;
+        }
+        if ((ss.st_size >> 10) > max_logsize) {
+          if (logs[i].f) {
+            /* write to the log before closing it huh.. */
+            putlog(LOG_MISC, "*", MISC_CLOGS, logs[i].filename, ss.st_size);
+            fflush(logs[i].f);
+            fclose(logs[i].f);
+            logs[i].f = NULL;
+          }
+
+          egg_snprintf(buf, sizeof buf, "%s.yesterday", logs[i].filename);
+          buf[1023] = 0;
+          unlink(buf);
+          movefile(logs[i].filename, buf);
+        }
       }
     }
   }
@@ -655,16 +664,17 @@
    */
   for (i = 0; i < max_logs; i++) {
     if (logs[i].f != NULL) {
-       if ((logs[i].repeats > 0) && quick_logs) {
-         /* Repeat.. if quicklogs used then display 'last message
-          * repeated x times' and reset repeats.
-	  */
+      if ((logs[i].repeats > 0) && quick_logs) {
+        /* Repeat.. if quicklogs used then display 'last message
+         * repeated x times' and reset repeats.
+         */
         char stamp[33];
+
         egg_strftime(&stamp[0], 32, LOG_TS, localtime(&now));
-	fprintf(logs[i].f, "%s ", stamp);
-	fprintf(logs[i].f, MISC_LOGREPEAT, logs[i].repeats);
-	/* Reset repeats */
-	logs[i].repeats = 0;
+        fprintf(logs[i].f, "%s ", stamp);
+        fprintf(logs[i].f, MISC_LOGREPEAT, logs[i].repeats);
+        /* Reset repeats */
+        logs[i].repeats = 0;
       }
       fflush(logs[i].f);
     }
@@ -676,11 +686,11 @@
  *     String substitution functions
  */
 
-static int	 cols = 0;
-static int	 colsofar = 0;
-static int	 blind = 0;
-static int	 subwidth = 70;
-static char	*colstr = NULL;
+static int cols = 0;
+static int colsofar = 0;
+static int blind = 0;
+static int subwidth = 70;
+static char *colstr = NULL;
 
 
 /* Add string to colstr
@@ -693,7 +703,7 @@
   if ((newcol[0]) && (newcol[0] != '\377'))
     colsofar++;
   colstr = nrealloc(colstr, strlen(colstr) + strlen(newcol) +
-		    (colstr[0] ? 2 : 1));
+                    (colstr[0] ? 2 : 1));
   if ((newcol[0]) && (newcol[0] != '\377')) {
     if (colstr[0])
       strcat(colstr, "\377");
@@ -709,7 +719,7 @@
       *p = 0;
       strcat(s, q);
       for (i = strlen(q); i < colwidth; i++)
-	strcat(s, " ");
+        strcat(s, " ");
       q = p + 1;
       p = strchr(q, '\377');
     }
@@ -745,13 +755,14 @@
 #define HELP_FLASH 8
 
 void help_subst(char *s, char *nick, struct flag_record *flags,
-		int isdcc, char *topic)
+                int isdcc, char *topic)
 {
   char xx[HELP_BUF_LEN + 1], sub[161], *current, *q, chr, *writeidx,
-  *readidx, *towrite;
+       *readidx, *towrite;
   struct chanset_t *chan;
   int i, j, center = 0;
   static int help_flags;
+
 #ifdef HAVE_UNAME
   struct utsname uname_info;
 #endif
@@ -789,71 +800,77 @@
     switch (chr) {
     case 'b':
       if (glob_hilite(*flags)) {
-	if (help_flags & HELP_IRC) {
-	  towrite = "\002";
-	} else if (help_flags & HELP_BOLD) {
-	  help_flags &= ~HELP_BOLD;
-	  towrite = "\033[0m";
-	} else {
-	  help_flags |= HELP_BOLD;
-	  towrite = "\033[1m";
-	}
+        if (help_flags & HELP_IRC) {
+          towrite = "\002";
+        }
+        else if (help_flags & HELP_BOLD) {
+          help_flags &= ~HELP_BOLD;
+          towrite = "\033[0m";
+        }
+        else {
+          help_flags |= HELP_BOLD;
+          towrite = "\033[1m";
+        }
       }
       break;
     case 'v':
       if (glob_hilite(*flags)) {
-	if (help_flags & HELP_IRC) {
-	  towrite = "\026";
-	} else if (help_flags & HELP_REV) {
-	  help_flags &= ~HELP_REV;
-	  towrite = "\033[0m";
-	} else {
-	  help_flags |= HELP_REV;
-	  towrite = "\033[7m";
-	}
+        if (help_flags & HELP_IRC) {
+          towrite = "\026";
+        }
+        else if (help_flags & HELP_REV) {
+          help_flags &= ~HELP_REV;
+          towrite = "\033[0m";
+        }
+        else {
+          help_flags |= HELP_REV;
+          towrite = "\033[7m";
+        }
       }
       break;
     case '_':
       if (glob_hilite(*flags)) {
-	if (help_flags & HELP_IRC) {
-	  towrite = "\037";
-	} else if (help_flags & HELP_UNDER) {
-	  help_flags &= ~HELP_UNDER;
-	  towrite = "\033[0m";
-	} else {
-	  help_flags |= HELP_UNDER;
-	  towrite = "\033[4m";
-	}
+        if (help_flags & HELP_IRC) {
+          towrite = "\037";
+        }
+        else if (help_flags & HELP_UNDER) {
+          help_flags &= ~HELP_UNDER;
+          towrite = "\033[0m";
+        }
+        else {
+          help_flags |= HELP_UNDER;
+          towrite = "\033[4m";
+        }
       }
       break;
     case 'f':
       if (glob_hilite(*flags)) {
-	if (help_flags & HELP_FLASH) {
-	  if (help_flags & HELP_IRC) {
-	    towrite = "\002\037";
-	  } else {
-	    towrite = "\033[0m";
-	  }
-	  help_flags &= ~HELP_FLASH;
-	} else {
-	  help_flags |= HELP_FLASH;
-	  if (help_flags & HELP_IRC) {
-	    towrite = "\037\002";
-	  } else {
-	    towrite = "\033[5m";
-	  }
-	}
+        if (help_flags & HELP_FLASH) {
+          if (help_flags & HELP_IRC)
+            towrite = "\002\037";
+          else
+            towrite = "\033[0m";
+          help_flags &= ~HELP_FLASH;
+        }
+        else {
+          help_flags |= HELP_FLASH;
+          if (help_flags & HELP_IRC)
+            towrite = "\037\002";
+          else
+            towrite = "\033[5m";
+        }
       }
       break;
     case 'U':
 #ifdef HAVE_UNAME
       if (uname(&uname_info) >= 0) {
-	egg_snprintf(sub, sizeof sub, "%s %s", uname_info.sysname,
-		       uname_info.release);
-	towrite = sub;
-      } else
+        egg_snprintf(sub, sizeof sub, "%s %s", uname_info.sysname,
+                     uname_info.release);
+        towrite = sub;
+      }
+      else
 #endif
-	towrite = "*UNKNOWN*";
+        towrite = "*UNKNOWN*";
       break;
     case 'B':
       towrite = (isdcc ? botnetnick : botname);
@@ -877,102 +894,105 @@
     case 'N':
       towrite = strchr(nick, ':');
       if (towrite)
-	towrite++;
+        towrite++;
       else
-	towrite = nick;
+        towrite = nick;
       break;
     case 'C':
       if (!blind)
-	for (chan = chanset; chan; chan = chan->next) {
-	  if ((strlen(chan->dname) + writeidx + 2) >=
-	      (s + HELP_BUF_LEN)) {
-	    strncpy(writeidx, chan->dname, (s + HELP_BUF_LEN) - writeidx);
-	    s[HELP_BUF_LEN] = 0;
-	    return;
-	  }
-	  writeidx += my_strcpy(writeidx, chan->dname);
-	  if (chan->next) {
-	    *writeidx++ = ',';
-	    *writeidx++ = ' ';
-	  }
-	}
+        for (chan = chanset; chan; chan = chan->next) {
+          if ((strlen(chan->dname) + writeidx + 2) >= (s + HELP_BUF_LEN)) {
+            strncpy(writeidx, chan->dname, (s + HELP_BUF_LEN) - writeidx);
+            s[HELP_BUF_LEN] = 0;
+            return;
+          }
+          writeidx += my_strcpy(writeidx, chan->dname);
+          if (chan->next) {
+            *writeidx++ = ',';
+            *writeidx++ = ' ';
+          }
+        }
       break;
     case '{':
       q = current;
       current++;
       while ((*current != '}') && (*current))
-	current++;
+        current++;
       if (*current) {
-	*current = 0;
-	current--;
-	q += 2;
-	/* Now q is the string and p is where the rest of the fcn expects */
-	if (!strncmp(q, "help=", 5)) {
-	  if (topic && egg_strcasecmp(q + 5, topic))
-	    blind |= 2;
-	  else
-	    blind &= ~2;
-	} else if (!(blind & 2)) {
-	  if (q[0] == '+') {
-	    struct flag_record fr =
-	    {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-
-	    break_down_flags(q + 1, &fr, NULL);
-	    if (!flagrec_ok(&fr, flags))
-	      blind |= 1;
-	    else
-	      blind &= ~1;
-	  } else if (q[0] == '-') {
-	    blind &= ~1;
-	  } else if (!egg_strcasecmp(q, "end")) {
-	    blind &= ~1;
-	    subwidth = 70;
-	    if (cols) {
-	      sub[0] = 0;
-	      subst_addcol(sub, "\377");
-	      nfree(colstr);
-	      colstr = NULL;
-	      cols = 0;
-	      towrite = sub;
-	    }
-	  } else if (!egg_strcasecmp(q, "center"))
-	    center = 1;
-	  else if (!strncmp(q, "cols=", 5)) {
-	    char *r;
-
-	    cols = atoi(q + 5);
-	    colsofar = 0;
-	    colstr = (char *) nmalloc(1);
-	    colstr[0] = 0;
-	    r = strchr(q + 5, '/');
-	    if (r != NULL)
-	      subwidth = atoi(r + 1);
-	  }
-	}
-      } else
-	current = q;		/* no } so ignore */
+        *current = 0;
+        current--;
+        q += 2;
+        /* Now q is the string and p is where the rest of the fcn expects */
+        if (!strncmp(q, "help=", 5)) {
+          if (topic && egg_strcasecmp(q + 5, topic))
+            blind |= 2;
+          else
+            blind &= ~2;
+        }
+        else if (!(blind & 2)) {
+          if (q[0] == '+') {
+            struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
+
+            break_down_flags(q + 1, &fr, NULL);
+            if (!flagrec_ok(&fr, flags))
+              blind |= 1;
+            else
+              blind &= ~1;
+          }
+          else if (q[0] == '-')
+            blind &= ~1;
+          else if (!egg_strcasecmp(q, "end")) {
+            blind &= ~1;
+            subwidth = 70;
+            if (cols) {
+              sub[0] = 0;
+              subst_addcol(sub, "\377");
+              nfree(colstr);
+              colstr = NULL;
+              cols = 0;
+              towrite = sub;
+            }
+          }
+          else if (!egg_strcasecmp(q, "center"))
+            center = 1;
+          else if (!strncmp(q, "cols=", 5)) {
+            char *r;
+
+            cols = atoi(q + 5);
+            colsofar = 0;
+            colstr = (char *) nmalloc(1);
+            colstr[0] = 0;
+            r = strchr(q + 5, '/');
+            if (r != NULL)
+              subwidth = atoi(r + 1);
+          }
+        }
+      }
+      else
+        current = q;            /* no } so ignore */
       break;
     default:
       if (!blind) {
-	*writeidx++ = chr;
-	if (writeidx >= (s + HELP_BUF_LEN)) {
-	  *writeidx = 0;
-	  return;
-	}
+        *writeidx++ = chr;
+        if (writeidx >= (s + HELP_BUF_LEN)) {
+          *writeidx = 0;
+          return;
+        }
       }
     }
     if (towrite && !blind) {
       if ((writeidx + strlen(towrite)) >= (s + HELP_BUF_LEN)) {
-	strncpy(writeidx, towrite, (s + HELP_BUF_LEN) - writeidx);
-	s[HELP_BUF_LEN] = 0;
-	return;
+        strncpy(writeidx, towrite, (s + HELP_BUF_LEN) - writeidx);
+        s[HELP_BUF_LEN] = 0;
+        return;
       }
       writeidx += my_strcpy(writeidx, towrite);
     }
     if (chr) {
       readidx = current + 2;
       current = strchr(readidx, '%');
-    } else {
+    }
+    else {
       readidx = current + 1;
       current = NULL;
     }
@@ -985,7 +1005,8 @@
       return;
     }
     strcpy(writeidx, readidx);
-  } else
+  }
+  else
     *writeidx = 0;
   if (center) {
     strcpy(xx, s);
@@ -993,7 +1014,7 @@
     if (i > 0) {
       s[0] = 0;
       for (j = 0; j < i; j++)
-	s[j] = ' ';
+        s[j] = ' ';
       strcpy(s + i, xx);
     }
   }
@@ -1014,22 +1035,23 @@
     while (!feof(f)) {
       fgets(s, HELP_BUF_LEN, f);
       if (!feof(f)) {
-	p = s;
-	while ((q = strstr(p, "%{help="))) {
-	  q += 7;
-	  if ((p = strchr(q, '}'))) {
-	    *p = 0;
-	    list = nmalloc(sizeof(struct help_list_t));
-
-	    list->name = nmalloc(p - q + 1);
-	    strcpy(list->name, q);
-	    list->next = current->first;
-	    list->type = type;
-	    current->first = list;
-	    p++;
-	  } else
-	    p = "";
-	}
+        p = s;
+        while ((q = strstr(p, "%{help="))) {
+          q += 7;
+          if ((p = strchr(q, '}'))) {
+            *p = 0;
+            list = nmalloc(sizeof(struct help_list_t));
+
+            list->name = nmalloc(p - q + 1);
+            strcpy(list->name, q);
+            list->next = current->first;
+            list->type = type;
+            current->first = list;
+            p++;
+          }
+          else
+            p = "";
+        }
       }
     }
     fclose(f);
@@ -1043,7 +1065,7 @@
 
   for (current = help_list; current; current = current->next)
     if (!strcmp(current->name, file))
-      return;			/* Already exists, can't re-add :P */
+      return;                   /* Already exists, can't re-add :P */
   current = nmalloc(sizeof(struct help_ref));
 
   current->name = nmalloc(strlen(file) + 1);
@@ -1067,15 +1089,15 @@
   for (current = help_list; current; last = current, current = current->next)
     if (!strcmp(current->name, file)) {
       while ((item = current->first)) {
-	current->first = item->next;
-	nfree(item->name);
-	nfree(item);
+        current->first = item->next;
+        nfree(item->name);
+        nfree(item);
       }
       nfree(current->name);
       if (last)
-	last->next = current->next;
+        last->next = current->next;
       else
-	help_list = current->next;
+        help_list = current->next;
       nfree(current);
       return;
     }
@@ -1110,7 +1132,7 @@
     dprintf(idx, "HELP FILE(S): %s\n", current->name);
     for (item = current->first; item; item = item->next) {
       dprintf(idx, "   %s (%s)\n", item->name, (item->type == 0) ? "msg/" :
-	      (item->type == 1) ? "" : "set/");
+              (item->type == 1) ? "" : "set/");
     }
   }
 }
@@ -1124,24 +1146,24 @@
   struct help_list_t *item;
 
   /* Somewhere here goes the eventual substituation */
-  if (!(dcc & HELP_TEXT))
-  {
+  if (!(dcc & HELP_TEXT)) {
     for (current = help_list; current; current = current->next)
       for (item = current->first; item; item = item->next)
-	if (!strcmp(item->name, file)) {
-	  if (!item->type && !dcc) {
-	    egg_snprintf(s, sizeof s, "%smsg/%s", helpdir, current->name);
-	    if ((f = fopen(s, "r")))
-	      return f;
-	  } else if (dcc && item->type) {
-	    if (item->type == 1)
-	      egg_snprintf(s, sizeof s, "%s%s", helpdir, current->name);
-	    else
-	      egg_snprintf(s, sizeof s, "%sset/%s", helpdir, current->name);
-	    if ((f = fopen(s, "r")))
-	      return f;
-	  }
-	}
+        if (!strcmp(item->name, file)) {
+          if (!item->type && !dcc) {
+            egg_snprintf(s, sizeof s, "%smsg/%s", helpdir, current->name);
+            if ((f = fopen(s, "r")))
+              return f;
+          }
+          else if (dcc && item->type) {
+            if (item->type == 1)
+              egg_snprintf(s, sizeof s, "%s%s", helpdir, current->name);
+            else
+              egg_snprintf(s, sizeof s, "%sset/%s", helpdir, current->name);
+            if ((f = fopen(s, "r")))
+              return f;
+          }
+        }
     /* No match was found, so we better return NULL */
     return NULL;
   }
@@ -1160,19 +1182,19 @@
   FILE *f = resolve_help(fl, file);
 
   if (f) {
-    help_subst(NULL, NULL, 0, HELP_IRC, NULL);	/* Clear flags */
+    help_subst(NULL, NULL, 0, HELP_IRC, NULL);  /* Clear flags */
     while (!feof(f)) {
       fgets(s, HELP_BUF_LEN, f);
       if (!feof(f)) {
-	if (s[strlen(s) - 1] == '\n')
-	  s[strlen(s) - 1] = 0;
-	if (!s[0])
-	  strcpy(s, " ");
-	help_subst(s, who, flags, 0, file);
-	if ((s[0]) && (strlen(s) > 1)) {
-	  dprintf(DP_HELP, "NOTICE %s :%s\n", who, s);
-	  lines++;
-	}
+        if (s[strlen(s) - 1] == '\n')
+          s[strlen(s) - 1] = 0;
+        if (!s[0])
+          strcpy(s, " ");
+        help_subst(s, who, flags, 0, file);
+        if ((s[0]) && (strlen(s) > 1)) {
+          dprintf(DP_HELP, "NOTICE %s :%s\n", who, s);
+          lines++;
+        }
       }
     }
     fclose(f);
@@ -1182,26 +1204,26 @@
 }
 
 static int display_tellhelp(int idx, char *file, FILE *f,
-			    struct flag_record *flags)
+                            struct flag_record *flags)
 {
   char s[HELP_BUF_LEN + 1];
   int lines = 0;
 
   if (f) {
     help_subst(NULL, NULL, 0,
-	       (dcc[idx].status & STAT_TELNET) ? 0 : HELP_IRC, NULL);
+               (dcc[idx].status & STAT_TELNET) ? 0 : HELP_IRC, NULL);
     while (!feof(f)) {
       fgets(s, HELP_BUF_LEN, f);
       if (!feof(f)) {
-	if (s[strlen(s) - 1] == '\n')
-	  s[strlen(s) - 1] = 0;
-	if (!s[0])
-	  strcpy(s, " ");
-	help_subst(s, dcc[idx].nick, flags, 1, file);
-	if (s[0]) {
-	  dprintf(idx, "%s\n", s);
-	  lines++;
-	}
+        if (s[strlen(s) - 1] == '\n')
+          s[strlen(s) - 1] = 0;
+        if (!s[0])
+          strcpy(s, " ");
+        help_subst(s, dcc[idx].nick, flags, 1, file);
+        if (s[0]) {
+          dprintf(idx, "%s\n", s);
+          lines++;
+        }
       }
     }
     fclose(f);
@@ -1233,12 +1255,12 @@
   for (current = help_list; current; current = current->next)
     for (item = current->first; item; item = item->next)
       if (wild_match(match, item->name) && item->type) {
-	if (item->type == 1)
-	  egg_snprintf(s, sizeof s, "%s%s", helpdir, current->name);
-	else
-	  egg_snprintf(s, sizeof s, "%sset/%s", helpdir, current->name);
-	if ((f = fopen(s, "r")))
-	  display_tellhelp(idx, item->name, f, flags);
+        if (item->type == 1)
+          egg_snprintf(s, sizeof s, "%s%s", helpdir, current->name);
+        else
+          egg_snprintf(s, sizeof s, "%sset/%s", helpdir, current->name);
+        if ((f = fopen(s, "r")))
+          display_tellhelp(idx, item->name, f, flags);
       }
   if (!s[0])
     dprintf(idx, "%s\n", IRC_NOHELP2);
@@ -1258,12 +1280,12 @@
     for (item = current->first; item; item = item->next)
       if (!strcmp(match, item->name) && item->type) {
 
-	if (item->type == 1)
-	  egg_snprintf(s, sizeof s, "%s%s", helpdir, current->name);
-	else
-	  egg_snprintf(s, sizeof s, "%sset/%s", helpdir, current->name);
-	if ((f = fopen(s, "r")))
-	  display_tellhelp(idx, item->name, f, flags);
+        if (item->type == 1)
+          egg_snprintf(s, sizeof s, "%s%s", helpdir, current->name);
+        else
+          egg_snprintf(s, sizeof s, "%sset/%s", helpdir, current->name);
+        if ((f = fopen(s, "r")))
+          display_tellhelp(idx, item->name, f, flags);
       }
   if (!s[0])
     dprintf(idx, "%s\n", IRC_NOHELP2);
@@ -1274,11 +1296,11 @@
 void sub_lang(int idx, char *text)
 {
   char s[1024];
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.chat->con_chan);
   help_subst(NULL, NULL, 0,
-	     (dcc[idx].status & STAT_TELNET) ? 0 : HELP_IRC, NULL);
+             (dcc[idx].status & STAT_TELNET) ? 0 : HELP_IRC, NULL);
   strncpyz(s, text, sizeof s);
   if (s[strlen(s) - 1] == '\n')
     s[strlen(s) - 1] = 0;
@@ -1296,6 +1318,7 @@
 char *extracthostname(char *hostmask)
 {
   char *p = strrchr(hostmask, '@');
+
   return p ? p + 1 : "";
 }
 
@@ -1305,7 +1328,7 @@
 {
   FILE *vv;
   char s[1024];
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   if (!is_file(motdfile))
     return;
@@ -1318,17 +1341,17 @@
   dprintf(idx, "\n");
   /* reset the help_subst variables to their defaults */
   help_subst(NULL, NULL, 0,
-	     (dcc[idx].status & STAT_TELNET) ? 0 : HELP_IRC, NULL);
+             (dcc[idx].status & STAT_TELNET) ? 0 : HELP_IRC, NULL);
   while (!feof(vv)) {
     fgets(s, 120, vv);
     if (!feof(vv)) {
       if (s[strlen(s) - 1] == '\n')
-	s[strlen(s) - 1] = 0;
+        s[strlen(s) - 1] = 0;
       if (!s[0])
-	strcpy(s, " ");
+        strcpy(s, " ");
       help_subst(s, dcc[idx].nick, &fr, 1, botnetnick);
       if (s[0])
-	dprintf(idx, "%s\n", s);
+        dprintf(idx, "%s\n", s);
     }
   }
   fclose(vv);
@@ -1337,10 +1360,11 @@
 
 /* Show banner to telnet user 
  */
-void show_banner(int idx) {
+void show_banner(int idx)
+{
   FILE *vv;
   char s[1024];
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   if (!is_file(bannerfile))
     return;
@@ -1349,14 +1373,14 @@
   if (!vv)
     return;
 
-  get_user_flagrec(dcc[idx].user, &fr,dcc[idx].u.chat->con_chan);
+  get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.chat->con_chan);
   /* reset the help_subst variables to their defaults */
   help_subst(NULL, NULL, 0, 0, NULL);
-  while(!feof(vv)) {
+  while (!feof(vv)) {
     fgets(s, 120, vv);
     if (!feof(vv)) {
       if (!s[0])
-	strcpy(s, " \n");
+        strcpy(s, " \n");
       help_subst(s, dcc[idx].nick, &fr, 0, botnetnick);
       dprintf(idx, "%s", s);
     }
@@ -1403,10 +1427,10 @@
  */
 char *str_escape(const char *str, const char div, const char mask)
 {
-  const int	 len = strlen(str);
-  int		 buflen = (2 * len), blen = 0;
-  char		*buf = nmalloc(buflen + 1), *b = buf;
-  const char	*s;
+  const int len = strlen(str);
+  int buflen = (2 * len), blen = 0;
+  char *buf = nmalloc(buflen + 1), *b = buf;
+  const char *s;
 
   if (!buf)
     return NULL;
@@ -1416,7 +1440,7 @@
       buflen = (buflen * 2);
       buf = nrealloc(buf, buflen + 1);
       if (!buf)
-	return NULL;
+        return NULL;
       b = buf + blen;
     }
 
@@ -1424,7 +1448,8 @@
       sprintf(b, "%c%02x", mask, *s);
       b += 3;
       blen += 3;
-    } else {
+    }
+    else {
       *(b++) = *s;
       blen++;
     }
@@ -1452,20 +1477,22 @@
  */
 char *strchr_unescape(char *str, const char div, register const char esc_char)
 {
-  char		 buf[3];
-  register char	*s, *p;
+  char buf[3];
+  register char *s, *p;
 
   buf[2] = 0;
   for (s = p = str; *s; s++, p++) {
-    if (*s == esc_char) {	/* Found escape character.		*/
+    if (*s == esc_char) {       /* Found escape character.              */
       /* Convert code to character. */
       buf[0] = s[1], buf[1] = s[2];
       *p = (unsigned char) strtol(buf, NULL, 16);
       s += 2;
-    } else if (*s == div) {
+    }
+    else if (*s == div) {
       *p = *s = 0;
-      return (s + 1);		/* Found searched for character.	*/
-    } else
+      return (s + 1);           /* Found searched for character.        */
+    }
+    else
       *p = *s;
   }
   *p = 0;
Index: eggdrop1.6/src/misc_file.c
diff -u eggdrop1.6/src/misc_file.c:1.8 eggdrop1.6/src/misc_file.c:1.9
--- eggdrop1.6/src/misc_file.c:1.8	Wed Jan 22 20:13:29 2003
+++ eggdrop1.6/src/misc_file.c	Tue Jan 28 00:37:24 2003
@@ -2,7 +2,7 @@
  * misc.c -- handles:
  *   copyfile() movefile() file_readable()
  *
- * $Id: misc_file.c,v 1.8 2003/01/23 02:13:29 wcc Exp $
+ * $Id: misc_file.c,v 1.9 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -61,11 +61,11 @@
   for (x = 1; x > 0;) {
     x = read(fi, buf, 512);
     if (x > 0) {
-      if (write(fo, buf, x) < x) {	/* Couldn't write */
-	close(fo);
-	close(fi);
-	unlink(newpath);
-	return 4;
+      if (write(fo, buf, x) < x) {      /* Couldn't write */
+        close(fo);
+        close(fi);
+        unlink(newpath);
+        return 4;
       }
     }
   }
Index: eggdrop1.6/src/misc_file.h
diff -u eggdrop1.6/src/misc_file.h:1.5 eggdrop1.6/src/misc_file.h:1.6
--- eggdrop1.6/src/misc_file.h:1.5	Wed Jan 22 20:13:29 2003
+++ eggdrop1.6/src/misc_file.h	Tue Jan 28 00:37:24 2003
@@ -2,7 +2,7 @@
  * misc_file.h
  *   prototypes for misc_file.c
  *
- * $Id: misc_file.h,v 1.5 2003/01/23 02:13:29 wcc Exp $
+ * $Id: misc_file.h,v 1.6 2003/01/28 06:37:24 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -29,4 +29,4 @@
 int movefile(char *, char *);
 int file_readable(char *);
 
-#endif				/* _EGG_MISC_FILE_H */
+#endif /* _EGG_MISC_FILE_H */
Index: eggdrop1.6/src/mod/assoc.mod/assoc.c
diff -u eggdrop1.6/src/mod/assoc.mod/assoc.c:1.22 eggdrop1.6/src/mod/assoc.mod/assoc.c:1.23
--- eggdrop1.6/src/mod/assoc.mod/assoc.c:1.22	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/mod/assoc.mod/assoc.c	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * assoc.c -- part of assoc.mod
  *   the assoc code, moved here mainly from botnet.c for module work
  *
- * $Id: assoc.c,v 1.22 2002/12/24 02:30:06 wcc Exp $
+ * $Id: assoc.c,v 1.23 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -43,8 +43,7 @@
 /* Channel name-number associations */
 static assoc_t *assoc;
 
-static void botnet_send_assoc(int idx, int chan, char *nick,
-			      char *buf)
+static void botnet_send_assoc(int idx, int chan, char *nick, char *buf)
 {
   char x[1024];
   int idx2;
@@ -52,8 +51,8 @@
   simple_sprintf(x, "assoc %D %s %s", chan, nick, buf);
   for (idx2 = 0; idx2 < dcc_total; idx2++)
     if ((dcc[idx2].type == &DCC_BOT) && (idx2 != idx) &&
-	(b_numver(idx2) >= NEAT_BOTNET) &&
-	!(bot_flags(dcc[idx2].user) & BOT_ISOLATE))
+        (b_numver(idx2) >= NEAT_BOTNET) &&
+        !(bot_flags(dcc[idx2].user) & BOT_ISOLATE))
       botnet_send_zapf(idx2, botnetnick, dcc[idx2].nick, x);
 }
 
@@ -77,10 +76,10 @@
 
     if (!(bot_flags(dcc[idx].user) & BOT_ISOLATE)) {
       for (a = assoc; a && a->name[0]; a = a->next) {
-          simple_sprintf(x, "assoc %D %s %s", (int) a->channel, botnetnick,
-           		a->name);
-	  botnet_send_zapf(idx, botnetnick, dcc[idx].nick, x);
-	}
+        simple_sprintf(x, "assoc %D %s %s", (int) a->channel, botnetnick,
+                       a->name);
+        botnet_send_zapf(idx, botnetnick, dcc[idx].nick, x);
+      }
     }
   }
 }
@@ -92,12 +91,13 @@
   while (a) {
     if (a->channel == chan) {
       if (last != NULL)
-	last->next = a->next;
+        last->next = a->next;
       else
-	assoc = a->next;
+        assoc = a->next;
       nfree(a);
       a = NULL;
-    } else {
+    }
+    else {
       last = a;
       a = a->next;
     }
@@ -138,9 +138,9 @@
       b->channel = chan;
       strncpyz(b->name, name, sizeof b->name);
       if (old == NULL)
-	assoc = b;
+        assoc = b;
       else
-	old->next = b;
+        old->next = b;
       return;
     }
   }
@@ -185,8 +185,8 @@
   }
   dprintf(idx, " %s  %s\n", ASSOC_CHAN, ASSOC_NAME);
   for (; a && a->name[0]; a = a->next)
-      dprintf(idx, "%c%5d %s\n", (a->channel < GLOBAL_CHANS) ? ' ' : '*',
-	      a->channel % GLOBAL_CHANS, a->name);
+    dprintf(idx, "%c%5d %s\n", (a->channel < GLOBAL_CHANS) ? ' ' : '*',
+            a->channel % GLOBAL_CHANS, a->name);
   return;
 }
 
@@ -198,32 +198,36 @@
   if (!par[0]) {
     putlog(LOG_CMDS, "*", "#%s# assoc", dcc[idx].nick);
     dump_assoc(idx);
-  } else if (!u || !(u->flags & USER_BOTMAST)) {
+  }
+  else if (!u || !(u->flags & USER_BOTMAST)) {
     dprintf(idx, "%s", ASSOC_NOSUCHCMD);
-  } else {
+  }
+  else {
     num = newsplit(&par);
     if (num[0] == '*') {
       chan = GLOBAL_CHANS + atoi(num + 1);
       if ((chan < GLOBAL_CHANS) || (chan > 199999)) {
-	   dprintf(idx, "%s\n", ASSOC_LCHAN_RANGE);
-	return 0;
+        dprintf(idx, "%s\n", ASSOC_LCHAN_RANGE);
+        return 0;
       }
-    } else {
+    }
+    else {
       chan = atoi(num);
       if (chan == 0) {
-	    dprintf(idx, "%s\n", ASSOC_PARTYLINE);
-	return 0;
-      } else if ((chan < 1) || (chan > 99999)) {
-	    dprintf(idx, "%s\n", ASSOC_CHAN_RANGE);
-	return 0;
+        dprintf(idx, "%s\n", ASSOC_PARTYLINE);
+        return 0;
+      }
+      else if ((chan < 1) || (chan > 99999)) {
+        dprintf(idx, "%s\n", ASSOC_CHAN_RANGE);
+        return 0;
       }
     }
     if (!par[0]) {
       /* Remove an association */
       if (get_assoc_name(chan) == NULL) {
-	    dprintf(idx, ASSOC_NONAME_CHAN, (chan < GLOBAL_CHANS) ? "" : "*",
-	            chan % GLOBAL_CHANS);
-	return 0;
+        dprintf(idx, ASSOC_NONAME_CHAN, (chan < GLOBAL_CHANS) ? "" : "*",
+                chan % GLOBAL_CHANS);
+        return 0;
       }
       kill_assoc(chan);
       putlog(LOG_CMDS, "*", "#%s# assoc %d", dcc[idx].nick, chan);
@@ -231,7 +235,7 @@
               chan % GLOBAL_CHANS);
       chanout_but(-1, chan, ASSOC_REMOUT_CHAN, dcc[idx].nick);
       if (chan < GLOBAL_CHANS)
-	botnet_send_assoc(-1, chan, dcc[idx].nick, "0");
+        botnet_send_assoc(-1, chan, dcc[idx].nick, "0");
       return 0;
     }
     if (strlen(par) > 20) {
@@ -246,18 +250,19 @@
     putlog(LOG_CMDS, "*", "#%s# assoc %d %s", dcc[idx].nick, chan, par);
     dprintf(idx, ASSOC_NEWNAME_CHAN, (chan < GLOBAL_CHANS) ? "" : "*",
             chan % GLOBAL_CHANS, par);
-    chanout_but(-1, chan, ASSOC_NEWOUT_CHAN, dcc[idx].nick,
-		par);
+    chanout_but(-1, chan, ASSOC_NEWOUT_CHAN, dcc[idx].nick, par);
     if (chan < GLOBAL_CHANS)
       botnet_send_assoc(-1, chan, dcc[idx].nick, par);
   }
   return 0;
 }
 
-static int tcl_killassoc STDVAR {
+static int tcl_killassoc STDVAR
+{
   int chan;
 
   BADARGS(2, 2, " chan");
+  
   if (argv[1][0] == '&')
     kill_all_assoc();
   else {
@@ -267,16 +272,19 @@
       return TCL_ERROR;
     }
     kill_assoc(chan);
+
     botnet_send_assoc(-1, chan, "*script*", "0");
   }
   return TCL_OK;
 }
 
-static int tcl_assoc STDVAR {
+static int tcl_assoc STDVAR
+{
   int chan;
   char name[21], *p;
 
   BADARGS(2, 3, " chan ?name?");
+  
   if ((argc == 2) && ((argv[1][0] < '0') || (argv[1][0] > '9'))) {
     chan = get_assoc(argv[1]);
     if (chan == -1)
@@ -322,19 +330,21 @@
       nick = newsplit(&par);
       s1 = get_assoc_name(chan);
       if (linking && ((s1 == NULL) || (s1[0] == 0) ||
-		      (((int) get_user(find_entry_type("BOTFL"),
-				       dcc[idx].user) & BOT_HUB)))) {
-	add_assoc(par, chan);
-	botnet_send_assoc(idx, chan, nick, par);
-	chanout_but(-1, chan, ASSOC_CHNAME_NAMED, nick, par);
-      } else if (par[0] == '0') {
-	kill_assoc(chan);
-	chanout_but(-1, chan, ASSOC_CHNAME_REM, botnick, nick);
-      } else if (get_assoc(par) != chan) {
-	/* New one i didn't know about -- pass it on */
-	s1 = get_assoc_name(chan);
-	add_assoc(par, chan);
-	chanout_but(-1, chan, ASSOC_CHNAME_NAMED2, botnick, nick, par);
+          (((int) get_user(find_entry_type("BOTFL"),
+          dcc[idx].user) & BOT_HUB)))) {
+        add_assoc(par, chan);
+        botnet_send_assoc(idx, chan, nick, par);
+        chanout_but(-1, chan, ASSOC_CHNAME_NAMED, nick, par);
+      }
+      else if (par[0] == '0') {
+        kill_assoc(chan);
+        chanout_but(-1, chan, ASSOC_CHNAME_REM, botnick, nick);
+      }
+      else if (get_assoc(par) != chan) {
+        /* New one i didn't know about -- pass it on */
+        s1 = get_assoc_name(chan);
+        add_assoc(par, chan);
+        chanout_but(-1, chan, ASSOC_CHNAME_NAMED2, botnick, nick, par);
       }
     }
   }
@@ -352,34 +362,29 @@
       count++;
       size += sizeof(assoc_t);
     }
-    dprintf(idx, "    %d assocs using %d bytes\n",
-	    count, size);
+    dprintf(idx, "    %d assocs using %d bytes\n", count, size);
   }
 }
 
-static cmd_t mydcc[] =
-{
-  {"assoc",	"",	cmd_assoc,		NULL},
-  {NULL, 	NULL,	NULL,			NULL}
+static cmd_t mydcc[] = {
+  {"assoc", "",   cmd_assoc, NULL},
+  {NULL,    NULL, NULL,      NULL}
 };
 
-static cmd_t mybot[] =
-{
-  {"assoc",	"",	(Function) zapf_assoc,	NULL},
-  {NULL,        NULL,   NULL,                   NULL}
+static cmd_t mybot[] = {
+  {"assoc", "",   (Function) zapf_assoc, NULL},
+  {NULL,    NULL, NULL,                  NULL}
 };
 
-static cmd_t mylink[] =
-{
-  {"*",		"",	(Function) link_assoc,	"assoc"},
-  {NULL,	NULL,	NULL,			NULL}
+static cmd_t mylink[] = {
+  {"*",  "",   (Function) link_assoc, "assoc"},
+  {NULL, NULL, NULL,                     NULL}
 };
 
-static tcl_cmds mytcl[] =
-{
-  {"assoc",		tcl_assoc},
-  {"killassoc",		tcl_killassoc},
-  {NULL,		NULL}
+static tcl_cmds mytcl[] = {
+  {"assoc",         tcl_assoc},
+  {"killassoc", tcl_killassoc},
+  {NULL,                 NULL}
 };
 
 static char *assoc_close()
@@ -397,15 +402,14 @@
 
 EXPORT_SCOPE char *assoc_start();
 
-static Function assoc_table[] =
-{
+static Function assoc_table[] = {
   (Function) assoc_start,
   (Function) assoc_close,
   (Function) assoc_expmem,
   (Function) assoc_report,
 };
 
-char *assoc_start(Function * global_funcs)
+char *assoc_start(Function *global_funcs)
 {
   global = global_funcs;
 
Index: eggdrop1.6/src/mod/assoc.mod/assoc.h
diff -u eggdrop1.6/src/mod/assoc.mod/assoc.h:1.5 eggdrop1.6/src/mod/assoc.mod/assoc.h:1.6
--- eggdrop1.6/src/mod/assoc.mod/assoc.h:1.5	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/mod/assoc.mod/assoc.h	Tue Jan 28 00:37:25 2003
@@ -1,7 +1,7 @@
 /*
  * assoc.h -- part of assoc.mod
  *
- * $Id: assoc.h,v 1.5 2002/12/24 02:30:06 wcc Exp $
+ * $Id: assoc.h,v 1.6 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -42,4 +42,4 @@
 #define ASSOC_CHNAME_TOOLONG	get_language(0xb00e)
 #define ASSOC_CHNAME_FIRSTCHAR	get_language(0xb00f)
 
-#endif				/* _EGG_MOD_ASSOC_ASSOC_H */
+#endif /* _EGG_MOD_ASSOC_ASSOC_H */
Index: eggdrop1.6/src/mod/blowfish.mod/bf_tab.h
diff -u eggdrop1.6/src/mod/blowfish.mod/bf_tab.h:1.6 eggdrop1.6/src/mod/blowfish.mod/bf_tab.h:1.7
--- eggdrop1.6/src/mod/blowfish.mod/bf_tab.h:1.6	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/mod/blowfish.mod/bf_tab.h	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * bf_tab.h -- part of blowfish.mod
  *   Blowfish P-box and S-box tables
  *
- * $Id: bf_tab.h,v 1.6 2002/12/24 02:30:06 wcc Exp $
+ * $Id: bf_tab.h,v 1.7 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -25,276 +25,274 @@
 #ifndef _EGG_MOD_BLOWFISH_BF_TAB_H
 #define _EGG_MOD_BLOWFISH_BF_TAB_H
 
-static u_32bit_t initbf_P[bf_N + 2] =
-{
+static u_32bit_t initbf_P[bf_N + 2] = {
   0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344,
   0xa4093822, 0x299f31d0, 0x082efa98, 0xec4e6c89,
   0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c,
   0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917,
   0x9216d5d9, 0x8979fb1b,
 };
-static u_32bit_t initbf_S[4][256] =
-{
+static u_32bit_t initbf_S[4][256] = {
   {
-    0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
-    0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
-    0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
-    0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
-    0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
-    0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
-    0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef,
-    0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e,
-    0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
-    0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
-    0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce,
-    0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
-    0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e,
-    0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677,
-    0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
-    0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032,
-    0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88,
-    0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
-    0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e,
-    0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
-    0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
-    0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98,
-    0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88,
-    0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
-    0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
-    0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d,
-    0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
-    0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7,
-    0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba,
-    0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
-    0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f,
-    0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09,
-    0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
-    0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb,
-    0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
-    0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
-    0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab,
-    0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82,
-    0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
-    0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
-    0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0,
-    0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
-    0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790,
-    0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8,
-    0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
-    0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0,
-    0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7,
-    0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
-    0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad,
-    0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
-    0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
-    0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9,
-    0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477,
-    0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
-    0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
-    0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af,
-    0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
-    0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
-    0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41,
-    0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
-    0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
-    0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
-    0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
-    0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a},
+   0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
+   0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99,
+   0x24a19947, 0xb3916cf7, 0x0801f2e2, 0x858efc16,
+   0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e,
+   0x0d95748f, 0x728eb658, 0x718bcd58, 0x82154aee,
+   0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013,
+   0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef,
+   0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e,
+   0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60,
+   0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440,
+   0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce,
+   0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a,
+   0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e,
+   0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677,
+   0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193,
+   0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032,
+   0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88,
+   0x23893e81, 0xd396acc5, 0x0f6d6ff3, 0x83f44239,
+   0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e,
+   0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0,
+   0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3,
+   0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98,
+   0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88,
+   0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe,
+   0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6,
+   0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d,
+   0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b,
+   0x075372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7,
+   0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x04c006ba,
+   0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463,
+   0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f,
+   0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09,
+   0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3,
+   0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb,
+   0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279,
+   0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8,
+   0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab,
+   0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82,
+   0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db,
+   0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573,
+   0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0,
+   0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b,
+   0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790,
+   0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8,
+   0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4,
+   0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0,
+   0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7,
+   0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c,
+   0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad,
+   0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1,
+   0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299,
+   0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9,
+   0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477,
+   0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf,
+   0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49,
+   0x00250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af,
+   0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa,
+   0x78c14389, 0xd95a537f, 0x207d5ba2, 0x02e5b9c5,
+   0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41,
+   0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915,
+   0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400,
+   0x08ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915,
+   0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664,
+   0x53b02d5d, 0xa99f8fa1, 0x08ba4799, 0x6e85076a},
   {
-    0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,
-    0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,
-    0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
-    0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e,
-    0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6,
-    0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
-    0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e,
-    0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1,
-    0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
-    0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8,
-    0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
-    0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
-    0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701,
-    0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7,
-    0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
-    0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
-    0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf,
-    0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
-    0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e,
-    0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87,
-    0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
-    0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2,
-    0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16,
-    0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
-    0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b,
-    0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
-    0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
-    0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3,
-    0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f,
-    0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
-    0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
-    0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960,
-    0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
-    0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28,
-    0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802,
-    0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
-    0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510,
-    0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf,
-    0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
-    0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e,
-    0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
-    0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
-    0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8,
-    0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281,
-    0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
-    0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
-    0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128,
-    0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
-    0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0,
-    0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0,
-    0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
-    0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250,
-    0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3,
-    0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
-    0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00,
-    0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
-    0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
-    0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
-    0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735,
-    0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
-    0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
-    0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
-    0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
-    0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7},
+   0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623,
+   0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266,
+   0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1,
+   0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e,
+   0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6,
+   0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1,
+   0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x021ecc5e,
+   0x09686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1,
+   0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737,
+   0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8,
+   0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x0200b3ff,
+   0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd,
+   0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701,
+   0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7,
+   0xa9446146, 0x0fd0030e, 0xecc8c73e, 0xa4751e41,
+   0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331,
+   0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf,
+   0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af,
+   0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e,
+   0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87,
+   0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c,
+   0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2,
+   0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16,
+   0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd,
+   0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b,
+   0x043556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509,
+   0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e,
+   0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3,
+   0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f,
+   0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a,
+   0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4,
+   0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960,
+   0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66,
+   0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x018cff28,
+   0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802,
+   0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84,
+   0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510,
+   0x13cca830, 0xeb61bd96, 0x0334fe1e, 0xaa0363cf,
+   0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14,
+   0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e,
+   0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50,
+   0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7,
+   0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8,
+   0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281,
+   0x0e358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99,
+   0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696,
+   0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128,
+   0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73,
+   0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0,
+   0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0,
+   0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105,
+   0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250,
+   0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3,
+   0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285,
+   0x095bbf00, 0xad19489d, 0x1462b174, 0x23820e00,
+   0x58428d2a, 0x0c55f5ea, 0x1dadf43e, 0x233f7061,
+   0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb,
+   0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e,
+   0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735,
+   0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc,
+   0x9e447a2e, 0xc3453484, 0xfdd56705, 0x0e1e9ec9,
+   0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340,
+   0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20,
+   0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7},
   {
-    0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
-    0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
-    0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
-    0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840,
-    0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45,
-    0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
-    0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
-    0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb,
-    0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
-    0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6,
-    0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42,
-    0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
-    0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2,
-    0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb,
-    0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
-    0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b,
-    0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
-    0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
-    0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3,
-    0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc,
-    0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
-    0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
-    0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b,
-    0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
-    0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922,
-    0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728,
-    0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
-    0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e,
-    0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37,
-    0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
-    0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804,
-    0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
-    0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
-    0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb,
-    0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d,
-    0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
-    0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
-    0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9,
-    0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
-    0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe,
-    0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d,
-    0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
-    0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f,
-    0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61,
-    0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
-    0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9,
-    0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
-    0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
-    0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e,
-    0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633,
-    0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
-    0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,
-    0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52,
-    0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
-    0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5,
-    0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62,
-    0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
-    0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
-    0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24,
-    0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
-    0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
-    0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
-    0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
-    0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0},
+   0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934,
+   0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068,
+   0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af,
+   0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840,
+   0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45,
+   0xbfbc09ec, 0x03bd9785, 0x7fac6dd0, 0x31cb8504,
+   0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a,
+   0x28507825, 0x530429f4, 0x0a2c86da, 0xe9b66dfb,
+   0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee,
+   0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6,
+   0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42,
+   0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b,
+   0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2,
+   0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb,
+   0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527,
+   0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b,
+   0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33,
+   0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c,
+   0xfdf8e802, 0x04272f70, 0x80bb155c, 0x05282ce3,
+   0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc,
+   0x07f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17,
+   0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564,
+   0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b,
+   0x0e12b4c2, 0x02e1329e, 0xaf664fd1, 0xcad18115,
+   0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922,
+   0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728,
+   0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0,
+   0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e,
+   0x0a476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37,
+   0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d,
+   0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804,
+   0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b,
+   0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3,
+   0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb,
+   0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d,
+   0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c,
+   0x6a124237, 0xb79251e7, 0x06a1bbe6, 0x4bfb6350,
+   0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9,
+   0x44421659, 0x0a121386, 0xd90cec6e, 0xd5abea2a,
+   0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe,
+   0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d,
+   0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc,
+   0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f,
+   0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61,
+   0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2,
+   0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9,
+   0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2,
+   0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c,
+   0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e,
+   0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633,
+   0xe85a1f02, 0x09f0be8c, 0x4a99a025, 0x1d6efe10,
+   0x1ab93d1d, 0x0ba5a4df, 0xa186f20f, 0x2868f169,
+   0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52,
+   0x50115e01, 0xa70683fa, 0xa002b5c4, 0x0de6d027,
+   0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5,
+   0xf0177a28, 0xc0f586e0, 0x006058aa, 0x30dc7d62,
+   0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634,
+   0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76,
+   0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24,
+   0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc,
+   0xed545578, 0x08fca5b5, 0xd83d7cd3, 0x4dad0fc4,
+   0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c,
+   0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837,
+   0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0},
   {
-    0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
-    0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
-    0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
-    0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
-    0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
-    0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
-    0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
-    0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
-    0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
-    0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
-    0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
-    0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
-    0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
-    0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
-    0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
-    0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
-    0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
-    0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
-    0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
-    0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
-    0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
-    0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
-    0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
-    0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
-    0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,
-    0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,
-    0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
-    0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
-    0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
-    0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
-    0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
-    0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
-    0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
-    0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
-    0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
-    0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
-    0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
-    0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
-    0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
-    0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
-    0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
-    0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
-    0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
-    0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
-    0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
-    0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
-    0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
-    0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
-    0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
-    0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
-    0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
-    0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
-    0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
-    0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
-    0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
-    0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
-    0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
-    0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
-    0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
-    0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
-    0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
-    0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
-    0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
-    0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6}
+   0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b,
+   0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe,
+   0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b,
+   0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4,
+   0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8,
+   0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6,
+   0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304,
+   0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22,
+   0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4,
+   0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6,
+   0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9,
+   0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59,
+   0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593,
+   0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x022b8b51,
+   0x96d5ac3a, 0x017da67d, 0xd1cf3ed6, 0x7c7d2d28,
+   0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c,
+   0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b,
+   0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28,
+   0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c,
+   0x15056dd4, 0x88f46dba, 0x03a16125, 0x0564f0bd,
+   0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a,
+   0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319,
+   0x7533d928, 0xb155fdf5, 0x03563482, 0x8aba3cbb,
+   0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f,
+   0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991,
+   0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32,
+   0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680,
+   0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x09072166,
+   0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae,
+   0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb,
+   0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5,
+   0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47,
+   0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370,
+   0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d,
+   0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x0115af84,
+   0xe1b00428, 0x95983a1d, 0x06b89fb4, 0xce6ea048,
+   0x6f3f3b82, 0x3520ab82, 0x011a1d4b, 0x277227f8,
+   0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd,
+   0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9,
+   0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7,
+   0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38,
+   0x0339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f,
+   0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c,
+   0xbf97222c, 0x15e6fc2a, 0x0f91fc71, 0x9b941525,
+   0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1,
+   0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442,
+   0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964,
+   0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e,
+   0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8,
+   0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0x0fe3f11d,
+   0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f,
+   0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299,
+   0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02,
+   0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc,
+   0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614,
+   0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a,
+   0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6,
+   0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b,
+   0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0,
+   0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060,
+   0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e,
+   0x1948c25c, 0x02fb8a8c, 0x01c36ae4, 0xd6ebe1f9,
+   0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f,
+   0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6}
 };
 
-#endif				/* _EGG_MOD_BLOWFISH_BF_TAB_H */
+#endif /* _EGG_MOD_BLOWFISH_BF_TAB_H */
Index: eggdrop1.6/src/mod/blowfish.mod/blowfish.c
diff -u eggdrop1.6/src/mod/blowfish.mod/blowfish.c:1.24 eggdrop1.6/src/mod/blowfish.mod/blowfish.c:1.25
--- eggdrop1.6/src/mod/blowfish.mod/blowfish.c:1.24	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/mod/blowfish.mod/blowfish.c	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * blowfish.c -- part of blowfish.mod
  *   encryption and decryption of passwords
  *
- * $Id: blowfish.c,v 1.24 2002/12/24 02:30:06 wcc Exp $
+ * $Id: blowfish.c,v 1.25 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -31,7 +31,7 @@
 
 #include "src/mod/module.h"
 #include "blowfish.h"
-#include "bf_tab.h"		/* P-box P-array, S-box */
+#include "bf_tab.h"             /* P-box P-array, S-box */
 #undef global
 static Function *global = NULL;
 
@@ -73,7 +73,7 @@
   return tot;
 }
 
-static void blowfish_encipher(u_32bit_t * xl, u_32bit_t * xr)
+static void blowfish_encipher(u_32bit_t *xl, u_32bit_t *xr)
 {
   union aword Xl;
   union aword Xr;
@@ -104,7 +104,7 @@
   *xl = Xr.word;
 }
 
-static void blowfish_decipher(u_32bit_t * xl, u_32bit_t * xr)
+static void blowfish_decipher(u_32bit_t *xl, u_32bit_t *xr)
 {
   union aword Xl;
   union aword Xr;
@@ -143,18 +143,18 @@
   if (details) {
     for (i = 0; i < BOXES; i++)
       if (box[i].P != NULL)
-	tot++;
+        tot++;
     dprintf(idx, "    Blowfish encryption module:\n");
     dprintf(idx, "    %d of %d boxes in use: ", tot, BOXES);
     for (i = 0; i < BOXES; i++)
       if (box[i].P != NULL) {
-	dprintf(idx, "(age: %d) ", now - box[i].lastuse);
+        dprintf(idx, "(age: %d) ", now - box[i].lastuse);
       }
     dprintf(idx, "\n");
   }
 }
 
-static void blowfish_init(u_8bit_t * key, int keybytes)
+static void blowfish_init(u_8bit_t *key, int keybytes)
 {
   int i, j, bx;
   time_t lowest;
@@ -173,17 +173,17 @@
   for (i = 0; i < BOXES; i++)
     if (box[i].P != NULL) {
       if ((box[i].keybytes == keybytes) &&
-	  (!strncmp((char *) (box[i].key), (char *) key, keybytes))) {
-	/* Match! */
-	box[i].lastuse = now;
-	bf_P = box[i].P;
-	bf_S = box[i].S;
-	return;
+          (!strncmp((char *) (box[i].key), (char *) key, keybytes))) {
+        /* Match! */
+        box[i].lastuse = now;
+        bf_P = box[i].P;
+        bf_S = box[i].S;
+        return;
       }
     }
   /* No pre-allocated buffer: make new one */
   /* Set 'bx' to empty buffer */
-  bx = (-1);
+  bx = -1;
   for (i = 0; i < BOXES; i++) {
     if (box[i].P == NULL) {
       bx = i;
@@ -195,8 +195,8 @@
     lowest = now;
     for (i = 0; i < BOXES; i++)
       if (box[i].lastuse <= lowest) {
-	lowest = box[i].lastuse;
-	bx = i;
+        lowest = box[i].lastuse;
+        bx = i;
       }
     nfree(box[bx].P);
     for (i = 0; i < 4; i++)
@@ -226,7 +226,7 @@
       bf_S[i][j] = initbf_S[i][j];
 
   j = 0;
-  if (keybytes > 0) { /* drummer: fixes crash if key=="" */
+  if (keybytes > 0) {           /* drummer: fixes crash if key=="" */
     for (i = 0; i < bf_N + 2; ++i) {
       temp.word = 0;
       temp.w.byte0 = key[j];
@@ -261,7 +261,8 @@
 #define SALT2  0x23f6b095
 
 /* Convert 64-bit encrypted password to text for userfile */
-static char *base64 = "./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+static char *base64 =
+            "./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
 static int base64dec(char c)
 {
@@ -284,7 +285,7 @@
   right = SALT2;
   blowfish_encipher(&left, &right);
   p = new;
-  *p++ = '+';			/* + means encrypted pass */
+  *p++ = '+';                   /* + means encrypted pass */
   n = 32;
   while (n > 0) {
     *p++ = base64[right & 0x3f];
@@ -392,6 +393,7 @@
   char *p;
 
   BADARGS(3, 3, " key string");
+  
   p = encrypt_string(argv[1], argv[2]);
   Tcl_AppendResult(irp, p, NULL);
   nfree(p);
@@ -403,6 +405,7 @@
   char *p;
 
   BADARGS(3, 3, " key string");
+  
   p = decrypt_string(argv[1], argv[2]);
   Tcl_AppendResult(irp, p, NULL);
   nfree(p);
@@ -412,21 +415,23 @@
 static int tcl_encpass STDVAR
 {
   BADARGS(2, 2, " string");
+  
   if (strlen(argv[1]) > 0) {
     char p[16];
+   
     blowfish_encrypt_pass(argv[1], p);
     Tcl_AppendResult(irp, p, NULL);
-  } else
+  }
+  else
     Tcl_AppendResult(irp, "", NULL);
   return TCL_OK;
 }
 
-static tcl_cmds mytcls[] =
-{
-  {"encrypt",	tcl_encrypt},
-  {"decrypt",	tcl_decrypt},
-  {"encpass",	tcl_encpass},
-  {NULL,	NULL}
+static tcl_cmds mytcls[] = {
+  {"encrypt", tcl_encrypt},
+  {"decrypt", tcl_decrypt},
+  {"encpass", tcl_encpass},
+  {NULL,             NULL}
 };
 
 static char *blowfish_close()
@@ -436,8 +441,7 @@
 
 EXPORT_SCOPE char *blowfish_start(Function *);
 
-static Function blowfish_table[] =
-{
+static Function blowfish_table[] = {
   /* 0 - 3 */
   (Function) blowfish_start,
   (Function) blowfish_close,
Index: eggdrop1.6/src/mod/blowfish.mod/blowfish.h
diff -u eggdrop1.6/src/mod/blowfish.mod/blowfish.h:1.8 eggdrop1.6/src/mod/blowfish.mod/blowfish.h:1.9
--- eggdrop1.6/src/mod/blowfish.mod/blowfish.h:1.8	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/mod/blowfish.mod/blowfish.h	Tue Jan 28 00:37:25 2003
@@ -1,7 +1,7 @@
 /*
  * blowfish.h -- part of blowfish.mod
  *
- * $Id: blowfish.h,v 1.8 2002/12/24 02:30:06 wcc Exp $
+ * $Id: blowfish.h,v 1.9 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -25,7 +25,7 @@
 #ifndef _EGG_MOD_BLOWFISH_BLOWFISH_H
 #define _EGG_MOD_BLOWFISH_BLOWFISH_H
 
-#define MAXKEYBYTES	56		/* 448 bits */
+#define MAXKEYBYTES	56      /* 448 bits */
 #define bf_N		16
 #define noErr		 0
 #define DATAERROR	-1
@@ -40,13 +40,13 @@
     unsigned int byte1:8;
     unsigned int byte2:8;
     unsigned int byte3:8;
-#else				/* !WORDS_BIGENDIAN */
+#else                           /* !WORDS_BIGENDIAN */
     unsigned int byte3:8;
     unsigned int byte2:8;
     unsigned int byte1:8;
     unsigned int byte0:8;
-#endif				/* !WORDS_BIGENDIAN */
+#endif                          /* !WORDS_BIGENDIAN */
   } w;
 };
 
-#endif				/* _EGG_MOD_BLOWFISH_BLOWFISH_H */
+#endif /* _EGG_MOD_BLOWFISH_BLOWFISH_H */
Index: eggdrop1.6/src/mod/channels.mod/channels.c
diff -u eggdrop1.6/src/mod/channels.mod/channels.c:1.76 eggdrop1.6/src/mod/channels.mod/channels.c:1.77
--- eggdrop1.6/src/mod/channels.mod/channels.c:1.76	Mon Jan 20 18:53:27 2003
+++ eggdrop1.6/src/mod/channels.mod/channels.c	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * channels.c -- part of channels.mod
  *   support for channels within the bot
  *
- * $Id: channels.c,v 1.76 2003/01/21 00:53:27 wcc Exp $
+ * $Id: channels.c,v 1.77 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -321,7 +321,7 @@
  */
 static int channels_chon(char *handle, int idx)
 {
-  struct flag_record fr = {FR_CHAN | FR_ANYWH | FR_GLOBAL, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_CHAN | FR_ANYWH | FR_GLOBAL, 0, 0, 0, 0, 0 };
   int find, found = 0;
   struct chanset_t *chan = chanset;
 
@@ -568,7 +568,7 @@
   struct chanset_t *chan;
   int i;
   char s[1024], s2[100];
-  struct flag_record fr = {FR_CHAN | FR_GLOBAL, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_CHAN | FR_GLOBAL, 0, 0, 0, 0, 0 };
 
   for (chan = chanset; chan; chan = chan->next) {
     if (idx != DP_STDOUT)
@@ -734,11 +734,11 @@
 }
 
 #if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
-static char *traced_globchanset(ClientData cdata, Tcl_Interp * irp,
+static char *traced_globchanset(ClientData cdata, Tcl_Interp *irp,
 				CONST char *name1, CONST char *name2,
                                 int flags)
 #else
-static char *traced_globchanset(ClientData cdata, Tcl_Interp * irp, 
+static char *traced_globchanset(ClientData cdata, Tcl_Interp *irp, 
                                 char *name1, char *name2, int flags)
 #endif
 {
@@ -913,7 +913,7 @@
   (Function) & global_invite_time,
 };
 
-char *channels_start(Function * global_funcs)
+char *channels_start(Function *global_funcs)
 {
   global = global_funcs;
 
Index: eggdrop1.6/src/mod/channels.mod/channels.h
diff -u eggdrop1.6/src/mod/channels.mod/channels.h:1.21 eggdrop1.6/src/mod/channels.mod/channels.h:1.22
--- eggdrop1.6/src/mod/channels.mod/channels.h:1.21	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/mod/channels.mod/channels.h	Tue Jan 28 00:37:25 2003
@@ -1,7 +1,7 @@
 /*
  * channels.h -- part of channels.mod
  *
- * $Id: channels.h,v 1.21 2002/12/24 02:30:06 wcc Exp $
+ * $Id: channels.h,v 1.22 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -72,23 +72,23 @@
 
 static int u_equals_mask(maskrec *u, char *uhost);
 static int u_match_mask(struct maskrec *rec, char *mask);
-static int u_delexempt (struct chanset_t * c, char * who, int doit);
-static int u_addexempt (struct chanset_t * chan, char * exempt, char * from,
- 			char * note,  time_t expire_time, int flags);
-static int u_delinvite (struct chanset_t * c, char * who, int doit);
-static int u_addinvite (struct chanset_t * chan, char * invite, char * from,
- 			char * note,  time_t expire_time, int flags);
+static int u_delexempt (struct chanset_t *c, char *who, int doit);
+static int u_addexempt (struct chanset_t *chan, char *exempt, char *from,
+ 			char *note, time_t expire_time, int flags);
+static int u_delinvite (struct chanset_t *c, char *who, int doit);
+static int u_addinvite (struct chanset_t *chan, char *invite, char *from,
+ 			char *note,  time_t expire_time, int flags);
 static int u_delban(struct chanset_t *c, char *who, int doit);
 static int u_addban(struct chanset_t *chan, char *ban, char *from, char *note,
 		    time_t expire_time, int flags);
 static void tell_bans(int idx, int show_inact, char *match);
-static int write_bans(FILE * f, int idx);
+static int write_bans(FILE *f, int idx);
 static void check_expired_bans(void);
-static void tell_exempts (int idx, int show_inact, char * match);
-static int write_exempts (FILE * f, int idx);
+static void tell_exempts (int idx, int show_inact, char *match);
+static int write_exempts (FILE *f, int idx);
 static void check_expired_exempts(void);
-static void tell_invites (int idx, int show_inact, char * match);
-static int write_invites (FILE * f, int idx);
+static void tell_invites (int idx, int show_inact, char *match);
+static int write_invites (FILE *f, int idx);
 static void check_expired_invites(void);
 static void write_channels(void);
 static void read_channels(int);
@@ -97,9 +97,9 @@
 static void set_mode_protect(struct chanset_t *chan, char *set);
 static int ismasked(masklist *m, char *user);
 static int ismodeline(masklist *m, char *user);
-static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan,
+static int tcl_channel_modify(Tcl_Interp *irp, struct chanset_t *chan,
 			      int items, char **item);
-static int tcl_channel_add(Tcl_Interp * irp, char *, char *);
+static int tcl_channel_add(Tcl_Interp *irp, char *, char *);
 static char *convert_element(char *src, char *dst);
 static int expmem_udef(struct udef_struct *);
 static int expmem_udef_chans (struct udef_chans *);
Index: eggdrop1.6/src/mod/channels.mod/cmdschan.c
diff -u eggdrop1.6/src/mod/channels.mod/cmdschan.c:1.58 eggdrop1.6/src/mod/channels.mod/cmdschan.c:1.59
--- eggdrop1.6/src/mod/channels.mod/cmdschan.c:1.58	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/mod/channels.mod/cmdschan.c	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * cmdschan.c -- part of channels.mod
  *   commands from a user via dcc that cause server interaction
  *
- * $Id: cmdschan.c,v 1.58 2002/12/24 02:30:06 wcc Exp $
+ * $Id: cmdschan.c,v 1.59 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -25,8 +25,8 @@
 
 #include <ctype.h>
 
-static struct flag_record user	 = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-static struct flag_record victim = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+static struct flag_record user	 = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
+static struct flag_record victim = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
 
 static void cmd_pls_ban(struct userrec *u, int idx, char *par)
Index: eggdrop1.6/src/mod/channels.mod/help/set/channels.help
diff -u eggdrop1.6/src/mod/channels.mod/help/set/channels.help:1.2 eggdrop1.6/src/mod/channels.mod/help/set/channels.help:1.3
--- eggdrop1.6/src/mod/channels.mod/help/set/channels.help:1.2	Mon Nov 20 23:18:05 2000
+++ eggdrop1.6/src/mod/channels.mod/help/set/channels.help	Tue Jan 28 00:37:25 2003
@@ -22,13 +22,13 @@
 ###  %bset exempt-time%b <#>
    specifies how long (in minutes) a temporary exemption will last
    on the channel before being purged. if set to 0, bot never
-   removes it. this is an IRCNET feature.
+   removes it. this is an IRCnet feature.
 %{help=set invite-time}
 %{+n}
 ###  %bset invite-time%b <#>
    specifies how long (in minutes) a temporary invitation will
    last on the channel before being purged. if set to 0, bot never
-   removes it. this is an IRCNET feature.
+   removes it. this is an IRCnet feature.
 %{help=set chanfile}
 %{+n}
 ###  %bset chanfile%b
Index: eggdrop1.6/src/mod/channels.mod/tclchan.c
diff -u eggdrop1.6/src/mod/channels.mod/tclchan.c:1.69 eggdrop1.6/src/mod/channels.mod/tclchan.c:1.70
--- eggdrop1.6/src/mod/channels.mod/tclchan.c:1.69	Mon Dec 23 20:30:06 2002
+++ eggdrop1.6/src/mod/channels.mod/tclchan.c	Tue Jan 28 00:37:25 2003
@@ -1,7 +1,7 @@
 /*
  * tclchan.c -- part of channels.mod
  *
- * $Id: tclchan.c,v 1.69 2002/12/24 02:30:06 wcc Exp $
+ * $Id: tclchan.c,v 1.70 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -732,7 +732,7 @@
   return TCL_OK;
 }
 
-static int tcl_channel_info(Tcl_Interp * irp, struct chanset_t *chan)
+static int tcl_channel_info(Tcl_Interp *irp, struct chanset_t *chan)
 {
   char a[121], b[121], s[121];
 #if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
@@ -896,7 +896,7 @@
   return TCL_OK;
 }
 
-static int tcl_channel_get(Tcl_Interp * irp, struct chanset_t *chan, char *setting)
+static int tcl_channel_get(Tcl_Interp *irp, struct chanset_t *chan, char *setting)
 {
   char s[121];
   struct udef_struct *ul;
@@ -1043,7 +1043,7 @@
 
 /* Parse options for a channel.
  */
-static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan,
+static int tcl_channel_modify(Tcl_Interp *irp, struct chanset_t *chan,
 			      int items, char **item)
 {
   int i, x = 0, found,
Index: eggdrop1.6/src/mod/channels.mod/userchan.c
diff -u eggdrop1.6/src/mod/channels.mod/userchan.c:1.30 eggdrop1.6/src/mod/channels.mod/userchan.c:1.31
--- eggdrop1.6/src/mod/channels.mod/userchan.c:1.30	Mon Jan 20 02:51:19 2003
+++ eggdrop1.6/src/mod/channels.mod/userchan.c	Tue Jan 28 00:37:25 2003
@@ -1,7 +1,7 @@
 /*
  * userchan.c -- part of channels.mod
  *
- * $Id: userchan.c,v 1.30 2003/01/20 08:51:19 wcc Exp $
+ * $Id: userchan.c,v 1.31 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -174,7 +174,7 @@
 
   j = atoi(uhost);
   if (!j)
-    j = (-1);
+    j = -1;
   while(u) {
     if (j >= 0)
       j--;
@@ -279,11 +279,10 @@
   return i;
 }
 
-static int u_delexempt (struct chanset_t * c, char * who, int doit)
+static int u_delexempt (struct chanset_t *c, char *who, int doit)
 {
   int j, i = 0;
-  maskrec *t;
-  maskrec **u = c ? &(c->exempts) : &global_exempts;
+  maskrec *t, **u = c ? &(c->exempts) : &global_exempts;
 
   if (!strchr(who,'!') && (j = atoi(who))) {
     j--;
@@ -482,7 +481,7 @@
   else if (strchr(host, '@') == NULL)
     strcat(host, "@*");
   else if (strchr(host, '!') == NULL) {
-    char * i = strchr(host, '@');
+    char *i = strchr(host, '@');
     strcpy(s, i);
     *i = 0;
     strcat(host, "!*");
@@ -564,7 +563,7 @@
   else if (strchr(host, '@') == NULL)
     strcat(host, "@*");
   else if (strchr(host, '!') == NULL) {
-    char * i = strchr(host, '@');
+    char *i = strchr(host, '@');
     strcpy(s, i);
     *i = 0;
     strcat(host, "!*");
@@ -888,8 +887,8 @@
   }
 
   /* don't return here, we want to show global exempts even if no chan */
-  if (!chan && !(chan = findchan_by_dname(dcc[idx].u.chat->con_chan))
-      && !(chan = chanset))
+  if (!chan && !(chan = findchan_by_dname(dcc[idx].u.chat->con_chan)) &&
+      !(chan = chanset))
     chan = NULL;
 
   if (chan && show_inact)
@@ -982,8 +981,8 @@
   }
 
   /* don't return here, we want to show global invites even if no chan */
-  if (!chan && !(chan = findchan_by_dname(dcc[idx].u.chat->con_chan))
-      && !(chan = chanset))
+  if (!chan && !(chan = findchan_by_dname(dcc[idx].u.chat->con_chan)) &&
+      !(chan = chanset))
     chan = NULL;
 
   if (chan && show_inact)
@@ -1082,7 +1081,7 @@
   }
   for (chan = chanset; chan; chan = chan->next)
     if ((idx < 0) || (chan->status & CHAN_SHARED)) {
-      struct flag_record fr = {FR_CHAN | FR_GLOBAL | FR_BOT, 0, 0, 0, 0, 0};
+      struct flag_record fr = { FR_CHAN | FR_GLOBAL | FR_BOT, 0, 0, 0, 0, 0 };
 
       if (idx >= 0)
 	get_user_flagrec(dcc[idx].user, &fr, chan->dname);
@@ -1137,7 +1136,7 @@
   }
   for (chan = chanset;chan;chan=chan->next)
     if ((idx < 0) || (chan->status & CHAN_SHARED)) {
-      struct flag_record fr = {FR_CHAN | FR_GLOBAL | FR_BOT, 0, 0, 0, 0, 0};
+      struct flag_record fr = { FR_CHAN | FR_GLOBAL | FR_BOT, 0, 0, 0, 0, 0 };
 
       if (idx >= 0)
 	get_user_flagrec(dcc[idx].user,&fr,chan->dname);
@@ -1192,7 +1191,7 @@
   }
   for (chan = chanset; chan; chan = chan->next)
     if ((idx < 0) || (chan->status & CHAN_SHARED)) {
-      struct flag_record fr = {FR_CHAN | FR_GLOBAL | FR_BOT, 0, 0, 0, 0, 0};
+      struct flag_record fr = { FR_CHAN | FR_GLOBAL | FR_BOT, 0, 0, 0, 0, 0 };
 
       if (idx >= 0)
 	get_user_flagrec(dcc[idx].user,&fr,chan->dname);
Index: eggdrop1.6/src/mod/compress.mod/compress.c
diff -u eggdrop1.6/src/mod/compress.mod/compress.c:1.15 eggdrop1.6/src/mod/compress.mod/compress.c:1.16
--- eggdrop1.6/src/mod/compress.mod/compress.c:1.15	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/compress.mod/compress.c	Tue Jan 28 00:37:25 2003
@@ -6,7 +6,7 @@
  * Written by Fabian Knittel <fknittel at gmx.de>. Based on zlib examples
  * by Jean-loup Gailly and Miguel Albrecht.
  *
- * $Id: compress.c,v 1.15 2002/12/24 02:30:07 wcc Exp $
+ * $Id: compress.c,v 1.16 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -47,13 +47,12 @@
 #define BUFLEN	512
 
 
-static Function *global = NULL,
-		*share_funcs = NULL;
+static Function *global = NULL, *share_funcs = NULL;
 
-static unsigned int compressed_files;	/* Number of files compressed.      */
-static unsigned int uncompressed_files;	/* Number of files uncompressed.    */
-static unsigned int share_compressed;	/* Compress userfiles when sharing? */
-static unsigned int compress_level;	/* Default compression used.	    */
+static unsigned int compressed_files;   /* Number of files compressed.      */
+static unsigned int uncompressed_files; /* Number of files uncompressed.    */
+static unsigned int share_compressed;   /* Compress userfiles when sharing? */
+static unsigned int compress_level;     /* Default compression used.        */
 
 
 static int uncompress_to_file(char *f_src, char *f_target);
@@ -71,9 +70,9 @@
 
 static int is_compressedfile(char *filename)
 {
-  char		  buf1[50], buf2[50];
-  FILE		 *fin;
-  register int    len1, len2, i;
+  char buf1[50], buf2[50];
+  FILE *fin;
+  register int len1, len2, i;
 
   egg_memset(buf1, 0, 50);
   egg_memset(buf2, 0, 50);
@@ -125,21 +124,20 @@
   FILE *fin, *fout;
 
   if (!is_file(f_src)) {
-    putlog(LOG_MISC, "*", "Failed to uncompress file `%s': not a file.",
-	   f_src);
+    putlog(LOG_MISC, "*", "Failed to uncompress file `%s': not a file.", f_src);
     return COMPF_ERROR;
   }
   fin = gzopen(f_src, "rb");
   if (!fin) {
     putlog(LOG_MISC, "*", "Failed to uncompress file `%s': gzopen failed.",
-	   f_src);
+           f_src);
     return COMPF_ERROR;
   }
 
   fout = fopen(f_target, "wb");
   if (!fout) {
     putlog(LOG_MISC, "*", "Failed to uncompress file `%s': open failed: %s.",
-	   f_src, strerror(errno));
+           f_src, strerror(errno));
     return COMPF_ERROR;
   }
 
@@ -147,25 +145,26 @@
     len = gzread(fin, buf, sizeof(buf));
     if (len < 0) {
       putlog(LOG_MISC, "*", "Failed to uncompress file `%s': gzread failed.",
-	     f_src);
+             f_src);
       return COMPF_ERROR;
     }
     if (!len)
       break;
     if ((int) fwrite(buf, 1, (unsigned int) len, fout) != len) {
-      putlog(LOG_MISC, "*", "Failed to uncompress file `%s': fwrite failed: %s.",
-	     f_src, strerror(errno));
+      putlog(LOG_MISC, "*",
+             "Failed to uncompress file `%s': fwrite failed: %s.", f_src,
+             strerror(errno));
       return COMPF_ERROR;
     }
   }
   if (fclose(fout)) {
     putlog(LOG_MISC, "*", "Failed to uncompress file `%s': fclose failed: %s.",
-	   f_src, strerror(errno));
+           f_src, strerror(errno));
     return COMPF_ERROR;
   }
   if (gzclose(fin) != Z_OK) {
     putlog(LOG_MISC, "*", "Failed to uncompress file `%s': gzclose failed.",
-	   f_src);
+           f_src);
     return COMPF_ERROR;
   }
   uncompressed_files++;
@@ -187,31 +186,31 @@
  */
 static int compress_to_file_mmap(FILE *fout, FILE *fin)
 {
-    int		  len, ifd = fileno(fin);
-    char	 *buf;
-    struct stat	  st;
+  int len, ifd = fileno(fin);
+  char *buf;
+  struct stat st;
 
-    /* Find out size of file */
-    if (fstat(ifd, &st) < 0)
-      return COMPF_ERROR;
-    if (st.st_size <= 0)
-      return COMPF_ERROR;
+  /* Find out size of file */
+  if (fstat(ifd, &st) < 0)
+    return COMPF_ERROR;
+  if (st.st_size <= 0)
+    return COMPF_ERROR;
 
-    /* mmap file contents to memory */
-    buf = mmap(0, st.st_size, PROT_READ, MAP_SHARED, ifd, 0);
-    if (buf < 0)
-      return COMPF_ERROR;
+  /* mmap file contents to memory */
+  buf = mmap(0, st.st_size, PROT_READ, MAP_SHARED, ifd, 0);
+  if (buf < 0)
+    return COMPF_ERROR;
 
-    /* Compress the whole file in one go */
-    len = gzwrite(fout, buf, st.st_size);
-    if (len != (int) st.st_size)
-      return COMPF_ERROR;
+  /* Compress the whole file in one go */
+  len = gzwrite(fout, buf, st.st_size);
+  if (len != (int) st.st_size)
+    return COMPF_ERROR;
 
-    munmap(buf, st.st_size);
-    fclose(fin);
-    if (gzclose(fout) != Z_OK)
-      return COMPF_ERROR;
-    return COMPF_SUCCESS;
+  munmap(buf, st.st_size);
+  fclose(fin);
+  if (gzclose(fout) != Z_OK)
+    return COMPF_ERROR;
+  return COMPF_SUCCESS;
 }
 #endif /* HAVE_MMAP */
 
@@ -219,29 +218,28 @@
  */
 static int compress_to_file(char *f_src, char *f_target, int mode_num)
 {
-  char  buf[BUFLEN], mode[5];
+  char buf[BUFLEN], mode[5];
   FILE *fin, *fout;
-  int   len;
+  int len;
 
   adjust_mode_num(&mode_num);
   egg_snprintf(mode, sizeof mode, "wb%d", mode_num);
 
   if (!is_file(f_src)) {
-    putlog(LOG_MISC, "*", "Failed to compress file `%s': not a file.",
-	   f_src);
+    putlog(LOG_MISC, "*", "Failed to compress file `%s': not a file.", f_src);
     return COMPF_ERROR;
   }
   fin = fopen(f_src, "rb");
   if (!fin) {
     putlog(LOG_MISC, "*", "Failed to compress file `%s': open failed: %s.",
-	   f_src, strerror(errno));
+           f_src, strerror(errno));
     return COMPF_ERROR;
   }
 
   fout = gzopen(f_target, mode);
   if (!fout) {
     putlog(LOG_MISC, "*", "Failed to compress file `%s': gzopen failed.",
-	   f_src);
+           f_src);
     return COMPF_ERROR;
   }
 
@@ -249,7 +247,8 @@
   if (compress_to_file_mmap(fout, fin) == COMPF_SUCCESS) {
     compressed_files++;
     return COMPF_SUCCESS;
-  } else {
+  }
+  else {
     /* To be on the safe side, close the file before attempting
      * to write again.
      */
@@ -262,21 +261,21 @@
     len = fread(buf, 1, sizeof(buf), fin);
     if (ferror(fin)) {
       putlog(LOG_MISC, "*", "Failed to compress file `%s': fread failed: %s",
-	     f_src, strerror(errno));
+             f_src, strerror(errno));
       return COMPF_ERROR;
     }
     if (!len)
       break;
     if (gzwrite(fout, buf, (unsigned int) len) != len) {
       putlog(LOG_MISC, "*", "Failed to compress file `%s': gzwrite failed.",
-	     f_src);
+             f_src);
       return COMPF_ERROR;
     }
   }
   fclose(fin);
   if (gzclose(fout) != Z_OK) {
     putlog(LOG_MISC, "*", "Failed to compress file `%s': gzclose failed.",
-	   f_src);
+           f_src);
     return COMPF_ERROR;
   }
   compressed_files++;
@@ -288,7 +287,7 @@
 static int compress_file(char *filename, int mode_num)
 {
   char *temp_fn, randstr[5];
-  int   ret;
+  int ret;
 
   /* Create temporary filename. */
   temp_fn = nmalloc(strlen(filename) + 5);
@@ -314,7 +313,7 @@
 static int uncompress_file(char *filename)
 {
   char *temp_fn, randstr[5];
-  int   ret;
+  int ret;
 
   /* Create temporary filename. */
   temp_fn = nmalloc(strlen(filename) + 5);
@@ -361,8 +360,8 @@
 }
 
 static uff_table_t compress_uff_table[] = {
-  {"compress",	UFF_COMPRESS,	uff_ask_compress, 100, uff_comp, uff_uncomp},
-  {NULL,	0,		NULL,		    0,	   NULL,       NULL}
+  {"compress", UFF_COMPRESS, uff_ask_compress, 100, uff_comp, uff_uncomp},
+  {NULL,       0,            NULL,             0,   NULL,           NULL}
 };
 
 /*
@@ -370,9 +369,9 @@
  */
 
 static tcl_ints my_tcl_ints[] = {
-  {"share-compressed",  	&share_compressed},
-  {"compress-level",		&compress_level},
-  {NULL,                	NULL}
+  {"share-compressed", &share_compressed},
+  {"compress-level",     &compress_level},
+  {NULL,                            NULL}
 };
 
 static int compress_expmem(void)
@@ -384,7 +383,7 @@
 {
   if (details)
     dprintf(idx, "    Compressed %u file(s), uncompressed %u file(s).\n",
-	    compressed_files, uncompressed_files);
+            compressed_files, uncompressed_files);
   return 0;
 }
 
@@ -401,8 +400,7 @@
 
 EXPORT_SCOPE char *compress_start();
 
-static Function compress_table[] =
-{
+static Function compress_table[] = {
   /* 0 - 3 */
   (Function) compress_start,
   (Function) compress_close,
@@ -420,10 +418,11 @@
 char *compress_start(Function *global_funcs)
 {
   global = global_funcs;
-  compressed_files	= 0;
-  uncompressed_files	= 0;
-  share_compressed	= 0;
-  compress_level	= 9;
+
+  compressed_files = 0;
+  uncompressed_files = 0;
+  share_compressed = 0;
+  compress_level = 9;
 
   module_register(MODULE_NAME, compress_table, 1, 1);
   if (!module_depend(MODULE_NAME, "eggdrop", 106, 0)) {
Index: eggdrop1.6/src/mod/compress.mod/compress.h
diff -u eggdrop1.6/src/mod/compress.mod/compress.h:1.6 eggdrop1.6/src/mod/compress.mod/compress.h:1.7
--- eggdrop1.6/src/mod/compress.mod/compress.h:1.6	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/compress.mod/compress.h	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * compress.h -- part of src/mod/compress.mod
  *   header file for the zlib compression module
  *
- * $Id: compress.h,v 1.6 2002/12/24 02:30:07 wcc Exp $
+ * $Id: compress.h,v 1.7 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -25,17 +25,17 @@
 #ifndef _EGG_MOD_COMPRESS_COMPRESS_H
 #define _EGG_MOD_COMPRESS_COMPRESS_H
 
-#define UFF_COMPRESS	0x000008	/* Compress the user file	*/
+#define UFF_COMPRESS	0x000008        /* Compress the user file       */
 
 typedef enum {
-  COMPF_ERROR,		/* Compression failed.			*/
-  COMPF_SUCCESS		/* Compression succeeded.		*/
+  COMPF_ERROR,                  /* Compression failed.                  */
+  COMPF_SUCCESS                 /* Compression succeeded.               */
 } compf_result;
 
 typedef enum {
-  COMPF_UNCOMPRESSED,	/* File is uncompressed.		*/
-  COMPF_COMPRESSED,	/* File is compressed.			*/
-  COMPF_FAILED		/* Could not determine file type.	*/
+  COMPF_UNCOMPRESSED,           /* File is uncompressed.                */
+  COMPF_COMPRESSED,             /* File is compressed.                  */
+  COMPF_FAILED                  /* Could not determine file type.       */
 } compf_type;
 
 
Index: eggdrop1.6/src/mod/compress.mod/tclcompress.c
diff -u eggdrop1.6/src/mod/compress.mod/tclcompress.c:1.6 eggdrop1.6/src/mod/compress.mod/tclcompress.c:1.7
--- eggdrop1.6/src/mod/compress.mod/tclcompress.c:1.6	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/compress.mod/tclcompress.c	Tue Jan 28 00:37:25 2003
@@ -4,7 +4,7 @@
  *
  * Written by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: tclcompress.c,v 1.6 2002/12/24 02:30:07 wcc Exp $
+ * $Id: tclcompress.c,v 1.7 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -29,20 +29,22 @@
 
 static int tcl_compress_file STDVAR
 {
-  int	 mode_num = compress_level, result, curr_arg = 1;
-  char	*fn_src = NULL, *fn_target = NULL;
+  int mode_num = compress_level, result, curr_arg = 1;
+  char *fn_src = NULL, *fn_target = NULL;
 
   BADARGS(2, 5, " ?options...? src-file ?target-file?");
+
   while ((argc > 1) && ((argv[curr_arg])[0] == '-')) {
     if (!strcmp(argv[curr_arg], "-level")) {
       argc--;
       if (argc <= 1) {
-	Tcl_AppendResult(irp, "option `-level' needs parameter", NULL);
-	return TCL_ERROR;
+        Tcl_AppendResult(irp, "option `-level' needs parameter", NULL);
+        return TCL_ERROR;
       }
       curr_arg++;
       mode_num = atoi(argv[curr_arg]);
-    } else {
+    }
+    else {
       Tcl_AppendResult(irp, "unknown option `", argv[curr_arg], "'", NULL);
       return TCL_ERROR;
     }
@@ -77,9 +79,10 @@
 
 static int tcl_uncompress_file STDVAR
 {
-  int	 result;
+  int result;
 
   BADARGS(2, 3, " src-file ?target-file?");
+
   if (argc == 2)
     result = uncompress_file(argv[1]);
   else
@@ -94,24 +97,23 @@
 
 static int tcl_iscompressed STDVAR
 {
-  int	 result;
+  int result;
 
   BADARGS(2, 2, " compressed-file");
+  
   result = is_compressedfile(argv[1]);
   if (result == COMPF_UNCOMPRESSED)
-    Tcl_AppendResult(irp, "0", NULL);	/* Uncompressed.	*/
+    Tcl_AppendResult(irp, "0", NULL);  /* Uncompressed.        */
   else if (result == COMPF_COMPRESSED)
-    Tcl_AppendResult(irp, "1", NULL);	/* Compressed.		*/
+    Tcl_AppendResult(irp, "1", NULL);  /* Compressed.          */
   else
-    Tcl_AppendResult(irp, "2", NULL);	/* Failed to detect.	*/
+    Tcl_AppendResult(irp, "2", NULL);  /* Failed to detect.    */
   return TCL_OK;
 }
 
-
-static tcl_cmds my_tcl_cmds[] =
-{
-  {"compressfile",	tcl_compress_file},
-  {"uncompressfile",	tcl_uncompress_file},
-  {"iscompressed",	tcl_iscompressed},
-  {NULL,		NULL}
+static tcl_cmds my_tcl_cmds[] = {
+  {"compressfile",     tcl_compress_file},
+  {"uncompressfile", tcl_uncompress_file},
+  {"iscompressed",      tcl_iscompressed},
+  {NULL,                            NULL}
 };
Index: eggdrop1.6/src/mod/console.mod/console.c
diff -u eggdrop1.6/src/mod/console.mod/console.c:1.26 eggdrop1.6/src/mod/console.mod/console.c:1.27
--- eggdrop1.6/src/mod/console.mod/console.c:1.26	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/console.mod/console.c	Tue Jan 28 00:37:25 2003
@@ -3,7 +3,7 @@
  *   saved console settings based on console.tcl
  *   by cmwagner/billyjoe/D. Senso
  *
- * $Id: console.c,v 1.26 2002/12/24 02:30:07 wcc Exp $
+ * $Id: console.c,v 1.27 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -79,9 +79,9 @@
   ci = (struct console_info *) e->u.extra;
 
   l = simple_sprintf(work, "%s %s %s %d %d %d",
-		     ci->channel, masktype(ci->conflags),
-		     stripmasktype(ci->stripflags), ci->echoflags,
-		     ci->page, ci->conchan);
+                     ci->channel, masktype(ci->conflags),
+                     stripmasktype(ci->stripflags), ci->echoflags,
+                     ci->page, ci->conchan);
 
   e->u.list = user_malloc(sizeof(struct list_type));
   e->u.list->next = NULL;
@@ -104,14 +104,14 @@
 }
 
 static int console_write_userfile(FILE *f, struct userrec *u,
-				  struct user_entry *e)
+                                  struct user_entry *e)
 {
   struct console_info *i = e->u.extra;
 
   if (fprintf(f, "--CONSOLE %s %s %s %d %d %d\n",
-	      i->channel, masktype(i->conflags),
-	      stripmasktype(i->stripflags), i->echoflags,
-	      i->page, i->conchan) == EOF)
+              i->channel, masktype(i->conflags),
+              stripmasktype(i->stripflags), i->echoflags,
+              i->page, i->conchan) == EOF)
     return 0;
   return 1;
 }
@@ -136,21 +136,21 @@
 }
 
 static int console_tcl_get(Tcl_Interp *irp, struct userrec *u,
-			   struct user_entry *e, int argc, char **argv)
+                           struct user_entry *e, int argc, char **argv)
 {
   char work[1024];
   struct console_info *i = e->u.extra;
 
   simple_sprintf(work, "%s %s %s %d %d %d",
-		 i->channel, masktype(i->conflags),
-		 stripmasktype(i->stripflags), i->echoflags,
-		 i->page, i->conchan);
+                 i->channel, masktype(i->conflags),
+                 stripmasktype(i->stripflags), i->echoflags,
+                 i->page, i->conchan);
   Tcl_AppendResult(irp, work, NULL);
   return TCL_OK;
 }
 
 static int console_tcl_set(Tcl_Interp *irp, struct userrec *u,
-		    struct user_entry *e, int argc, char **argv)
+                           struct user_entry *e, int argc, char **argv)
 {
   struct console_info *i = e->u.extra;
   int l;
@@ -173,12 +173,12 @@
     if (argc > 5) {
       i->stripflags = stripmodes(argv[5]);
       if (argc > 6) {
-	i->echoflags = (argv[6][0] == '1') ? 1 : 0;
-	if (argc > 7) {
-	  i->page = atoi(argv[7]);
-	  if (argc > 8)
-	    i->conchan = atoi(argv[8]);
-	}
+        i->echoflags = (argv[6][0] == '1') ? 1 : 0;
+        if (argc > 7) {
+          i->page = atoi(argv[7]);
+          if (argc > 8)
+            i->conchan = atoi(argv[8]);
+        }
       }
     }
   }
@@ -201,9 +201,9 @@
     dprintf(idx, "  %s\n", CONSOLE_SAVED_SETTINGS);
     dprintf(idx, "    %s %s\n", CONSOLE_CHANNEL, i->channel);
     dprintf(idx, "    %s %s, %s %s, %s %s\n", CONSOLE_FLAGS,
-    	masktype(i->conflags), CONSOLE_STRIPFLAGS,
-	    stripmasktype(i->stripflags), CONSOLE_ECHO,
-	    i->echoflags ? CONSOLE_YES : CONSOLE_NO);
+            masktype(i->conflags), CONSOLE_STRIPFLAGS,
+            stripmasktype(i->stripflags), CONSOLE_ECHO,
+            i->echoflags ? CONSOLE_YES : CONSOLE_NO);
     dprintf(idx, "    %s %d, %s %s%d\n", CONSOLE_PAGE_SETTING, i->page,
             CONSOLE_CHANNEL2, (i->conchan < GLOBAL_CHANS) ? "" : "*",
             i->conchan % GLOBAL_CHANS);
@@ -211,7 +211,7 @@
 }
 
 static int console_dupuser(struct userrec *new, struct userrec *old,
-			   struct user_entry *e)
+                           struct user_entry *e)
 {
   struct console_info *i = e->u.extra, *j;
 
@@ -223,9 +223,8 @@
   return set_user(e->type, new, j);
 }
 
-static struct user_entry_type USERENTRY_CONSOLE =
-{
-  NULL,				/* always 0 ;) */
+static struct user_entry_type USERENTRY_CONSOLE = {
+  NULL,                         /* always 0 ;) */
   NULL,
   console_dupuser,
   console_unpack,
@@ -248,41 +247,41 @@
   if (dcc[idx].type == &DCC_CHAT) {
     if (i) {
       if (i->channel && i->channel[0])
-	strcpy(dcc[idx].u.chat->con_chan, i->channel);
+        strcpy(dcc[idx].u.chat->con_chan, i->channel);
       dcc[idx].u.chat->con_flags = i->conflags;
       dcc[idx].u.chat->strip_flags = i->stripflags;
       if (i->echoflags)
-	dcc[idx].status |= STAT_ECHO;
+        dcc[idx].status |= STAT_ECHO;
       else
-	dcc[idx].status &= ~STAT_ECHO;
+        dcc[idx].status &= ~STAT_ECHO;
       if (i->page) {
-	dcc[idx].status |= STAT_PAGE;
-	dcc[idx].u.chat->max_line = i->page;
-	if (!dcc[idx].u.chat->line_count)
-	  dcc[idx].u.chat->current_lines = 0;
+        dcc[idx].status |= STAT_PAGE;
+        dcc[idx].u.chat->max_line = i->page;
+        if (!dcc[idx].u.chat->line_count)
+          dcc[idx].u.chat->current_lines = 0;
       }
       dcc[idx].u.chat->channel = i->conchan;
-    } else if (force_channel > -1)
+    }
+    else if (force_channel > -1)
       dcc[idx].u.chat->channel = force_channel;
     if ((dcc[idx].u.chat->channel >= 0) &&
-	(dcc[idx].u.chat->channel < GLOBAL_CHANS)) {
+        (dcc[idx].u.chat->channel < GLOBAL_CHANS)) {
       botnet_send_join_idx(idx, -1);
       check_tcl_chjn(botnetnick, dcc[idx].nick, dcc[idx].u.chat->channel,
-		     geticon(idx), dcc[idx].sock, dcc[idx].host);
+                     geticon(idx), dcc[idx].sock, dcc[idx].host);
     }
     if (info_party) {
       char *p = get_user(&USERENTRY_INFO, dcc[idx].user);
 
       if (p) {
-	if (dcc[idx].u.chat->channel >= 0) {
-	    char x[1024];
+        if (dcc[idx].u.chat->channel >= 0) {
+          char x[1024];
 
-	    chanout_but(-1, dcc[idx].u.chat->channel,
-			"*** [%s] %s\n", dcc[idx].nick, p);
-	    simple_sprintf(x, "[%s] %s", dcc[idx].nick, p);
-	    botnet_send_chan(-1, botnetnick, NULL,
-			     dcc[idx].u.chat->channel, x);
-	}
+          chanout_but(-1, dcc[idx].u.chat->channel,
+                      "*** [%s] %s\n", dcc[idx].nick, p);
+          simple_sprintf(x, "[%s] %s", dcc[idx].nick, p);
+          botnet_send_chan(-1, botnetnick, NULL, dcc[idx].u.chat->channel, x);
+        }
       }
     }
   }
@@ -313,9 +312,9 @@
     dprintf(idx, "%s\n", CONSOLE_SAVED_SETTINGS2);
     dprintf(idx, "  %s %s\n", CONSOLE_CHANNEL, i->channel);
     dprintf(idx, "  %s %s, %s %s, %s %s\n", CONSOLE_FLAGS,
-	    masktype(i->conflags), CONSOLE_STRIPFLAGS,
-	    stripmasktype(i->stripflags), CONSOLE_ECHO,
-	    i->echoflags ? CONSOLE_YES : CONSOLE_NO);
+            masktype(i->conflags), CONSOLE_STRIPFLAGS,
+            stripmasktype(i->stripflags), CONSOLE_ECHO,
+            i->echoflags ? CONSOLE_YES : CONSOLE_NO);
     dprintf(idx, "  %s %d, %s %d\n", CONSOLE_PAGE_SETTING, i->page,
             CONSOLE_CHANNEL2, i->conchan);
   }
@@ -331,24 +330,21 @@
   return 0;
 }
 
-static tcl_ints myints[] =
-{
-  {"console-autosave",	&console_autosave,	0},
-  {"force-channel",	&force_channel,		0},
-  {"info-party",	&info_party,		0},
-  {NULL,		NULL,			0}
+static tcl_ints myints[] = {
+  {"console-autosave", &console_autosave, 0},
+  {"force-channel",    &force_channel,    0},
+  {"info-party",       &info_party,       0},
+  {NULL,               NULL,              0}
 };
 
-static cmd_t mychon[] =
-{
-  {"*",		"",	console_chon,		"console:chon"},
-  {NULL,	NULL,	NULL,			NULL}
+static cmd_t mychon[] = {
+  {"*",  "",   console_chon, "console:chon"},
+  {NULL, NULL, NULL,                   NULL}
 };
 
-static cmd_t mydcc[] =
-{
-  {"store",	"",	console_store,		NULL},
-  {NULL,	NULL,	NULL,			NULL}
+static cmd_t mydcc[] = {
+  {"store", "",   console_store, NULL},
+  {NULL,    NULL, NULL,          NULL}
 };
 
 static char *console_close()
@@ -365,8 +361,7 @@
 
 EXPORT_SCOPE char *console_start();
 
-static Function console_table[] =
-{
+static Function console_table[] = {
   (Function) console_start,
   (Function) console_close,
   (Function) NULL,
@@ -374,7 +369,7 @@
   (Function) console_dostore,
 };
 
-char *console_start(Function * global_funcs)
+char *console_start(Function *global_funcs)
 {
   global = global_funcs;
 
Index: eggdrop1.6/src/mod/console.mod/console.h
diff -u eggdrop1.6/src/mod/console.mod/console.h:1.4 eggdrop1.6/src/mod/console.mod/console.h:1.5
--- eggdrop1.6/src/mod/console.mod/console.h:1.4	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/console.mod/console.h	Tue Jan 28 00:37:25 2003
@@ -1,7 +1,7 @@
 /*
  * console.h -- part of console.mod
  *
- * $Id: console.h,v 1.4 2002/12/24 02:30:07 wcc Exp $
+ * $Id: console.h,v 1.5 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -35,4 +35,4 @@
 #define CONSOLE_YES		get_language(0xb048)
 #define CONSOLE_NO		get_language(0xb049)
 
-#endif				/* _EGG_MOD_CONSOLE_CONSOLE_H */
+#endif /* _EGG_MOD_CONSOLE_CONSOLE_H */
Index: eggdrop1.6/src/mod/ctcp.mod/ctcp.c
diff -u eggdrop1.6/src/mod/ctcp.mod/ctcp.c:1.19 eggdrop1.6/src/mod/ctcp.mod/ctcp.c:1.20
--- eggdrop1.6/src/mod/ctcp.mod/ctcp.c:1.19	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/ctcp.mod/ctcp.c	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * ctcp.c -- part of ctcp.mod
  *   all the ctcp handling (except DCC, it's special ;)
  *
- * $Id: ctcp.c,v 1.19 2002/12/24 02:30:07 wcc Exp $
+ * $Id: ctcp.c,v 1.20 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -40,7 +40,7 @@
 
 
 static int ctcp_FINGER(char *nick, char *uhost, char *handle,
-		       char *object, char *keyword, char *text)
+                       char *object, char *keyword, char *text)
 {
   if (ctcp_mode != 1 && ctcp_finger[0])
     simple_sprintf(ctcp_reply, "%s\001FINGER %s\001", ctcp_reply, ctcp_finger);
@@ -48,7 +48,7 @@
 }
 
 static int ctcp_ECHOERR(char *nick, char *uhost, char *handle,
-			char *object, char *keyword, char *text)
+                        char *object, char *keyword, char *text)
 {
   if (ctcp_mode != 1 && strlen(text) <= 80)
     simple_sprintf(ctcp_reply, "%s\001%s %s\001", ctcp_reply, keyword, text);
@@ -56,36 +56,36 @@
 }
 
 static int ctcp_PING(char *nick, char *uhost, char *handle,
-		     char *object, char *keyword, char *text)
+                     char *object, char *keyword, char *text)
 {
   struct userrec *u = get_user_by_handle(userlist, handle);
   int atr = u ? u->flags : 0;
 
   if ((ctcp_mode != 1 || (atr & USER_OP)) && strlen(text) <= 80)
-      simple_sprintf(ctcp_reply, "%s\001%s %s\001", ctcp_reply, keyword, text);
+    simple_sprintf(ctcp_reply, "%s\001%s %s\001", ctcp_reply, keyword, text);
   return 1;
 }
 
 static int ctcp_VERSION(char *nick, char *uhost, char *handle,
-			char *object, char *keyword, char *text)
+                        char *object, char *keyword, char *text)
 {
   if (ctcp_mode != 1 && ctcp_version[0])
     simple_sprintf(ctcp_reply, "%s\001VERSION %s\001", ctcp_reply,
-		   ctcp_version);
+                   ctcp_version);
   return 1;
 }
 
 static int ctcp_USERINFO(char *nick, char *uhost, char *handle,
-			 char *object, char *keyword, char *text)
+                         char *object, char *keyword, char *text)
 {
   if (ctcp_mode != 1 && ctcp_userinfo[0])
     simple_sprintf(ctcp_reply, "%s\001USERINFO %s\001", ctcp_reply,
-		   ctcp_userinfo);
+                   ctcp_userinfo);
   return 1;
 }
 
 static int ctcp_CLIENTINFO(char *nick, char *uhosr, char *handle,
-			   char *object, char *keyword, char *msg)
+                           char *object, char *keyword, char *msg)
 {
   char *p = NULL;
 
@@ -119,15 +119,16 @@
     p = CLIENTINFO_ECHO;
   if (p == NULL) {
     simple_sprintf(ctcp_reply,
-	       "%s\001ERRMSG CLIENTINFO: %s is not a valid function\001",
-		   ctcp_reply, msg);
-  } else
+                   "%s\001ERRMSG CLIENTINFO: %s is not a valid function\001",
+                   ctcp_reply, msg);
+  }
+  else
     simple_sprintf(ctcp_reply, "%s\001CLIENTINFO %s\001", ctcp_reply, p);
   return 1;
 }
 
 static int ctcp_TIME(char *nick, char *uhost, char *handle, char *object,
-		     char *keyword, char *text)
+                     char *keyword, char *text)
 {
   char tms[25];
 
@@ -140,30 +141,29 @@
 }
 
 static int ctcp_CHAT(char *nick, char *uhost, char *handle, char *object,
-		     char *keyword, char *text)
+                     char *keyword, char *text)
 {
   struct userrec *u = get_user_by_handle(userlist, handle);
   int atr = u ? u->flags : 0, i;
 
-  if ((atr & (USER_PARTY | USER_XFER)) ||
-      ((atr & USER_OP) && !require_p)) {
+  if ((atr & (USER_PARTY | USER_XFER)) || ((atr & USER_OP) && !require_p)) {
 
     if (u_pass_match(u, "-")) {
-      simple_sprintf(ctcp_reply, "%s\001ERROR no password set\001", ctcp_reply);
+      simple_sprintf(ctcp_reply, "%s\001ERROR no password set\001",
+                     ctcp_reply);
       return 1;
     }
 
     for (i = 0; i < dcc_total; i++) {
       if ((dcc[i].type->flags & DCT_LISTEN) &&
-	  (!strcmp(dcc[i].nick, "(telnet)") ||
-	   !strcmp(dcc[i].nick, "(users)"))) {
+          (!strcmp(dcc[i].nick, "(telnet)") ||
+           !strcmp(dcc[i].nick, "(users)"))) {
         /* Do me a favour and don't change this back to a CTCP reply,
          * CTCP replies are NOTICE's this has to be a PRIVMSG
          * -poptix 5/1/1997 */
-	dprintf(DP_SERVER, "PRIVMSG %s :\001DCC CHAT chat %lu %u\001\n",
-		nick,
-		iptolong(natip[0] ? (IP) inet_addr(natip) : getmyip()),
-		dcc[i].port);
+        dprintf(DP_SERVER, "PRIVMSG %s :\001DCC CHAT chat %lu %u\001\n",
+                nick, iptolong(natip[0] ? (IP) inet_addr(natip) : getmyip()),
+                dcc[i].port);
         return 1;
       }
     }
@@ -172,32 +172,29 @@
   return 1;
 }
 
-static cmd_t myctcp[] =
-{
-  {"FINGER",		"",	ctcp_FINGER,		NULL},
-  {"ECHO",		"",	ctcp_ECHOERR,		NULL},
-  {"PING",		"",	ctcp_PING,		NULL},
-  {"ERRMSG",		"",	ctcp_ECHOERR,		NULL},
-  {"VERSION",		"",	ctcp_VERSION,		NULL},
-  {"USERINFO",		"",	ctcp_USERINFO,		NULL},
-  {"CLIENTINFO",	"",	ctcp_CLIENTINFO,	NULL},
-  {"TIME",		"",	ctcp_TIME,		NULL},
-  {"CHAT",		"",	ctcp_CHAT,		NULL},
-  {NULL,		NULL,	NULL,			NULL}
+static cmd_t myctcp[] = {
+  {"FINGER",     "",   ctcp_FINGER,     NULL},
+  {"ECHO",       "",   ctcp_ECHOERR,    NULL},
+  {"PING",       "",   ctcp_PING,       NULL},
+  {"ERRMSG",     "",   ctcp_ECHOERR,    NULL},
+  {"VERSION",    "",   ctcp_VERSION,    NULL},
+  {"USERINFO",   "",   ctcp_USERINFO,   NULL},
+  {"CLIENTINFO", "",   ctcp_CLIENTINFO, NULL},
+  {"TIME",       "",   ctcp_TIME,       NULL},
+  {"CHAT",       "",   ctcp_CHAT,       NULL},
+  {NULL,         NULL, NULL,            NULL}
 };
 
-static tcl_strings mystrings[] =
-{
-  {"ctcp-version",	ctcp_version,	120,	0},
-  {"ctcp-finger",	ctcp_finger,	120,	0},
-  {"ctcp-userinfo",	ctcp_userinfo,	120,	0},
-  {NULL,		NULL,		0,	0}
+static tcl_strings mystrings[] = {
+  {"ctcp-version",  ctcp_version,  120, 0},
+  {"ctcp-finger",   ctcp_finger,   120, 0},
+  {"ctcp-userinfo", ctcp_userinfo, 120, 0},
+  {NULL,            NULL,          0,   0}
 };
 
-static tcl_ints myints[] =
-{
-  {"ctcp-mode",		&ctcp_mode},
-  {NULL,		NULL}
+static tcl_ints myints[] = {
+  {"ctcp-mode", &ctcp_mode},
+  {NULL,              NULL}
 };
 
 static char *ctcp_close()
@@ -212,15 +209,14 @@
 
 EXPORT_SCOPE char *ctcp_start();
 
-static Function ctcp_table[] =
-{
+static Function ctcp_table[] = {
   (Function) ctcp_start,
   (Function) ctcp_close,
   (Function) NULL,
   (Function) NULL,
 };
 
-char *ctcp_start(Function * global_funcs)
+char *ctcp_start(Function *global_funcs)
 {
   global = global_funcs;
 
Index: eggdrop1.6/src/mod/ctcp.mod/ctcp.h
diff -u eggdrop1.6/src/mod/ctcp.mod/ctcp.h:1.6 eggdrop1.6/src/mod/ctcp.mod/ctcp.h:1.7
--- eggdrop1.6/src/mod/ctcp.mod/ctcp.h:1.6	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/ctcp.mod/ctcp.h	Tue Jan 28 00:37:25 2003
@@ -2,7 +2,7 @@
  * ctcp.h -- part of ctcp.mod
  *   all the defines for ctcp.c
  *
- * $Id: ctcp.h,v 1.6 2002/12/24 02:30:07 wcc Exp $
+ * $Id: ctcp.h,v 1.7 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -40,4 +40,4 @@
 #define CLIENTINFO_PING "PING returns the arguments it receives"
 #define CLIENTINFO_ECHO "ECHO returns the arguments it receives"
 
-#endif				/* _EGG_MOD_CTCP_CTCP_H */
+#endif /* _EGG_MOD_CTCP_CTCP_H */
Index: eggdrop1.6/src/mod/dns.mod/coredns.c
diff -u eggdrop1.6/src/mod/dns.mod/coredns.c:1.22 eggdrop1.6/src/mod/dns.mod/coredns.c:1.23
--- eggdrop1.6/src/mod/dns.mod/coredns.c:1.22	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/dns.mod/coredns.c	Tue Jan 28 00:37:25 2003
@@ -5,7 +5,7 @@
  *
  * Modified/written by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: coredns.c,v 1.22 2002/12/24 02:30:07 wcc Exp $
+ * $Id: coredns.c,v 1.23 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Portions Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -45,13 +45,13 @@
 
 /* Defines */
 
-#define BASH_SIZE	 8192		/* Size of hash tables */
-#define HOSTNAMELEN 	  255		/* From RFC */
+#define BASH_SIZE	 8192   /* Size of hash tables */
+#define HOSTNAMELEN 	  255   /* From RFC */
 #define RES_RETRYDELAY      3
 #define RES_MAXSENDS        4
-#define RES_FAILEDDELAY   600		/* TTL for failed records (in
-					   seconds). */
-#define RES_MAX_TTL     86400		/* Maximum TTL (in seconds). */
+#define RES_FAILEDDELAY   600   /* TTL for failed records (in
+                                 * seconds). */
+#define RES_MAX_TTL     86400   /* Maximum TTL (in seconds). */
 
 #define RES_ERR "DNS Resolver error: "
 #define RES_MSG "DNS Resolver: "
@@ -63,78 +63,78 @@
 /* Macros */
 
 #define nonull(s) (s) ? s : nullstring
-#define BASH_MODULO(x) ((x) & 8191)	/* Modulo for hash table size */
+#define BASH_MODULO(x) ((x) & 8191)     /* Modulo for hash table size */
 
 /* Non-blocking nameserver interface routines */
 
 #ifdef DEBUG_DNS
 #  define RESPONSECODES_COUNT 6
 static char *responsecodes[RESPONSECODES_COUNT + 1] = {
-    "no error",
-    "format error in query",
-    "server failure",
-    "queried domain name does not exist",
-    "requested query type not implemented",
-    "refused by name server",
-    "unknown error",
+  "no error",
+  "format error in query",
+  "server failure",
+  "queried domain name does not exist",
+  "requested query type not implemented",
+  "refused by name server",
+  "unknown error",
 };
 #endif /* DEBUG_DNS */
 
 #ifdef DEBUG_DNS
 #  define RESOURCETYPES_COUNT 17
 static const char *resourcetypes[RESOURCETYPES_COUNT + 1] = {
-    "unknown type",
-    "A: host address",
-    "NS: authoritative name server",
-    "MD: mail destination (OBSOLETE)",
-    "MF: mail forwarder (OBSOLETE)",
-    "CNAME: name alias",
-    "SOA: authority record",
-    "MB: mailbox domain name (EXPERIMENTAL)",
-    "MG: mail group member (EXPERIMENTAL)",
-    "MR: mail rename domain name (EXPERIMENTAL)",
-    "NULL: NULL RR (EXPERIMENTAL)",
-    "WKS: well known service description",
-    "PTR: domain name pointer",
-    "HINFO: host information",
-    "MINFO: mailbox or mail list information",
-    "MX: mail exchange",
-    "TXT: text string",
-    "unknown type",
+  "unknown type",
+  "A: host address",
+  "NS: authoritative name server",
+  "MD: mail destination (OBSOLETE)",
+  "MF: mail forwarder (OBSOLETE)",
+  "CNAME: name alias",
+  "SOA: authority record",
+  "MB: mailbox domain name (EXPERIMENTAL)",
+  "MG: mail group member (EXPERIMENTAL)",
+  "MR: mail rename domain name (EXPERIMENTAL)",
+  "NULL: NULL RR (EXPERIMENTAL)",
+  "WKS: well known service description",
+  "PTR: domain name pointer",
+  "HINFO: host information",
+  "MINFO: mailbox or mail list information",
+  "MX: mail exchange",
+  "TXT: text string",
+  "unknown type",
 };
 #endif /* DEBUG_DNS */
 
 #ifdef DEBUG_DNS
 #  define CLASSTYPES_COUNT 5
 static const char *classtypes[CLASSTYPES_COUNT + 1] = {
-    "unknown class",
-    "IN: the Internet",
-    "CS: CSNET (OBSOLETE)",
-    "CH: CHAOS",
-    "HS: Hesoid [Dyer 87]",
-    "unknown class"
+  "unknown class",
+  "IN: the Internet",
+  "CS: CSNET (OBSOLETE)",
+  "CH: CHAOS",
+  "HS: Hesoid [Dyer 87]",
+  "unknown class"
 };
 #endif /* DEBUG_DNS */
 
 typedef struct {
-    u_16bit_t	id;			/* Packet id */
-    u_8bit_t	databyte_a;
-    /* rd:1				recursion desired
-     * tc:1				truncated message
-     * aa:1				authoritive answer
-     * opcode:4				purpose of message
-     * qr:1				response flag
-     */
-    u_8bit_t	databyte_b;
-    /* rcode:4				response code
-     * unassigned:2			unassigned bits
-     * pr:1				primary server required (non standard)
-     * ra:1				recursion available
-     */
-    u_16bit_t	qdcount;		/* Query record count */
-    u_16bit_t	ancount;		/* Answer record count */
-    u_16bit_t	nscount;		/* Authority reference record count */
-    u_16bit_t	arcount;		/* Resource reference record count */
+  u_16bit_t id;                 /* Packet id */
+  u_8bit_t databyte_a;
+  /* rd:1                             recursion desired
+   * tc:1                             truncated message
+   * aa:1                             authoritive answer
+   * opcode:4                         purpose of message
+   * qr:1                             response flag
+   */
+  u_8bit_t databyte_b;
+  /* rcode:4                          response code
+   * unassigned:2                     unassigned bits
+   * pr:1                             primary server required (non standard)
+   * ra:1                             recursion available
+   */
+  u_16bit_t qdcount;            /* Query record count */
+  u_16bit_t ancount;            /* Answer record count */
+  u_16bit_t nscount;            /* Authority reference record count */
+  u_16bit_t arcount;            /* Resource reference record count */
 } packetheader;
 
 #ifndef HFIXEDSZ
@@ -161,7 +161,7 @@
                                           ((x)[-2] <<  8) | ((x)[-1] <<  0))))
 
 
-static u_32bit_t resrecvbuf[(MAX_PACKETSIZE + 7) >> 2];	/* MUST BE DWORD ALIGNED */
+static u_32bit_t resrecvbuf[(MAX_PACKETSIZE + 7) >> 2]; /* MUST BE DWORD ALIGNED */
 
 static struct resolve *idbash[BASH_SIZE];
 static struct resolve *ipbash[BASH_SIZE];
@@ -195,30 +195,31 @@
  */
 static char *strtdiff(char *d, long signeddiff)
 {
-    u_32bit_t diff;
-    u_32bit_t seconds, minutes, hours;
-    long day;
-
-    if ((diff = labs(signeddiff))) {
-	seconds = diff % 60;
-	diff /= 60;
-	minutes = diff % 60;
-	diff /= 60;
-	hours = diff % 24;
-	day = signeddiff / (60 * 60 * 24);
-	if (day)
-	    sprintf(d, "%lid", day);
-	else
-	    *d = '\0';
-	if (hours)
-	    sprintf(d + strlen(d), "%uh", hours);
-	if (minutes)
-	    sprintf(d + strlen(d), "%um", minutes);
-	if (seconds)
-	    sprintf(d + strlen(d), "%us", seconds);
-    } else
-	sprintf(d, "0s");
-    return d;
+  u_32bit_t diff;
+  u_32bit_t seconds, minutes, hours;
+  long day;
+
+  if ((diff = labs(signeddiff))) {
+    seconds = diff % 60;
+    diff /= 60;
+    minutes = diff % 60;
+    diff /= 60;
+    hours = diff % 24;
+    day = signeddiff / (60 * 60 * 24);
+    if (day)
+      sprintf(d, "%lid", day);
+    else
+      *d = '\0';
+    if (hours)
+      sprintf(d + strlen(d), "%uh", hours);
+    if (minutes)
+      sprintf(d + strlen(d), "%um", minutes);
+    if (seconds)
+      sprintf(d + strlen(d), "%us", seconds);
+  }
+  else
+    sprintf(d, "0s");
+  return d;
 }
 #endif /* DEBUG_DNS */
 
@@ -226,11 +227,11 @@
  */
 static struct resolve *allocresolve()
 {
-    struct resolve *rp;
+  struct resolve *rp;
 
-    rp = (struct resolve *) nmalloc(sizeof(struct resolve));
-    egg_bzero(rp, sizeof(struct resolve));
-    return rp;
+  rp = (struct resolve *) nmalloc(sizeof(struct resolve));
+  egg_bzero(rp, sizeof(struct resolve));
+  return rp;
 }
 
 
@@ -242,188 +243,197 @@
  */
 inline static u_32bit_t getidbash(u_16bit_t id)
 {
-    return (u_32bit_t) BASH_MODULO(id);
+  return (u_32bit_t) BASH_MODULO(id);
 }
 
 /* Return the hash bucket number for ip.
  */
 inline static u_32bit_t getipbash(IP ip)
 {
-    return (u_32bit_t) BASH_MODULO(ip);
+  return (u_32bit_t) BASH_MODULO(ip);
 }
 
 /* Return the hash bucket number for host.
  */
 static u_32bit_t gethostbash(char *host)
 {
-    u_32bit_t bashvalue = 0;
+  u_32bit_t bashvalue = 0;
 
-    for (; *host; host++) {
-	bashvalue ^= *host;
-	bashvalue += (*host >> 1) + (bashvalue >> 1);
-    }
-    return BASH_MODULO(bashvalue);
+  for (; *host; host++) {
+    bashvalue ^= *host;
+    bashvalue += (*host >> 1) + (bashvalue >> 1);
+  }
+  return BASH_MODULO(bashvalue);
 }
 
 /* Insert request structure addrp into the id hash table.
  */
 static void linkresolveid(struct resolve *addrp)
 {
-    struct resolve *rp;
-    u_32bit_t bashnum;
+  struct resolve *rp;
+  u_32bit_t bashnum;
 
-    bashnum = getidbash(addrp->id);
-    rp = idbash[bashnum];
-    if (rp) {
-	while ((rp->nextid) && (addrp->id > rp->nextid->id))
-	    rp = rp->nextid;
-	while ((rp->previousid) && (addrp->id < rp->previousid->id))
-	    rp = rp->previousid;
-	if (rp->id < addrp->id) {
-	    addrp->previousid = rp;
-	    addrp->nextid = rp->nextid;
-	    if (rp->nextid)
-		rp->nextid->previousid = addrp;
-	    rp->nextid = addrp;
-	} else if (rp->id > addrp->id) {
-	    addrp->previousid = rp->previousid;
-	    addrp->nextid = rp;
-	    if (rp->previousid)
-		rp->previousid->nextid = addrp;
-	    rp->previousid = addrp;
-	} else		/* Trying to add the same id! */
-	    return;
-    } else
-	addrp->nextid = addrp->previousid = NULL;
-    idbash[bashnum] = addrp;
+  bashnum = getidbash(addrp->id);
+  rp = idbash[bashnum];
+  if (rp) {
+    while ((rp->nextid) && (addrp->id > rp->nextid->id))
+      rp = rp->nextid;
+    while ((rp->previousid) && (addrp->id < rp->previousid->id))
+      rp = rp->previousid;
+    if (rp->id < addrp->id) {
+      addrp->previousid = rp;
+      addrp->nextid = rp->nextid;
+      if (rp->nextid)
+        rp->nextid->previousid = addrp;
+      rp->nextid = addrp;
+    }
+    else if (rp->id > addrp->id) {
+      addrp->previousid = rp->previousid;
+      addrp->nextid = rp;
+      if (rp->previousid)
+        rp->previousid->nextid = addrp;
+      rp->previousid = addrp;
+    }
+    else                        /* Trying to add the same id! */
+      return;
+  }
+  else
+    addrp->nextid = addrp->previousid = NULL;
+  idbash[bashnum] = addrp;
 }
 
 /* Remove request structure rp from the id hash table.
  */
 static void unlinkresolveid(struct resolve *rp)
 {
-    u_32bit_t bashnum;
+  u_32bit_t bashnum;
 
-    bashnum = getidbash(rp->id);
-    if (idbash[bashnum] == rp) {
-	if (rp->previousid)
-	    idbash[bashnum] = rp->previousid;
-	else
-	    idbash[bashnum] = rp->nextid;
-    }
-    if (rp->nextid)
-	rp->nextid->previousid = rp->previousid;
+  bashnum = getidbash(rp->id);
+  if (idbash[bashnum] == rp) {
     if (rp->previousid)
-	rp->previousid->nextid = rp->nextid;
+      idbash[bashnum] = rp->previousid;
+    else
+      idbash[bashnum] = rp->nextid;
+  }
+  if (rp->nextid)
+    rp->nextid->previousid = rp->previousid;
+  if (rp->previousid)
+    rp->previousid->nextid = rp->nextid;
 }
 
 /* Insert request structure addrp into the host hash table.
  */
 static void linkresolvehost(struct resolve *addrp)
 {
-    struct resolve *rp;
-    u_32bit_t bashnum;
-    int ret;
-
-    bashnum = gethostbash(addrp->hostn);
-    rp = hostbash[bashnum];
-    if (rp) {
-	while ((rp->nexthost) &&
-	       (egg_strcasecmp(addrp->hostn, rp->nexthost->hostn) < 0))
-	    rp = rp->nexthost;
-	while ((rp->previoushost) &&
-	       (egg_strcasecmp(addrp->hostn, rp->previoushost->hostn) > 0))
-	    rp = rp->previoushost;
-	ret = egg_strcasecmp(addrp->hostn, rp->hostn);
-	if (ret < 0) {
-	    addrp->previoushost = rp;
-	    addrp->nexthost = rp->nexthost;
-	    if (rp->nexthost)
-		rp->nexthost->previoushost = addrp;
-	    rp->nexthost = addrp;
-	} else if (ret > 0) {
-	    addrp->previoushost = rp->previoushost;
-	    addrp->nexthost = rp;
-	    if (rp->previoushost)
-		rp->previoushost->nexthost = addrp;
-	    rp->previoushost = addrp;
-	} else		/* Trying to add the same host! */
-	    return;
-    } else
-	addrp->nexthost = addrp->previoushost = NULL;
-    hostbash[bashnum] = addrp;
+  struct resolve *rp;
+  u_32bit_t bashnum;
+  int ret;
+
+  bashnum = gethostbash(addrp->hostn);
+  rp = hostbash[bashnum];
+  if (rp) {
+    while ((rp->nexthost) &&
+           (egg_strcasecmp(addrp->hostn, rp->nexthost->hostn) < 0))
+      rp = rp->nexthost;
+    while ((rp->previoushost) &&
+           (egg_strcasecmp(addrp->hostn, rp->previoushost->hostn) > 0))
+      rp = rp->previoushost;
+    ret = egg_strcasecmp(addrp->hostn, rp->hostn);
+    if (ret < 0) {
+      addrp->previoushost = rp;
+      addrp->nexthost = rp->nexthost;
+      if (rp->nexthost)
+        rp->nexthost->previoushost = addrp;
+      rp->nexthost = addrp;
+    }
+    else if (ret > 0) {
+      addrp->previoushost = rp->previoushost;
+      addrp->nexthost = rp;
+      if (rp->previoushost)
+        rp->previoushost->nexthost = addrp;
+      rp->previoushost = addrp;
+    }
+    else                        /* Trying to add the same host! */
+      return;
+  }
+  else
+    addrp->nexthost = addrp->previoushost = NULL;
+  hostbash[bashnum] = addrp;
 }
 
 /* Remove request structure rp from the host hash table.
  */
 static void unlinkresolvehost(struct resolve *rp)
 {
-    u_32bit_t bashnum;
+  u_32bit_t bashnum;
 
-    bashnum = gethostbash(rp->hostn);
-    if (hostbash[bashnum] == rp) {
-	if (rp->previoushost)
-	    hostbash[bashnum] = rp->previoushost;
-	else
-	    hostbash[bashnum] = rp->nexthost;
-    }
-    if (rp->nexthost)
-	rp->nexthost->previoushost = rp->previoushost;
+  bashnum = gethostbash(rp->hostn);
+  if (hostbash[bashnum] == rp) {
     if (rp->previoushost)
-	rp->previoushost->nexthost = rp->nexthost;
-    nfree(rp->hostn);
+      hostbash[bashnum] = rp->previoushost;
+    else
+      hostbash[bashnum] = rp->nexthost;
+  }
+  if (rp->nexthost)
+    rp->nexthost->previoushost = rp->previoushost;
+  if (rp->previoushost)
+    rp->previoushost->nexthost = rp->nexthost;
+  nfree(rp->hostn);
 }
 
 /* Insert request structure addrp into the ip hash table.
  */
 static void linkresolveip(struct resolve *addrp)
 {
-    struct resolve *rp;
-    u_32bit_t bashnum;
+  struct resolve *rp;
+  u_32bit_t bashnum;
 
-    bashnum = getipbash(addrp->ip);
-    rp = ipbash[bashnum];
-    if (rp) {
-	while ((rp->nextip) && (addrp->ip > rp->nextip->ip))
-	    rp = rp->nextip;
-	while ((rp->previousip) && (addrp->ip < rp->previousip->ip))
-	    rp = rp->previousip;
-	if (rp->ip < addrp->ip) {
-	    addrp->previousip = rp;
-	    addrp->nextip = rp->nextip;
-	    if (rp->nextip)
-		rp->nextip->previousip = addrp;
-	    rp->nextip = addrp;
-	} else if (rp->ip > addrp->ip) {
-	    addrp->previousip = rp->previousip;
-	    addrp->nextip = rp;
-	    if (rp->previousip)
-		rp->previousip->nextip = addrp;
-	    rp->previousip = addrp;
-	} else		/* Trying to add the same ip! */
-	    return;
-    } else
-	addrp->nextip = addrp->previousip = NULL;
-    ipbash[bashnum] = addrp;
+  bashnum = getipbash(addrp->ip);
+  rp = ipbash[bashnum];
+  if (rp) {
+    while ((rp->nextip) && (addrp->ip > rp->nextip->ip))
+      rp = rp->nextip;
+    while ((rp->previousip) && (addrp->ip < rp->previousip->ip))
+      rp = rp->previousip;
+    if (rp->ip < addrp->ip) {
+      addrp->previousip = rp;
+      addrp->nextip = rp->nextip;
+      if (rp->nextip)
+        rp->nextip->previousip = addrp;
+      rp->nextip = addrp;
+    }
+    else if (rp->ip > addrp->ip) {
+      addrp->previousip = rp->previousip;
+      addrp->nextip = rp;
+      if (rp->previousip)
+        rp->previousip->nextip = addrp;
+      rp->previousip = addrp;
+    }
+    else                        /* Trying to add the same ip! */
+      return;
+  }
+  else
+    addrp->nextip = addrp->previousip = NULL;
+  ipbash[bashnum] = addrp;
 }
 
 /* Remove request structure rp from the ip hash table.
  */
 static void unlinkresolveip(struct resolve *rp)
 {
-    u_32bit_t bashnum;
+  u_32bit_t bashnum;
 
-    bashnum = getipbash(rp->ip);
-    if (ipbash[bashnum] == rp) {
-	if (rp->previousip)
-	    ipbash[bashnum] = rp->previousip;
-	else
-	    ipbash[bashnum] = rp->nextip;
-    }
-    if (rp->nextip)
-	rp->nextip->previousip = rp->previousip;
+  bashnum = getipbash(rp->ip);
+  if (ipbash[bashnum] == rp) {
     if (rp->previousip)
-	rp->previousip->nextip = rp->nextip;
+      ipbash[bashnum] = rp->previousip;
+    else
+      ipbash[bashnum] = rp->nextip;
+  }
+  if (rp->nextip)
+    rp->nextip->previousip = rp->previousip;
+  if (rp->previousip)
+    rp->previousip->nextip = rp->nextip;
 }
 
 /* Add request structure rp to the expireresolves list. Entries are sorted
@@ -431,42 +441,44 @@
  */
 static void linkresolve(struct resolve *rp)
 {
-    struct resolve *irp;
+  struct resolve *irp;
 
-    if (expireresolves) {
-	irp = expireresolves;
-	while ((irp->next) && (rp->expiretime >= irp->expiretime))
-	    irp = irp->next;
-	if (rp->expiretime >= irp->expiretime) {
-	    rp->next = NULL;
-	    rp->previous = irp;
-	    irp->next = rp;
-	} else {
-	    rp->previous = irp->previous;
-	    rp->next = irp;
-	    if (irp->previous)
-		irp->previous->next = rp;
-	    else
-		expireresolves = rp;
-	    irp->previous = rp;
-	}
-    } else {
-	rp->next = NULL;
-	rp->previous = NULL;
-	expireresolves = rp;
-    }
+  if (expireresolves) {
+    irp = expireresolves;
+    while ((irp->next) && (rp->expiretime >= irp->expiretime))
+      irp = irp->next;
+    if (rp->expiretime >= irp->expiretime) {
+      rp->next = NULL;
+      rp->previous = irp;
+      irp->next = rp;
+    }
+    else {
+      rp->previous = irp->previous;
+      rp->next = irp;
+      if (irp->previous)
+        irp->previous->next = rp;
+      else
+        expireresolves = rp;
+      irp->previous = rp;
+    }
+  }
+  else {
+    rp->next = NULL;
+    rp->previous = NULL;
+    expireresolves = rp;
+  }
 }
 
 /* Remove reqeust structure rp from the expireresolves list.
  */
 static void untieresolve(struct resolve *rp)
 {
-    if (rp->previous)
-	rp->previous->next = rp->next;
-    else
-	expireresolves = rp->next;
-    if (rp->next)
-	rp->next->previous = rp->previous;
+  if (rp->previous)
+    rp->previous->next = rp->next;
+  else
+    expireresolves = rp->next;
+  if (rp->next)
+    rp->next->previous = rp->previous;
 }
 
 /* Remove request structure rp from all lists and hash tables and
@@ -475,85 +487,87 @@
 static void unlinkresolve(struct resolve *rp)
 {
 
-    untieresolve(rp);		/* Not really needed. Left in to be on the
-				   safe side. */
-    unlinkresolveid(rp);
-    unlinkresolveip(rp);
-    if (rp->hostn)
-	unlinkresolvehost(rp);
-    nfree(rp);
+  untieresolve(rp);             /* Not really needed. Left in to be on the
+                                 * safe side. */
+  unlinkresolveid(rp);
+  unlinkresolveip(rp);
+  if (rp->hostn)
+    unlinkresolvehost(rp);
+  nfree(rp);
 }
 
 /* Find request structure using the id.
  */
 static struct resolve *findid(u_16bit_t id)
 {
-    struct resolve *rp;
-    int bashnum;
+  struct resolve *rp;
+  int bashnum;
 
-    bashnum = getidbash(id);
-    rp = idbash[bashnum];
-    if (rp) {
-	while ((rp->nextid) && (id >= rp->nextid->id))
-	    rp = rp->nextid;
-	while ((rp->previousid) && (id <= rp->previousid->id))
-	    rp = rp->previousid;
-	if (id == rp->id) {
-	    idbash[bashnum] = rp;
-	    return rp;
-	} else
-	    return NULL;
+  bashnum = getidbash(id);
+  rp = idbash[bashnum];
+  if (rp) {
+    while ((rp->nextid) && (id >= rp->nextid->id))
+      rp = rp->nextid;
+    while ((rp->previousid) && (id <= rp->previousid->id))
+      rp = rp->previousid;
+    if (id == rp->id) {
+      idbash[bashnum] = rp;
+      return rp;
     }
-    return rp;			/* NULL */
+    else
+      return NULL;
+  }
+  return rp;                    /* NULL */
 }
 
 /* Find request structure using the host.
  */
 static struct resolve *findhost(char *hostn)
 {
-    struct resolve *rp;
-    int bashnum;
+  struct resolve *rp;
+  int bashnum;
 
-    bashnum = gethostbash(hostn);
-    rp = hostbash[bashnum];
-    if (rp) {
-	while ((rp->nexthost)
-	       && (egg_strcasecmp(hostn, rp->nexthost->hostn) >= 0))
-	    rp = rp->nexthost;
-	while ((rp->previoushost)
-	       && (egg_strcasecmp(hostn, rp->previoushost->hostn) <= 0))
-	    rp = rp->previoushost;
-	if (egg_strcasecmp(hostn, rp->hostn))
-	    return NULL;
-	else {
-	    hostbash[bashnum] = rp;
-	    return rp;
-	}
+  bashnum = gethostbash(hostn);
+  rp = hostbash[bashnum];
+  if (rp) {
+    while ((rp->nexthost) &&
+          (egg_strcasecmp(hostn, rp->nexthost->hostn) >= 0))
+      rp = rp->nexthost;
+    while ((rp->previoushost) &&
+           (egg_strcasecmp(hostn, rp->previoushost->hostn) <= 0))
+      rp = rp->previoushost;
+    if (egg_strcasecmp(hostn, rp->hostn))
+      return NULL;
+    else {
+      hostbash[bashnum] = rp;
+      return rp;
     }
-    return rp;			/* NULL */
+  }
+  return rp;                    /* NULL */
 }
 
 /* Find request structure using the ip.
  */
 static struct resolve *findip(IP ip)
 {
-    struct resolve *rp;
-    u_32bit_t bashnum;
+  struct resolve *rp;
+  u_32bit_t bashnum;
 
-    bashnum = getipbash(ip);
-    rp = ipbash[bashnum];
-    if (rp) {
-	while ((rp->nextip) && (ip >= rp->nextip->ip))
-	    rp = rp->nextip;
-	while ((rp->previousip) && (ip <= rp->previousip->ip))
-	    rp = rp->previousip;
-	if (ip == rp->ip) {
-	    ipbash[bashnum] = rp;
-	    return rp;
-	} else
-	    return NULL;
+  bashnum = getipbash(ip);
+  rp = ipbash[bashnum];
+  if (rp) {
+    while ((rp->nextip) && (ip >= rp->nextip->ip))
+      rp = rp->nextip;
+    while ((rp->previousip) && (ip <= rp->previousip->ip))
+      rp = rp->previousip;
+    if (ip == rp->ip) {
+      ipbash[bashnum] = rp;
+      return rp;
     }
-    return rp;			/* NULL */
+    else
+      return NULL;
+  }
+  return rp;                    /* NULL */
 }
 
 
@@ -565,62 +579,60 @@
  */
 static void dorequest(char *s, int type, u_16bit_t id)
 {
-    packetheader *hp;
-    int r, i;
-    u_8bit_t buf[(MAX_PACKETSIZE / sizeof(char)) + 1];
-
-    r = res_mkquery(QUERY, s, C_IN, type, NULL, 0, NULL, buf,
-		    MAX_PACKETSIZE);
-    if (r == -1) {
-	ddebug0(RES_ERR "Query too large.");
-	return;
-    }
-    hp = (packetheader *) buf;
-    hp->id = id;	/* htons() deliberately left out (redundant) */
-    for (i = 0; i < _res.nscount; i++)
-	(void) sendto(resfd, buf, r, 0,
-		      (struct sockaddr *) &_res.nsaddr_list[i],
-		      sizeof(struct sockaddr));
+  packetheader *hp;
+  int r, i;
+  u_8bit_t buf[(MAX_PACKETSIZE / sizeof(char)) + 1];
+
+  r = res_mkquery(QUERY, s, C_IN, type, NULL, 0, NULL, buf, MAX_PACKETSIZE);
+  if (r == -1) {
+    ddebug0(RES_ERR "Query too large.");
+    return;
+  }
+  hp = (packetheader *) buf;
+  hp->id = id;                  /* htons() deliberately left out (redundant) */
+  for (i = 0; i < _res.nscount; i++)
+    (void) sendto(resfd, buf, r, 0,
+                  (struct sockaddr *) &_res.nsaddr_list[i],
+                  sizeof(struct sockaddr));
 }
 
 /* (Re-)send request with existing id.
  */
 static void resendrequest(struct resolve *rp, int type)
 {
-    rp->sends++;
-    /* Update expire time */
-    rp->expiretime = now + (RES_RETRYDELAY * rp->sends);
-    /* Add (back) to expire list */
-    linkresolve(rp);
-
-    if (type == T_A) {
-	dorequest(rp->hostn, type, rp->id);
-	ddebug1(RES_MSG "Sent domain lookup request for \"%s\".",
-		rp->hostn);
-    } else if (type == T_PTR) {
-	sprintf(tempstring, "%u.%u.%u.%u.in-addr.arpa",
-		((u_8bit_t *) & rp->ip)[3],
-		((u_8bit_t *) & rp->ip)[2],
-		((u_8bit_t *) & rp->ip)[1], ((u_8bit_t *) & rp->ip)[0]);
-	dorequest(tempstring, type, rp->id);
-	ddebug1(RES_MSG "Sent domain lookup request for \"%s\".",
-		iptostr(rp->ip));
-    }
+  rp->sends++;
+  /* Update expire time */
+  rp->expiretime = now + (RES_RETRYDELAY * rp->sends);
+  /* Add (back) to expire list */
+  linkresolve(rp);
+
+  if (type == T_A) {
+    dorequest(rp->hostn, type, rp->id);
+    ddebug1(RES_MSG "Sent domain lookup request for \"%s\".", rp->hostn);
+  }
+  else if (type == T_PTR) {
+    sprintf(tempstring, "%u.%u.%u.%u.in-addr.arpa",
+            ((u_8bit_t *) & rp->ip)[3],
+            ((u_8bit_t *) & rp->ip)[2],
+            ((u_8bit_t *) & rp->ip)[1], ((u_8bit_t *) & rp->ip)[0]);
+    dorequest(tempstring, type, rp->id);
+    ddebug1(RES_MSG "Sent domain lookup request for \"%s\".", iptostr(rp->ip));
+  }
 }
 
 /* Send request for the first time.
  */
 static void sendrequest(struct resolve *rp, int type)
 {
-    /* Create unique id */
-    do {
-	idseed = (((idseed + idseed) | (long) time(NULL))
-		  + idseed - 0x54bad4a) ^ aseed;
-	aseed ^= idseed;
-	rp->id = (u_16bit_t) idseed;
-    } while (findid(rp->id));
-    linkresolveid(rp);		/* Add id to id hash table */
-    resendrequest(rp, type);	/* Send request */
+  /* Create unique id */
+  do {
+    idseed = (((idseed + idseed) | (long) time(NULL))
+              + idseed - 0x54bad4a) ^ aseed;
+    aseed ^= idseed;
+    rp->id = (u_16bit_t) idseed;
+  } while (findid(rp->id));
+  linkresolveid(rp);            /* Add id to id hash table */
+  resendrequest(rp, type);      /* Send request */
 }
 
 /* Gets called as soon as the request turns out to have failed. Calls
@@ -628,17 +640,17 @@
  */
 static void failrp(struct resolve *rp, int type)
 {
-    if (rp->state == STATE_FINISHED)
-	return;
-    rp->expiretime = now + RES_FAILEDDELAY;
-    rp->state = STATE_FAILED;
-
-    /* Expire time was changed, reinsert entry to maintain order */
-    untieresolve(rp);
-    linkresolve(rp);
+  if (rp->state == STATE_FINISHED)
+    return;
+  rp->expiretime = now + RES_FAILEDDELAY;
+  rp->state = STATE_FAILED;
+
+  /* Expire time was changed, reinsert entry to maintain order */
+  untieresolve(rp);
+  linkresolve(rp);
 
-    ddebug0(RES_MSG "Lookup failed.");
-    dns_event_failure(rp, type);
+  ddebug0(RES_MSG "Lookup failed.");
+  dns_event_failure(rp, type);
 }
 
 /* Gets called as soon as the request turns out to be successful. Calls
@@ -646,280 +658,287 @@
  */
 static void passrp(struct resolve *rp, long ttl, int type)
 {
-    rp->state = STATE_FINISHED;
+  rp->state = STATE_FINISHED;
 
-    /* Do not cache entries for too long. */
-    if (ttl < RES_MAX_TTL)
-	rp->expiretime = now + (time_t) ttl;
-    else
-	rp->expiretime = now + RES_MAX_TTL;
+  /* Do not cache entries for too long. */
+  if (ttl < RES_MAX_TTL)
+    rp->expiretime = now + (time_t) ttl;
+  else
+    rp->expiretime = now + RES_MAX_TTL;
+
+  /* Expire time was changed, reinsert entry to maintain order */
+  untieresolve(rp);
+  linkresolve(rp);
 
-    /* Expire time was changed, reinsert entry to maintain order */
-    untieresolve(rp);
-    linkresolve(rp);
-
-    ddebug1(RES_MSG "Lookup successful: %s", rp->hostn);
-    dns_event_success(rp, type);
+  ddebug1(RES_MSG "Lookup successful: %s", rp->hostn);
+  dns_event_success(rp, type);
 }
 
 /* Parses the response packets received.
  */
 static void parserespacket(u_8bit_t *s, int l)
 {
-    struct resolve *rp;
-    packetheader *hp;
-    u_8bit_t *eob;
-    u_8bit_t *c;
-    long ttl;
-    int r, usefulanswer;
-    u_16bit_t rr, datatype, class, qdatatype, qclass;
-    u_8bit_t rdatalength;
-
-    if (l < sizeof(packetheader)) {
-	debug0(RES_ERR "Packet smaller than standard header size.");
-	return;
-    }
-    if (l == sizeof(packetheader)) {
-	debug0(RES_ERR "Packet has empty body.");
-	return;
-    }
-    hp = (packetheader *) s;
-    /* Convert data to host byte order
-     *
-     * hp->id does not need to be redundantly byte-order flipped, it
-     * is only echoed by nameserver
-     */
-    rp = findid(hp->id);
-    if (!rp)
-	return;
-    if ((rp->state == STATE_FINISHED) || (rp->state == STATE_FAILED))
-	return;
-    hp->qdcount = ntohs(hp->qdcount);
-    hp->ancount = ntohs(hp->ancount);
-    hp->nscount = ntohs(hp->nscount);
-    hp->arcount = ntohs(hp->arcount);
-    if (getheader_tc(hp)) {	/* Packet truncated */
-	ddebug0(RES_ERR "Nameserver packet truncated.");
-	return;
+  struct resolve *rp;
+  packetheader *hp;
+  u_8bit_t *eob;
+  u_8bit_t *c;
+  long ttl;
+  int r, usefulanswer;
+  u_16bit_t rr, datatype, class, qdatatype, qclass;
+  u_8bit_t rdatalength;
+
+  if (l < sizeof(packetheader)) {
+    debug0(RES_ERR "Packet smaller than standard header size.");
+    return;
+  }
+  if (l == sizeof(packetheader)) {
+    debug0(RES_ERR "Packet has empty body.");
+    return;
+  }
+  hp = (packetheader *) s;
+  /* Convert data to host byte order
+   *
+   * hp->id does not need to be redundantly byte-order flipped, it
+   * is only echoed by nameserver
+   */
+  rp = findid(hp->id);
+  if (!rp)
+    return;
+  if ((rp->state == STATE_FINISHED) || (rp->state == STATE_FAILED))
+    return;
+  hp->qdcount = ntohs(hp->qdcount);
+  hp->ancount = ntohs(hp->ancount);
+  hp->nscount = ntohs(hp->nscount);
+  hp->arcount = ntohs(hp->arcount);
+  if (getheader_tc(hp)) {       /* Packet truncated */
+    ddebug0(RES_ERR "Nameserver packet truncated.");
+    return;
+  }
+  if (!getheader_qr(hp)) {      /* Not a reply */
+    ddebug0(RES_ERR
+            "Query packet received on nameserver communication socket.");
+    return;
+  }
+  if (getheader_opcode(hp)) {   /* Not opcode 0 (standard query) */
+    ddebug0(RES_ERR "Invalid opcode in response packet.");
+    return;
+  }
+  eob = s + l;
+  c = s + HFIXEDSZ;
+  switch (getheader_rcode(hp)) {
+  case NOERROR:
+    if (hp->ancount) {
+      ddebug4(RES_MSG
+              "Received nameserver reply. (qd:%u an:%u ns:%u ar:%u)",
+              hp->qdcount, hp->ancount, hp->nscount, hp->arcount);
+      if (hp->qdcount != 1) {
+        ddebug0(RES_ERR "Reply does not contain one query.");
+        return;
+      }
+      if (c > eob) {
+        ddebug0(RES_ERR "Reply too short.");
+        return;
+      }
+      switch (rp->state) {      /* Construct expected query reply */
+      case STATE_PTRREQ:
+        sprintf(stackstring,
+                "%u.%u.%u.%u.in-addr.arpa",
+                ((u_8bit_t *) & rp->ip)[3],
+                ((u_8bit_t *) & rp->ip)[2],
+                ((u_8bit_t *) & rp->ip)[1], ((u_8bit_t *) & rp->ip)[0]);
+        break;
+      case STATE_AREQ:
+        strncpy(stackstring, rp->hostn, 1024);
+      }
+      *namestring = '\0';
+      r = dn_expand(s, s + l, c, namestring, MAXDNAME);
+      if (r == -1) {
+        ddebug0(RES_ERR "dn_expand() failed while expanding query domain.");
+        return;
+      }
+      namestring[strlen(stackstring)] = '\0';
+      if (egg_strcasecmp(stackstring, namestring)) {
+        ddebug2(RES_MSG
+                "Unknown query packet dropped. (\"%s\" does not match \"%s\")",
+                stackstring, namestring);
+        return;
+      }
+      ddebug1(RES_MSG "Queried domain name: \"%s\"", namestring);
+      c += r;
+      if (c + 4 > eob) {
+        ddebug0(RES_ERR "Query resource record truncated.");
+        return;
+      }
+      qdatatype = sucknetword(c);
+      qclass = sucknetword(c);
+      if (qclass != C_IN) {
+        ddebug2(RES_ERR "Received unsupported query class: %u (%s)",
+                qclass, qclass < CLASSTYPES_COUNT ?
+                classtypes[qclass] : classtypes[CLASSTYPES_COUNT]);
+      }
+      switch (qdatatype) {
+      case T_PTR:
+        if (!IS_PTR(rp)) {
+          ddebug0(RES_WRN
+                  "Ignoring response with unexpected query type \"PTR\".");
+          return;
+        }
+        break;
+      case T_A:
+        if (!IS_A(rp)) {
+          ddebug0(RES_WRN
+                  "Ignoring response with unexpected query type \"PTR\".");
+          return;
+        }
+        break;
+      default:
+        ddebug2(RES_ERR "Received unimplemented query type: %u (%s)",
+                qdatatype,
+                qdatatype < RESOURCETYPES_COUNT ?
+                resourcetypes[qdatatype] : resourcetypes[RESOURCETYPES_COUNT]);
+      }
+      for (rr = hp->ancount + hp->nscount + hp->arcount; rr; rr--) {
+        if (c > eob) {
+          ddebug0(RES_ERR
+                  "Packet does not contain all specified resouce records.");
+          return;
+        }
+        *namestring = '\0';
+        r = dn_expand(s, s + l, c, namestring, MAXDNAME);
+        if (r == -1) {
+          ddebug0(RES_ERR "dn_expand() failed while expanding answer domain.");
+          return;
+        }
+        namestring[strlen(stackstring)] = '\0';
+        if (egg_strcasecmp(stackstring, namestring))
+          usefulanswer = 0;
+        else
+          usefulanswer = 1;
+        ddebug1(RES_MSG "answered domain query: \"%s\"", namestring);
+        c += r;
+        if (c + 10 > eob) {
+          ddebug0(RES_ERR "Resource record truncated.");
+          return;
+        }
+        datatype = sucknetword(c);
+        class = sucknetword(c);
+        ttl = sucknetlong(c);
+        rdatalength = sucknetword(c);
+        if (class != qclass) {
+          ddebug2(RES_MSG "query class: %u (%s)",
+                  qclass,
+                  qclass < CLASSTYPES_COUNT ?
+                  classtypes[qclass] : classtypes[CLASSTYPES_COUNT]);
+          ddebug2(RES_MSG "rr class: %u (%s)", class,
+                  class < CLASSTYPES_COUNT ?
+                  classtypes[class] : classtypes[CLASSTYPES_COUNT]);
+          ddebug0(RES_ERR "Answered class does not match queried class.");
+          return;
+        }
+        if (!rdatalength) {
+          ddebug0(RES_ERR "Zero size rdata.");
+          return;
+        }
+        if (c + rdatalength > eob) {
+          ddebug0(RES_ERR "Specified rdata length exceeds packet size.");
+          return;
+        }
+        if (datatype == qdatatype) {
+          ddebug1(RES_MSG "TTL: %s", strtdiff(sendstring, ttl));
+          ddebug1(RES_MSG "TYPE: %s", datatype < RESOURCETYPES_COUNT ?
+                  resourcetypes[datatype] :
+                  resourcetypes[RESOURCETYPES_COUNT]);
+          if (usefulanswer)
+            switch (datatype) {
+            case T_A:
+              if (rdatalength != 4) {
+                ddebug1(RES_ERR
+                        "Unsupported rdata format for \"A\" type. (%u bytes)",
+                        rdatalength);
+                return;
+              }
+              my_memcpy(&rp->ip, (IP *) c, sizeof(IP));
+              linkresolveip(rp);
+              passrp(rp, ttl, T_A);
+              return;
+            case T_PTR:
+              *namestring = '\0';
+              r = dn_expand(s, s + l, c, namestring, MAXDNAME);
+              if (r == -1) {
+                ddebug0(RES_ERR
+                        "dn_expand() failed while expanding domain in rdata.");
+                return;
+              }
+              ddebug1(RES_MSG "Answered domain: \"%s\"", namestring);
+              if (r > HOSTNAMELEN) {
+                ddebug0(RES_ERR "Domain name too long.");
+                failrp(rp, T_PTR);
+                return;
+              }
+              if (!rp->hostn) {
+                rp->hostn = (char *) nmalloc(strlen(namestring) + 1);
+                strcpy(rp->hostn, namestring);
+                linkresolvehost(rp);
+                passrp(rp, ttl, T_PTR);
+                return;
+              }
+              break;
+            default:
+              ddebug2(RES_ERR "Received unimplemented data type: %u (%s)",
+                      datatype,
+                      datatype < RESOURCETYPES_COUNT ?
+                      resourcetypes[datatype] :
+                      resourcetypes[RESOURCETYPES_COUNT]);
+            }
+        }
+        else if (datatype == T_CNAME) {
+          *namestring = '\0';
+          r = dn_expand(s, s + l, c, namestring, MAXDNAME);
+          if (r == -1) {
+            ddebug0(RES_ERR
+                    "dn_expand() failed while expanding domain in rdata.");
+            return;
+          }
+          ddebug1(RES_MSG "answered domain is CNAME for: %s", namestring);
+          /* The next responses will be related to the domain
+           * pointed to by CNAME, so we need to update which
+           * respones we regard as important.
+           */
+          strncpy(stackstring, namestring, 1024);
+        }
+        else {
+          ddebug2(RES_MSG "Ignoring resource type %u. (%s)",
+                  datatype, datatype < RESOURCETYPES_COUNT ?
+                  resourcetypes[datatype] :
+                  resourcetypes[RESOURCETYPES_COUNT]);
+        }
+        c += rdatalength;
+      }
     }
-    if (!getheader_qr(hp)) {	/* Not a reply */
-	ddebug0(RES_ERR "Query packet received on nameserver communication socket.");
-	return;
-    }
-    if (getheader_opcode(hp)) {	/* Not opcode 0 (standard query) */
-	ddebug0(RES_ERR "Invalid opcode in response packet.");
-	return;
-    }
-    eob = s + l;
-    c = s + HFIXEDSZ;
-    switch (getheader_rcode(hp)) {
-    case NOERROR:
-	if (hp->ancount) {
-	    ddebug4(RES_MSG
-		    "Received nameserver reply. (qd:%u an:%u ns:%u ar:%u)",
-		    hp->qdcount, hp->ancount, hp->nscount, hp->arcount);
-	    if (hp->qdcount != 1) {
-		ddebug0(RES_ERR "Reply does not contain one query.");
-		return;
-	    }
-	    if (c > eob) {
-		ddebug0(RES_ERR "Reply too short.");
-		return;
-	    }
-	    switch (rp->state) {	/* Construct expected query reply */
-	    case STATE_PTRREQ:
-		sprintf(stackstring,
-			"%u.%u.%u.%u.in-addr.arpa",
-			((u_8bit_t *) & rp->ip)[3],
-			((u_8bit_t *) & rp->ip)[2],
-			((u_8bit_t *) & rp->ip)[1], ((u_8bit_t *) & rp->ip)[0]);
-		break;
-	    case STATE_AREQ:
-		strncpy(stackstring, rp->hostn, 1024);
-	    }
-	    *namestring = '\0';
-	    r = dn_expand(s, s + l, c, namestring, MAXDNAME);
-	    if (r == -1) {
-		ddebug0(RES_ERR "dn_expand() failed while expanding query domain.");
-		return;
-	    }
-	    namestring[strlen(stackstring)] = '\0';
-	    if (egg_strcasecmp(stackstring, namestring)) {
-		ddebug2(RES_MSG "Unknown query packet dropped. (\"%s\" does not match \"%s\")", stackstring, namestring);
-		return;
-	    }
-	    ddebug1(RES_MSG "Queried domain name: \"%s\"", namestring);
-	    c += r;
-	    if (c + 4 > eob) {
-		ddebug0(RES_ERR "Query resource record truncated.");
-		return;
-	    }
-	    qdatatype = sucknetword(c);
-	    qclass = sucknetword(c);
-	    if (qclass != C_IN) {
-		ddebug2(RES_ERR "Received unsupported query class: %u (%s)",
-			qclass, qclass < CLASSTYPES_COUNT ?
-					classtypes[qclass] :
-					classtypes[CLASSTYPES_COUNT]);
-	    }
-	    switch (qdatatype) {
-	    case T_PTR:
-		if (!IS_PTR(rp)) {
-		    ddebug0(RES_WRN "Ignoring response with unexpected query type \"PTR\".");
-		    return;
-		}
-		break;
-	    case T_A:
-		if (!IS_A(rp)) {
-		    ddebug0(RES_WRN "Ignoring response with unexpected query type \"PTR\".");
-		    return;
-		}
-		break;
-	    default:
-		ddebug2(RES_ERR "Received unimplemented query type: %u (%s)",
-			qdatatype,
-			qdatatype < RESOURCETYPES_COUNT ?
-				resourcetypes[qdatatype] :
-				resourcetypes[RESOURCETYPES_COUNT]);
-	    }
-	    for (rr = hp->ancount + hp->nscount + hp->arcount; rr; rr--) {
-		if (c > eob) {
-		    ddebug0(RES_ERR "Packet does not contain all specified resouce records.");
-		    return;
-		}
-		*namestring = '\0';
-		r = dn_expand(s, s + l, c, namestring, MAXDNAME);
-		if (r == -1) {
-		    ddebug0(RES_ERR "dn_expand() failed while expanding answer domain.");
-		    return;
-		}
-		namestring[strlen(stackstring)] = '\0';
-		if (egg_strcasecmp(stackstring, namestring))
-		    usefulanswer = 0;
-		else
-		    usefulanswer = 1;
-		ddebug1(RES_MSG "answered domain query: \"%s\"", namestring);
-		c += r;
-		if (c + 10 > eob) {
-		    ddebug0(RES_ERR "Resource record truncated.");
-		    return;
-		}
-		datatype = sucknetword(c);
-		class = sucknetword(c);
-		ttl = sucknetlong(c);
-		rdatalength = sucknetword(c);
-		if (class != qclass) {
-		    ddebug2(RES_MSG "query class: %u (%s)",
-			    qclass,
-			    qclass < CLASSTYPES_COUNT ?
-				classtypes[qclass] :
-				classtypes[CLASSTYPES_COUNT]);
-		    ddebug2(RES_MSG "rr class: %u (%s)", class,
-			    class < CLASSTYPES_COUNT ?
-				classtypes[class] :
-				classtypes[CLASSTYPES_COUNT]);
-		    ddebug0(RES_ERR "Answered class does not match queried class.");
-		    return;
-		}
-		if (!rdatalength) {
-		    ddebug0(RES_ERR "Zero size rdata.");
-		    return;
-		}
-		if (c + rdatalength > eob) {
-		    ddebug0(RES_ERR "Specified rdata length exceeds packet size.");
-		    return;
-		}
-		if (datatype == qdatatype) {
-		    ddebug1(RES_MSG "TTL: %s", strtdiff(sendstring, ttl));
-		    ddebug1(RES_MSG "TYPE: %s", datatype < RESOURCETYPES_COUNT ?
-			    resourcetypes[datatype] :
-			    resourcetypes[RESOURCETYPES_COUNT]);
-		    if (usefulanswer)
-			switch (datatype) {
-			case T_A:
-			    if (rdatalength != 4) {
-				ddebug1(RES_ERR "Unsupported rdata format for \"A\" type. (%u bytes)", rdatalength);
-				return;
-			    }
-			    my_memcpy(&rp->ip, (IP *) c, sizeof(IP));
-			    linkresolveip(rp);
-			    passrp(rp, ttl, T_A);
-			    return;
-			case T_PTR:
-			    *namestring = '\0';
-			    r =	dn_expand(s, s + l, c, namestring, MAXDNAME);
-			    if (r == -1) {
-				ddebug0(RES_ERR "dn_expand() failed while expanding domain in rdata.");
-				return;
-			    }
-			    ddebug1(RES_MSG "Answered domain: \"%s\"",
-				   namestring);
-			    if (r > HOSTNAMELEN) {
-				ddebug0(RES_ERR "Domain name too long.");
-				failrp(rp, T_PTR);
-				return;
-			    }
-			    if (!rp->hostn) {
-				rp->hostn = (char *)nmalloc(strlen(namestring) + 1);
-				strcpy(rp->hostn, namestring);
-				linkresolvehost(rp);
-				passrp(rp, ttl, T_PTR);
-				return;
-			    }
-			    break;
-			default:
-			    ddebug2(RES_ERR "Received unimplemented data type: %u (%s)",
-				    datatype,
-				    datatype < RESOURCETYPES_COUNT ?
-					resourcetypes[datatype] :
-					resourcetypes[RESOURCETYPES_COUNT]);
-			}
-		} else if (datatype == T_CNAME) {
-		    *namestring = '\0';
-		    r =	dn_expand(s, s + l, c, namestring, MAXDNAME);
-		    if (r == -1) {
-			ddebug0(RES_ERR "dn_expand() failed while expanding domain in rdata.");
-			return;
-		    }
-		    ddebug1(RES_MSG "answered domain is CNAME for: %s",
-			   namestring);
-		    /* The next responses will be related to the domain
-		     * pointed to by CNAME, so we need to update which
-		     * respones we regard as important.
-		     */
-		    strncpy(stackstring, namestring, 1024);
-		} else {
-		    ddebug2(RES_MSG "Ignoring resource type %u. (%s)",
-			   datatype, datatype < RESOURCETYPES_COUNT ?
-				resourcetypes[datatype] :
-				resourcetypes[RESOURCETYPES_COUNT]);
-		}
-		c += rdatalength;
-	    }
-	} else
-	    ddebug0(RES_ERR "No error returned but no answers given.");
-	break;
-    case NXDOMAIN:
-	ddebug0(RES_MSG "Host not found.");
-	switch (rp->state) {
-	case STATE_PTRREQ:
-		failrp(rp, T_PTR);
-		break;
-	case STATE_AREQ:
-		failrp(rp, T_A);
-		break;
-	default:
-		failrp(rp, 0);
-		break;
-	}
-	break;
+    else
+      ddebug0(RES_ERR "No error returned but no answers given.");
+    break;
+  case NXDOMAIN:
+    ddebug0(RES_MSG "Host not found.");
+    switch (rp->state) {
+    case STATE_PTRREQ:
+      failrp(rp, T_PTR);
+      break;
+    case STATE_AREQ:
+      failrp(rp, T_A);
+      break;
     default:
-	ddebug2(RES_MSG "Received error response %u. (%s)",
-		getheader_rcode(hp),
-		getheader_rcode(hp) < RESPONSECODES_COUNT ?
-			responsecodes[getheader_rcode(hp)] :
-			responsecodes[RESPONSECODES_COUNT]);
+      failrp(rp, 0);
+      break;
     }
+    break;
+  default:
+    ddebug2(RES_MSG "Received error response %u. (%s)",
+            getheader_rcode(hp),
+            getheader_rcode(hp) < RESPONSECODES_COUNT ?
+            responsecodes[getheader_rcode(hp)] :
+            responsecodes[RESPONSECODES_COUNT]);
+  }
 }
 
 /* Read data received on our dns socket. This function is called
@@ -927,203 +946,207 @@
  */
 static void dns_ack(void)
 {
-    struct sockaddr_in from;
-    unsigned int fromlen = sizeof(struct sockaddr_in);
-    int r, i;
-
-    r =	recvfrom(resfd, (u_8bit_t *) resrecvbuf, MAX_PACKETSIZE, 0,
-		 (struct sockaddr *) &from, &fromlen);
-    if (r <= 0) {
-	ddebug1(RES_MSG "Socket error: %s", strerror(errno));
-	return;
-    }
-    /* Check to see if this server is actually one we sent to */
-    if (from.sin_addr.s_addr == localhost) {
-        for (i = 0; i < _res.nscount; i++)
-	    /* 0.0.0.0 replies as 127.0.0.1 */
-	    if ((_res.nsaddr_list[i].sin_addr.s_addr == from.sin_addr.s_addr)
-		|| (!_res.nsaddr_list[i].sin_addr.s_addr))
-		break;
-    } else {
-        for (i = 0; i < _res.nscount; i++)
-	    if (_res.nsaddr_list[i].sin_addr.s_addr == from.sin_addr.s_addr)
-		break;
-    }
-    if (i == _res.nscount) {
-        ddebug1(RES_ERR "Received reply from unknown source: %s",
-	       iptostr(from.sin_addr.s_addr));
-    } else
-        parserespacket((u_8bit_t *) resrecvbuf, r);
+  struct sockaddr_in from;
+  unsigned int fromlen = sizeof(struct sockaddr_in);
+  int r, i;
+
+  r = recvfrom(resfd, (u_8bit_t *) resrecvbuf, MAX_PACKETSIZE, 0,
+               (struct sockaddr *) &from, &fromlen);
+  if (r <= 0) {
+    ddebug1(RES_MSG "Socket error: %s", strerror(errno));
+    return;
+  }
+  /* Check to see if this server is actually one we sent to */
+  if (from.sin_addr.s_addr == localhost) {
+    for (i = 0; i < _res.nscount; i++)
+      /* 0.0.0.0 replies as 127.0.0.1 */
+      if ((_res.nsaddr_list[i].sin_addr.s_addr == from.sin_addr.s_addr) ||
+          (!_res.nsaddr_list[i].sin_addr.s_addr))
+        break;
+  }
+  else {
+    for (i = 0; i < _res.nscount; i++)
+      if (_res.nsaddr_list[i].sin_addr.s_addr == from.sin_addr.s_addr)
+        break;
+  }
+  if (i == _res.nscount) {
+    ddebug1(RES_ERR "Received reply from unknown source: %s",
+            iptostr(from.sin_addr.s_addr));
+  }
+  else
+    parserespacket((u_8bit_t *) resrecvbuf, r);
 }
 
 /* Remove or resend expired requests. Called once a second.
  */
 static void dns_check_expires(void)
 {
-    struct resolve *rp, *nextrp;
+  struct resolve *rp, *nextrp;
 
-    /* Walk through sorted list ... */
-    for (rp = expireresolves; (rp) && (now >= rp->expiretime);
-	 rp = nextrp) {
-	nextrp = rp->next;
-	untieresolve(rp);
-	switch (rp->state) {
-	case STATE_FINISHED:	/* TTL has expired */
-	case STATE_FAILED:	/* Fake TTL has expired */
-	    ddebug4(RES_MSG "Cache record for \"%s\" (%s) has expired. (state: %u)  Marked for expire at: %ld.",
-		   nonull(rp->hostn), iptostr(rp->ip), rp->state,
-		   rp->expiretime);
-	    unlinkresolve(rp);
-	    break;
-	case STATE_PTRREQ:	/* T_PTR send timed out */
-	    if (rp->sends <= RES_MAXSENDS) {
-	      ddebug1(RES_MSG "Resend #%d for \"PTR\" query...", rp->sends - 1);
-	      resendrequest(rp, T_PTR);
-	    } else {
-	      ddebug0(RES_MSG "\"PTR\" query timed out.");
-	      failrp(rp, T_PTR);
-	    }
-	    break;
-	case STATE_AREQ:	/* T_A send timed out */
-	    if (rp->sends <= RES_MAXSENDS) {
-	      ddebug1(RES_MSG "Resend #%d for \"A\" query...", rp->sends - 1);
-	      resendrequest(rp, T_A);
-	    } else {
-	      ddebug0(RES_MSG "\"A\" query timed out.");
-	      failrp(rp, T_A);
-	    }
-	    break;
-	default:		/* Unknown state, let it expire */
-	    ddebug1(RES_WRN "Unknown request state %d. Request expired.",
-		   rp->state);
-	    failrp(rp, 0);
-	}
+  /* Walk through sorted list ... */
+  for (rp = expireresolves; (rp) && (now >= rp->expiretime); rp = nextrp) {
+    nextrp = rp->next;
+    untieresolve(rp);
+    switch (rp->state) {
+    case STATE_FINISHED:       /* TTL has expired */
+    case STATE_FAILED:         /* Fake TTL has expired */
+      ddebug4(RES_MSG
+              "Cache record for \"%s\" (%s) has expired. (state: %u)  Marked for expire at: %ld.",
+              nonull(rp->hostn), iptostr(rp->ip), rp->state, rp->expiretime);
+      unlinkresolve(rp);
+      break;
+    case STATE_PTRREQ:         /* T_PTR send timed out */
+      if (rp->sends <= RES_MAXSENDS) {
+        ddebug1(RES_MSG "Resend #%d for \"PTR\" query...", rp->sends - 1);
+        resendrequest(rp, T_PTR);
+      }
+      else {
+        ddebug0(RES_MSG "\"PTR\" query timed out.");
+        failrp(rp, T_PTR);
+      }
+      break;
+    case STATE_AREQ:           /* T_A send timed out */
+      if (rp->sends <= RES_MAXSENDS) {
+        ddebug1(RES_MSG "Resend #%d for \"A\" query...", rp->sends - 1);
+        resendrequest(rp, T_A);
+      }
+      else {
+        ddebug0(RES_MSG "\"A\" query timed out.");
+        failrp(rp, T_A);
+      }
+      break;
+    default:                   /* Unknown state, let it expire */
+      ddebug1(RES_WRN "Unknown request state %d. Request expired.", rp->state);
+      failrp(rp, 0);
     }
+  }
 }
 
 /* Start searching for a host-name, using it's ip-address.
  */
 static void dns_lookup(IP ip)
 {
-    struct resolve *rp;
-
-    ip = htonl(ip);
-    if ((rp = findip(ip))) {
-	if (rp->state == STATE_FINISHED || rp->state == STATE_FAILED) {
-	    if (rp->state == STATE_FINISHED && rp->hostn) {
-		ddebug2(RES_MSG "Used cached record: %s == \"%s\".",
-			    iptostr(ip), rp->hostn);
-		dns_event_success(rp, T_PTR);
-	    } else {
-		ddebug1(RES_MSG "Used failed record: %s == ???", iptostr(ip));
-		dns_event_failure(rp, T_PTR);
-	    }
-	}
-	return;
-    }
+  struct resolve *rp;
 
-    ddebug0(RES_MSG "Creating new record");
-    rp = allocresolve();
-    rp->state = STATE_PTRREQ;
-    rp->sends = 1;
-    rp->ip = ip;
-    linkresolveip(rp);
-    sendrequest(rp, T_PTR);
+  ip = htonl(ip);
+  if ((rp = findip(ip))) {
+    if (rp->state == STATE_FINISHED || rp->state == STATE_FAILED) {
+      if (rp->state == STATE_FINISHED && rp->hostn) {
+        ddebug2(RES_MSG "Used cached record: %s == \"%s\".",
+                iptostr(ip), rp->hostn);
+        dns_event_success(rp, T_PTR);
+      }
+      else {
+        ddebug1(RES_MSG "Used failed record: %s == ???", iptostr(ip));
+        dns_event_failure(rp, T_PTR);
+      }
+    }
+    return;
+  }
+
+  ddebug0(RES_MSG "Creating new record");
+  rp = allocresolve();
+  rp->state = STATE_PTRREQ;
+  rp->sends = 1;
+  rp->ip = ip;
+  linkresolveip(rp);
+  sendrequest(rp, T_PTR);
 }
 
 /* Start searching for an ip-address, using it's host-name.
  */
 static void dns_forward(char *hostn)
 {
-    struct resolve *rp;
-    struct in_addr inaddr;
+  struct resolve *rp;
+  struct in_addr inaddr;
 
-    /* Check if someone passed us an IP address as hostname
-     * and return it straight away.
-     */
-    if (egg_inet_aton(hostn, &inaddr)) {
-      call_ipbyhost(hostn, ntohl(inaddr.s_addr), 1);
-      return;
-    }
-    if ((rp = findhost(hostn))) {
-	if (rp->state == STATE_FINISHED || rp->state == STATE_FAILED) {
-	    if (rp->state == STATE_FINISHED && rp->ip) {
-		ddebug2(RES_MSG "Used cached record: %s == \"%s\".", hostn,
-		       iptostr(rp->ip));
-		dns_event_success(rp, T_A);
-	    } else {
-		ddebug1(RES_MSG "Used failed record: %s == ???", hostn);
-		dns_event_failure(rp, T_A);
-	    }
-	}
-	return;
-    }
-    ddebug0(RES_MSG "Creating new record");
-    rp = allocresolve();
-    rp->state = STATE_AREQ;
-    rp->sends = 1;
-    rp->hostn = (char *)nmalloc(strlen(hostn) + 1);
-    strcpy(rp->hostn, hostn);
-    linkresolvehost(rp);
-    sendrequest(rp, T_A);
+  /* Check if someone passed us an IP address as hostname
+   * and return it straight away.
+   */
+  if (egg_inet_aton(hostn, &inaddr)) {
+    call_ipbyhost(hostn, ntohl(inaddr.s_addr), 1);
+    return;
+  }
+  if ((rp = findhost(hostn))) {
+    if (rp->state == STATE_FINISHED || rp->state == STATE_FAILED) {
+      if (rp->state == STATE_FINISHED && rp->ip) {
+        ddebug2(RES_MSG "Used cached record: %s == \"%s\".", hostn,
+                iptostr(rp->ip));
+        dns_event_success(rp, T_A);
+      }
+      else {
+        ddebug1(RES_MSG "Used failed record: %s == ???", hostn);
+        dns_event_failure(rp, T_A);
+      }
+    }
+    return;
+  }
+  ddebug0(RES_MSG "Creating new record");
+  rp = allocresolve();
+  rp->state = STATE_AREQ;
+  rp->sends = 1;
+  rp->hostn = (char *) nmalloc(strlen(hostn) + 1);
+  strcpy(rp->hostn, hostn);
+  linkresolvehost(rp);
+  sendrequest(rp, T_A);
 }
 
 /* Initialise the network.
  */
 static int init_dns_network(void)
 {
-    int option;
-    struct in_addr inaddr;
-
-    resfd = socket(AF_INET, SOCK_DGRAM, 0);
-    if (resfd == -1) {
-	putlog(LOG_MISC, "*",
-		"Unable to allocate socket for nameserver communication: %s",
-		strerror(errno));
-	return 0;
-    }
-    (void) allocsock(resfd, SOCK_PASS);
-    option = 1;
-    if (setsockopt(resfd, SOL_SOCKET, SO_BROADCAST, (char *) &option,
-	 sizeof(option))) {
-	putlog(LOG_MISC, "*",
-		"Unable to setsockopt() on nameserver communication socket: %s",
-		strerror(errno));
-	killsock(resfd);
-	return 0;
-    }
+  int option;
+  struct in_addr inaddr;
 
-    egg_inet_aton("127.0.0.1", &inaddr);
-    localhost = inaddr.s_addr;
-    return 1;
+  resfd = socket(AF_INET, SOCK_DGRAM, 0);
+  if (resfd == -1) {
+    putlog(LOG_MISC, "*",
+           "Unable to allocate socket for nameserver communication: %s",
+           strerror(errno));
+    return 0;
+  }
+  (void) allocsock(resfd, SOCK_PASS);
+  option = 1;
+  if (setsockopt(resfd, SOL_SOCKET, SO_BROADCAST, (char *) &option,
+                 sizeof(option))) {
+    putlog(LOG_MISC, "*",
+           "Unable to setsockopt() on nameserver communication socket: %s",
+           strerror(errno));
+    killsock(resfd);
+    return 0;
+  }
+
+  egg_inet_aton("127.0.0.1", &inaddr);
+  localhost = inaddr.s_addr;
+  return 1;
 }
 
 /* Initialise the core dns system, returns 1 if all goes well, 0 if not.
  */
 static int init_dns_core(void)
 {
-    int i;
-
-    /* Initialise the resolv library. */
-    res_init();
-    if (!_res.nscount) {
-	putlog(LOG_MISC, "*", "No nameservers defined.");
-	return 0;
-    }
-    _res.options |= RES_RECURSE | RES_DEFNAMES | RES_DNSRCH;
-    for (i = 0; i < _res.nscount; i++)
-	_res.nsaddr_list[i].sin_family = AF_INET;
-
-    if (!init_dns_network())
-	return 0;
+  int i;
 
-    /* Initialise the hash tables. */
-    aseed = time(NULL) ^ (time(NULL) << 3) ^ (u_32bit_t) getpid();
-    for (i = 0; i < BASH_SIZE; i++) {
-	idbash[i] = NULL;
-	ipbash[i] = NULL;
-	hostbash[i] = NULL;
-    }
-    expireresolves = NULL;
-    return 1;
+  /* Initialise the resolv library. */
+  res_init();
+  if (!_res.nscount) {
+    putlog(LOG_MISC, "*", "No nameservers defined.");
+    return 0;
+  }
+  _res.options |= RES_RECURSE | RES_DEFNAMES | RES_DNSRCH;
+  for (i = 0; i < _res.nscount; i++)
+    _res.nsaddr_list[i].sin_family = AF_INET;
+
+  if (!init_dns_network())
+    return 0;
+
+  /* Initialise the hash tables. */
+  aseed = time(NULL) ^ (time(NULL) << 3) ^ (u_32bit_t) getpid();
+  for (i = 0; i < BASH_SIZE; i++) {
+    idbash[i] = NULL;
+    ipbash[i] = NULL;
+    hostbash[i] = NULL;
+  }
+  expireresolves = NULL;
+  return 1;
 }
Index: eggdrop1.6/src/mod/dns.mod/dns.c
diff -u eggdrop1.6/src/mod/dns.mod/dns.c:1.28 eggdrop1.6/src/mod/dns.mod/dns.c:1.29
--- eggdrop1.6/src/mod/dns.mod/dns.c:1.28	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/dns.mod/dns.c	Tue Jan 28 00:37:25 2003
@@ -4,7 +4,7 @@
  *
  * Written by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: dns.c,v 1.28 2002/12/24 02:30:07 wcc Exp $
+ * $Id: dns.c,v 1.29 2003/01/28 06:37:25 wcc Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -50,7 +50,8 @@
   if (type == T_PTR) {
     debug2("DNS resolved %s to %s", iptostr(rp->ip), rp->hostn);
     call_hostbyip(ntohl(rp->ip), rp->hostn, 1);
-  } else if (type == T_A) {
+  }
+  else if (type == T_A) {
     debug2("DNS resolved %s to %s", rp->hostn, iptostr(rp->ip));
     call_ipbyhost(rp->hostn, ntohl(rp->ip), 1);
   }
@@ -67,12 +68,14 @@
     debug1("DNS resolve failed for %s", iptostr(rp->ip));
     strcpy(s, iptostr(rp->ip));
     call_hostbyip(ntohl(rp->ip), s, 0);
-  } else if (type == T_A) {
+  }
+  else if (type == T_A) {
     debug1("DNS resolve failed for %s", rp->hostn);
     call_ipbyhost(rp->hostn, 0, 0);
-  } else
+  }
+  else
     debug2("DNS resolve failed for unknown %s / %s", iptostr(rp->ip),
-	   nonull(rp->hostn));
+           nonull(rp->hostn));
   return;
 }
 
@@ -90,7 +93,8 @@
     putlog(LOG_MISC, "*", "DNS socket successfully reopened!");
     dcc[idx].sock = resfd;
     dcc[idx].timeval = now;
-  } else
+  }
+  else
     lostdcc(idx);
 }
 
@@ -104,8 +108,7 @@
   strcpy(buf, "dns   (ready)");
 }
 
-static struct dcc_table DCC_DNS =
-{
+static struct dcc_table DCC_DNS = {
   "DNS",
   DCT_LISTEN,
   eof_dns_socket,
@@ -172,8 +175,7 @@
   del_hook(HOOK_SECONDLY, (Function) dns_check_expires);
 
   for (i = 0; i < dcc_total; i++) {
-    if (dcc[i].type == &DCC_DNS &&
-	dcc[i].sock == resfd) {
+    if (dcc[i].type == &DCC_DNS && dcc[i].sock == resfd) {
       killsock(dcc[i].sock);
       lostdcc(i);
       break;
@@ -187,8 +189,7 @@
 
 EXPORT_SCOPE char *dns_start();
 
-static Function dns_table[] =
-{
+static Function dns_table[] = {
   /* 0 - 3 */
   (Function) dns_start,
   (Function) dns_close,
@@ -202,6 +203,7 @@
   int idx;
 
   global = global_funcs;
+
   module_register(MODULE_NAME, dns_table, 1, 0);
   if (!module_depend(MODULE_NAME, "eggdrop", 106, 0)) {
     module_undepend(MODULE_NAME);
Index: eggdrop1.6/src/mod/dns.mod/dns.h
diff -u eggdrop1.6/src/mod/dns.mod/dns.h:1.10 eggdrop1.6/src/mod/dns.mod/dns.h:1.11
--- eggdrop1.6/src/mod/dns.mod/dns.h:1.10	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/dns.mod/dns.h	Tue Jan 28 00:37:26 2003
@@ -4,7 +4,7 @@
  *
  * Written by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: dns.h,v 1.10 2002/12/24 02:30:07 wcc Exp $
+ * $Id: dns.h,v 1.11 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -38,27 +38,27 @@
 #define _EGG_MOD_DNS_DNS_H
 
 struct resolve {
-    struct resolve	*next;
-    struct resolve	*previous;
-    struct resolve	*nextid;
-    struct resolve	*previousid;
-    struct resolve	*nextip;
-    struct resolve	*previousip;
-    struct resolve	*nexthost;
-    struct resolve	*previoushost;
-    time_t		expiretime;
-    char		*hostn;
-    IP			ip;
-    u_16bit_t		id;
-    u_8bit_t		state;
-    u_8bit_t		sends;
+  struct resolve *next;
+  struct resolve *previous;
+  struct resolve *nextid;
+  struct resolve *previousid;
+  struct resolve *nextip;
+  struct resolve *previousip;
+  struct resolve *nexthost;
+  struct resolve *previoushost;
+  time_t expiretime;
+  char *hostn;
+  IP ip;
+  u_16bit_t id;
+  u_8bit_t state;
+  u_8bit_t sends;
 };
 
 enum resolve_states {
-    STATE_FINISHED,
-    STATE_FAILED,
-    STATE_PTRREQ,
-    STATE_AREQ
+  STATE_FINISHED,
+  STATE_FAILED,
+  STATE_PTRREQ,
+  STATE_AREQ
 };
 
 #define IS_PTR(x) (x->state == STATE_PTRREQ)
@@ -70,12 +70,12 @@
 # define ddebug2		debug2
 # define ddebug3		debug3
 # define ddebug4		debug4
-#else	/* !DEBUG_DNS */
+#else /* !DEBUG_DNS */
 # define ddebug0(x)
 # define ddebug1(x, x1)
 # define ddebug2(x, x1, x2)
 # define ddebug3(x, x1, x2, x3)
 # define ddebug4(x, x1, x2, x3, x4)
-#endif	/* !DEBUG_DNS */
+#endif /* !DEBUG_DNS */
 
-#endif	/* _EGG_MOD_DNS_DNS_H */
+#endif /* _EGG_MOD_DNS_DNS_H */
Index: eggdrop1.6/src/mod/filesys.mod/dbcompat.c
diff -u eggdrop1.6/src/mod/filesys.mod/dbcompat.c:1.13 eggdrop1.6/src/mod/filesys.mod/dbcompat.c:1.14
--- eggdrop1.6/src/mod/filesys.mod/dbcompat.c:1.13	Mon Jan 20 18:53:27 2003
+++ eggdrop1.6/src/mod/filesys.mod/dbcompat.c	Tue Jan 28 00:37:26 2003
@@ -4,7 +4,7 @@
  *
  * Written for filedb3 by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: dbcompat.c,v 1.13 2003/01/21 00:53:27 wcc Exp $
+ * $Id: dbcompat.c,v 1.14 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -72,59 +72,63 @@
       fn = newsplit(&s1);
       rmspace(fn);
       if ((fn[0]) && (fn[0] != ';') && (fn[0] != '#')) {
-	/* Not comment */
-	if (fn[0] == '-') {
-	  /* Adjust comment for current file */
-	  if (in_file && fdbe) {
-	    rmspace(s);
-	    if (fdbe->desc) {
-	      fdbe->desc = nrealloc(fdbe->desc,
-				    strlen(fdbe->desc) + strlen(s) + 2);
-	      strcat(fdbe->desc, "\n");
-	    } else
-	      fdbe->desc = nmalloc(strlen(s) + 2);
-	    strcat(fdbe->desc, s);
-	  }
-	} else {
-	  if (fdbe) {
-	    /* File pending. Write to DB */
-	    filedb_addfile(fdb, fdbe);
-	    free_fdbe(&fdbe);
-	  }
-	  fdbe = malloc_fdbe();
-	  in_file = 1;
-	  nick = newsplit(&s1);
-	  rmspace(nick);
-	  tm = newsplit(&s1);
-	  rmspace(tm);
-	  rmspace(s1);
-	  i = strlen(fn) - 1;
-	  if (fn[i] == '/')
-	    fn[i] = 0;
-	  malloc_strcpy(fdbe->filename, fn);
-	  malloc_strcpy(fdbe->uploader, nick);
-	  fdbe->gots = atoi(s1);
-	  fdbe->uploaded = atoi(tm);
-	  sprintf(s, "%s/%s", path, fn);
-	  if (stat(s, &st) == 0) {
-	    /* File is okay */
-	    if (S_ISDIR(st.st_mode)) {
-	      fdbe->stat |= FILE_DIR;
-	      if (nick[0] == '+') {
-		char x[100];
-		/* Only do global flags, it's an old one */
-		struct flag_record fr = {FR_GLOBAL, 0, 0, 0, 0, 0};
-
-		break_down_flags(nick + 1, &fr, NULL);
-		build_flags(x, &fr, NULL);
-		/* We only want valid flags */
-		malloc_strcpy(fdbe->flags_req, x);
-	      }
-	    }
-	    fdbe->size = st.st_size;
-	  } else
-	    in_file = 0;	/* skip */
-	}
+        /* Not comment */
+        if (fn[0] == '-') {
+          /* Adjust comment for current file */
+          if (in_file && fdbe) {
+            rmspace(s);
+            if (fdbe->desc) {
+              fdbe->desc = nrealloc(fdbe->desc,
+                                    strlen(fdbe->desc) + strlen(s) + 2);
+              strcat(fdbe->desc, "\n");
+            }
+            else
+              fdbe->desc = nmalloc(strlen(s) + 2);
+            strcat(fdbe->desc, s);
+          }
+        }
+        else {
+          if (fdbe) {
+            /* File pending. Write to DB */
+            filedb_addfile(fdb, fdbe);
+            free_fdbe(&fdbe);
+          }
+          fdbe = malloc_fdbe();
+          in_file = 1;
+          nick = newsplit(&s1);
+          rmspace(nick);
+          tm = newsplit(&s1);
+          rmspace(tm);
+          rmspace(s1);
+          i = strlen(fn) - 1;
+          if (fn[i] == '/')
+            fn[i] = 0;
+          malloc_strcpy(fdbe->filename, fn);
+          malloc_strcpy(fdbe->uploader, nick);
+          fdbe->gots = atoi(s1);
+          fdbe->uploaded = atoi(tm);
+          sprintf(s, "%s/%s", path, fn);
+          if (stat(s, &st) == 0) {
+            /* File is okay */
+            if (S_ISDIR(st.st_mode)) {
+              fdbe->stat |= FILE_DIR;
+              if (nick[0] == '+') {
+                char x[100];
+
+                /* Only do global flags, it's an old one */
+                struct flag_record fr = { FR_GLOBAL, 0, 0, 0, 0, 0 };
+
+                break_down_flags(nick + 1, &fr, NULL);
+                build_flags(x, &fr, NULL);
+                /* We only want valid flags */
+                malloc_strcpy(fdbe->flags_req, x);
+              }
+            }
+            fdbe->size = st.st_size;
+          }
+          else
+            in_file = 0;        /* skip */
+        }
       }
     }
     my_free(s);
@@ -154,24 +158,24 @@
     fread(&fdb1, sizeof(filedb1), 1, fdb_s);
     if (!feof(fdb_s)) {
       if (!(fdb1.stat & FILE_UNUSED)) {
-	filedb_entry *fdbe = malloc_fdbe();
+        filedb_entry *fdbe = malloc_fdbe();
 
-	fdbe->stat = fdb1.stat;
-	if (fdb1.filename[0])
-	  malloc_strcpy(fdbe->filename, fdb1.filename);
-	if (fdb1.desc[0])
-	  malloc_strcpy(fdbe->desc, fdb1.desc);
-	if (fdb1.uploader[0])
-	  malloc_strcpy(fdbe->uploader, fdb1.uploader);
-	if (fdb1.flags_req[0])
-	  malloc_strcpy(fdbe->flags_req, fdb1.flags_req);
-	fdbe->uploaded = fdb1.uploaded;
-	fdbe->size = fdb1.size;
-	fdbe->gots = fdb1.gots;
-	if (fdb1.sharelink[0])
-	  malloc_strcpy(fdbe->sharelink, fdb1.sharelink);
-	filedb_addfile(fdb_s, fdbe);
-	free_fdbe(&fdbe);
+        fdbe->stat = fdb1.stat;
+        if (fdb1.filename[0])
+          malloc_strcpy(fdbe->filename, fdb1.filename);
+        if (fdb1.desc[0])
+          malloc_strcpy(fdbe->desc, fdb1.desc);
+        if (fdb1.uploader[0])
+          malloc_strcpy(fdbe->uploader, fdb1.uploader);
+        if (fdb1.flags_req[0])
+          malloc_strcpy(fdbe->flags_req, fdb1.flags_req);
+        fdbe->uploaded = fdb1.uploaded;
+        fdbe->size = fdb1.size;
+        fdbe->gots = fdb1.gots;
+        if (fdb1.sharelink[0])
+          malloc_strcpy(fdbe->sharelink, fdb1.sharelink);
+        filedb_addfile(fdb_s, fdbe);
+        free_fdbe(&fdbe);
       }
     }
   }
@@ -189,26 +193,26 @@
     fread(&fdb2, sizeof(filedb2), 1, fdb_s);
     if (!feof(fdb_s)) {
       if (!(fdb2.stat & FILE_UNUSED)) {
-	filedb_entry *fdbe = malloc_fdbe();
+        filedb_entry *fdbe = malloc_fdbe();
 
-	fdbe->stat = fdb2.stat;
-	if (fdb2.filename[0])
-	  malloc_strcpy(fdbe->filename, fdb2.filename);
-	if (fdb2.desc[0])
-	  malloc_strcpy(fdbe->desc, fdb2.desc);
-	if (fdb2.chname[0])
-	  malloc_strcpy(fdbe->chan, fdb2.chname);
-	if (fdb2.uploader[0])
-	  malloc_strcpy(fdbe->uploader, fdb2.uploader);
-	if (fdb2.flags_req[0])
-	  malloc_strcpy(fdbe->flags_req, fdb2.flags_req);
-	fdbe->uploaded = fdb2.uploaded;
-	fdbe->size = fdb2.size;
-	fdbe->gots = fdb2.gots;
-	if (fdb2.sharelink[0])
-	  malloc_strcpy(fdbe->sharelink, fdb2.sharelink);
-	filedb_addfile(fdb_t, fdbe);
-	free_fdbe(&fdbe);
+        fdbe->stat = fdb2.stat;
+        if (fdb2.filename[0])
+          malloc_strcpy(fdbe->filename, fdb2.filename);
+        if (fdb2.desc[0])
+          malloc_strcpy(fdbe->desc, fdb2.desc);
+        if (fdb2.chname[0])
+          malloc_strcpy(fdbe->chan, fdb2.chname);
+        if (fdb2.uploader[0])
+          malloc_strcpy(fdbe->uploader, fdb2.uploader);
+        if (fdb2.flags_req[0])
+          malloc_strcpy(fdbe->flags_req, fdb2.flags_req);
+        fdbe->uploaded = fdb2.uploaded;
+        fdbe->size = fdb2.size;
+        fdbe->gots = fdb2.gots;
+        if (fdb2.sharelink[0])
+          malloc_strcpy(fdbe->sharelink, fdb2.sharelink);
+        filedb_addfile(fdb_t, fdbe);
+        free_fdbe(&fdbe);
       }
     }
   }
@@ -226,34 +230,33 @@
  * Also remember to check the returned *fdb_s on failure, as it could be
  * NULL.
  */
-static int convert_old_db(FILE **fdb_s, char *filedb)
+static int convert_old_db(FILE ** fdb_s, char *filedb)
 {
   filedb_top fdbt;
   FILE *fdb_t;
-  int ret = 0;					/* Default to 'failure'	*/
+  int ret = 0;                  /* Default to 'failure' */
 
   filedb_readtop(*fdb_s, &fdbt);
   /* Old DB version? */
   if (fdbt.version > 0 && fdbt.version < FILEDB_VERSION3) {
     char *tempdb;
 
-    putlog(LOG_MISC, "*", "Converting old filedb %s to newest format.",
-	   filedb);
+    putlog(LOG_MISC, "*", "Converting old filedb %s to newest format.", filedb);
     /* Create temp DB name */
     tempdb = nmalloc(strlen(filedb) + 5);
     simple_sprintf(tempdb, "%s-tmp", filedb);
 
-    fdb_t = fopen(tempdb, "w+b");		/* Open temp DB		*/
+    fdb_t = fopen(tempdb, "w+b");       /* Open temp DB         */
     if (fdb_t) {
-      filedb_initdb(fdb_t);			/* Initialise new DB	*/
+      filedb_initdb(fdb_t);     /* Initialise new DB    */
 
       /* Convert old database to new one, saving
        * in temporary db file
        */
       if (fdbt.version == FILEDB_VERSION1)
-        convert_version1(*fdb_s, fdb_t);	/* v1 -> v3		*/
+        convert_version1(*fdb_s, fdb_t);        /* v1 -> v3             */
       else
-	convert_version2(*fdb_s, fdb_t);	/* v2 -> v3		*/
+        convert_version2(*fdb_s, fdb_t);        /* v2 -> v3             */
 
       unlockfile(*fdb_s);
       fclose(fdb_t);
@@ -261,28 +264,28 @@
 
       /* Move over db to new location */
       if (movefile(tempdb, filedb))
-	putlog(LOG_MISC, "*", "(!) Moving file db from %s to %s failed.",
-			tempdb, filedb);
+        putlog(LOG_MISC, "*", "(!) Moving file db from %s to %s failed.",
+               tempdb, filedb);
 
-      *fdb_s = fopen(filedb, "r+b");		/* Reopen new db	*/
+      *fdb_s = fopen(filedb, "r+b");    /* Reopen new db        */
       if (*fdb_s) {
-	lockfile(*fdb_s);
-	/* Now we should have recreated the original situation,
-	 * with the file pointer just pointing to the new version
-	 * of the DB instead of the original one.
-	 */
-	ret = 1;
-      } else
+        lockfile(*fdb_s);
+        /* Now we should have recreated the original situation,
+         * with the file pointer just pointing to the new version
+         * of the DB instead of the original one.
+         */
+        ret = 1;
+      }
+      else
         putlog(LOG_MISC, "*", "(!) Reopening db %s failed.", filedb);
     }
     my_free(tempdb);
-  /* Database already at the newest version? */
-  } else if (fdbt.version == FILEDB_VERSION3) {
-    ret = 1;					/* Always successfull	*/
-  /* Unknown version? */
-  } else {
-    putlog(LOG_MISC, "*", "(!) Unknown db version: %d", fdbt.version);
+    /* Database already at the newest version? */
   }
+  else if (fdbt.version == FILEDB_VERSION3)
+    ret = 1;
+  else
+    putlog(LOG_MISC, "*", "(!) Unknown db version: %d", fdbt.version);
   if (!ret)
     putlog(LOG_MISC, "*", "Conversion of filedb %s failed.", filedb);
   return ret;
Index: eggdrop1.6/src/mod/filesys.mod/dbcompat.h
diff -u eggdrop1.6/src/mod/filesys.mod/dbcompat.h:1.7 eggdrop1.6/src/mod/filesys.mod/dbcompat.h:1.8
--- eggdrop1.6/src/mod/filesys.mod/dbcompat.h:1.7	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/filesys.mod/dbcompat.h	Tue Jan 28 00:37:26 2003
@@ -5,7 +5,7 @@
  *
  * Written for filedb3 by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: dbcompat.h,v 1.7 2002/12/24 02:30:07 wcc Exp $
+ * $Id: dbcompat.h,v 1.8 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -34,56 +34,56 @@
 
 /* Structure for file database (per directory) */
 struct filler1 {
-  char			xxx[1 + 61 + 301 + 10 + 11 + 61];
-  unsigned short int	uuu[2];
-  time_t		ttt[2];
-  unsigned int		iii[2];
+  char xxx[1 + 61 + 301 + 10 + 11 + 61];
+  unsigned short int uuu[2];
+  time_t ttt[2];
+  unsigned int iii[2];
 };
 
 typedef struct {
-  char			version;
-  unsigned short int	stat;		/* Misc */
-  time_t		timestamp;	/* Last time this db was updated */
-  char			filename[61];
-  char			desc[301];	/* Should be plenty */
-  char			uploader[10];	/* Where this file came from */
-  unsigned char		flags_req[11];	/* Access flags required */
-  time_t		uploaded;	/* Time it was uploaded */
-  unsigned int		size;		/* File length */
-  unsigned short int	gots;		/* Times the file was downloaded */
-  char			sharelink[61];	/* Points to where? */
-  char			unused[512 - sizeof(struct filler1)];
+  char version;
+  unsigned short int stat;      /* Misc */
+  time_t timestamp;             /* Last time this db was updated */
+  char filename[61];
+  char desc[301];               /* Should be plenty */
+  char uploader[10];            /* Where this file came from */
+  unsigned char flags_req[11];  /* Access flags required */
+  time_t uploaded;              /* Time it was uploaded */
+  unsigned int size;            /* File length */
+  unsigned short int gots;      /* Times the file was downloaded */
+  char sharelink[61];           /* Points to where? */
+  char unused[512 - sizeof(struct filler1)];
 } filedb1;
 
 struct filler2 {
-  char			xxx[1 + 61 + 186 + 81 + 33 + 22 + 61];
-  unsigned short int	uuu[2];
-  time_t		ttt[2];
-  unsigned int		iii[1];
+  char xxx[1 + 61 + 186 + 81 + 33 + 22 + 61];
+  unsigned short int uuu[2];
+  time_t ttt[2];
+  unsigned int iii[1];
 };
 
 typedef struct {
-  char			version;
-  unsigned short int	stat;		/* Misc */
-  time_t		timestamp;	/* Last time this db was updated */
-  char			filename[61];
-  char			desc[186];	/* Should be plenty - shrink it, we
-					 * Need the  space :) */
-  char			chname[81];	/* Channel for chan spec stuff */
-  char			uploader[33];	/* Where this file came from */
-  char			flags_req[22];	/* Access flags required */
-  time_t		uploaded;	/* Time it was uploaded */
-  unsigned int		size;		/* File length */
-  unsigned short int	gots;		/* Times the file was downloaded */
-  char			sharelink[61];	/* Points to where? */
-  char			unused[512 - sizeof(struct filler2)];
+  char version;
+  unsigned short int stat;      /* Misc */
+  time_t timestamp;             /* Last time this db was updated */
+  char filename[61];
+  char desc[186];               /* Should be plenty - shrink it, we
+                                 * Need the  space :) */
+  char chname[81];              /* Channel for chan spec stuff */
+  char uploader[33];            /* Where this file came from */
+  char flags_req[22];           /* Access flags required */
+  time_t uploaded;              /* Time it was uploaded */
+  unsigned int size;            /* File length */
+  unsigned short int gots;      /* Times the file was downloaded */
+  char sharelink[61];           /* Points to where? */
+  char unused[512 - sizeof(struct filler2)];
 } filedb2;
 
 /*
  *    Prototypes
  */
 
-static int convert_old_db(FILE **fdb, char *s);
+static int convert_old_db(FILE ** fdb, char *s);
 static int convert_old_files(char *npath, char *s);
 
-#endif				/* _EGG_MOD_FILESYS_DBCOMPAT.H */
+#endif /* _EGG_MOD_FILESYS_DBCOMPAT.H */
Index: eggdrop1.6/src/mod/filesys.mod/filedb3.c
diff -u eggdrop1.6/src/mod/filesys.mod/filedb3.c:1.22 eggdrop1.6/src/mod/filesys.mod/filedb3.c:1.23
--- eggdrop1.6/src/mod/filesys.mod/filedb3.c:1.22	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/filesys.mod/filedb3.c	Tue Jan 28 00:37:26 2003
@@ -4,7 +4,7 @@
  *
  * Rewritten by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: filedb3.c,v 1.22 2002/12/24 02:30:07 wcc Exp $
+ * $Id: filedb3.c,v 1.23 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -76,7 +76,7 @@
 
 /* Frees a filedb entry and all it's elements.
  */
-static void free_fdbe(filedb_entry **fdbe)
+static void free_fdbe(filedb_entry ** fdbe)
 {
   if (!fdbe || !*fdbe)
     return;
@@ -137,7 +137,7 @@
 
 /* Unlocks the file using fcntl.
  */
-static void unlockfile(FILE * f)
+static void unlockfile(FILE *f)
 {
   struct flock fl;
 
@@ -164,7 +164,8 @@
     if (feof(fdb))
       return 0;
     fread(fdbt, 1, sizeof(filedb_top), fdb);
-  } else
+  }
+  else
     fseek(fdb, sizeof(filedb_top), SEEK_SET);
   return 1;
 }
@@ -186,10 +187,10 @@
 {
   filedb_header fdh;
 
-  fseek(fdb, pos, SEEK_SET);			/* Go to start of entry	*/
+  fseek(fdb, pos, SEEK_SET);    /* Go to start of entry */
   if (feof(fdb))
     return 0;
-  fread(&fdh, 1, sizeof(filedb_header), fdb);	/* Read header		*/
+  fread(&fdh, 1, sizeof(filedb_header), fdb);   /* Read header          */
   fdh.stat = FILE_UNUSED;
 
   /* Assign all available space to buffer. Simplifies
@@ -198,8 +199,8 @@
   fdh.buffer_len += filedb_tot_dynspace(fdh);
   filedb_zero_dynspace(fdh);
 
-  fseek(fdb, pos, SEEK_SET);			/* Go back to start	*/
-  fwrite(&fdh, 1, sizeof(filedb_header), fdb);	/* Write new header	*/
+  fseek(fdb, pos, SEEK_SET);    /* Go back to start     */
+  fwrite(&fdh, 1, sizeof(filedb_header), fdb);  /* Write new header     */
   return 1;
 }
 
@@ -229,20 +230,20 @@
        * more efficiently.
        */
       if (fdbe->buf_len > (tot + sizeof(filedb_header) + FILEDB_ESTDYN)) {
-	filedb_entry *fdbe_oe;
+        filedb_entry *fdbe_oe;
 
-	/* Create new entry containing the additional space */
-	fdbe_oe = malloc_fdbe();
-	fdbe_oe->stat = FILE_UNUSED;
-	fdbe_oe->pos = fdbe->pos + sizeof(filedb_header) + tot;
-	fdbe_oe->buf_len = fdbe->buf_len - tot - sizeof(filedb_header);
-	filedb_movefile(fdb, fdbe_oe->pos, fdbe_oe);
-	free_fdbe(&fdbe_oe);
-
-	/* Cut down buf_len of entry as the rest is now used in the new
-	 * entry.
-	 */
-	fdbe->buf_len = tot;
+        /* Create new entry containing the additional space */
+        fdbe_oe = malloc_fdbe();
+        fdbe_oe->stat = FILE_UNUSED;
+        fdbe_oe->pos = fdbe->pos + sizeof(filedb_header) + tot;
+        fdbe_oe->buf_len = fdbe->buf_len - tot - sizeof(filedb_header);
+        filedb_movefile(fdb, fdbe_oe->pos, fdbe_oe);
+        free_fdbe(&fdbe_oe);
+
+        /* Cut down buf_len of entry as the rest is now used in the new
+         * entry.
+         */
+        fdbe->buf_len = tot;
       }
       return fdbe;
     }
@@ -272,7 +273,7 @@
  * entry.
  */
 static int _filedb_updatefile(FILE *fdb, long pos, filedb_entry *fdbe,
-			      int update, char *file, int line)
+                              int update, char *file, int line)
 {
   filedb_header fdh;
   int reposition = 0;
@@ -301,9 +302,9 @@
   if (fdbe->sharelink)
     fdh.sharelink_len = strlen(fdbe->sharelink) + 1;
 
-  odyntot = fdbe->dyn_len;		/* Old length of dynamic data	*/
-  obuftot = fdbe->buf_len;		/* Old length of spare space	*/
-  ndyntot = filedb_tot_dynspace(fdh);	/* New length of dynamic data	*/
+  odyntot = fdbe->dyn_len;      /* Old length of dynamic data   */
+  obuftot = fdbe->buf_len;      /* Old length of spare space    */
+  ndyntot = filedb_tot_dynspace(fdh);   /* New length of dynamic data   */
   nbuftot = obuftot;
 
   if (fdbe->_type == TYPE_EXIST) {
@@ -319,27 +320,30 @@
         ndyntot = odyntot;
         nbuftot = obuftot;
       }
-    } else {
+    }
+    else {
       /* If we have a given/preferred position */
       if ((pos != POS_NEW) &&
-	 /* and if our new size is smaller than the old size, we
-	  * just adjust the buffer length and still use the same
-	  * position
-	  */
+          /* and if our new size is smaller than the old size, we
+           * just adjust the buffer length and still use the same
+           * position
+           */
           (ndyntot <= (odyntot + obuftot))) {
-	nbuftot = (odyntot + obuftot) - ndyntot;
-      } else {
-	/* If we have an existing position, but the new entry doesn't
-	 * fit into it's old home, we need to delete it before
-	 * repositioning.
-	 */
-	if (pos != POS_NEW)
+        nbuftot = (odyntot + obuftot) - ndyntot;
+      }
+      else {
+        /* If we have an existing position, but the new entry doesn't
+         * fit into it's old home, we need to delete it before
+         * repositioning.
+         */
+        if (pos != POS_NEW)
           filedb_delfile(fdb, pos);
-	reposition = 1;
+        reposition = 1;
       }
     }
-  } else {
-    fdbe->_type = TYPE_EXIST;		/* Update type			*/
+  }
+  else {
+    fdbe->_type = TYPE_EXIST;   /* Update type                  */
     reposition = 1;
   }
 
@@ -383,16 +387,17 @@
       fwrite(fdbe->flags_req, 1, fdh.flags_req_len, fdb);
     if (fdbe->sharelink)
       fwrite(fdbe->sharelink, 1, fdh.sharelink_len, fdb);
-  } else
-    fseek(fdb, ndyntot, SEEK_CUR);	/* Skip over dynamic data */
-  fseek(fdb, nbuftot, SEEK_CUR);	/* Skip over buffer	  */
+  }
+  else
+    fseek(fdb, ndyntot, SEEK_CUR);      /* Skip over dynamic data */
+  fseek(fdb, nbuftot, SEEK_CUR);        /* Skip over buffer       */
   return 0;
 }
 
 /* Moves an existing file entry, saved in fdbe to a new position.
  */
 static int _filedb_movefile(FILE *fdb, long pos, filedb_entry *fdbe,
-			    char *file, int line)
+                            char *file, int line)
 {
   fdbe->_type = TYPE_EXIST;
   _filedb_updatefile(fdb, pos, fdbe, UPDATE_ALL, file, line);
@@ -401,7 +406,8 @@
 
 /* Adds a completely new file.
  */
-static int _filedb_addfile(FILE *fdb, filedb_entry *fdbe, char *file, int line)
+static int _filedb_addfile(FILE *fdb, filedb_entry *fdbe, char *file,
+                           int line)
 {
   fdbe->_type = TYPE_NEW;
   _filedb_updatefile(fdb, POS_NEW, fdbe, UPDATE_ALL, file, line);
@@ -425,7 +431,7 @@
  * the entry.
  */
 static filedb_entry *_filedb_getfile(FILE *fdb, long pos, int get,
-				     char *file, int line)
+                                     char *file, int line)
 {
   filedb_entry *fdbe;
   filedb_header fdh;
@@ -447,8 +453,8 @@
 
   fdbe->buf_len = fdh.buffer_len;
   fdbe->dyn_len = filedb_tot_dynspace(fdh);
-  fdbe->pos = pos;			/* Save position		*/
-  fdbe->_type = TYPE_EXIST;		/* Entry exists in DB		*/
+  fdbe->pos = pos;              /* Save position                */
+  fdbe->_type = TYPE_EXIST;     /* Entry exists in DB           */
 
   /* This is useful for cases where we don't read the rest of the
    * data, but need to know whether the file is a link.
@@ -461,7 +467,8 @@
   /* Read additional data from db */
   if (get >= GET_FILENAME) {
     filedb_read(fdb, fdbe->filename, fdh.filename_len);
-  } else
+  }
+  else
     fseek(fdb, fdh.filename_len, SEEK_CUR);
   if (get < GET_FULL || (fdh.stat & FILE_UNUSED))
     fseek(fdb, filedb_tot_dynspace(fdh) - fdh.filename_len, SEEK_CUR);
@@ -472,29 +479,27 @@
     filedb_read(fdb, fdbe->flags_req, fdh.flags_req_len);
     filedb_read(fdb, fdbe->sharelink, fdh.sharelink_len);
   }
-  fseek(fdb, fdh.buffer_len, SEEK_CUR);	/* Skip buffer			*/
-  return fdbe;				/* Return the ready structure	*/
+  fseek(fdb, fdh.buffer_len, SEEK_CUR); /* Skip buffer                  */
+  return fdbe;                  /* Return the ready structure   */
 }
 
 /* Searches the filedb for a file matching the specified mask, starting
  * at position 'pos'. The first matching file is returned.
  */
 static filedb_entry *_filedb_matchfile(FILE *fdb, long pos, char *match,
-				       char *file, int line)
+                                       char *file, int line)
 {
   filedb_entry *fdbe = NULL;
 
   fseek(fdb, pos, SEEK_SET);
-  while (!feof(fdb))
-  {
+  while (!feof(fdb)) {
     pos = ftell(fdb);
     fdbe = filedb_getfile(fdb, pos, GET_FILENAME);
     if (fdbe) {
-      if (!(fdbe->stat & FILE_UNUSED) &&	    /* Not unused?	   */
-	  wild_match_file(match, fdbe->filename)) { /* Matches our mask?   */
+      if (!(fdbe->stat & FILE_UNUSED) &&        /* Not unused?         */
+          wild_match_file(match, fdbe->filename)) {     /* Matches our mask?   */
         free_fdbe(&fdbe);
-        fdbe = _filedb_getfile(fdb, pos, GET_FULL,
-			       file, line);	    /* Save all data now   */
+        fdbe = _filedb_getfile(fdb, pos, GET_FULL, file, line); /* Save all data now   */
         return fdbe;
       }
       free_fdbe(&fdbe);
@@ -511,35 +516,35 @@
   long oldpos, newpos, temppos;
   filedb_entry *fdbe = NULL;
 
-  filedb_readtop(fdb, NULL);				/* Skip DB header  */
+  filedb_readtop(fdb, NULL);    /* Skip DB header  */
   newpos = temppos = oldpos = ftell(fdb);
-  fseek(fdb, oldpos, SEEK_SET);				/* Go to beginning */
-  while (!feof(fdb))					/* Loop until EOF  */
-  {
-    fdbe = filedb_getfile(fdb, oldpos, GET_HEADER);	/* Read header	   */
+  fseek(fdb, oldpos, SEEK_SET); /* Go to beginning */
+  while (!feof(fdb)) {          /* Loop until EOF  */
+    fdbe = filedb_getfile(fdb, oldpos, GET_HEADER);     /* Read header     */
     if (fdbe) {
-      if (fdbe->stat & FILE_UNUSED) {			/* Found dirt!	   */
+      if (fdbe->stat & FILE_UNUSED) {   /* Found dirt!     */
         free_fdbe(&fdbe);
-	while (!feof(fdb)) {				/* Loop until EOF  */
-	  newpos = ftell(fdb);
-	  fdbe = filedb_getfile(fdb, newpos, GET_FULL);	/* Read next entry */
-	  if (!fdbe)
-	    break;
-	  if (!(fdbe->stat & FILE_UNUSED)) {		/* Not unused?	   */
-	    temppos = ftell(fdb);
-	    filedb_movefile(fdb, oldpos, fdbe);		/* Move to top	   */
-	    oldpos = ftell(fdb);
-	    fseek(fdb, temppos, SEEK_SET);
-	  }
-	  free_fdbe(&fdbe);
-	}
-      } else {
+        while (!feof(fdb)) {    /* Loop until EOF  */
+          newpos = ftell(fdb);
+          fdbe = filedb_getfile(fdb, newpos, GET_FULL); /* Read next entry */
+          if (!fdbe)
+            break;
+          if (!(fdbe->stat & FILE_UNUSED)) {    /* Not unused?     */
+            temppos = ftell(fdb);
+            filedb_movefile(fdb, oldpos, fdbe); /* Move to top     */
+            oldpos = ftell(fdb);
+            fseek(fdb, temppos, SEEK_SET);
+          }
+          free_fdbe(&fdbe);
+        }
+      }
+      else {
         free_fdbe(&fdbe);
-	oldpos = ftell(fdb);
+        oldpos = ftell(fdb);
       }
     }
   }
-  ftruncate(fileno(fdb), oldpos);			/* Shorten file	   */
+  ftruncate(fileno(fdb), oldpos);       /* Shorten file    */
 }
 
 /* Merges empty entries to one big entry, if they directly
@@ -553,41 +558,41 @@
   int modified;
 
   filedb_readtop(fdb, NULL);
-  while (!feof(fdb))
-  {
+  while (!feof(fdb)) {
     fdbe_t = filedb_getfile(fdb, ftell(fdb), GET_HEADER);
     if (fdbe_t) {
       if (fdbe_t->stat & FILE_UNUSED) {
-	modified = 0;
-	fdbe_i = filedb_getfile(fdb, ftell(fdb), GET_HEADER);
-	while (fdbe_i) {
-	  /* Is this entry in use? */
-	  if (!(fdbe_i->stat & FILE_UNUSED))
-	    break;	/* It is, exit loop. */
-
-	  /* Woohoo, found an empty entry. Append it's space to
-	   * our target entry's buffer space.
-	   */
-	  fdbe_t->buf_len += sizeof(filedb_header) + fdbe_i->buf_len;
-	  modified++;
-	  free_fdbe(&fdbe_i);
-	  /* Get next file entry */
-	  fdbe_i = filedb_getfile(fdb, ftell(fdb), GET_HEADER);
-	}
-
-	/* Did we exit the loop because of a used entry? */
-	if (fdbe_i) {
-	  free_fdbe(&fdbe_i);
-	  /* Did we find any empty entries before? */
-	  if (modified)
-	    filedb_updatefile(fdb, fdbe_t->pos, fdbe_t, UPDATE_SIZE);
-	/* ... or because we hit EOF? */
-	} else {
-	  /* Truncate trailing empty entries and exit. */
-	  ftruncate(fileno(fdb), fdbe_t->pos);
-	  free_fdbe(&fdbe_t);
-	  return;
-	}
+        modified = 0;
+        fdbe_i = filedb_getfile(fdb, ftell(fdb), GET_HEADER);
+        while (fdbe_i) {
+          /* Is this entry in use? */
+          if (!(fdbe_i->stat & FILE_UNUSED))
+            break;              /* It is, exit loop. */
+
+          /* Woohoo, found an empty entry. Append it's space to
+           * our target entry's buffer space.
+           */
+          fdbe_t->buf_len += sizeof(filedb_header) + fdbe_i->buf_len;
+          modified++;
+          free_fdbe(&fdbe_i);
+          /* Get next file entry */
+          fdbe_i = filedb_getfile(fdb, ftell(fdb), GET_HEADER);
+        }
+
+        /* Did we exit the loop because of a used entry? */
+        if (fdbe_i) {
+          free_fdbe(&fdbe_i);
+          /* Did we find any empty entries before? */
+          if (modified)
+            filedb_updatefile(fdb, fdbe_t->pos, fdbe_t, UPDATE_SIZE);
+          /* ... or because we hit EOF? */
+        }
+        else {
+          /* Truncate trailing empty entries and exit. */
+          ftruncate(fileno(fdb), fdbe_t->pos);
+          free_fdbe(&fdbe_t);
+          return;
+        }
       }
       free_fdbe(&fdbe_t);
     }
@@ -622,7 +627,7 @@
   filedb_writetop(fdb, &fdbt);
 }
 
-static void filedb_timestamp(FILE * fdb)
+static void filedb_timestamp(FILE *fdb)
 {
   filedb_top fdbt;
 
@@ -665,19 +670,20 @@
       filedb_readtop(fdb, NULL);
       fdbe = filedb_matchfile(fdb, ftell(fdb), name);
       if (!fdbe) {
-	/* new file! */
-	fdbe = malloc_fdbe();
-	malloc_strcpy(fdbe->filename, name);
-	malloc_strcpy(fdbe->uploader, botnetnick);
-	fdbe->uploaded = now;
-	fdbe->size = st.st_size;
-	if (S_ISDIR(st.st_mode))
-	  fdbe->stat |= FILE_DIR;
-	filedb_addfile(fdb, fdbe);
-      } else if (fdbe->size != st.st_size) {
-	/* update size if needed */
-	fdbe->size = st.st_size;
-	filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_HEADER);
+        /* new file! */
+        fdbe = malloc_fdbe();
+        malloc_strcpy(fdbe->filename, name);
+        malloc_strcpy(fdbe->uploader, botnetnick);
+        fdbe->uploaded = now;
+        fdbe->size = st.st_size;
+        if (S_ISDIR(st.st_mode))
+          fdbe->stat |= FILE_DIR;
+        filedb_addfile(fdb, fdbe);
+      }
+      else if (fdbe->size != st.st_size) {
+        /* update size if needed */
+        fdbe->size = st.st_size;
+        filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_HEADER);
       }
       free_fdbe(&fdbe);
     }
@@ -695,12 +701,12 @@
   while (fdbe) {
     where = ftell(fdb);
     if (!(fdbe->stat & FILE_UNUSED) && !(fdbe->stat & FILE_ISLINK) &&
-	fdbe->filename) {
+        fdbe->filename) {
       s = nmalloc(strlen(path) + 1 + strlen(fdbe->filename) + 1);
       sprintf(s, "%s/%s", path, fdbe->filename);
       if (stat(s, &st) != 0)
-	/* gone file */
-	filedb_delfile(fdb, fdbe->pos);
+        /* gone file */
+        filedb_delfile(fdb, fdbe->pos);
       my_free(s);
     }
     free_fdbe(&fdbe);
@@ -714,8 +720,8 @@
    * done on-the-fly when we display the file list.
    */
   if (sort)
-    filedb_cleanup(fdb);			/* Cleanup DB		*/
-  filedb_timestamp(fdb);			/* Write new timestamp	*/
+    filedb_cleanup(fdb);        /* Cleanup DB           */
+  filedb_timestamp(fdb);        /* Write new timestamp  */
 }
 
 /* Converts all slashes to dots. Returns an allocated buffer, so
@@ -723,16 +729,16 @@
  */
 static char *make_point_path(char *path)
 {
-    char *s2 = NULL, *p = NULL;
+  char *s2 = NULL, *p = NULL;
 
-    malloc_strcpy(s2, path);
-    if (s2[strlen(s2) - 1] == '/')
-      s2[strlen(s2) - 1] = 0;		/* remove trailing '/' */
-    p = s2;
-    while (*p++)
-      if (*p == '/')
-	*p = '.';
-    return s2;
+  malloc_strcpy(s2, path);
+  if (s2[strlen(s2) - 1] == '/')
+    s2[strlen(s2) - 1] = 0;     /* remove trailing '/' */
+  p = s2;
+  while (*p++)
+    if (*p == '/')
+      *p = '.';
+  return s2;
 }
 
 /* Opens the filedb responsible to the specified directory.
@@ -756,7 +762,8 @@
     s = nmalloc(strlen(filedb_path) + strlen(s2) + 8);
     simple_sprintf(s, "%sfiledb.%s", filedb_path, s2);
     my_free(s2);
-  } else {
+  }
+  else {
     s = nmalloc(strlen(npath) + 10);
     simple_sprintf(s, "%s/.filedb", npath);
   }
@@ -765,9 +772,9 @@
     if (convert_old_files(npath, s)) {
       fdb = fopen(s, "r+b");
       if (fdb == NULL) {
-	putlog(LOG_MISC, "*", FILES_NOCONVERT, npath);
-	my_free(s);
-	my_free(npath);
+        putlog(LOG_MISC, "*", FILES_NOCONVERT, npath);
+        my_free(s);
+        my_free(npath);
         return NULL;
       }
       lockfile(fdb);
@@ -776,15 +783,16 @@
       my_free(s);
       my_free(npath);
       return fdb;
-    } else {
+    }
+    else {
       filedb_top fdbt;
 
       /* Create new database and fix it up */
       fdb = fopen(s, "w+b");
       if (!fdb) {
-	my_free(s);
-	my_free(npath);
-	return NULL;
+        my_free(s);
+        my_free(npath);
+        return NULL;
       }
       lockfile(fdb);
       fdbt.version = FILEDB_NEWEST_VER;
@@ -798,7 +806,7 @@
     }
   }
 
-  lockfile(fdb);			/* Lock it from other bots */
+  lockfile(fdb);                /* Lock it from other bots */
   filedb_readtop(fdb, &fdbt);
   if (fdbt.version < FILEDB_NEWEST_VER) {
     if (!convert_old_db(&fdb, s)) {
@@ -821,8 +829,7 @@
    * (6 hours may be a bit often)
    */
   if (sort || ((now - fdbt.timestamp) > (6 * 3600)) ||
-      (fdbt.timestamp < st.st_mtime) ||
-      (fdbt.timestamp < st.st_ctime))
+      (fdbt.timestamp < st.st_mtime) || (fdbt.timestamp < st.st_ctime))
     /* File database isn't up-to-date! */
     filedb_update(npath, fdb, sort & 1);
   else if ((now - fdbt.timestamp) > 300)
@@ -837,7 +844,7 @@
 /* Closes the filedb. Also removes the lock and updates the
  * timestamp.
  */
-static void filedb_close(FILE * fdb)
+static void filedb_close(FILE *fdb)
 {
   filedb_timestamp(fdb);
   fseek(fdb, 0L, SEEK_END);
@@ -850,7 +857,7 @@
  * is misleading, as the file is added in filedb_open() and we
  * only add information in here.
  */
-static void filedb_add(FILE * fdb, char *filename, char *nick)
+static void filedb_add(FILE *fdb, char *filename, char *nick)
 {
   filedb_entry *fdbe = NULL;
 
@@ -871,11 +878,11 @@
  */
 static void filedb_ls(FILE *fdb, int idx, char *mask, int showall)
 {
-  int  ok = 0, cnt = 0, is = 0;
+  int ok = 0, cnt = 0, is = 0;
   char s1[81], *p = NULL;
-  struct flag_record user  = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-  filedb_entry *fdbe  = NULL;
-  filelist_t   *flist = NULL;
+  struct flag_record user = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
+  filedb_entry *fdbe = NULL;
+  filelist_t *flist = NULL;
 
   flist = filelist_new();
   filedb_readtop(fdb, NULL);
@@ -886,12 +893,12 @@
       ok = 0;
     if (ok && (fdbe->stat & FILE_DIR) && fdbe->flags_req) {
       /* Check permissions */
-      struct flag_record req = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+      struct flag_record req = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
       break_down_flags(fdbe->flags_req, &req, NULL);
       get_user_flagrec(dcc[idx].user, &user, dcc[idx].u.file->chat->con_chan);
       if (!flagrec_ok(&req, &user)) {
-	ok = 0;
+        ok = 0;
       }
     }
     if (ok)
@@ -903,109 +910,112 @@
     if (ok) {
       /* Display it! */
       if (cnt == 0) {
-	dprintf(idx, FILES_LSHEAD1);
-	dprintf(idx, FILES_LSHEAD2);
+        dprintf(idx, FILES_LSHEAD1);
+        dprintf(idx, FILES_LSHEAD2);
       }
       filelist_add(flist, fdbe->filename);
       if (fdbe->stat & FILE_DIR) {
-	char *s2 = NULL, *s3 = NULL;
+        char *s2 = NULL, *s3 = NULL;
+
+        /* Too long? */
+        if (strlen(fdbe->filename) > 45) {
+          /* Display the filename on its own line. */
+          s2 = nmalloc(strlen(fdbe->filename) + 3);
+          sprintf(s2, "%s/\n", fdbe->filename);
+          filelist_addout(flist, s2);
+          my_free(s2);
+        }
+        else {
+          s2 = nmalloc(strlen(fdbe->filename) + 2);
+          sprintf(s2, "%s/", fdbe->filename);
+        }
+        /* Note: You have to keep the sprintf and the nmalloc statements
+         *       in sync, i.e. always check that you allocate enough
+         *       memory.
+         */
+        if ((fdbe->flags_req) && (user.global &(USER_MASTER | USER_JANITOR))) {
+          s3 = nmalloc(42 + strlen(s2 ? s2 : "") + 6 +
+                       strlen(FILES_REQUIRES) + strlen(fdbe->flags_req) + 1 +
+                       strlen(fdbe->chan ? fdbe->chan : "") + 1);
+          sprintf(s3, "%-30s <DIR%s>  (%s %s%s%s)\n", s2,
+                  fdbe->stat & FILE_SHARE ?
+                  " SHARE" : "", FILES_REQUIRES, fdbe->flags_req,
+                  fdbe->chan ? " " : "", fdbe->chan ? fdbe->chan : "");
+        }
+        else {
+          s3 = nmalloc(38 + strlen(s2 ? s2 : ""));
+          sprintf(s3, "%-30s <DIR>\n", s2 ? s2 : "");
+        }
+        if (s2)
+          my_free(s2);
+        filelist_addout(flist, s3);
+        my_free(s3);
+      }
+      else {
+        char s2[41], t[50], *s3 = NULL, *s4;
 
-	/* Too long? */
-	if (strlen(fdbe->filename) > 45) {
-	  /* Display the filename on its own line. */
-	  s2 = nmalloc(strlen(fdbe->filename) + 3);
-	  sprintf(s2, "%s/\n", fdbe->filename);
-	  filelist_addout(flist, s2);
-	  my_free(s2);
-	} else {
-	  s2 = nmalloc(strlen(fdbe->filename) + 2);
-	  sprintf(s2, "%s/", fdbe->filename);
-	}
-	/* Note: You have to keep the sprintf and the nmalloc statements
-	 *       in sync, i.e. always check that you allocate enough
-	 *       memory.
-	 */
-	if ((fdbe->flags_req) &&
-	    (user.global &(USER_MASTER | USER_JANITOR))) {
-	  s3 = nmalloc(42 + strlen(s2 ? s2 : "") + 6 +
-		       strlen(FILES_REQUIRES) + strlen(fdbe->flags_req) + 1 +
-		       strlen(fdbe->chan ? fdbe->chan : "") + 1);
-	  sprintf(s3, "%-30s <DIR%s>  (%s %s%s%s)\n", s2,
-		  fdbe->stat & FILE_SHARE ?
-		  " SHARE" : "", FILES_REQUIRES, fdbe->flags_req,
-		  fdbe->chan ? " " : "", fdbe->chan ? fdbe->chan : "");
-	} else {
-	  s3 = nmalloc(38 + strlen(s2 ? s2 : ""));
-	  sprintf(s3, "%-30s <DIR>\n", s2 ? s2 : "");
-	}
-	if (s2)
-	  my_free(s2);
-	filelist_addout(flist, s3);
-	my_free(s3);
-      } else {
-	char s2[41], t[50], *s3 = NULL, *s4;
-
-	s2[0] = 0;
-	if (showall) {
-	  if (fdbe->stat & FILE_SHARE)
-	    strcat(s2, " (shr)");
-	  if (fdbe->stat & FILE_HIDDEN)
-	    strcat(s2, " (hid)");
-	}
-	egg_strftime(t, 10, "%d%b%Y", localtime(&fdbe->uploaded));
-	if (fdbe->size < 1024)
-	  sprintf(s1, "%5d", fdbe->size);
-	else
-	  sprintf(s1, "%4dk", (int) (fdbe->size / 1024));
-	if (fdbe->sharelink)
-	  strcpy(s1, "     ");
-	/* Too long? */
-	if (strlen(fdbe->filename) > 30) {
-	  s3 = nmalloc(strlen(fdbe->filename) + 2);
-	  sprintf(s3, "%s\n", fdbe->filename);
-	  filelist_addout(flist, s3);
-	  my_free(s3);
-	  /* Causes filename to be displayed on its own line */
-	} else
-	  malloc_strcpy(s3, fdbe->filename);
-	s4 = nmalloc(69 + strlen(s3 ? s3 : "") + strlen(s1) +
-		     strlen(fdbe->uploader) + strlen(t) + strlen(s2));
-	sprintf(s4, "%-30s %s  %-9s (%s)  %6d%s\n", s3 ? s3 : "", s1,
-		fdbe->uploader, t, fdbe->gots, s2);
-	if (s3)
-	  my_free(s3);
-	filelist_addout(flist, s4);
-	my_free(s4);
-	if (fdbe->sharelink) {
-	  s4 = nmalloc(9 + strlen(fdbe->sharelink));
-	  sprintf(s4, "   --> %s\n", fdbe->sharelink);
-	  filelist_addout(flist, s4);
-	  my_free(s4);
-	}
+        s2[0] = 0;
+        if (showall) {
+          if (fdbe->stat & FILE_SHARE)
+            strcat(s2, " (shr)");
+          if (fdbe->stat & FILE_HIDDEN)
+            strcat(s2, " (hid)");
+        }
+        egg_strftime(t, 10, "%d%b%Y", localtime(&fdbe->uploaded));
+        if (fdbe->size < 1024)
+          sprintf(s1, "%5d", fdbe->size);
+        else
+          sprintf(s1, "%4dk", (int) (fdbe->size / 1024));
+        if (fdbe->sharelink)
+          strcpy(s1, "     ");
+        /* Too long? */
+        if (strlen(fdbe->filename) > 30) {
+          s3 = nmalloc(strlen(fdbe->filename) + 2);
+          sprintf(s3, "%s\n", fdbe->filename);
+          filelist_addout(flist, s3);
+          my_free(s3);
+          /* Causes filename to be displayed on its own line */
+        }
+        else
+          malloc_strcpy(s3, fdbe->filename);
+        s4 = nmalloc(69 + strlen(s3 ? s3 : "") + strlen(s1) +
+                     strlen(fdbe->uploader) + strlen(t) + strlen(s2));
+        sprintf(s4, "%-30s %s  %-9s (%s)  %6d%s\n", s3 ? s3 : "", s1,
+                fdbe->uploader, t, fdbe->gots, s2);
+        if (s3)
+          my_free(s3);
+        filelist_addout(flist, s4);
+        my_free(s4);
+        if (fdbe->sharelink) {
+          s4 = nmalloc(9 + strlen(fdbe->sharelink));
+          sprintf(s4, "   --> %s\n", fdbe->sharelink);
+          filelist_addout(flist, s4);
+          my_free(s4);
+        }
       }
       if (fdbe->desc) {
-	p = strchr(fdbe->desc, '\n');
-	while (p != NULL) {
-	  *p = 0;
-	  if ((fdbe->desc)[0]) {
-	    char *sd;
-
-	    sd = nmalloc(strlen(fdbe->desc) + 5);
-	    sprintf(sd, "   %s\n", fdbe->desc);
-	    filelist_addout(flist, sd);
-	    my_free(sd);
-	  }
-	  strcpy(fdbe->desc, p + 1);
-	  p = strchr(fdbe->desc, '\n');
-	}
-	if ((fdbe->desc)[0]) {
-	  char *sd;
-
-	  sd = nmalloc(strlen(fdbe->desc) + 5);
-	  sprintf(sd, "   %s\n", fdbe->desc);
-	  filelist_addout(flist, sd);
-	  my_free(sd);
-	}
+        p = strchr(fdbe->desc, '\n');
+        while (p != NULL) {
+          *p = 0;
+          if ((fdbe->desc)[0]) {
+            char *sd;
+
+            sd = nmalloc(strlen(fdbe->desc) + 5);
+            sprintf(sd, "   %s\n", fdbe->desc);
+            filelist_addout(flist, sd);
+            my_free(sd);
+          }
+          strcpy(fdbe->desc, p + 1);
+          p = strchr(fdbe->desc, '\n');
+        }
+        if ((fdbe->desc)[0]) {
+          char *sd;
+
+          sd = nmalloc(strlen(fdbe->desc) + 5);
+          sprintf(sd, "   %s\n", fdbe->desc);
+          filelist_addout(flist, sd);
+          my_free(sd);
+        }
       }
       cnt++;
     }
@@ -1026,10 +1036,10 @@
 
 static void remote_filereq(int idx, char *from, char *file)
 {
-  char *p   = NULL, *what   = NULL, *dir = NULL,
-       *s1  = NULL, *reject = NULL, *s   = NULL;
+  char *p = NULL, *what = NULL, *dir = NULL,
+    *s1 = NULL, *reject = NULL, *s = NULL;
   FILE *fdb = NULL;
-  int	i   = 0;
+  int i = 0;
   filedb_entry *fdbe = NULL;
 
   malloc_strcpy(what, file);
@@ -1038,40 +1048,44 @@
     *p = 0;
     malloc_strcpy(dir, what);
     strcpy(what, p + 1);
-  } else {
+  }
+  else {
     malloc_strcpy(dir, "");
   }
   fdb = filedb_open(dir, 0);
   if (!fdb) {
     reject = FILES_DIRDNE;
-  } else {
+  }
+  else {
     filedb_readtop(fdb, NULL);
     fdbe = filedb_matchfile(fdb, ftell(fdb), what);
     filedb_close(fdb);
     if (!fdbe) {
       reject = FILES_FILEDNE;
-    } else {
+    }
+    else {
       if ((!(fdbe->stat & FILE_SHARE)) ||
-	  (fdbe->stat & (FILE_HIDDEN | FILE_DIR)))
-	reject = FILES_NOSHARE;
+          (fdbe->stat & (FILE_HIDDEN | FILE_DIR)))
+        reject = FILES_NOSHARE;
       else {
-	s1 = nmalloc(strlen(dccdir) + strlen(dir) + strlen(what) + 2);
-	/* Copy to /tmp if needed */
-	sprintf(s1, "%s%s%s%s", dccdir, dir, dir[0] ? "/" : "", what);
-	if (copy_to_tmp) {
-	  s = nmalloc(strlen(tempdir) + strlen(what) + 1);
-	  sprintf(s, "%s%s", tempdir, what);
-	  copyfile(s1, s);
-	} else
-	  s = s1;
-	i = raw_dcc_send(s, "*remote", FILES_REMOTE, s);
-	if (i > 0) {
-	  wipe_tmp_filename(s, -1);
-	  reject = FILES_SENDERR;
-	}
-	if (s1 != s)
-	  my_free(s);
-	my_free(s1);
+        s1 = nmalloc(strlen(dccdir) + strlen(dir) + strlen(what) + 2);
+        /* Copy to /tmp if needed */
+        sprintf(s1, "%s%s%s%s", dccdir, dir, dir[0] ? "/" : "", what);
+        if (copy_to_tmp) {
+          s = nmalloc(strlen(tempdir) + strlen(what) + 1);
+          sprintf(s, "%s%s", tempdir, what);
+          copyfile(s1, s);
+        }
+        else
+          s = s1;
+        i = raw_dcc_send(s, "*remote", FILES_REMOTE, s);
+        if (i > 0) {
+          wipe_tmp_filename(s, -1);
+          reject = FILES_SENDERR;
+        }
+        if (s1 != s)
+          my_free(s);
+        my_free(s1);
       }
       free_fdbe(&fdbe);
     }
@@ -1087,9 +1101,9 @@
   }
   /* Grab info from dcc struct and bounce real request across net */
   i = dcc_total - 1;
-  s = nmalloc(40);	/* Enough? */
+  s = nmalloc(40);              /* Enough? */
   simple_sprintf(s, "%d %u %d", iptolong(getmyip()), dcc[i].port,
-		dcc[i].u.xfer->length);
+                 dcc[i].u.xfer->length);
   botnet_send_filesend(idx, s1, from, s);
   putlog(LOG_FILES, "*", FILES_REMOTEREQ, dir, dir[0] ? "/" : "", what);
   my_free(s1);
@@ -1112,7 +1126,8 @@
     *desc = nmalloc(strlen(fdbe->desc) + 1);
     strcpy(*desc, fdbe->desc);
     free_fdbe(&fdbe);
-  } else
+  }
+  else
     *desc = NULL;
 }
 
@@ -1125,14 +1140,15 @@
     *owner = nmalloc(strlen(fdbe->uploader) + 1);
     strcpy(*owner, fdbe->uploader);
     free_fdbe(&fdbe);
-  } else
+  }
+  else
     *owner = NULL;
 }
 
 static int filedb_getgots(char *dir, char *fn)
 {
   filedb_entry *fdbe = NULL;
-  int	        gots = 0;
+  int gots = 0;
 
   fdbe = filedb_getentry(dir, fn);
   if (fdbe) {
@@ -1145,7 +1161,7 @@
 static void filedb_setdesc(char *dir, char *fn, char *desc)
 {
   filedb_entry *fdbe = NULL;
-  FILE         *fdb  = NULL;
+  FILE *fdb = NULL;
 
   fdb = filedb_open(dir, 0);
   if (!fdb)
@@ -1164,7 +1180,7 @@
 static void filedb_setowner(char *dir, char *fn, char *owner)
 {
   filedb_entry *fdbe = NULL;
-  FILE         *fdb  = NULL;
+  FILE *fdb = NULL;
 
   fdb = filedb_open(dir, 0);
   if (!fdb)
@@ -1183,7 +1199,7 @@
 static void filedb_setlink(char *dir, char *fn, char *link)
 {
   filedb_entry *fdbe = NULL;
-  FILE	       *fdb  = NULL;
+  FILE *fdb = NULL;
 
   fdb = filedb_open(dir, 0);
   if (!fdb)
@@ -1222,14 +1238,15 @@
   fdbe = filedb_getentry(dir, fn);
   if (fdbe && (!(fdbe->stat & FILE_DIR))) {
     malloc_strcpy(*link, fdbe->sharelink);
-  } else
+  }
+  else
     *link = NULL;
   if (fdbe)
     free_fdbe(&fdbe);
   return;
 }
 
-static void filedb_getfiles(Tcl_Interp * irp, char *dir)
+static void filedb_getfiles(Tcl_Interp *irp, char *dir)
 {
   FILE *fdb;
   filedb_entry *fdbe;
@@ -1242,14 +1259,14 @@
     fdbe = filedb_getfile(fdb, ftell(fdb), GET_FILENAME);
     if (fdbe) {
       if (!(fdbe->stat & (FILE_DIR | FILE_UNUSED)))
-	Tcl_AppendElement(irp, fdbe->filename);
+        Tcl_AppendElement(irp, fdbe->filename);
       free_fdbe(&fdbe);
     }
   }
   filedb_close(fdb);
 }
 
-static void filedb_getdirs(Tcl_Interp * irp, char *dir)
+static void filedb_getdirs(Tcl_Interp *irp, char *dir)
 {
   FILE *fdb;
   filedb_entry *fdbe;
@@ -1262,7 +1279,7 @@
     fdbe = filedb_getfile(fdb, ftell(fdb), GET_FILENAME);
     if (fdbe) {
       if ((!(fdbe->stat & FILE_UNUSED)) && (fdbe->stat & FILE_DIR))
-	Tcl_AppendElement(irp, fdbe->filename);
+        Tcl_AppendElement(irp, fdbe->filename);
       free_fdbe(&fdbe);
     }
   }
@@ -1284,11 +1301,11 @@
     if (!(fdbe->stat & FILE_DIR)) {
       switch (what) {
       case FILEDB_SHARE:
-	fdbe->stat |= FILE_SHARE;
-	break;
+        fdbe->stat |= FILE_SHARE;
+        break;
       case FILEDB_UNSHARE:
-	fdbe->stat &= ~FILE_SHARE;
-	break;
+        fdbe->stat &= ~FILE_SHARE;
+        break;
       }
       changed = 1;
     }
Index: eggdrop1.6/src/mod/filesys.mod/filedb3.h
diff -u eggdrop1.6/src/mod/filesys.mod/filedb3.h:1.13 eggdrop1.6/src/mod/filesys.mod/filedb3.h:1.14
--- eggdrop1.6/src/mod/filesys.mod/filedb3.h:1.13	Wed Jan 22 20:41:48 2003
+++ eggdrop1.6/src/mod/filesys.mod/filedb3.h	Tue Jan 28 00:37:26 2003
@@ -4,7 +4,7 @@
  *
  * Written by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: filedb3.h,v 1.13 2003/01/23 02:41:48 wcc Exp $
+ * $Id: filedb3.h,v 1.14 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -48,50 +48,50 @@
 
 /* Top of each DB */
 typedef struct {
-  char version;				/* DB version			*/
-  time_t timestamp;			/* Last updated			*/
+  char version;                 /* DB version                   */
+  time_t timestamp;             /* Last updated                 */
 } filedb_top;
 
 /* Header of each entry */
 typedef struct {
-  time_t uploaded;			/* Upload time			*/
-  unsigned int size;			/* File size			*/
-  unsigned short int stat;		/* Misc information		*/
-  unsigned short int gots;		/* Number of gets		*/
-  unsigned short int filename_len; 	/* Length of filename buf	*/
-  unsigned short int desc_len;	 	/* Length of description buf	*/
-  unsigned short int sharelink_len;	/* Length of sharelink buf	*/
-  unsigned short int chan_len;		/* Length of channel name buf	*/
-  unsigned short int uploader_len;	/* Length of uploader buf	*/
-  unsigned short int flags_req_len;	/* Length of flags buf		*/
-  unsigned short int buffer_len;	/* Length of additional buffer	*/
+  time_t uploaded;              /* Upload time                  */
+  unsigned int size;            /* File size                    */
+  unsigned short int stat;      /* Misc information             */
+  unsigned short int gots;      /* Number of gets               */
+  unsigned short int filename_len;      /* Length of filename buf       */
+  unsigned short int desc_len;  /* Length of description buf    */
+  unsigned short int sharelink_len;     /* Length of sharelink buf      */
+  unsigned short int chan_len;  /* Length of channel name buf   */
+  unsigned short int uploader_len;      /* Length of uploader buf       */
+  unsigned short int flags_req_len;     /* Length of flags buf          */
+  unsigned short int buffer_len;        /* Length of additional buffer  */
 } filedb_header;
 
 /* Structure used to pass data between lower level
  * and higher level functions.
  */
 typedef struct {
-  time_t uploaded;			/* Upload time			*/
-  unsigned int size;			/* File size			*/
-  unsigned short int stat;		/* Misc information		*/
-  unsigned short int gots;		/* Number of gets		*/
-  unsigned short int _type;		/* Type of entry (private)	*/
+  time_t uploaded;              /* Upload time                  */
+  unsigned int size;            /* File size                    */
+  unsigned short int stat;      /* Misc information             */
+  unsigned short int gots;      /* Number of gets               */
+  unsigned short int _type;     /* Type of entry (private)      */
 
   /* NOTE: These three are only valid during one db open/close. Entry
    *       movements often invalidate them too, so make sure you know
    *       what you're doing before using/relying on them.
    */
-  long pos;				/* Last position in the filedb	*/
-  unsigned short int dyn_len;		/* Length of dynamic data in DB	*/
-  unsigned short int buf_len;		/* Length of additional buffer	*/
-
-  char *filename;			/* Filename			*/
-  char *desc;				/* Description			*/
-  char *sharelink;			/* Share link. Points to remote
-		 			   file on linked bot.		*/
-  char *chan;				/* Channel name			*/
-  char *uploader;			/* Uploader			*/
-  char *flags_req;			/* Required flags		*/
+  long pos;                     /* Last position in the filedb  */
+  unsigned short int dyn_len;   /* Length of dynamic data in DB */
+  unsigned short int buf_len;   /* Length of additional buffer  */
+
+  char *filename;               /* Filename                     */
+  char *desc;                   /* Description                  */
+  char *sharelink;              /* Share link. Points to remote
+                                 * file on linked bot.          */
+  char *chan;                   /* Channel name                 */
+  char *uploader;               /* Uploader                     */
+  char *flags_req;              /* Required flags               */
 } filedb_entry;
 
 
@@ -146,32 +146,32 @@
  */
 
 #define FILEDB_VERSION1	0x0001
-#define FILEDB_VERSION2	0x0002	/* DB version used for 1.3, 1.4		*/
+#define FILEDB_VERSION2	0x0002  /* DB version used for 1.3, 1.4         */
 #define FILEDB_VERSION3	0x0003
-#define FILEDB_NEWEST_VER FILEDB_VERSION3	/* Newest DB version	*/
+#define FILEDB_NEWEST_VER FILEDB_VERSION3       /* Newest DB version    */
 
-#define POS_NEW		0	/* Position which indicates that the
-				   entry wants to be repositioned.	*/
+#define POS_NEW		0       /* Position which indicates that the
+                                 * entry wants to be repositioned.      */
 
-#define FILE_UNUSED	0x0001	/* Deleted entry.			*/
-#define FILE_DIR	0x0002	/* It's actually a directory.		*/
-#define FILE_SHARE	0x0004	/* Can be shared on the botnet.		*/
-#define FILE_HIDDEN	0x0008	/* Hidden file.				*/
-#define FILE_ISLINK	0x0010	/* The file is a link to another bot.	*/
+#define FILE_UNUSED	0x0001  /* Deleted entry.                       */
+#define FILE_DIR	0x0002  /* It's actually a directory.           */
+#define FILE_SHARE	0x0004  /* Can be shared on the botnet.         */
+#define FILE_HIDDEN	0x0008  /* Hidden file.                         */
+#define FILE_ISLINK	0x0010  /* The file is a link to another bot.   */
 
-#define FILEDB_ESTDYN	50	/* Estimated dynamic length of an entry	*/
+#define FILEDB_ESTDYN	50      /* Estimated dynamic length of an entry */
 
 enum {
-  GET_HEADER,			/* Only save minimal data		*/
-  GET_FILENAME,			/* Additionally save filename		*/
-  GET_FULL,			/* Save all data			*/
-
-  UPDATE_HEADER,		/* Only update header			*/
-  UPDATE_SIZE,			/* Update header, enforce new buf sizes	*/
-  UPDATE_ALL,			/* Update additional data too		*/
+  GET_HEADER,                   /* Only save minimal data               */
+  GET_FILENAME,                 /* Additionally save filename           */
+  GET_FULL,                     /* Save all data                        */
+
+  UPDATE_HEADER,                /* Only update header                   */
+  UPDATE_SIZE,                  /* Update header, enforce new buf sizes */
+  UPDATE_ALL,                   /* Update additional data too           */
 
-  TYPE_NEW,			/* New entry				*/
-  TYPE_EXIST			/* Existing entry			*/
+  TYPE_NEW,                     /* New entry                            */
+  TYPE_EXIST                    /* Existing entry                       */
 };
 
 
@@ -192,4 +192,4 @@
 static filedb_entry *_filedb_matchfile(FILE *, long, char *, char *, int);
 static filedb_entry *filedb_getentry(char *, char *);
 
-#endif				/* _EGG_MOD_FILESYS_FILEDB3_H */
+#endif /* _EGG_MOD_FILESYS_FILEDB3_H */
Index: eggdrop1.6/src/mod/filesys.mod/filelist.c
diff -u eggdrop1.6/src/mod/filesys.mod/filelist.c:1.11 eggdrop1.6/src/mod/filesys.mod/filelist.c:1.12
--- eggdrop1.6/src/mod/filesys.mod/filelist.c:1.11	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/filesys.mod/filelist.c	Tue Jan 28 00:37:26 2003
@@ -4,7 +4,7 @@
  *
  * Written by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: filelist.c,v 1.11 2002/12/24 02:30:07 wcc Exp $
+ * $Id: filelist.c,v 1.12 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -68,9 +68,12 @@
 static void filelist_addout(filelist_t *flist, char *desc)
 {
   if (FILELIST_LE(flist).output) {
-    FILELIST_LE(flist).output = nrealloc(FILELIST_LE(flist).output, strlen(FILELIST_LE(flist).output) + strlen(desc) + 1);
+    FILELIST_LE(flist).output = nrealloc(FILELIST_LE(flist).output,
+                                strlen(FILELIST_LE(flist).output) +
+                                strlen(desc) + 1);
     strcat(FILELIST_LE(flist).output, desc);
-  } else {
+  }
+  else {
     FILELIST_LE(flist).output = nmalloc(strlen(desc) + 1);
     strcpy(FILELIST_LE(flist).output, desc);
   }
@@ -101,12 +104,12 @@
       j--;
     if (i <= j) {
       if (strcmp(el[j].fn, el[i].fn)) {
-	elt.fn = el[j].fn;
-	elt.output = el[j].output;
-	el[j].fn = el[i].fn;
-	el[j].output = el[i].output;
-	el[i].fn = elt.fn;
-	el[i].output = elt.output;
+        elt.fn = el[j].fn;
+        elt.output = el[j].output;
+        el[j].fn = el[i].fn;
+        el[j].output = el[i].output;
+        el[i].fn = elt.fn;
+        el[i].output = elt.output;
       }
       i++;
       j--;
Index: eggdrop1.6/src/mod/filesys.mod/filelist.h
diff -u eggdrop1.6/src/mod/filesys.mod/filelist.h:1.7 eggdrop1.6/src/mod/filesys.mod/filelist.h:1.8
--- eggdrop1.6/src/mod/filesys.mod/filelist.h:1.7	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/filesys.mod/filelist.h	Tue Jan 28 00:37:26 2003
@@ -4,7 +4,7 @@
  *
  * Written by Fabian Knittel <fknittel at gmx.de>
  *
- * $Id: filelist.h,v 1.7 2002/12/24 02:30:07 wcc Exp $
+ * $Id: filelist.h,v 1.8 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1999, 2000, 2001, 2002, 2003 Eggheads Development Team
@@ -28,13 +28,13 @@
 #define _EGG_MOD_FILESYS_FILELIST_H
 
 typedef struct {
-  char			*fn;
-  char			*output;
+  char *fn;
+  char *output;
 } filelist_element_t;
 
 typedef struct {
-  int			tot;
-  filelist_element_t	*elements;
+  int tot;
+  filelist_element_t *elements;
 } filelist_t;
 
 /* Short-cut to access the last element in filelist */
@@ -47,4 +47,4 @@
 static inline void filelist_idxshow(filelist_t *, int);
 static void filelist_sort(filelist_t *);
 
-#endif				/* _EGG_MOD_FILESYS_FILELIST_H */
+#endif /* _EGG_MOD_FILESYS_FILELIST_H */
Index: eggdrop1.6/src/mod/filesys.mod/files.c
diff -u eggdrop1.6/src/mod/filesys.mod/files.c:1.31 eggdrop1.6/src/mod/filesys.mod/files.c:1.32
--- eggdrop1.6/src/mod/filesys.mod/files.c:1.31	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/filesys.mod/files.c	Tue Jan 28 00:37:26 2003
@@ -2,7 +2,7 @@
  * files.c - part of filesys.mod
  *   handles all file system commands
  *
- * $Id: files.c,v 1.31 2002/12/24 02:30:07 wcc Exp $
+ * $Id: files.c,v 1.32 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -75,13 +75,13 @@
 
 static int welcome_to_files(int idx)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   FILE *f;
   char *p = get_user(&USERENTRY_DCCDIR, dcc[idx].user);
 
   dprintf(idx, "\n");
-  if (fr.global & USER_JANITOR)
-    fr.global |= USER_MASTER;
+  if (fr.global &USER_JANITOR)
+    fr.global |=USER_MASTER;
 
   /* Show motd if the user went straight here without going thru the
    * party line.
@@ -105,10 +105,9 @@
       dprintf(idx, "\n\n");
       dccdir[0] = 0;
       chanout_but(-1, dcc[idx].u.file->chat->channel,
-		  "*** %s rejoined the party line.\n",
-		  dcc[idx].nick);
+                  "*** %s rejoined the party line.\n", dcc[idx].nick);
       botnet_send_join_idx(idx, dcc[idx].u.file->chat->channel);
-      return 0;			/* failed */
+      return 0;                 /* failed */
     }
   }
   filedb_close(f);
@@ -120,7 +119,7 @@
 {
   struct userrec *u = get_user_by_handle(userlist, dcc[idx].nick);
   FILE *fdb = NULL;
-  char *p   = NULL;
+  char *p = NULL;
 
   putlog(LOG_FILES, "*", "files: #%s# optimize", dcc[idx].nick);
   p = get_user(&USERENTRY_DCCDIR, u);
@@ -150,17 +149,17 @@
 static int resolve_dir(char *current, char *change, char **real, int idx)
 {
   char *elem = NULL, *s = NULL, *new = NULL, *work = NULL, *p = NULL;
-  FILE *fdb  = NULL;
-  DIR  *dir  = NULL;
+  FILE *fdb = NULL;
+  DIR *dir = NULL;
   filedb_entry *fdbe = NULL;
-  struct flag_record user = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0},
-		     req  = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record user = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 },
+                     req = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   *real = NULL;
   malloc_strcpy(*real, current);
   if (!change[0])
-    return 1;				/* No change? */
-  new = nmalloc(strlen(change) + 2);	/* Add 2, because we add '/' below */
+    return 1;                   /* No change? */
+  new = nmalloc(strlen(change) + 2);    /* Add 2, because we add '/' below */
   strcpy(new, change);
   if (new[0] == '/') {
     /* EVERYONE has access here */
@@ -175,70 +174,71 @@
     p++;
     malloc_strcpy(elem, new);
     strcpy(new, p);
-    if (!(strcmp(elem, ".")) || (!elem[0])) {	/* Do nothing */
-    } else if (!strcmp(elem, "..")) {	/* Go back */
+    if (strcmp(elem, ".") && elem[0] && !strcmp(elem, "..")) {
       /* Always allowed */
       p = strrchr(*real, '/');
       if (p == NULL) {
-	/* Can't go back from here? */
-	if (!(*real)[0]) {
-	  my_free(elem);
-	  my_free(new);
-	  malloc_strcpy(*real, current);
-	  return 0;
-	}
-	(*real)[0] = 0;
-      } else
-	*p = 0;
-    } else {
+        /* Can't go back from here? */
+        if (!(*real)[0]) {
+          my_free(elem);
+          my_free(new);
+          malloc_strcpy(*real, current);
+          return 0;
+        }
+        (*real)[0] = 0;
+      }
+      else
+        *p = 0;
+    }
+    else {
       /* Allowed access here? */
       fdb = filedb_open(*real, 0);
       if (!fdb) {
-	/* Non-existent starting point! */
-	my_free(elem);
-	my_free(new);
-	malloc_strcpy(*real, current);
-	return 0;
+        /* Non-existent starting point! */
+        my_free(elem);
+        my_free(new);
+        malloc_strcpy(*real, current);
+        return 0;
       }
       filedb_readtop(fdb, NULL);
       fdbe = filedb_matchfile(fdb, ftell(fdb), elem);
       filedb_close(fdb);
       if (!fdbe) {
-	/* Non-existent */
-	my_free(elem);
-	my_free(new);
-	malloc_strcpy(*real, current);
-	return 0;
+        /* Non-existent */
+        my_free(elem);
+        my_free(new);
+        malloc_strcpy(*real, current);
+        return 0;
       }
       if (!(fdbe->stat & FILE_DIR) || fdbe->sharelink) {
-	/* Not a dir */
-	free_fdbe(&fdbe);
-	my_free(elem);
-	my_free(new);
-	malloc_strcpy(*real, current);
-	return 0;
+        /* Not a dir */
+        free_fdbe(&fdbe);
+        my_free(elem);
+        my_free(new);
+        malloc_strcpy(*real, current);
+        return 0;
       }
       if (idx >= 0)
-	get_user_flagrec(dcc[idx].user, &user, fdbe->chan);
+        get_user_flagrec(dcc[idx].user, &user, fdbe->chan);
       else
-	user.global = USER_OWNER | USER_BOT | USER_MASTER | USER_OP |
-		      USER_FRIEND;
+        user.global = USER_OWNER | USER_BOT | USER_MASTER | USER_OP |
+          USER_FRIEND;
 
       if (fdbe->flags_req) {
         break_down_flags(fdbe->flags_req, &req, NULL);
         if (!flagrec_ok(&req, &user)) {
-	  free_fdbe(&fdbe);
-	  my_free(elem);
-	  my_free(new);
-	  malloc_strcpy(*real, current);
-	  return 0;
-	}
+          free_fdbe(&fdbe);
+          my_free(elem);
+          my_free(new);
+          malloc_strcpy(*real, current);
+          return 0;
+        }
       }
       free_fdbe(&fdbe);
       malloc_strcpy(s, *real);
       if (s[0])
-	if (s[strlen(s) - 1] != '/')
-	  strcat(s, "/");
+        if (s[strlen(s) - 1] != '/')
+          strcat(s, "/");
       work = nmalloc(strlen(s) + strlen(elem) + 1);
       sprintf(work, "%s%s", s, elem);
       malloc_strcpy(*real, work);
@@ -281,7 +281,8 @@
     malloc_strcpy(destdir, path);
     malloc_strcpy(fn, p + 1);
     *p = '/';
-  } else {
+  }
+  else {
     malloc_strcpy(destdir, "");
     malloc_strcpy(fn, path);
   }
@@ -290,7 +291,7 @@
     my_free(path);
     my_free(destdir);
     my_free(fn);
-    return;			/* Not my concern, then */
+    return;                     /* Not my concern, then */
   }
   my_free(path);
   my_free(destdir);
@@ -347,7 +348,7 @@
   dcc[idx].u.file->dir[160] = 0;
   set_user(&USERENTRY_DCCDIR, dcc[idx].user, dcc[idx].u.file->dir);
   putlog(LOG_FILES, "*", "files: #%s# cd /%s", dcc[idx].nick,
-	 dcc[idx].u.file->dir);
+         dcc[idx].u.file->dir);
   dprintf(idx, "%s: /%s\n", FILES_NEWCURDIR, dcc[idx].u.file->dir);
 }
 
@@ -364,14 +365,15 @@
       malloc_strcpy(s, par);
       malloc_strcpy(mask, p + 1);
       if (!resolve_dir(dcc[idx].u.file->dir, s, &destdir, idx)) {
-	dprintf(idx, FILES_ILLDIR);
-	my_free(s);
-	my_free(mask);
-	my_free(destdir);
-	return;
+        dprintf(idx, FILES_ILLDIR);
+        my_free(s);
+        my_free(mask);
+        my_free(destdir);
+        return;
       }
       my_free(s);
-    } else {
+    }
+    else {
       malloc_strcpy(destdir, dcc[idx].u.file->dir);
       malloc_strcpy(mask, par);
     }
@@ -393,13 +395,15 @@
     filedb_close(fdb);
     my_free(destdir);
     my_free(mask);
-  } else {
+  }
+  else {
     putlog(LOG_FILES, "*", "files: #%s# ls", dcc[idx].nick);
     fdb = filedb_open(dcc[idx].u.file->dir, 0);
     if (fdb) {
       filedb_ls(fdb, idx, "*", showall);
       filedb_close(fdb);
-    } else
+    }
+    else
       dprintf(idx, FILES_ILLDIR);
   }
 }
@@ -432,7 +436,7 @@
   }
   if (!par[0]) {
     dprintf(idx, "%s: %sget <file(s)> [nickname]\n", MISC_USAGE,
-	    resend ? "re" : "");
+            resend ? "re" : "");
     return;
   }
   what = newsplit(&par);
@@ -452,7 +456,8 @@
       return;
     }
     my_free(s);
-  } else
+  }
+  else
     malloc_strcpy(destdir, dcc[idx].u.file->dir);
   fdb = filedb_open(destdir, 0);
   if (!fdb)
@@ -471,37 +476,38 @@
     if (!(fdbe->stat & (FILE_HIDDEN | FILE_DIR))) {
       ok = 1;
       if (fdbe->sharelink) {
-	char *bot, *whoto = NULL;
+        char *bot, *whoto = NULL;
 
-	/* This is a link to a file on another bot... */
-	bot = nmalloc(strlen(fdbe->sharelink) + 1);
-	splitc(bot, fdbe->sharelink, ':');
-	if (!egg_strcasecmp(bot, botnetnick)) {
-	  dprintf(idx, "Can't get that file, it's linked to this bot!\n");
-	} else if (!in_chain(bot)) {
-	  dprintf(idx, FILES_NOTAVAIL, fdbe->filename);
-	} else {
-	  i = nextbot(bot);
-	  malloc_strcpy(whoto, par);
-	  if (!whoto[0])
-	    malloc_strcpy(whoto, dcc[idx].nick);
-	  s = nmalloc(strlen(whoto) + strlen(botnetnick) + 13);
-	  simple_sprintf(s, "%d:%s@%s", dcc[idx].sock, whoto, botnetnick);
-	  botnet_send_filereq(i, s, bot, fdbe->sharelink);
-	  dprintf(idx, FILES_REQUESTED, fdbe->sharelink, bot);
-	  /* Increase got count now (or never) */
-	  fdbe->gots++;
-	  s = nrealloc(s, strlen(bot) + strlen(fdbe->sharelink) + 2);
-	  sprintf(s, "%s:%s", bot, fdbe->sharelink);
-	  malloc_strcpy(fdbe->sharelink, s);
-	  filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
-	  my_free(whoto);
-	  my_free(s);
-	}
-	my_free(bot);
-      } else {
-	do_dcc_send(idx, destdir, fdbe->filename, par, resend);
-	/* Don't increase got count till later */
+        /* This is a link to a file on another bot... */
+        bot = nmalloc(strlen(fdbe->sharelink) + 1);
+        splitc(bot, fdbe->sharelink, ':');
+        if (!egg_strcasecmp(bot, botnetnick))
+          dprintf(idx, "Can't get that file, it's linked to this bot!\n");
+        else if (!in_chain(bot))
+          dprintf(idx, FILES_NOTAVAIL, fdbe->filename);
+        else {
+          i = nextbot(bot);
+          malloc_strcpy(whoto, par);
+          if (!whoto[0])
+            malloc_strcpy(whoto, dcc[idx].nick);
+          s = nmalloc(strlen(whoto) + strlen(botnetnick) + 13);
+          simple_sprintf(s, "%d:%s@%s", dcc[idx].sock, whoto, botnetnick);
+          botnet_send_filereq(i, s, bot, fdbe->sharelink);
+          dprintf(idx, FILES_REQUESTED, fdbe->sharelink, bot);
+          /* Increase got count now (or never) */
+          fdbe->gots++;
+          s = nrealloc(s, strlen(bot) + strlen(fdbe->sharelink) + 2);
+          sprintf(s, "%s:%s", bot, fdbe->sharelink);
+          malloc_strcpy(fdbe->sharelink, s);
+          filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
+          my_free(whoto);
+          my_free(s);
+        }
+        my_free(bot);
+      }
+      else {
+        do_dcc_send(idx, destdir, fdbe->filename, par, resend);
+        /* Don't increase got count till later */
       }
     }
     free_fdbe(&fdbe);
@@ -513,7 +519,7 @@
     dprintf(idx, FILES_NOMATCH);
   else
     putlog(LOG_FILES, "*", "files: #%s# %sget %s %s", dcc[idx].nick,
-	   resend ? "re" : "", what, par);
+           resend ? "re" : "", what, par);
 }
 
 static void cmd_reget(int idx, char *par)
@@ -529,7 +535,7 @@
 static void cmd_file_help(int idx, char *par)
 {
   char *s;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.file->chat->con_chan);
   if (par[0]) {
@@ -539,7 +545,8 @@
     s[256] = 0;
     tellhelp(idx, s, &fr, 0);
     my_free(s);
-  } else {
+  }
+  else {
     putlog(LOG_FILES, "*", "files: #%s# help", dcc[idx].nick);
     tellhelp(idx, "filesys/help", &fr, 0);
   }
@@ -695,7 +702,7 @@
   while (fdbe) {
     where = ftell(fdb);
     if ((fdbe->stat & FILE_SHARE) &&
-	!(fdbe->stat & (FILE_DIR | FILE_HIDDEN))) {
+        !(fdbe->stat & (FILE_DIR | FILE_HIDDEN))) {
       fdbe->stat &= ~FILE_SHARE;
       ok++;
       dprintf(idx, "%s: %s\n", FILES_UNSHARED, fdbe->filename);
@@ -710,8 +717,7 @@
   else {
     putlog(LOG_FILES, "*", "files: #%s# unshare %s", dcc[idx].nick, par);
     if (ok > 1)
-      dprintf(idx, "%s %d file%s.\n", FILES_UNSHARED, ok,
-	      ok == 1 ? "" : "s");
+      dprintf(idx, "%s %d file%s.\n", FILES_UNSHARED, ok, ok == 1 ? "" : "s");
   }
 }
 
@@ -736,12 +742,13 @@
       *p = 0;
       malloc_strcpy(newfn, p + 1);
       if (!resolve_dir(dcc[idx].u.file->dir, par, &newpath, idx)) {
-	dprintf(idx, FILES_NOSUCHDIR);
-	my_free(newfn);
-	my_free(newpath);
-	return;
+        dprintf(idx, FILES_NOSUCHDIR);
+        my_free(newfn);
+        my_free(newpath);
+        return;
       }
-    } else {
+    }
+    else {
       malloc_strcpy(newpath, dcc[idx].u.file->dir);
       malloc_strcpy(newfn, par);
     }
@@ -755,17 +762,19 @@
     fdbe = filedb_matchfile(fdb, ftell(fdb), newfn);
     if (fdbe) {
       if (!fdbe->sharelink) {
-	dprintf(idx, FILES_NORMAL, newfn);
-	filedb_close(fdb);
-      } else {
-	malloc_strcpy(fdbe->sharelink, share);
-	filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
-	filedb_close(fdb);
-	dprintf(idx, FILES_CHGLINK, share);
-	putlog(LOG_FILES, "*", "files: #%s# ln %s %s",
-	       dcc[idx].nick, par, share);
+        dprintf(idx, FILES_NORMAL, newfn);
+        filedb_close(fdb);
+      }
+      else {
+        malloc_strcpy(fdbe->sharelink, share);
+        filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
+        filedb_close(fdb);
+        dprintf(idx, FILES_CHGLINK, share);
+        putlog(LOG_FILES, "*", "files: #%s# ln %s %s",
+               dcc[idx].nick, par, share);
       }
-    } else {
+    }
+    else {
       /* New entry */
       fdbe = malloc_fdbe();
       malloc_strcpy(fdbe->filename, newfn);
@@ -776,7 +785,7 @@
       filedb_close(fdb);
       dprintf(idx, "%s %s -> %s\n", FILES_ADDLINK, fdbe->filename, share);
       putlog(LOG_FILES, "*", "files: #%s# ln /%s%s%s %s", dcc[idx].nick,
-	     newpath, newpath[0] ? "/" : "", newfn, share);
+             newpath, newpath[0] ? "/" : "", newfn, share);
     }
     free_fdbe(&fdbe);
     my_free(newpath);
@@ -805,7 +814,7 @@
   lin = 0;
   q = desc;
   while ((*q <= 32) && (*q))
-    strcpy(q, &q[1]);		/* Zapf leading spaces */
+    strcpy(q, &q[1]);           /* Zapf leading spaces */
   p = strchr(q, '|');
   while (p != NULL) {
     /* Check length */
@@ -815,12 +824,12 @@
       *p = '|';
       p = q + 60;
       while ((*p != ' ') && (p != q))
-	p--;
+        p--;
       if (p == q)
-	*(q + 60) = '|';	/* No space, so truncate it */
+        *(q + 60) = '|';        /* No space, so truncate it */
       else
-	*p = '|';
-      p = strchr(q, '|');	/* Go back, find my place, and continue */
+        *p = '|';
+      p = strchr(q, '|');       /* Go back, find my place, and continue */
     }
     *p = '\n';
     q = p + 1;
@@ -830,7 +839,8 @@
     if (lin == 5) {
       *p = 0;
       p = NULL;
-    } else
+    }
+    else
       p = strchr(q, '|');
   }
   if (desc[strlen(desc) - 1] == '\n')
@@ -853,27 +863,28 @@
     if (!(fdbe->stat & FILE_HIDDEN)) {
       ok = 1;
       if ((!(dcc[idx].user->flags & USER_JANITOR)) &&
-	  (egg_strcasecmp(fdbe->uploader, dcc[idx].nick)))
-	dprintf(idx, FILES_NOTOWNER, fdbe->filename);
+          (egg_strcasecmp(fdbe->uploader, dcc[idx].nick)))
+        dprintf(idx, FILES_NOTOWNER, fdbe->filename);
       else {
-	if (desc[0]) {
-	  /* If the current description is the same as the new
-	   * one, don't change anything.
-	   */
-	  if (fdbe->desc && !strcmp(fdbe->desc, desc)) {
-	    free_fdbe(&fdbe);
-	    fdbe = filedb_matchfile(fdb, where, fn);
-	    continue;
-	  }
-	  malloc_strcpy(fdbe->desc, desc);
-	} else if (fdbe->desc) {
-	  my_free(fdbe->desc);
-	}
-	filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
-	if (par[0])
-	  dprintf(idx, "%s: %s\n", FILES_CHANGED, fdbe->filename);
-	else
-	  dprintf(idx, "%s: %s\n", FILES_BLANKED, fdbe->filename);
+        if (desc[0]) {
+          /* If the current description is the same as the new
+           * one, don't change anything.
+           */
+          if (fdbe->desc && !strcmp(fdbe->desc, desc)) {
+            free_fdbe(&fdbe);
+            fdbe = filedb_matchfile(fdb, where, fn);
+            continue;
+          }
+          malloc_strcpy(fdbe->desc, desc);
+        }
+        else if (fdbe->desc) {
+          my_free(fdbe->desc);
+        }
+        filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
+        if (par[0])
+          dprintf(idx, "%s: %s\n", FILES_CHANGED, fdbe->filename);
+        else
+          dprintf(idx, "%s: %s\n", FILES_BLANKED, fdbe->filename);
       }
     }
     free_fdbe(&fdbe);
@@ -913,13 +924,13 @@
     where = ftell(fdb);
     if (!(fdbe->stat & (FILE_HIDDEN | FILE_DIR))) {
       s = nmalloc(strlen(dccdir) + strlen(dcc[idx].u.file->dir)
-		  + strlen(fdbe->filename) + 2);
+                  + strlen(fdbe->filename) + 2);
       sprintf(s, "%s%s/%s", dccdir, dcc[idx].u.file->dir, fdbe->filename);
       ok++;
       filedb_delfile(fdb, fdbe->pos);
       /* Shared file links won't be able to be unlinked */
       if (!(fdbe->sharelink))
-	unlink(s);
+        unlink(s);
       dprintf(idx, "%s: %s\n", FILES_ERASED, fdbe->filename);
       my_free(s);
     }
@@ -942,7 +953,7 @@
   FILE *fdb;
   filedb_entry *fdbe;
   int ret;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   if (!par[0]) {
     dprintf(idx, "%s: mkdir <dir> [required-flags] [channel]\n", MISC_USAGE);
@@ -963,15 +974,16 @@
       /* Need some extra checking here to makesure we dont mix up
        * the flags with a +channel. <cybah>
        */
-      if(!findchan(flags) && flags[0] != '+') {
-	dprintf(idx, "Invalid channel!\n");
-	return;
-      } else if(findchan(flags)) {
-	/* Flags is a channel. */
-	chan = flags;
-	flags = par;
-      }	/* (else) Couldn't find the channel and flags[0] is a '+', these
-	 * are flags. */
+      if (!findchan(flags) && flags[0] != '+') {
+        dprintf(idx, "Invalid channel!\n");
+        return;
+      }
+      else if (findchan(flags)) {
+        /* Flags is a channel. */
+        chan = flags;
+        flags = par;
+      }                         /* (else) Couldn't find the channel and flags[0] is a '+', these
+                                 * are flags. */
     }
     if (chan[0] && !findchan(chan)) {
       dprintf(idx, "Invalid channel!\n");
@@ -984,13 +996,13 @@
     fdbe = filedb_matchfile(fdb, ftell(fdb), name);
     if (!fdbe) {
       s = nmalloc(strlen(dccdir) + strlen(dcc[idx].u.file->dir)
-		  + strlen(name) + 2);
+                  + strlen(name) + 2);
       sprintf(s, "%s%s/%s", dccdir, dcc[idx].u.file->dir, name);
       if (mkdir(s, 0755) != 0) {
-	dprintf(idx, MISC_FAILED);
-	filedb_close(fdb);
-	my_free(s);
-	return;
+        dprintf(idx, MISC_FAILED);
+        filedb_close(fdb);
+        my_free(s);
+        return;
       }
       my_free(s);
       fdbe = malloc_fdbe();
@@ -998,8 +1010,9 @@
       malloc_strcpy(fdbe->filename, name);
       fdbe->uploaded = now;
       dprintf(idx, "%s /%s%s%s\n", FILES_CREADIR, dcc[idx].u.file->dir,
-	      dcc[idx].u.file->dir[0] ? "/" : "", name);
-    } else if (!(fdbe->stat & FILE_DIR)) {
+              dcc[idx].u.file->dir[0] ? "/" : "", name);
+    }
+    else if (!(fdbe->stat & FILE_DIR)) {
       dprintf(idx, FILES_NOSUCHDIR);
       free_fdbe(&fdbe);
       filedb_close(fdb);
@@ -1012,14 +1025,16 @@
       build_flags(buffer, &fr, NULL);
       malloc_strcpy(fdbe->flags_req, buffer);
       dprintf(idx, FILES_CHGACCESS, name, buffer);
-    } else if (!chan[0]) {
+    }
+    else if (!chan[0]) {
       my_free(fdbe->flags_req);
       dprintf(idx, FILES_CHGNACCESS, name);
     }
     if (chan[0]) {
       malloc_strcpy(fdbe->chan, chan);
       dprintf(idx, "Access set to channel: %s\n", chan);
-    } else if (!flags[0]) {
+    }
+    else if (!flags[0]) {
       my_free(fdbe->chan);
       dprintf(idx, "Access set to all channels.\n");
     }
@@ -1066,7 +1081,7 @@
     }
     /* Erase '.filedb' and '.files' if they exist */
     s = nmalloc(strlen(dccdir) + strlen(dcc[idx].u.file->dir)
-		+ strlen(name) + 10);
+                + strlen(name) + 10);
     sprintf(s, "%s%s/%s/.filedb", dccdir, dcc[idx].u.file->dir, name);
     unlink(s);
     sprintf(s, "%s%s/%s/.files", dccdir, dcc[idx].u.file->dir, name);
@@ -1074,7 +1089,7 @@
     sprintf(s, "%s%s/%s", dccdir, dcc[idx].u.file->dir, name);
     if (rmdir(s) == 0) {
       dprintf(idx, "%s /%s%s%s\n", FILES_REMDIR, dcc[idx].u.file->dir,
-	      dcc[idx].u.file->dir[0] ? "/" : "", name);
+              dcc[idx].u.file->dir[0] ? "/" : "", name);
       filedb_delfile(fdb, fdbe->pos);
       filedb_close(fdb);
       free_fdbe(&fdbe);
@@ -1095,7 +1110,7 @@
 {
   char *p, *fn, *oldpath = NULL, *s = NULL, *s1, *newfn = NULL;
   char *newpath = NULL;
-  int   ok = 0, only_first = 0, skip_this = 0;
+  int ok = 0, only_first = 0, skip_this = 0;
   FILE *fdb_old = NULL, *fdb_new = NULL;
   filedb_entry *fdbe_old = NULL, *fdbe_new = NULL;
   long where = 0;
@@ -1103,7 +1118,7 @@
   fn = newsplit(&par);
   if (!par[0]) {
     dprintf(idx, "%s: %s <oldfilepath> <newfilepath>\n",
-	    MISC_USAGE, copy ? "cp" : "mv");
+            MISC_USAGE, copy ? "cp" : "mv");
     return;
   }
   p = strrchr(fn, '/');
@@ -1118,7 +1133,8 @@
       return;
     }
     my_free(s);
-  } else
+  }
+  else
     malloc_strcpy(oldpath, dcc[idx].u.file->dir);
   malloc_strcpy(s, par);
   if (!resolve_dir(dcc[idx].u.file->dir, s, &newpath, idx)) {
@@ -1127,7 +1143,8 @@
     if (p == NULL) {
       malloc_strcpy(newfn, s);
       s[0] = 0;
-    } else {
+    }
+    else {
       *p = 0;
       malloc_strcpy(newfn, p + 1);
     }
@@ -1139,12 +1156,12 @@
       my_free(newpath);
       return;
     }
-  } else
+  }
+  else
     malloc_strcpy(newfn, "");
   my_free(s);
   /* Stupidness checks */
-  if ((!strcmp(oldpath, newpath)) &&
-      ((!newfn[0]) || (!strcmp(newfn, fn)))) {
+  if ((!strcmp(oldpath, newpath)) && ((!newfn[0]) || (!strcmp(newfn, fn)))) {
     dprintf(idx, FILES_STUPID, copy ? FILES_COPY : FILES_MOVE);
     my_free(oldpath);
     my_free(newpath);
@@ -1185,63 +1202,61 @@
     skip_this = 0;
     if (!(fdbe_old->stat & (FILE_HIDDEN | FILE_DIR))) {
       s = nmalloc(strlen(dccdir) + strlen(oldpath)
-		  + strlen(fdbe_old->filename) + 2);
+                  + strlen(fdbe_old->filename) + 2);
       s1 = nmalloc(strlen(dccdir) + strlen(newpath)
-		   + strlen(newfn[0] ? newfn : fdbe_old->filename) + 2);
+                   + strlen(newfn[0] ? newfn : fdbe_old->filename) + 2);
       sprintf(s, "%s%s%s%s", dccdir, oldpath,
-	      oldpath[0] ? "/" : "", fdbe_old->filename);
+              oldpath[0] ? "/" : "", fdbe_old->filename);
       sprintf(s1, "%s%s%s%s", dccdir, newpath,
-	      newpath[0] ? "/" : "", newfn[0] ? newfn : fdbe_old->filename);
+              newpath[0] ? "/" : "", newfn[0] ? newfn : fdbe_old->filename);
       if (!strcmp(s, s1)) {
-	dprintf(idx, "%s /%s%s%s %s\n", FILES_SKIPSTUPID,
-	        copy ? FILES_COPY : FILES_MOVE, newpath,
-	        newpath[0] ? "/" : "", newfn[0] ? newfn : fdbe_old->filename);
-	skip_this = 1;
+        dprintf(idx, "%s /%s%s%s %s\n", FILES_SKIPSTUPID,
+                copy ? FILES_COPY : FILES_MOVE, newpath,
+                newpath[0] ? "/" : "", newfn[0] ? newfn : fdbe_old->filename);
+        skip_this = 1;
       }
       /* Check for existence of file with same name in new dir */
       filedb_readtop(fdb_new, NULL);
       fdbe_new = filedb_matchfile(fdb_new, ftell(fdb_new),
-				  newfn[0] ? newfn : fdbe_old->filename);
+                                  newfn[0] ? newfn : fdbe_old->filename);
       if (fdbe_new) {
-	/* It's ok if the entry in the new dir is a normal file (we'll
-	 * just scrap the old entry and overwrite the file) -- but if
-	 * it's a directory, this file has to be skipped.
-	 */
-	if (fdbe_new->stat & FILE_DIR) {
-	  /* Skip */
-	  skip_this = 1;
-	} else {
-	  filedb_delfile(fdb_new, fdbe_new->pos);
-	}
-	free_fdbe(&fdbe_new);
+        /* It's ok if the entry in the new dir is a normal file (we'll
+         * just scrap the old entry and overwrite the file) -- but if
+         * it's a directory, this file has to be skipped.
+         */
+        if (fdbe_new->stat & FILE_DIR)
+          skip_this = 1;
+        else
+          filedb_delfile(fdb_new, fdbe_new->pos);
+        free_fdbe(&fdbe_new);
       }
       if (!skip_this) {
-	if ((fdbe_old->sharelink) || (copyfile(s, s1) == 0)) {
-	  /* Raw file moved okay: create new entry for it */
-	  ok++;
-	  fdbe_new = malloc_fdbe();
-	  fdbe_new->stat = fdbe_old->stat;
-	  /* We don't have to worry about any entries to be
-	   * NULL, because malloc_strcpy takes care of that.
-	   */
-	  malloc_strcpy(fdbe_new->flags_req, fdbe_old->flags_req);
-	  malloc_strcpy(fdbe_new->chan, fdbe_old->chan);
-	  malloc_strcpy(fdbe_new->filename, fdbe_old->filename);
-	  malloc_strcpy(fdbe_new->desc, fdbe_old->desc);
-	  if (newfn[0])
-	    malloc_strcpy(fdbe_new->filename, newfn);
-	  malloc_strcpy(fdbe_new->uploader, fdbe_old->uploader);
-	  fdbe_new->uploaded = fdbe_old->uploaded;
-	  fdbe_new->size = fdbe_old->size;
-	  fdbe_new->gots = fdbe_old->gots;
-	  malloc_strcpy(fdbe_new->sharelink, fdbe_old->sharelink);
-	  filedb_addfile(fdb_new, fdbe_new);
-	  if (!copy) {
-	    unlink(s);
-	    filedb_delfile(fdb_old, fdbe_old->pos);
-	  }
-	  free_fdbe(&fdbe_new);
-	}
+        if ((fdbe_old->sharelink) || (copyfile(s, s1) == 0)) {
+          /* Raw file moved okay: create new entry for it */
+          ok++;
+          fdbe_new = malloc_fdbe();
+          fdbe_new->stat = fdbe_old->stat;
+          /* We don't have to worry about any entries to be
+           * NULL, because malloc_strcpy takes care of that.
+           */
+          malloc_strcpy(fdbe_new->flags_req, fdbe_old->flags_req);
+          malloc_strcpy(fdbe_new->chan, fdbe_old->chan);
+          malloc_strcpy(fdbe_new->filename, fdbe_old->filename);
+          malloc_strcpy(fdbe_new->desc, fdbe_old->desc);
+          if (newfn[0])
+            malloc_strcpy(fdbe_new->filename, newfn);
+          malloc_strcpy(fdbe_new->uploader, fdbe_old->uploader);
+          fdbe_new->uploaded = fdbe_old->uploaded;
+          fdbe_new->size = fdbe_old->size;
+          fdbe_new->gots = fdbe_old->gots;
+          malloc_strcpy(fdbe_new->sharelink, fdbe_old->sharelink);
+          filedb_addfile(fdb_new, fdbe_new);
+          if (!copy) {
+            unlink(s);
+            filedb_delfile(fdb_old, fdbe_old->pos);
+          }
+          free_fdbe(&fdbe_new);
+        }
       }
       my_free(s);
       my_free(s1);
@@ -1258,10 +1273,10 @@
     dprintf(idx, FILES_NOMATCH);
   else {
     putlog(LOG_FILES, "*", "files: #%s# %s %s%s%s %s", dcc[idx].nick,
-	   copy ? "cp" : "mv", oldpath, oldpath[0] ? "/" : "", fn, par);
+           copy ? "cp" : "mv", oldpath, oldpath[0] ? "/" : "", fn, par);
     if (ok > 1)
       dprintf(idx, "%s %d file%s.\n",
-	      copy ? FILES_COPIED : FILES_MOVED, ok, ok == 1 ? "" : "s");
+              copy ? FILES_COPIED : FILES_MOVED, ok, ok == 1 ? "" : "s");
   }
   my_free(oldpath);
   my_free(newpath);
@@ -1301,10 +1316,11 @@
   else if (!(u = get_user_by_handle(userlist, nick)))
     dprintf(idx, "No such user.\n");
   else if (!strcmp(par, "clear") && dcc[idx].user &&
-	   (dcc[idx].user->flags & USER_JANITOR)) {
-    set_user (&USERENTRY_FSTAT, u, NULL);
+           (dcc[idx].user->flags & USER_JANITOR)) {
+    set_user(&USERENTRY_FSTAT, u, NULL);
     dprintf(idx, "Cleared filestats for %s.\n", nick);
-  } else
+  }
+  else
     tell_file_stats(idx, nick);
   return 0;
 }
@@ -1321,45 +1337,44 @@
     Function f = me->funcs[NOTES_CMD_NOTE];
 
     (f) (u, idx, par);
-  } else {
-    dprintf(idx, "Sending of notes is not supported.\n");
   }
+  else
+    dprintf(idx, "Sending of notes is not supported.\n");
 }
 
-static cmd_t myfiles[] =
-{
-  {"cancel",	"",	(Function) cmd_cancel,		NULL},
-  {"cd",	"",	(Function) cmd_chdir,		NULL},
-  {"chdir",	"",	(Function) cmd_chdir,		NULL},
-  {"cp",	"j",	(Function) cmd_cp,		NULL},
-  {"desc",	"",	(Function) cmd_desc,		NULL},
-  {"filestats",	"j",	(Function) cmd_filestats,	NULL},
-  {"get",	"",	(Function) cmd_get,		NULL},
-  {"reget",	"",	(Function) cmd_reget,		NULL},
-  {"help",	"",	(Function) cmd_file_help,	NULL},
-  {"hide",	"j",	(Function) cmd_hide,		NULL},
-  {"ln",	"j",	(Function) cmd_ln,		NULL},
-  {"ls",	"",	(Function) cmd_ls,		NULL},
-  {"lsa",	"j",	(Function) cmd_lsa,		NULL},
-  {"mkdir",	"j",	(Function) cmd_mkdir,		NULL},
-  {"mv",	"j",	(Function) cmd_mv,		NULL},
-  {"note",	"",	(Function) filesys_note,	NULL},
-  {"pending",	"",	(Function) cmd_pending,		NULL},
-  {"pwd",	"",	(Function) cmd_pwd,		NULL},
-  {"quit",	"",	(Function) CMD_LEAVE,		NULL},
-  {"rm",	"j",	(Function) cmd_rm,		NULL},
-  {"rmdir",	"j",	(Function) cmd_rmdir,		NULL},
-  {"share",	"j",	(Function) cmd_share,		NULL},
+static cmd_t myfiles[] = {
+  {"cancel",    "",   (Function) cmd_cancel,    NULL},
+  {"cd",        "",   (Function) cmd_chdir,     NULL},
+  {"chdir",     "",   (Function) cmd_chdir,     NULL},
+  {"cp",        "j",  (Function) cmd_cp,        NULL},
+  {"desc",      "",   (Function) cmd_desc,      NULL},
+  {"filestats", "j",  (Function) cmd_filestats, NULL},
+  {"get",       "",   (Function) cmd_get,       NULL},
+  {"reget",     "",   (Function) cmd_reget,     NULL},
+  {"help",      "",   (Function) cmd_file_help, NULL},
+  {"hide",      "j",  (Function) cmd_hide,      NULL},
+  {"ln",        "j",  (Function) cmd_ln,        NULL},
+  {"ls",        "",   (Function) cmd_ls,        NULL},
+  {"lsa",       "j",  (Function) cmd_lsa,       NULL},
+  {"mkdir",     "j",  (Function) cmd_mkdir,     NULL},
+  {"mv",        "j",  (Function) cmd_mv,        NULL},
+  {"note",      "",   (Function) filesys_note,  NULL},
+  {"pending",   "",   (Function) cmd_pending,   NULL},
+  {"pwd",       "",   (Function) cmd_pwd,       NULL},
+  {"quit",      "",   (Function) CMD_LEAVE,     NULL},
+  {"rm",        "j",  (Function) cmd_rm,        NULL},
+  {"rmdir",     "j",  (Function) cmd_rmdir,     NULL},
+  {"share",     "j",  (Function) cmd_share,     NULL},
 /* Since we have spelt optimize wrong for so many years, we will
  * keep the old spelling around for the command name for now to
  * avoid problems with people typing .optimise and wondering 
  * where it went (guppy:28Nov2001) */
-  {"optimise",	"j",	(Function) cmd_optimize,	NULL},
-  {"optimize",	"j",	(Function) cmd_optimize,	NULL},
-  {"stats",	"",	(Function) cmd_stats,		NULL},
-  {"unhide",	"j",	(Function) cmd_unhide,		NULL},
-  {"unshare",	"j",	(Function) cmd_unshare,		NULL},
-  {NULL,	NULL,	NULL,				NULL}
+  {"optimise",  "j",  (Function) cmd_optimize,  NULL},
+  {"optimize",  "j",  (Function) cmd_optimize,  NULL},
+  {"stats",     "",   (Function) cmd_stats,     NULL},
+  {"unhide",    "j",  (Function) cmd_unhide,    NULL},
+  {"unshare",   "j",  (Function) cmd_unshare,   NULL},
+  {NULL,        NULL, NULL,                     NULL}
 };
 
 
@@ -1386,7 +1401,8 @@
       return 0;
     }
     my_free(s);
-  } else {
+  }
+  else {
     malloc_strcpy(destdir, dcc[idx].u.file->dir);
     malloc_strcpy(what, fn);
   }
@@ -1425,19 +1441,22 @@
       my_free(bot);
       free_fdbe(&fdbe);
       return 0;
-    } else if (!in_chain(bot)) {
+    }
+    else if (!in_chain(bot)) {
       filedb_close(fdb);
       my_free(what);
       my_free(destdir);
       my_free(bot);
       free_fdbe(&fdbe);
       return 0;
-    } else {
+    }
+    else {
       i = nextbot(bot);
       if (nick[0]) {
         malloc_strcpy(whoto, nick);
-      } else {
-	malloc_strcpy(whoto, dcc[idx].nick);
+      }
+      else {
+        malloc_strcpy(whoto, dcc[idx].nick);
       }
       s = nmalloc(strlen(whoto) + strlen(botnetnick) + 13);
       simple_sprintf(s, "%d:%s@%s", dcc[idx].sock, whoto, botnetnick);
@@ -1476,6 +1495,6 @@
     return;
   strcpy(dcc[idx].u.file->dir, s);
   set_user(&USERENTRY_DCCDIR, get_user_by_handle(userlist, dcc[idx].nick),
-	   dcc[idx].u.file->dir);
+           dcc[idx].u.file->dir);
   my_free(s);
 }
Index: eggdrop1.6/src/mod/filesys.mod/files.h
diff -u eggdrop1.6/src/mod/filesys.mod/files.h:1.8 eggdrop1.6/src/mod/filesys.mod/files.h:1.9
--- eggdrop1.6/src/mod/filesys.mod/files.h:1.8	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/filesys.mod/files.h	Tue Jan 28 00:37:26 2003
@@ -1,7 +1,7 @@
 /*
  * files.h -- part of filesys.mod
  *
- * $Id: files.h,v 1.8 2002/12/24 02:30:07 wcc Exp $
+ * $Id: files.h,v 1.9 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -80,4 +80,4 @@
 #define FILES_WELCOME    get_language(0x33a)
 #define FILES_WELCOME1   get_language(0x33b)
 
-#endif				/* _EGG_MOD_FILESYS_FILES_H */
+#endif /* _EGG_MOD_FILESYS_FILES_H */
Index: eggdrop1.6/src/mod/filesys.mod/filesys.c
diff -u eggdrop1.6/src/mod/filesys.mod/filesys.c:1.53 eggdrop1.6/src/mod/filesys.mod/filesys.c:1.54
--- eggdrop1.6/src/mod/filesys.mod/filesys.c:1.53	Wed Jan 22 20:13:29 2003
+++ eggdrop1.6/src/mod/filesys.mod/filesys.c	Tue Jan 28 00:37:26 2003
@@ -2,7 +2,7 @@
  * filesys.c -- part of filesys.mod
  *   main file of the filesys eggdrop module
  *
- * $Id: filesys.c,v 1.53 2003/01/23 02:13:29 wcc Exp $
+ * $Id: filesys.c,v 1.54 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -94,8 +94,7 @@
 static void out_dcc_files(int idx, char *buf, void *x);
 static char *mktempfile(char *filename);
 
-static struct dcc_table DCC_FILES =
-{
+static struct dcc_table DCC_FILES = {
   "FILES",
   DCT_MASTER | DCT_VALIDIDX | DCT_SHOWWHO | DCT_SIMUL | DCT_CANBOOT | DCT_FILES,
   eof_dcc_files,
@@ -108,9 +107,8 @@
   out_dcc_files
 };
 
-static struct user_entry_type USERENTRY_DCCDIR =
-{
-  NULL,				/* always NULL ;) */
+static struct user_entry_type USERENTRY_DCCDIR = {
+  NULL,                         /* always NULL ;) */
   NULL,
   NULL,
   NULL,
@@ -139,7 +137,7 @@
 {
   int x;
   char s[5];
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   get_user_flagrec(dcc[idx].user, &fr, dcc[idx].u.file->chat->con_chan);
   sprintf(s, "%ld", dcc[idx].sock);
@@ -147,7 +145,7 @@
   Tcl_SetVar(interp, "_fil2", s, 0);
   Tcl_SetVar(interp, "_fil3", args, 0);
   x = check_tcl_bind(H_fil, cmd, &fr, " $_fil1 $_fil2 $_fil3",
-		     MATCH_PARTIAL | BIND_USE_ATTR | BIND_HAS_BUILTINS);
+                     MATCH_PARTIAL | BIND_USE_ATTR | BIND_HAS_BUILTINS);
   if (x == BIND_AMBIGUOUS) {
     dprintf(idx, "Ambiguous command.\n");
     return 0;
@@ -174,21 +172,22 @@
       dprintf(idx, "Too many people are in the file system right now.\n");
       dprintf(idx, "Please try again later.\n");
       putlog(LOG_MISC, "*", "File area full: DCC chat [%s]%s", dcc[idx].nick,
-	     dcc[idx].host);
+             dcc[idx].host);
       killsock(dcc[idx].sock);
       lostdcc(idx);
       return;
     }
     dcc[idx].type = &DCC_FILES;
     if (dcc[idx].status & STAT_TELNET)
-      dprintf(idx, "\377\374\001\n");	/* turn echo back on */
+      dprintf(idx, "\377\374\001\n");   /* turn echo back on */
     putlog(LOG_FILES, "*", "File system: [%s]%s/%d", dcc[idx].nick,
-	   dcc[idx].host, dcc[idx].port);
+           dcc[idx].host, dcc[idx].port);
     if (!welcome_to_files(idx)) {
       putlog(LOG_FILES, "*", "File system broken.");
       killsock(dcc[idx].sock);
       lostdcc(idx);
-    } else {
+    }
+    else {
       struct userrec *u = get_user_by_handle(userlist, dcc[idx].nick);
 
       touch_laston(u, "filearea", now);
@@ -197,7 +196,7 @@
   }
   dprintf(idx, "Negative on that, Houston.\n");
   putlog(LOG_MISC, "*", "Bad password: DCC chat [%s]%s", dcc[idx].nick,
-	 dcc[idx].host);
+         dcc[idx].host);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -219,8 +218,8 @@
 
 static void dcc_files(int idx, char *buf, int i)
 {
-  if (buf[0] &&
-      detect_dcc_flood(&dcc[idx].timeval, dcc[idx].u.file->chat, idx))
+  if (buf[0] && detect_dcc_flood(&dcc[idx].timeval, dcc[idx].u.file->chat,
+      idx))
     return;
   dcc[idx].timeval = now;
   strcpy(buf, check_tcl_filt(idx, buf));
@@ -230,17 +229,17 @@
   if (buf[0] == ',') {
     for (i = 0; i < dcc_total; i++) {
       if ((dcc[i].type->flags & DCT_MASTER) && dcc[idx].user &&
-	  (dcc[idx].user->flags & USER_MASTER) &&
-	  ((dcc[i].type == &DCC_FILES) ||
-	   (dcc[i].u.chat->channel >= 0)) &&
-	  ((i != idx) || (dcc[idx].status & STAT_ECHO)))
-	dprintf(i, "-%s- %s\n", dcc[idx].nick, &buf[1]);
+          (dcc[idx].user->flags & USER_MASTER) &&
+          ((dcc[i].type == &DCC_FILES) || (dcc[i].u.chat->channel >= 0)) &&
+          ((i != idx) || (dcc[idx].status & STAT_ECHO)))
+        dprintf(i, "-%s- %s\n", dcc[idx].nick, &buf[1]);
     }
-  } else if (got_files_cmd(idx, buf)) {
+  }
+  else if (got_files_cmd(idx, buf)) {
     dprintf(idx, "*** Ja mata!\n");
     flush_lines(idx, dcc[idx].u.file->chat);
     putlog(LOG_FILES, "*", "DCC user [%s]%s left file system", dcc[idx].nick,
-	   dcc[idx].host);
+           dcc[idx].host);
     set_user(&USERENTRY_DCCDIR, dcc[idx].user, dcc[idx].u.file->dir);
     if (dcc[idx].status & STAT_CHAT) {
       struct chat_info *ci;
@@ -252,15 +251,16 @@
       dcc[idx].status &= (~STAT_CHAT);
       dcc[idx].type = &DCC_CHAT;
       if (dcc[idx].u.chat->channel >= 0) {
-	chanout_but(-1, dcc[idx].u.chat->channel,
-		    "*** %s has returned.\n", dcc[idx].nick);
-	if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
-	  botnet_send_join_idx(idx, -1);
+        chanout_but(-1, dcc[idx].u.chat->channel,
+                    "*** %s has returned.\n", dcc[idx].nick);
+        if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
+          botnet_send_join_idx(idx, -1);
       }
-    } else {
+    }
+    else {
       dprintf(idx, "Dropping connection now.\n");
       putlog(LOG_FILES, "*", "Left files: [%s]%s/%d", dcc[idx].nick,
-	     dcc[idx].host, dcc[idx].port);
+             dcc[idx].host, dcc[idx].port);
       killsock(dcc[idx].sock);
       lostdcc(idx);
     }
@@ -280,7 +280,8 @@
     return;
   if (!(fs = get_user(&USERENTRY_FSTAT, u))) {
     dprintf(idx, "No file statistics for %s.\n", hand);
-  } else {
+  }
+  else {
     dprintf(idx, "  uploads: %4u / %6luk\n", fs->uploads, fs->upload_ks);
     dprintf(idx, "downloads: %4u / %6luk\n", fs->dnloads, fs->dnload_ks);
     if (fs->uploads)
@@ -307,9 +308,10 @@
     dprintf(idx, "There is no file transfer area.\n");
   else if (too_many_filers()) {
     dprintf(idx, "The maximum of %d %s in the file area right now.\n",
-	    dcc_users, (dcc_users != 1) ? "people are" : "person is");
+            dcc_users, (dcc_users != 1) ? "people are" : "person is");
     dprintf(idx, "Please try again later.\n");
-  } else {
+  }
+  else {
     if (!(atr & (USER_MASTER | USER_XFER)))
       dprintf(idx, "You don't have access to the file area.\n");
     else {
@@ -317,11 +319,10 @@
       dprintf(idx, "Entering file system...\n");
       if (dcc[idx].u.chat->channel >= 0) {
 
-	chanout_but(-1, dcc[idx].u.chat->channel,
-		    "*** %s has left: file system\n",
-		    dcc[idx].nick);
-	if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
-	  botnet_send_part_idx(idx, "file system");
+        chanout_but(-1, dcc[idx].u.chat->channel,
+                    "*** %s has left: file system\n", dcc[idx].nick);
+        if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
+          botnet_send_part_idx(idx, "file system");
       }
       ci = dcc[idx].u.chat;
       dcc[idx].u.file = get_data_ptr(sizeof(struct file_info));
@@ -330,28 +331,27 @@
       dcc[idx].type = &DCC_FILES;
       dcc[idx].status |= STAT_CHAT;
       if (!welcome_to_files(idx)) {
-	struct chat_info *ci = dcc[idx].u.file->chat;
+        struct chat_info *ci = dcc[idx].u.file->chat;
 
-	my_free(dcc[idx].u.file);
-	dcc[idx].u.chat = ci;
-	dcc[idx].type = &DCC_CHAT;
-	putlog(LOG_FILES, "*", "File system broken.");
-	if (dcc[idx].u.chat->channel >= 0) {
-	  chanout_but(-1, dcc[idx].u.chat->channel,
-		      "*** %s has returned.\n",
-		      dcc[idx].nick);
-	  if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
-	    botnet_send_join_idx(idx, -1);
-	}
-      } else
-	touch_laston(u, "filearea", now);
+        my_free(dcc[idx].u.file);
+        dcc[idx].u.chat = ci;
+        dcc[idx].type = &DCC_CHAT;
+        putlog(LOG_FILES, "*", "File system broken.");
+        if (dcc[idx].u.chat->channel >= 0) {
+          chanout_but(-1, dcc[idx].u.chat->channel,
+                      "*** %s has returned.\n", dcc[idx].nick);
+          if (dcc[idx].u.chat->channel < GLOBAL_CHANS)
+            botnet_send_join_idx(idx, -1);
+        }
+      }
+      else
+        touch_laston(u, "filearea", now);
     }
   }
   return 0;
 }
 
-static int _dcc_send(int idx, char *filename, char *nick, char *dir,
-		     int resend)
+static int _dcc_send(int idx, char *filename, char *nick, char *dir, int resend)
 {
   int x;
   char *nfn, *buf = NULL;
@@ -365,31 +365,32 @@
   if (x == DCCSEND_FULL) {
     dprintf(idx, "Sorry, too many DCC connections.  (try again later)\n");
     putlog(LOG_FILES, "*", "DCC connections full: %sGET %s [%s]", filename,
-	   resend ? "RE" : "", dcc[idx].nick);
+           resend ? "RE" : "", dcc[idx].nick);
     return 0;
   }
   if (x == DCCSEND_NOSOCK) {
     if (reserved_port_min) {
       dprintf(idx, "All my DCC SEND ports are in use.  Try later.\n");
       putlog(LOG_FILES, "*", "DCC port in use (can't open): %sGET %s [%s]",
-	     resend ? "RE" : "", filename, dcc[idx].nick);
-    } else {
+             resend ? "RE" : "", filename, dcc[idx].nick);
+    }
+    else {
       dprintf(idx, "Unable to listen at a socket.\n");
       putlog(LOG_FILES, "*", "DCC socket error: %sGET %s [%s]", filename,
-	     resend ? "RE" : "", dcc[idx].nick);
+             resend ? "RE" : "", dcc[idx].nick);
     }
     return 0;
   }
   if (x == DCCSEND_BADFN) {
     dprintf(idx, "File not found ?\n");
     putlog(LOG_FILES, "*", "DCC file not found: %sGET %s [%s]", filename,
-	   resend ? "RE" : "", dcc[idx].nick);
+           resend ? "RE" : "", dcc[idx].nick);
     return 0;
   }
   if (x == DCCSEND_FEMPTY) {
     dprintf(idx, "The file is empty.  Aborted transfer.\n");
     putlog(LOG_FILES, "*", "DCC file is empty: %s [%s]", filename,
-	   dcc[idx].nick);
+           dcc[idx].nick);
     return 0;
   }
   nfn = strrchr(dir, '/');
@@ -410,7 +411,7 @@
 
   if (egg_strcasecmp(nick, dcc[idx].nick))
     dprintf(DP_HELP, "NOTICE %s :Here is %s file from %s %s...\n", nick,
-	    resend ? "the" : "a", dcc[idx].nick, resend ? "again " : "");
+            resend ? "the" : "a", dcc[idx].nick, resend ? "again " : "");
   dprintf(idx, "%sending: %s to %s\n", resend ? "Res" : "S", nfn, nick);
   my_free(buf);
   return 1;
@@ -427,19 +428,20 @@
   if (dccdir[0] == 0) {
     dprintf(idx, "DCC file transfers not supported.\n");
     putlog(LOG_FILES, "*", "Refused dcc %sget %s from [%s]", resend ? "re" : "",
-	   fn, dcc[idx].nick);
+           fn, dcc[idx].nick);
     return 0;
   }
   if (strchr(fn, '/') != NULL) {
     dprintf(idx, "Filename cannot have '/' in it...\n");
     putlog(LOG_FILES, "*", "Refused dcc %sget %s from [%s]", resend ? "re" : "",
-	   fn, dcc[idx].nick);
+           fn, dcc[idx].nick);
     return 0;
   }
   if (dir[0]) {
     s = nmalloc(strlen(dccdir) + strlen(dir) + strlen(fn) + 2);
     sprintf(s, "%s%s/%s", dccdir, dir, fn);
-  } else {
+  }
+  else {
     s = nmalloc(strlen(dccdir) + strlen(fn) + 1);
     sprintf(s, "%s%s", dccdir, fn);
   }
@@ -477,13 +479,14 @@
     if (copyfile(s, s1) != 0) {
       dprintf(idx, "Can't make temporary copy of file!\n");
       putlog(LOG_FILES | LOG_MISC, "*",
-	     "Refused dcc %sget %s: copy to %s FAILED!",
-	     resend ? "re" : "", fn, tempdir);
+             "Refused dcc %sget %s: copy to %s FAILED!",
+             resend ? "re" : "", fn, tempdir);
       my_free(s);
       my_free(s1);
       return 0;
     }
-  } else {
+  }
+  else {
     s1 = nrealloc(s1, strlen(dccdir) + strlen(dir) + strlen(fn) + 2);
     sprintf(s1, "%s%s%s%s", dccdir, dir, dir[0] ? "/" : "", fn);
   }
@@ -503,6 +506,7 @@
   Function F = (Function) cd;
 
   BADARGS(4, 4, " hand idx param");
+  
   idx = findanyidx(atoi(argv[2]));
   if (idx < 0 && dcc[idx].type != &DCC_FILES) {
     Tcl_AppendResult(irp, "invalid idx", NULL);
@@ -512,7 +516,7 @@
     Tcl_AppendResult(irp, "break", NULL);
     return TCL_OK;
   }
-  (F)(idx, argv[3]);
+  (F) (idx, argv[3]);
   Tcl_ResetResult(irp);
   return TCL_OK;
 }
@@ -521,7 +525,7 @@
 {
   dprintf(i, "Timeout.\n");
   putlog(LOG_MISC, "*", "Password timeout on dcc chat: [%s]%s", dcc[i].nick,
-	 dcc[i].host);
+         dcc[i].host);
   killsock(dcc[i].sock);
   lostdcc(i);
 }
@@ -529,11 +533,11 @@
 static void disp_dcc_files(int idx, char *buf)
 {
   sprintf(buf, "file  flags: %c%c%c%c%c",
-	  dcc[idx].status & STAT_CHAT ? 'C' : 'c',
-	  dcc[idx].status & STAT_PARTY ? 'P' : 'p',
-	  dcc[idx].status & STAT_TELNET ? 'T' : 't',
-	  dcc[idx].status & STAT_ECHO ? 'E' : 'e',
-	  dcc[idx].status & STAT_PAGE ? 'P' : 'p');
+          dcc[idx].status & STAT_CHAT ? 'C' : 'c',
+          dcc[idx].status & STAT_PARTY ? 'P' : 'p',
+          dcc[idx].status & STAT_TELNET ? 'T' : 't',
+          dcc[idx].status & STAT_ECHO ? 'E' : 'e',
+          dcc[idx].status & STAT_PAGE ? 'P' : 'p');
 }
 
 static void disp_dcc_files_pass(int idx, char *buf)
@@ -554,7 +558,7 @@
 {
   dcc[idx].u.file->chat->con_flags = 0;
   putlog(LOG_MISC, "*", "Lost dcc connection to %s (%s/%d)", dcc[idx].nick,
-	 dcc[idx].host, dcc[idx].port);
+         dcc[idx].host, dcc[idx].port);
   killsock(dcc[idx].sock);
   lostdcc(idx);
 }
@@ -579,30 +583,26 @@
     tputs(dcc[idx].sock, buf, strlen(buf));
 }
 
-static cmd_t mydcc[] =
-{
-  {"files",		"-",	cmd_files,		NULL},
-  {NULL,		NULL,	NULL,			NULL}
+static cmd_t mydcc[] = {
+  {"files", "-",  cmd_files, NULL},
+  {NULL,    NULL, NULL,      NULL}
 };
 
-static tcl_strings mystrings[] =
-{
-  {"files-path",	dccdir,		120,	STR_DIR | STR_PROTECT},
-  {"incoming-path",	dccin,		120,	STR_DIR | STR_PROTECT},
-  {"filedb-path",	filedb_path,	120,	STR_DIR | STR_PROTECT},
-  {NULL,		NULL,		0,	0}
+static tcl_strings mystrings[] = {
+  {"files-path",    dccdir,      120, STR_DIR | STR_PROTECT},
+  {"incoming-path", dccin,       120, STR_DIR | STR_PROTECT},
+  {"filedb-path",   filedb_path, 120, STR_DIR | STR_PROTECT},
+  {NULL,            NULL,        0,                       0}
 };
 
-static tcl_ints myints[] =
-{
-  {"max-filesize",	&dcc_maxsize},
-  {"max-file-users",	&dcc_users},
-  {"upload-to-pwd",	&upload_to_cd},
-  {NULL,		NULL}
+static tcl_ints myints[] = {
+  {"max-filesize",    &dcc_maxsize},
+  {"max-file-users",    &dcc_users},
+  {"upload-to-pwd",  &upload_to_cd},
+  {NULL,                      NULL}
 };
 
-static struct dcc_table DCC_FILES_PASS =
-{
+static struct dcc_table DCC_FILES_PASS = {
   "FILES_PASS",
   0,
   eof_dcc_files,
@@ -621,7 +621,7 @@
 /* Received a ctcp-dcc.
  */
 static void filesys_dcc_send(char *nick, char *from, struct userrec *u,
-			     char *text)
+                             char *text)
 {
   char *param, *ip, *prt, *buf = NULL, *msg;
   int atr = u ? u->flags : 0, i;
@@ -632,51 +632,55 @@
   param = newsplit(&msg);
   if (!(atr & USER_XFER)) {
     putlog(LOG_FILES, "*", "Refused DCC SEND %s (no access): %s!%s", param,
-	   nick, from);
-    if (!quiet_reject) dprintf(DP_HELP, "NOTICE %s :No access\n", nick);
-  } else if (!dccin[0] && !upload_to_cd) {
+           nick, from);
+    if (!quiet_reject)
+      dprintf(DP_HELP, "NOTICE %s :No access\n", nick);
+  }
+  else if (!dccin[0] && !upload_to_cd) {
     dprintf(DP_HELP, "NOTICE %s :DCC file transfers not supported.\n", nick);
-    putlog(LOG_FILES, "*", "Refused dcc send %s from %s!%s", param, nick,
-           from);
-  } else if (strchr(param, '/')) {
+    putlog(LOG_FILES, "*", "Refused dcc send %s from %s!%s", param, nick, from);
+  }
+  else if (strchr(param, '/')) {
     dprintf(DP_HELP, "NOTICE %s :Filename cannot have '/' in it...\n", nick);
-    putlog(LOG_FILES, "*", "Refused dcc send %s from %s!%s", param, nick,
-           from);
-  } else {
+    putlog(LOG_FILES, "*", "Refused dcc send %s from %s!%s", param, nick, from);
+  }
+  else {
     ip = newsplit(&msg);
     prt = newsplit(&msg);
     if (atoi(prt) < 1024 || atoi(prt) > 65535) {
       /* Invalid port */
       dprintf(DP_HELP, "NOTICE %s :%s (invalid port)\n", nick,
-	      DCC_CONNECTFAILED1);
+              DCC_CONNECTFAILED1);
       putlog(LOG_FILES, "*", "Refused dcc send %s (%s): invalid port", param,
-	     nick);
-    } else if (atoi(msg) == 0) {
+             nick);
+    }
+    else if (atoi(msg) == 0) {
       dprintf(DP_HELP, "NOTICE %s :Sorry, file size info must be included.\n",
-	      nick);
+              nick);
       putlog(LOG_FILES, "*", "Refused dcc send %s (%s): no file size",
-	     param, nick);
-    } else if (dcc_maxsize && (atoi(msg) > (dcc_maxsize * 1024))) {
+             param, nick);
+    }
+    else if (dcc_maxsize && (atoi(msg) > (dcc_maxsize * 1024))) {
       dprintf(DP_HELP, "NOTICE %s :Sorry, file too large.\n", nick);
       putlog(LOG_FILES, "*", "Refused dcc send %s (%s): file too large", param,
-	     nick);
-    } else {
+             nick);
+    }
+    else {
       /* This looks like a good place for a sanity check. */
       if (!sanitycheck_dcc(nick, from, ip, prt)) {
-	my_free(buf);
-	return;
+        my_free(buf);
+        return;
       }
       i = new_dcc(&DCC_DNSWAIT, sizeof(struct dns_info));
       if (i < 0) {
-	dprintf(DP_HELP, "NOTICE %s :Sorry, too many DCC connections.\n",
-		nick);
-	putlog(LOG_MISC, "*", "DCC connections full: SEND %s (%s!%s)", param,
+        dprintf(DP_HELP, "NOTICE %s :Sorry, too many DCC connections.\n", nick);
+        putlog(LOG_MISC, "*", "DCC connections full: SEND %s (%s!%s)", param,
                nick, from);
-	return;
+        return;
       }
       dcc[i].addr = my_atoul(ip);
       dcc[i].port = atoi(prt);
-      dcc[i].sock = (-1);
+      dcc[i].sock = -1;
       dcc[i].user = u;
       strcpy(dcc[i].nick, nick);
       strcpy(dcc[i].host, from);
@@ -759,32 +763,34 @@
       sprintf(dcc[i].u.xfer->dir, "%s%s/", dccdir, p);
     else
       sprintf(dcc[i].u.xfer->dir, "%s", dccdir);
-  } else
+  }
+  else
     strcpy(dcc[i].u.xfer->dir, dccin);
   dcc[i].u.xfer->length = len;
   s1 = nmalloc(strlen(dcc[i].u.xfer->dir) +
-	       strlen(dcc[i].u.xfer->origname) + 1);
+               strlen(dcc[i].u.xfer->origname) + 1);
   sprintf(s1, "%s%s", dcc[i].u.xfer->dir, dcc[i].u.xfer->origname);
-  
+
   if (file_readable(s1)) {
     dprintf(DP_HELP, "NOTICE %s :File `%s' already exists.\n", dcc[i].nick,
             dcc[i].u.xfer->origname);
     lostdcc(i);
     my_free(s1);
-  } else {
+  }
+  else {
     my_free(s1);
     /* Check for dcc-sends in process with the same filename */
     for (j = 0; j < dcc_total; j++)
       if (j != i) {
         if ((dcc[j].type->flags & (DCT_FILETRAN | DCT_FILESEND))
-	    == (DCT_FILETRAN | DCT_FILESEND)) {
-	  if (!strcmp(dcc[i].u.xfer->origname, dcc[j].u.xfer->origname)) {
-	    dprintf(DP_HELP, "NOTICE %s :File `%s' is already being sent.\n",
-		    dcc[i].nick, dcc[i].u.xfer->origname);
-	    lostdcc(i);
-	    return;
-	  }
-	}
+            == (DCT_FILETRAN | DCT_FILESEND)) {
+          if (!strcmp(dcc[i].u.xfer->origname, dcc[j].u.xfer->origname)) {
+            dprintf(DP_HELP, "NOTICE %s :File `%s' is already being sent.\n",
+                    dcc[i].nick, dcc[i].u.xfer->origname);
+            lostdcc(i);
+            return;
+          }
+        }
       }
     /* Put uploads in /tmp first */
     s1 = nmalloc(strlen(tempdir) + strlen(dcc[i].u.xfer->filename) + 1);
@@ -793,14 +799,15 @@
     my_free(s1);
     if (dcc[i].u.xfer->f == NULL) {
       dprintf(DP_HELP,
-	      "NOTICE %s :Can't create file `%s' (temp dir error)\n",
-	      dcc[i].nick, dcc[i].u.xfer->origname);
+              "NOTICE %s :Can't create file `%s' (temp dir error)\n",
+              dcc[i].nick, dcc[i].u.xfer->origname);
       lostdcc(i);
-    } else {
+    }
+    else {
       dcc[i].timeval = now;
       dcc[i].sock = getsock(SOCK_BINARY);
       if (dcc[i].sock < 0 || open_telnet_dcc(dcc[i].sock, ip, prt) < 0)
-	dcc[i].type->eof(i);
+        dcc[i].type->eof(i);
     }
   }
 }
@@ -808,12 +815,12 @@
 /* This only handles CHAT requests, otherwise it's handled in transfer.
  */
 static int filesys_DCC_CHAT(char *nick, char *from, char *handle,
-			    char *object, char *keyword, char *text)
+                            char *object, char *keyword, char *text)
 {
   char *param, *ip, *prt, buf[512], *msg = buf;
   int i, sock;
   struct userrec *u = get_user_by_handle(userlist, handle);
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
 
   if (egg_strcasecmp(object, botname))
     return 0;
@@ -828,39 +835,44 @@
   param = newsplit(&msg);
   if (dcc_total == max_dcc) {
     putlog(LOG_MISC, "*", DCC_TOOMANYDCCS2, "CHAT(file)", param, nick, from);
-  } else if (glob_party(fr) || (!require_p && chan_op(fr)))
-    return 0;			/* Allow ctcp.so to pick up the chat */
+  }
+  else if (glob_party(fr) || (!require_p && chan_op(fr)))
+    return 0;                   /* Allow ctcp.so to pick up the chat */
   else if (!glob_xfer(fr)) {
     if (!quiet_reject)
       dprintf(DP_HELP, "NOTICE %s :%s\n", nick, DCC_REFUSED2);
     putlog(LOG_MISC, "*", "%s: %s!%s", DCC_REFUSED, nick, from);
-  } else if (u_pass_match(u, "-")) {
+  }
+  else if (u_pass_match(u, "-")) {
     if (!quiet_reject)
       dprintf(DP_HELP, "NOTICE %s :%s\n", nick, DCC_REFUSED3);
     putlog(LOG_MISC, "*", "%s: %s!%s", DCC_REFUSED4, nick, from);
-  } else if (!dccdir[0]) {
+  }
+  else if (!dccdir[0]) {
     putlog(LOG_MISC, "*", "%s: %s!%s", DCC_REFUSED5, nick, from);
-  } else {
+  }
+  else {
     ip = newsplit(&msg);
     prt = newsplit(&msg);
     sock = getsock(0);
     if (sock < 0 || open_telnet_dcc(sock, ip, prt) < 0) {
       neterror(buf);
       if (!quiet_reject)
-        dprintf(DP_HELP, "NOTICE %s :%s (%s)\n", nick,
-	        DCC_CONNECTFAILED1, buf);
+        dprintf(DP_HELP, "NOTICE %s :%s (%s)\n", nick, DCC_CONNECTFAILED1, buf);
       putlog(LOG_MISC, "*", "%s: CHAT(file) (%s!%s)", DCC_CONNECTFAILED2, nick,
              from);
       putlog(LOG_MISC, "*", "    (%s)", buf);
       killsock(sock);
-    } else if (atoi(prt) < 1024 || atoi(prt) > 65535) {
+    }
+    else if (atoi(prt) < 1024 || atoi(prt) > 65535) {
       /* Invalid port */
       if (!quiet_reject)
         dprintf(DP_HELP, "NOTICE %s :%s (invalid port)\n", nick,
-	        DCC_CONNECTFAILED1);
+                DCC_CONNECTFAILED1);
       putlog(LOG_FILES, "*", "%s: %s!%s", DCC_REFUSED7, nick, from);
 
-    } else {
+    }
+    else {
       i = new_dcc(&DCC_FILES_PASS, sizeof(struct file_info));
       dcc[i].addr = my_atoul(ip);
       dcc[i].port = atoi(prt);
@@ -879,10 +891,9 @@
   return 1;
 }
 
-static cmd_t myctcp[] =
-{
-  {"DCC",	"",	filesys_DCC_CHAT,		"files:DCC"},
-  {NULL,	NULL,	NULL,				NULL}
+static cmd_t myctcp[] = {
+  {"DCC", "",   filesys_DCC_CHAT, "files:DCC"},
+  {NULL,  NULL, NULL,                    NULL}
 };
 
 static void init_server_ctcps(char *module)
@@ -893,10 +904,9 @@
     add_builtins(H_ctcp, myctcp);
 }
 
-static cmd_t myload[] =
-{
-  {"server",	"",	(Function) init_server_ctcps,	"filesys:server"},
-  {NULL,	NULL,	NULL,				NULL}
+static cmd_t myload[] = {
+  {"server", "",   (Function) init_server_ctcps, "filesys:server"},
+  {NULL,     NULL, NULL,                                     NULL}
 };
 
 static int filesys_expmem()
@@ -910,16 +920,17 @@
     if (dccdir[0]) {
       dprintf(idx, "    DCC file path: %s", dccdir);
       if (upload_to_cd)
-	dprintf(idx, "\n        incoming: (go to the current dir)\n");
+        dprintf(idx, "\n        incoming: (go to the current dir)\n");
       else if (dccin[0])
-	dprintf(idx, "\n        incoming: %s\n", dccin);
+        dprintf(idx, "\n        incoming: %s\n", dccin);
       else
-	dprintf(idx, "    (no uploads)\n");
+        dprintf(idx, "    (no uploads)\n");
       if (dcc_users)
-	dprintf(idx, "        max users is %d\n", dcc_users);
+        dprintf(idx, "        max users is %d\n", dcc_users);
       if ((upload_to_cd) || (dccin[0]))
-	dprintf(idx, "    DCC max file size: %dk\n", dcc_maxsize);
-    } else
+        dprintf(idx, "    DCC max file size: %dk\n", dcc_maxsize);
+    }
+    else
       dprintf(idx, "  (Filesystem module loaded, but no active dcc path.)\n");
   }
 }
@@ -929,15 +940,17 @@
   int i;
   p_tcl_bind_list H_ctcp;
 
-  putlog(LOG_MISC, "*", "Unloading filesystem; killing all filesystem connections.");
+  putlog(LOG_MISC, "*",
+         "Unloading filesystem; killing all filesystem connections.");
   for (i = 0; i < dcc_total; i++)
     if (dcc[i].type == &DCC_FILES) {
       dprintf(i, DCC_BOOTED1);
       dprintf(i,
-	 "You have been booted from the filesystem, module unloaded.\n");
+              "You have been booted from the filesystem, module unloaded.\n");
       killsock(dcc[i].sock);
       lostdcc(i);
-    } else if (dcc[i].type == &DCC_FILES_PASS) {
+    }
+    else if (dcc[i].type == &DCC_FILES_PASS) {
       killsock(dcc[i].sock);
       lostdcc(i);
     }
@@ -959,8 +972,7 @@
 
 EXPORT_SCOPE char *filesys_start();
 
-static Function filesys_table[] =
-{
+static Function filesys_table[] = {
   /* 0 - 3 */
   (Function) filesys_start,
   (Function) filesys_close,
@@ -975,7 +987,7 @@
   (Function) & H_fil,
 };
 
-char *filesys_start(Function * global_funcs)
+char *filesys_start(Function *global_funcs)
 {
   global = global_funcs;
 
@@ -998,9 +1010,9 @@
   add_help_reference("filesys.help");
   init_server_ctcps(0);
   my_memcpy(&USERENTRY_DCCDIR, &USERENTRY_INFO,
-	    sizeof(struct user_entry_type) - sizeof(char *));
+            sizeof(struct user_entry_type) - sizeof(char *));
 
-  USERENTRY_DCCDIR.got_share = 0;	/* We dont want it shared tho */
+  USERENTRY_DCCDIR.got_share = 0;       /* We dont want it shared tho */
   add_entry_type(&USERENTRY_DCCDIR);
   DCC_FILES_PASS.timeout_val = &password_timeout;
   add_lang_section("filesys");
Index: eggdrop1.6/src/mod/filesys.mod/filesys.h
diff -u eggdrop1.6/src/mod/filesys.mod/filesys.h:1.11 eggdrop1.6/src/mod/filesys.mod/filesys.h:1.12
--- eggdrop1.6/src/mod/filesys.mod/filesys.h:1.11	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/filesys.mod/filesys.h	Tue Jan 28 00:37:26 2003
@@ -2,7 +2,7 @@
  * filesysc.h -- part of filesys.mod
  *   header file for the filesys2 eggdrop module
  *
- * $Id: filesys.h,v 1.11 2002/12/24 02:30:07 wcc Exp $
+ * $Id: filesys.h,v 1.12 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -57,6 +57,6 @@
 
 #else
 #define H_fil (*(p_tcl_hash_list *)(filesys_funcs[8]))
-#endif				/* MAKING_FILESYS */
+#endif /* MAKING_FILESYS */
 
-#endif				/* _EGG_MOD_FILESYS_FILESYS_H */
+#endif /* _EGG_MOD_FILESYS_FILESYS_H */
Index: eggdrop1.6/src/mod/filesys.mod/tclfiles.c
diff -u eggdrop1.6/src/mod/filesys.mod/tclfiles.c:1.17 eggdrop1.6/src/mod/filesys.mod/tclfiles.c:1.18
--- eggdrop1.6/src/mod/filesys.mod/tclfiles.c:1.17	Mon Dec 23 20:30:07 2002
+++ eggdrop1.6/src/mod/filesys.mod/tclfiles.c	Tue Jan 28 00:37:26 2003
@@ -2,7 +2,7 @@
  * tclfiles.c -- part of filesys.mod
  *   Tcl stubs for file system commands moved here to support modules
  *
- * $Id: tclfiles.c,v 1.17 2002/12/24 02:30:07 wcc Exp $
+ * $Id: tclfiles.c,v 1.18 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -28,12 +28,14 @@
   char *s = NULL;
 
   BADARGS(3, 3, " dir file");
+  
   filedb_getdesc(argv[1], argv[2], &s);
   if (s) {
     Tcl_AppendResult(irp, s, NULL);
     my_free(s);
     return TCL_OK;
-  } else {
+  }
+  else {
     Tcl_AppendResult(irp, "filedb access failed", NULL);
     return TCL_ERROR;
   }
@@ -42,6 +44,7 @@
 static int tcl_setdesc STDVAR
 {
   BADARGS(4, 4, " dir file desc");
+
   filedb_setdesc(argv[1], argv[2], argv[3]);
   return TCL_OK;
 }
@@ -51,12 +54,14 @@
   char *s = NULL;
 
   BADARGS(3, 3, " dir file");
+  
   filedb_getowner(argv[1], argv[2], &s);
   if (s) {
     Tcl_AppendResult(irp, s, NULL);
     my_free(s);
     return TCL_OK;
-  } else {
+  }
+  else {
     Tcl_AppendResult(irp, "filedb access failed", NULL);
     return TCL_ERROR;
   }
@@ -65,6 +70,7 @@
 static int tcl_setowner STDVAR
 {
   BADARGS(4, 4, " dir file owner");
+
   filedb_setowner(argv[1], argv[2], argv[3]);
   return TCL_OK;
 }
@@ -75,6 +81,7 @@
   char s[10];
 
   BADARGS(3, 3, " dir file");
+
   i = filedb_getgots(argv[1], argv[2]);
   sprintf(s, "%d", i);
   Tcl_AppendResult(irp, s, NULL);
@@ -84,6 +91,7 @@
 static int tcl_setlink STDVAR
 {
   BADARGS(4, 4, " dir file link");
+
   filedb_setlink(argv[1], argv[2], argv[3]);
   return TCL_OK;
 }
@@ -93,11 +101,13 @@
   char *s = NULL;
 
   BADARGS(3, 3, " dir file");
+  
   filedb_getlink(argv[1], argv[2], &s);
   if (s) {
     Tcl_AppendResult(irp, s, NULL);
     return TCL_OK;
-  } else {
+  }
+  else {
     Tcl_AppendResult(irp, "filedb access failed", NULL);
     return TCL_ERROR;
   }
@@ -108,6 +118,7 @@
   int i, idx;
 
   BADARGS(3, 3, " idx dir");
+  
   i = atoi(argv[1]);
   idx = findanyidx(i);
   if ((idx < 0) || (dcc[idx].type != &DCC_FILES)) {
@@ -124,6 +135,7 @@
   int i, idx;
 
   BADARGS(2, 2, " idx");
+  
   i = atoi(argv[1]);
   idx = findanyidx(i);
   if ((idx < 0) || (dcc[idx].type != &DCC_FILES)) {
@@ -138,6 +150,7 @@
 static int tcl_getfiles STDVAR
 {
   BADARGS(2, 2, " dir");
+  
   filedb_getfiles(irp, argv[1]);
   return TCL_OK;
 }
@@ -145,6 +158,7 @@
 static int tcl_getdirs STDVAR
 {
   BADARGS(2, 2, " dir");
+  
   filedb_getdirs(irp, argv[1]);
   return TCL_OK;
 }
@@ -152,6 +166,7 @@
 static int tcl_hide STDVAR
 {
   BADARGS(3, 3, " dir file");
+  
   filedb_change(argv[1], argv[2], FILEDB_HIDE);
   return TCL_OK;
 }
@@ -159,6 +174,7 @@
 static int tcl_unhide STDVAR
 {
   BADARGS(3, 3, " dir file");
+  
   filedb_change(argv[1], argv[2], FILEDB_UNHIDE);
   return TCL_OK;
 }
@@ -166,6 +182,7 @@
 static int tcl_share STDVAR
 {
   BADARGS(3, 3, " dir file");
+  
   filedb_change(argv[1], argv[2], FILEDB_SHARE);
   return TCL_OK;
 }
@@ -173,6 +190,7 @@
 static int tcl_unshare STDVAR
 {
   BADARGS(3, 3, " dir file");
+  
   filedb_change(argv[1], argv[2], FILEDB_UNSHARE);
   return TCL_OK;
 }
@@ -184,14 +202,16 @@
   char *s = NULL, *p, *d;
 
   BADARGS(3, 4, " dir ?flags ?channel??");
+ 
   malloc_strcpy(s, argv[1]);
   if (s[strlen(s) - 1] == '/')
-     s[strlen(s) - 1] = 0;
+    s[strlen(s) - 1] = 0;
   p = strrchr(s, '/');
   if (p == NULL) {
     p = s;
     d = "";
-  } else {
+  }
+  else {
     *p = 0;
     p++;
     d = s;
@@ -199,7 +219,7 @@
 
   fdb = filedb_open(d, 0);
   if (!fdb) {
-    Tcl_AppendResult(irp, "-3", NULL);		/* filedb access failed */
+    Tcl_AppendResult(irp, "-3", NULL);  /* filedb access failed */
     my_free(s);
     return TCL_OK;
   }
@@ -208,23 +228,23 @@
   my_free(s);
 
   if (!fdbe) {
-    Tcl_AppendResult(irp, "-1", NULL);	/* No such dir */
+    Tcl_AppendResult(irp, "-1", NULL);  /* No such dir */
     return TCL_OK;
   }
   if (!(fdbe->stat & FILE_DIR)) {
-    Tcl_AppendResult(irp, "-2", NULL);	/* Not a dir */
+    Tcl_AppendResult(irp, "-2", NULL);  /* Not a dir */
     return TCL_OK;
   }
   if (argc >= 3) {
-    struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+    struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
     char f[100];
 
     break_down_flags(argv[2], &fr, NULL);
     build_flags(f, &fr, NULL);
     malloc_strcpy(fdbe->flags_req, f);
-  } else {
-    my_free(fdbe->flags_req);
   }
+  else
+    my_free(fdbe->flags_req);
   if (argc == 4)
     malloc_strcpy(fdbe->chan, argv[3]);
 
@@ -241,14 +261,16 @@
   char *s = NULL, *p, *d;
 
   BADARGS(2, 2, " dir");
+ 
   malloc_strcpy(s, argv[1]);
   if (s[strlen(s) - 1] == '/')
-     s[strlen(s) - 1] = 0;
+    s[strlen(s) - 1] = 0;
   p = strrchr(s, '/');
   if (p == NULL) {
     p = s;
     d = "";
-  } else {
+  }
+  else {
     *p = 0;
     p++;
     d = s;
@@ -256,9 +278,7 @@
 
   fdbe = filedb_getentry(d, p);
   /* Directory doesn't exist? */
-  if (!fdbe ||
-      /* Not a directory? */
-      !(fdbe->stat & FILE_DIR)) {
+  if (!fdbe || !(fdbe->stat & FILE_DIR)) {
     Tcl_AppendResult(irp, "", NULL);
     my_free(s);
     free_fdbe(&fdbe);
@@ -268,7 +288,8 @@
     malloc_strcpy(s, fdbe->flags_req);
     if (s[0] == '-')
       s[0] = 0;
-  } else
+  }
+  else
     s[0] = 0;
   Tcl_AppendElement(irp, s);
   Tcl_AppendElement(irp, fdbe->chan);
@@ -282,17 +303,19 @@
   FILE *fdb;
   filedb_entry *fdbe;
   char *s = NULL, *t, *d, *p;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   BADARGS(2, 4, " dir ?required-flags ?channel??");
+
   malloc_strcpy(s, argv[1]);
   if (s[strlen(s) - 1] == '/')
-     s[strlen(s) - 1] = 0;
+    s[strlen(s) - 1] = 0;
   p = strrchr(s, '/');
   if (p == NULL) {
     p = s;
     d = "";
-  } else {
+  }
+  else {
     *p = 0;
     p++;
     d = s;
@@ -300,7 +323,7 @@
 
   fdb = filedb_open(d, 0);
   if (!fdb) {
-    Tcl_AppendResult(irp, "-3", NULL);		/* filedb access failed */
+    Tcl_AppendResult(irp, "-3", NULL);  /* filedb access failed */
     my_free(s);
     return TCL_OK;
   }
@@ -321,7 +344,8 @@
     fdbe->stat = FILE_DIR;
     malloc_strcpy(fdbe->filename, argv[1]);
     fdbe->uploaded = now;
-  } else if (!(fdbe->stat & FILE_DIR)) {
+  }
+  else if (!(fdbe->stat & FILE_DIR)) {
     Tcl_AppendResult(irp, "2", NULL);
     free_fdbe(&fdbe);
     my_free(s);
@@ -334,19 +358,20 @@
     break_down_flags(argv[2], &fr, NULL);
     build_flags(f, &fr, NULL);
     malloc_strcpy(fdbe->flags_req, f);
-  } else if (fdbe->flags_req) {
+  }
+  else if (fdbe->flags_req) {
     my_free(fdbe->flags_req);
   }
   if (argc == 4) {
     malloc_strcpy(fdbe->chan, argv[3]);
-  } else
-    if (fdbe->chan)
-      my_free(fdbe->chan);
+  }
+  else if (fdbe->chan)
+    my_free(fdbe->chan);
 
   if (fdbe->pos)
-      filedb_addfile(fdb, fdbe);
+    filedb_addfile(fdb, fdbe);
   else
-      filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
+    filedb_updatefile(fdb, fdbe->pos, fdbe, UPDATE_ALL);
   filedb_close(fdb);
   Tcl_AppendResult(irp, "0", NULL);
   return TCL_OK;
@@ -359,14 +384,16 @@
   char *s = NULL, *t, *d, *p;
 
   BADARGS(2, 2, " dir");
+  
   malloc_strcpy(s, argv[1]);
   if (s[strlen(s) - 1] == '/')
-     s[strlen(s) - 1] = 0;
+    s[strlen(s) - 1] = 0;
   p = strrchr(s, '/');
   if (p == NULL) {
     p = s;
     d = "";
-  } else {
+  }
+  else {
     *p = 0;
     p++;
     d = s;
@@ -417,7 +444,7 @@
   return TCL_OK;
 }
 
-static int tcl_mv_cp(Tcl_Interp * irp, int argc, char **argv, int copy)
+static int tcl_mv_cp(Tcl_Interp *irp, int argc, char **argv, int copy)
 {
   char *p, *fn = NULL, *oldpath = NULL, *s = NULL, *s1 = NULL;
   char *newfn = NULL, *newpath = NULL;
@@ -435,13 +462,14 @@
     strcpy(fn, p + 1);
     if (!resolve_dir("/", s, &oldpath, -1)) {
       /* Tcl can do * anything */
-      Tcl_AppendResult(irp, "-1", NULL);	/* Invalid source */
+      Tcl_AppendResult(irp, "-1", NULL);        /* Invalid source */
       my_free(fn);
       my_free(oldpath);
       return TCL_OK;
     }
     my_free(s);
-  } else
+  }
+  else
     malloc_strcpy(oldpath, "/");
   malloc_strcpy(s, argv[2]);
   if (!resolve_dir("/", s, &newpath, -1)) {
@@ -450,30 +478,31 @@
     if (!p) {
       malloc_strcpy(newfn, s);
       s[0] = 0;
-    } else {
+    }
+    else {
       *p = 0;
       malloc_strcpy(newfn, p + 1);
     }
     my_free(newpath);
     if (!resolve_dir("/", s, &newpath, -1)) {
-      Tcl_AppendResult(irp, "-2", NULL);	/* Invalid desto */
+      Tcl_AppendResult(irp, "-2", NULL);        /* Invalid desto */
       my_free(newpath);
       my_free(s);
       my_free(newfn);
       return TCL_OK;
     }
-  } else
+  }
+  else
     malloc_strcpy(newfn, "");
   my_free(s);
 
   /* Stupidness checks */
-  if ((!strcmp(oldpath, newpath)) &&
-      (!newfn[0] || !strcmp(newfn, fn))) {
+  if ((!strcmp(oldpath, newpath)) && (!newfn[0] || !strcmp(newfn, fn))) {
     my_free(newfn);
     my_free(fn);
     my_free(oldpath);
     my_free(newpath);
-    Tcl_AppendResult(irp, "-3", NULL);	/* Stupid copy to self */
+    Tcl_AppendResult(irp, "-3", NULL);  /* Stupid copy to self */
     return TCL_OK;
   }
   /* Be aware of 'cp * this.file' possibility: ONLY COPY FIRST ONE */
@@ -496,7 +525,7 @@
       filedb_close(fdb_old);
     else if (fdb_new)
       filedb_close(fdb_new);
-    Tcl_AppendResult(irp, "-5", NULL);	/* DB access failed */
+    Tcl_AppendResult(irp, "-5", NULL);  /* DB access failed */
     return -1;
   }
 
@@ -518,61 +547,59 @@
     skip_this = 0;
     if (!(fdbe_old->stat & (FILE_HIDDEN | FILE_DIR))) {
       s = nmalloc(strlen(dccdir) + strlen(oldpath)
-		  + strlen(fdbe_old->filename) + 2);
+                  + strlen(fdbe_old->filename) + 2);
       s1 = nmalloc(strlen(dccdir) + strlen(newpath)
-		   + strlen(newfn[0] ? newfn : fdbe_old->filename) + 2);
+                   + strlen(newfn[0] ? newfn : fdbe_old->filename) + 2);
       sprintf(s, "%s%s%s%s", dccdir, oldpath,
-	      oldpath[0] ? "/" : "", fdbe_old->filename);
+              oldpath[0] ? "/" : "", fdbe_old->filename);
       sprintf(s1, "%s%s%s%s", dccdir, newpath,
-	      newpath[0] ? "/" : "", newfn[0] ? newfn : fdbe_old->filename);
+              newpath[0] ? "/" : "", newfn[0] ? newfn : fdbe_old->filename);
       if (!strcmp(s, s1)) {
-	Tcl_AppendResult(irp, "-3", NULL); /* Stupid copy to self */
-	skip_this = 1;
+        Tcl_AppendResult(irp, "-3", NULL);      /* Stupid copy to self */
+        skip_this = 1;
       }
       /* Check for existence of file with same name in new dir */
       filedb_readtop(fdb_new, NULL);
       fdbe_new = filedb_matchfile(fdb_new, ftell(fdb_new),
-				  newfn[0] ? newfn : fdbe_old->filename);
+                                  newfn[0] ? newfn : fdbe_old->filename);
       if (fdbe_new) {
-	/* It's ok if the entry in the new dir is a normal file (we'll
-	 * just scrap the old entry and overwrite the file) -- but if
-	 * it's a directory, this file has to be skipped.
-	 */
-	if (fdbe_new->stat & FILE_DIR) {
-	  /* Skip */
-	  skip_this = 1;
-	} else {
-	  filedb_delfile(fdb_new, fdbe_new->pos);
-	}
-	free_fdbe(&fdbe_new);
+        /* It's ok if the entry in the new dir is a normal file (we'll
+         * just scrap the old entry and overwrite the file) -- but if
+         * it's a directory, this file has to be skipped.
+         */
+        if (fdbe_new->stat & FILE_DIR)
+          skip_this = 1;
+        else
+          filedb_delfile(fdb_new, fdbe_new->pos);
+        free_fdbe(&fdbe_new);
       }
       if (!skip_this) {
-	if ((fdbe_old->sharelink) || (copyfile(s, s1) == 0)) {
-	  /* Raw file moved okay: create new entry for it */
-	  ok++;
-	  fdbe_new = malloc_fdbe();
-	  fdbe_new->stat = fdbe_old->stat;
-	  /* We don't have to worry about any entries to be
-	   * NULL, because malloc_strcpy takes care of that.
-	   */
-	  malloc_strcpy(fdbe_new->flags_req, fdbe_old->flags_req);
-	  malloc_strcpy(fdbe_new->chan, fdbe_old->chan);
-	  malloc_strcpy(fdbe_new->filename, fdbe_old->filename);
-	  malloc_strcpy(fdbe_new->desc, fdbe_old->desc);
-	  if (newfn[0])
-	    malloc_strcpy(fdbe_new->filename, newfn);
-	  malloc_strcpy(fdbe_new->uploader, fdbe_old->uploader);
-	  fdbe_new->uploaded = fdbe_old->uploaded;
-	  fdbe_new->size = fdbe_old->size;
-	  fdbe_new->gots = fdbe_old->gots;
-	  malloc_strcpy(fdbe_new->sharelink, fdbe_old->sharelink);
-	  filedb_addfile(fdb_new, fdbe_new);
-	  if (!copy) {
-	    unlink(s);
-	    filedb_delfile(fdb_old, fdbe_old->pos);
-	  }
-	  free_fdbe(&fdbe_new);
-	}
+        if ((fdbe_old->sharelink) || (copyfile(s, s1) == 0)) {
+          /* Raw file moved okay: create new entry for it */
+          ok++;
+          fdbe_new = malloc_fdbe();
+          fdbe_new->stat = fdbe_old->stat;
+          /* We don't have to worry about any entries to be
+           * NULL, because malloc_strcpy takes care of that.
+           */
+          malloc_strcpy(fdbe_new->flags_req, fdbe_old->flags_req);
+          malloc_strcpy(fdbe_new->chan, fdbe_old->chan);
+          malloc_strcpy(fdbe_new->filename, fdbe_old->filename);
+          malloc_strcpy(fdbe_new->desc, fdbe_old->desc);
+          if (newfn[0])
+            malloc_strcpy(fdbe_new->filename, newfn);
+          malloc_strcpy(fdbe_new->uploader, fdbe_old->uploader);
+          fdbe_new->uploaded = fdbe_old->uploaded;
+          fdbe_new->size = fdbe_old->size;
+          fdbe_new->gots = fdbe_old->gots;
+          malloc_strcpy(fdbe_new->sharelink, fdbe_old->sharelink);
+          filedb_addfile(fdb_new, fdbe_new);
+          if (!copy) {
+            unlink(s);
+            filedb_delfile(fdb_old, fdbe_old->pos);
+          }
+          free_fdbe(&fdbe_new);
+        }
       }
       my_free(s);
       my_free(s1);
@@ -587,7 +614,7 @@
     filedb_close(fdb_new);
   filedb_close(fdb_old);
   if (!ok)
-    Tcl_AppendResult(irp, "-4", NULL);	/* No match */
+    Tcl_AppendResult(irp, "-4", NULL);  /* No match */
   else {
     char x[30];
 
@@ -612,7 +639,7 @@
 }
 
 static int tcl_fileresend_send(ClientData cd, Tcl_Interp *irp, int argc,
-	       		       char *argv[], int resend)
+                               char *argv[], int resend)
 {
   int i, idx;
   char s[21];
@@ -625,9 +652,9 @@
     return TCL_ERROR;
   }
   if (argc == 4)
-     i = files_reget(idx, argv[2], argv[3], resend);
+    i = files_reget(idx, argv[2], argv[3], resend);
   else
-     i = files_reget(idx, argv[2], "", resend);
+    i = files_reget(idx, argv[2], "", resend);
   sprintf(s, "%d", i);
   Tcl_AppendResult(irp, s, NULL);
   return TCL_OK;
@@ -643,30 +670,29 @@
   return tcl_fileresend_send(cd, irp, argc, argv, 0);
 }
 
-static tcl_cmds mytcls[] =
-{
-  {"getdesc",		tcl_getdesc},
-  {"getowner",		tcl_getowner},
-  {"setdesc",		tcl_setdesc},
-  {"setowner",		tcl_setowner},
-  {"getgots",		tcl_getgots},
-  {"getpwd",		tcl_getpwd},
-  {"setpwd",		tcl_setpwd},
-  {"getlink",		tcl_getlink},
-  {"setlink",		tcl_setlink},
-  {"getfiles",		tcl_getfiles},
-  {"getdirs",		tcl_getdirs},
-  {"hide",		tcl_hide},
-  {"unhide",		tcl_unhide},
-  {"share",		tcl_share},
-  {"unshare",		tcl_unshare},
-  {"filesend",		tcl_filesend},
-  {"fileresend",	tcl_fileresend},
-  {"mkdir",		tcl_mkdir},
-  {"rmdir",		tcl_rmdir},
-  {"cp",		tcl_cp},
-  {"mv",		tcl_mv},
-  {"getflags",		tcl_getflags},
-  {"setflags",		tcl_setflags},
-  {NULL,		NULL}
+static tcl_cmds mytcls[] = {
+  {"getdesc",    tcl_getdesc},
+  {"getowner",   tcl_getowner},
+  {"setdesc",    tcl_setdesc},
+  {"setowner",   tcl_setowner},
+  {"getgots",    tcl_getgots},
+  {"getpwd",     tcl_getpwd},
+  {"setpwd",     tcl_setpwd},
+  {"getlink",    tcl_getlink},
+  {"setlink",    tcl_setlink},
+  {"getfiles",   tcl_getfiles},
+  {"getdirs",    tcl_getdirs},
+  {"hide",       tcl_hide},
+  {"unhide",     tcl_unhide},
+  {"share",      tcl_share},
+  {"unshare",    tcl_unshare},
+  {"filesend",   tcl_filesend},
+  {"fileresend", tcl_fileresend},
+  {"mkdir",      tcl_mkdir},
+  {"rmdir",      tcl_rmdir},
+  {"cp",         tcl_cp},
+  {"mv",         tcl_mv},
+  {"getflags",   tcl_getflags},
+  {"setflags",   tcl_setflags},
+  {NULL,         NULL}
 };
Index: eggdrop1.6/src/mod/irc.mod/chan.c
diff -u eggdrop1.6/src/mod/irc.mod/chan.c:1.104 eggdrop1.6/src/mod/irc.mod/chan.c:1.105
--- eggdrop1.6/src/mod/irc.mod/chan.c:1.104	Mon Jan 20 18:53:27 2003
+++ eggdrop1.6/src/mod/irc.mod/chan.c	Tue Jan 28 00:37:26 2003
@@ -6,7 +6,7 @@
  *   user kickban, kick, op, deop
  *   idle kicking
  *
- * $Id: chan.c,v 1.104 2003/01/21 00:53:27 wcc Exp $
+ * $Id: chan.c,v 1.105 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -28,9 +28,9 @@
  */
 
 static time_t last_ctcp = (time_t) 0L;
-static int    count_ctcp = 0;
+static int count_ctcp = 0;
 static time_t last_invtime = (time_t) 0L;
-static char   last_invchan[300] = "";
+static char last_invchan[300] = "";
 
 /* ID length for !channels.
  */
@@ -43,7 +43,7 @@
 {
   memberlist *x;
 
-  for (x = chan->channel.member; x && x->nick[0]; x = x->next); 
+  for (x = chan->channel.member; x && x->nick[0]; x = x->next);
   x->next = (memberlist *) channel_malloc(sizeof(memberlist));
   x->next->next = NULL;
   x->next->nick[0] = 0;
@@ -150,13 +150,13 @@
  * and handles kick & deop as well.
  */
 static int detect_chan_flood(char *floodnick, char *floodhost, char *from,
-			     struct chanset_t *chan, int which, char *victim)
+                             struct chanset_t *chan, int which, char *victim)
 {
   char h[UHOSTLEN], ftype[12], *p;
   struct userrec *u;
   memberlist *m;
   int thr = 0, lapse = 0;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   if (!chan || (which < 0) || (which >= FLOOD_CHAN_MAX))
     return 0;
@@ -168,14 +168,13 @@
     return 0;
 
   get_user_flagrec(get_user_by_host(from), &fr, chan->dname);
-  if (glob_bot(fr) ||
-      ((which == FLOOD_DEOP) &&
-       (glob_master(fr) || chan_master(fr)) && (glob_friend(fr) || chan_friend(fr))) ||
-      ((which == FLOOD_KICK) &&
-       (glob_master(fr) || chan_master(fr)) && (glob_friend(fr) || chan_friend(fr))) ||
-      ((which != FLOOD_DEOP) && (which != FLOOD_KICK) && (glob_friend(fr) || chan_friend(fr))) ||
-      (channel_dontkickops(chan) &&
-       (chan_op(fr) || (glob_op(fr) && !chan_deop(fr)))))	/* arthur2 */
+  if (glob_bot(fr) || ((which == FLOOD_DEOP) && (glob_master(fr) ||
+      chan_master(fr)) && (glob_friend(fr) || chan_friend(fr))) ||
+      ((which == FLOOD_KICK) && (glob_master(fr) || chan_master(fr)) &&
+      (glob_friend(fr) || chan_friend(fr))) || ((which != FLOOD_DEOP) &&
+      (which != FLOOD_KICK) && (glob_friend(fr) || chan_friend(fr))) ||
+      (channel_dontkickops(chan) && (chan_op(fr) || (glob_op(fr) &&
+      !chan_deop(fr)))))
     return 0;
 
   /* Determine how many are necessary to make a flood. */
@@ -199,7 +198,7 @@
   case FLOOD_JOIN:
     thr = chan->flood_join_thr;
     lapse = chan->flood_join_time;
-      strcpy(ftype, "join");
+    strcpy(ftype, "join");
     break;
   case FLOOD_DEOP:
     thr = chan->flood_deop_thr;
@@ -213,7 +212,7 @@
     break;
   }
   if ((thr == 0) || (lapse == 0))
-    return 0;			/* no flood protection */
+    return 0;                   /* no flood protection */
   /* Okay, make sure i'm not flood-checking myself */
   if (match_my_nick(floodnick))
     return 0;
@@ -230,7 +229,7 @@
     if (!p)
       return 0;
   }
-  if (rfc_casecmp(chan->floodwho[which], p)) {	/* new */
+  if (rfc_casecmp(chan->floodwho[which], p)) {  /* new */
     strncpy(chan->floodwho[which], p, 80);
     chan->floodwho[which][80] = 0;
     chan->floodtime[which] = now;
@@ -251,7 +250,7 @@
       strcpy(chan->deopd, victim);
   }
   chan->floodnum[which]++;
-  if (chan->floodnum[which] >= thr) {	/* FLOOD */
+  if (chan->floodnum[which] >= thr) {   /* FLOOD */
     /* Reset counters */
     chan->floodnum[which] = 0;
     chan->floodtime[which] = 0;
@@ -266,69 +265,67 @@
     case FLOOD_NOTICE:
     case FLOOD_CTCP:
       /* Flooding chan! either by public or notice */
-      if (!chan_sentkick(m) && (me_op(chan) || (me_halfop(chan) && !chan_hasop(m)))) {
-	putlog(LOG_MODES, chan->dname, IRC_FLOODKICK, floodnick);
-	dprintf(DP_MODE, "KICK %s %s :%s\n", chan->name, floodnick,
-		CHAN_FLOOD);
-	m->flags |= SENTKICK;
+      if (!chan_sentkick(m) &&
+          (me_op(chan) || (me_halfop(chan) && !chan_hasop(m)))) {
+        putlog(LOG_MODES, chan->dname, IRC_FLOODKICK, floodnick);
+        dprintf(DP_MODE, "KICK %s %s :%s\n", chan->name, floodnick, CHAN_FLOOD);
+        m->flags |= SENTKICK;
       }
       return 1;
     case FLOOD_JOIN:
     case FLOOD_NICK:
-      if (use_exempts &&
-	  (u_match_mask(global_exempts, from) ||
-	   u_match_mask(chan->exempts, from)))
-	return 1;
+      if (use_exempts && (u_match_mask(global_exempts, from) ||
+          u_match_mask(chan->exempts, from)))
+        return 1;
       simple_sprintf(h, "*!*@%s", p);
       if (!isbanned(chan, h) && (me_op(chan) || me_halfop(chan))) {
-	check_exemptlist(chan, from);
-	do_mask(chan, chan->channel.ban, h, 'b');
+        check_exemptlist(chan, from);
+        do_mask(chan, chan->channel.ban, h, 'b');
       }
-      if ((u_match_mask(global_bans, from))
-	  || (u_match_mask(chan->bans, from)))
-	return 1;		/* Already banned */
+      if ((u_match_mask(global_bans, from)) ||
+          (u_match_mask(chan->bans, from)))
+        return 1;               /* Already banned */
       if (which == FLOOD_JOIN)
-	putlog(LOG_MISC | LOG_JOIN, chan->dname, IRC_FLOODIGNORE3, p);
+        putlog(LOG_MISC | LOG_JOIN, chan->dname, IRC_FLOODIGNORE3, p);
       else
-	putlog(LOG_MISC | LOG_JOIN, chan->dname, IRC_FLOODIGNORE4, p);
+        putlog(LOG_MISC | LOG_JOIN, chan->dname, IRC_FLOODIGNORE4, p);
       strcpy(ftype + 4, " flood");
       u_addban(chan, h, botnetnick, ftype, now + (60 * chan->ban_time), 0);
       if (!channel_enforcebans(chan) && (me_op(chan) || me_halfop(chan))) {
-	  char s[UHOSTLEN];
-	  for (m = chan->channel.member; m && m->nick[0]; m = m->next) {	  
-	    sprintf(s, "%s!%s", m->nick, m->userhost);
-	    if (wild_match(h, s) &&
-		(m->joined >= chan->floodtime[which]) &&
-		!chan_sentkick(m) && !match_my_nick(m->nick) && (me_op(chan) ||
-		(me_halfop(chan) && !chan_hasop(m)))) {
-	      m->flags |= SENTKICK;
-	      if (which == FLOOD_JOIN)
-	      dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, m->nick,
-		      IRC_JOIN_FLOOD);
-	      else
-	        dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, m->nick,
-		        IRC_NICK_FLOOD);
-	    }
-	  }
-	}
+        char s[UHOSTLEN];
+
+        for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
+          sprintf(s, "%s!%s", m->nick, m->userhost);
+          if (wild_match(h, s) && (m->joined >= chan->floodtime[which]) &&
+              !chan_sentkick(m) && !match_my_nick(m->nick) && (me_op(chan) ||
+              (me_halfop(chan) && !chan_hasop(m)))) {
+            m->flags |= SENTKICK;
+            if (which == FLOOD_JOIN)
+              dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, m->nick,
+                      IRC_JOIN_FLOOD);
+            else
+              dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, m->nick,
+                      IRC_NICK_FLOOD);
+          }
+        }
+      }
       return 1;
     case FLOOD_KICK:
       if ((me_op(chan) || (me_halfop(chan) && !chan_hasop(m))) &&
-	  !chan_sentkick(m)) {
-	putlog(LOG_MODES, chan->dname, "Kicking %s, for mass kick.", floodnick);
-	dprintf(DP_MODE, "KICK %s %s :%s\n", chan->name, floodnick,
-		IRC_MASSKICK);
-	m->flags |= SENTKICK;
+          !chan_sentkick(m)) {
+        putlog(LOG_MODES, chan->dname, "Kicking %s, for mass kick.", floodnick);
+        dprintf(DP_MODE, "KICK %s %s :%s\n", chan->name, floodnick,
+                IRC_MASSKICK);
+        m->flags |= SENTKICK;
       }
-    return 1;
+      return 1;
     case FLOOD_DEOP:
       if ((me_op(chan) || (me_halfop(chan) && !chan_hasop(m))) &&
-	  !chan_sentkick(m)) {
-	putlog(LOG_MODES, chan->dname,
-	       CHAN_MASSDEOP, chan->dname, from);
-	dprintf(DP_MODE, "KICK %s %s :%s\n",
-		chan->name, floodnick, CHAN_MASSDEOP_KICK);
-	m->flags |= SENTKICK;
+          !chan_sentkick(m)) {
+        putlog(LOG_MODES, chan->dname, CHAN_MASSDEOP, chan->dname, from);
+        dprintf(DP_MODE, "KICK %s %s :%s\n",
+                chan->name, floodnick, CHAN_MASSDEOP_KICK);
+        m->flags |= SENTKICK;
       }
       return 1;
     }
@@ -344,7 +341,7 @@
 
   maskhost(uhost, s1);
   if ((strlen(s1) != 1) && (strict_host == 0))
-    s1[2] = '*';		/* arthur2 */
+    s1[2] = '*';                /* arthur2 */
   do_mask(chan, chan->channel.ban, s1, 'b');
   return s1;
 }
@@ -352,11 +349,12 @@
 /* Kick any user (except friends/masters) with certain mask from channel
  * with a specified comment.  Ernst 18/3/1998
  */
-static void kick_all(struct chanset_t *chan, char *hostmask, char *comment, int bantype)
+static void kick_all(struct chanset_t *chan, char *hostmask, char *comment,
+                     int bantype)
 {
   memberlist *m;
   char kicknick[512], s[UHOSTLEN];
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   int k, l, flushed;
 
   if (!me_op(chan) && !me_halfop(chan))
@@ -368,30 +366,27 @@
     sprintf(s, "%s!%s", m->nick, m->userhost);
     get_user_flagrec(m->user ? m->user : get_user_by_host(s), &fr, chan->dname);
     if ((me_op(chan) || (me_halfop(chan) && !chan_hasop(m))) &&
-	wild_match(hostmask, s) && !chan_sentkick(m) &&
-	!match_my_nick(m->nick) && !chan_issplit(m) &&
-	!glob_friend(fr) && !chan_friend(fr) &&
-	!(use_exempts &&
-	  ((bantype && isexempted(chan, s)) ||
-	   (u_match_mask(global_exempts,s) ||
-	    u_match_mask(chan->exempts, s)))) &&
-	!(channel_dontkickops(chan) &&
-	  (chan_op(fr) || (glob_op(fr) && !chan_deop(fr))))) {	/* arthur2 */
+        wild_match(hostmask, s) && !chan_sentkick(m) &&
+        !match_my_nick(m->nick) && !chan_issplit(m) &&
+        !glob_friend(fr) && !chan_friend(fr) && !(use_exempts && ((bantype &&
+        isexempted(chan, s)) || (u_match_mask(global_exempts, s) ||
+        u_match_mask(chan->exempts, s)))) && !(channel_dontkickops(chan) &&
+        (chan_op(fr) || (glob_op(fr) && !chan_deop(fr))))) {
       if (!flushed) {
-	/* We need to kick someone, flush eventual bans first */
-	flush_mode(chan, QUICK);
-	flushed += 1;
+        /* We need to kick someone, flush eventual bans first */
+        flush_mode(chan, QUICK);
+        flushed += 1;
       }
-      m->flags |= SENTKICK;	/* Mark as pending kick */
+      m->flags |= SENTKICK;     /* Mark as pending kick */
       if (kicknick[0])
-	strcat(kicknick, ",");
+        strcat(kicknick, ",");
       strcat(kicknick, m->nick);
       k += 1;
       l = strlen(chan->name) + strlen(kicknick) + strlen(comment) + 5;
       if ((kick_method != 0 && k == kick_method) || (l > 480)) {
-	dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, kicknick, comment);
-	k = 0;
-	kicknick[0] = 0;
+        dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, kicknick, comment);
+        k = 0;
+        kicknick[0] = 0;
       }
     }
   }
@@ -403,37 +398,36 @@
  */
 static void refresh_ban_kick(struct chanset_t *chan, char *user, char *nick)
 {
-  register maskrec	*b;
-  memberlist		*m;
-  int			 cycle;
+  register maskrec *b;
+  memberlist *m;
+  int cycle;
 
   m = ismember(chan, nick);
   if (!m || chan_sentkick(m))
     return;
-  /* Check global bans in first cycle and channel bans
-     in second cycle. */
+  /* Check global bans in first cycle and channel bans in second cycle. */
   for (cycle = 0; cycle < 2; cycle++) {
     for (b = cycle ? chan->bans : global_bans; b; b = b->next) {
       if (wild_match(b->mask, user)) {
-	struct flag_record	fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-	char			c[512];		/* The ban comment.	*/
-	char			s[UHOSTLEN];
-
-	sprintf(s, "%s!%s", m->nick, m->userhost);
-	get_user_flagrec(m->user ? m->user : get_user_by_host(s), &fr,
-			 chan->dname);
-	if (!glob_friend(fr) && !chan_friend(fr)) {
-	  add_mode(chan, '-', 'o', nick);	/* Guess it can't hurt.	*/
-	  check_exemptlist(chan, user);
-	  do_mask(chan, chan->channel.ban, b->mask, 'b');
-	  b->lastactive = now;
-	  if (b->desc && b->desc[0] != '@')
-	    egg_snprintf(c, sizeof c, "%s%s", IRC_PREBANNED, b->desc);
-	  else
-	    c[0] = 0;
-	  kick_all(chan, b->mask, c[0] ? c : IRC_YOUREBANNED, 0);
-	  return;					/* Drop out on 1st ban.	*/
-	}
+        struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
+        char c[512];            /* The ban comment.     */
+        char s[UHOSTLEN];
+
+        sprintf(s, "%s!%s", m->nick, m->userhost);
+        get_user_flagrec(m->user ? m->user : get_user_by_host(s), &fr,
+                         chan->dname);
+        if (!glob_friend(fr) && !chan_friend(fr)) {
+          add_mode(chan, '-', 'o', nick);       /* Guess it can't hurt. */
+          check_exemptlist(chan, user);
+          do_mask(chan, chan->channel.ban, b->mask, 'b');
+          b->lastactive = now;
+          if (b->desc && b->desc[0] != '@')
+            egg_snprintf(c, sizeof c, "%s%s", IRC_PREBANNED, b->desc);
+          else
+            c[0] = 0;
+          kick_all(chan, b->mask, c[0] ? c : IRC_YOUREBANNED, 0);
+          return;               /* Drop out on 1st ban. */
+        }
       }
     }
   }
@@ -444,15 +438,15 @@
  */
 static void refresh_exempt(struct chanset_t *chan, char *user)
 {
-  maskrec	*e;
-  masklist	*b;
-  int		 cycle;
+  maskrec *e;
+  masklist *b;
+  int cycle;
 
   /* Check global exempts in first cycle and channel exempts
-     in second cycle. */
+   * in second cycle. */
   for (cycle = 0; cycle < 2; cycle++) {
     for (e = cycle ? chan->exempts : global_exempts; e; e = e->next) {
-      if (wild_match(user, e->mask) || wild_match(e->mask,user)) {
+      if (wild_match(user, e->mask) || wild_match(e->mask, user)) {
         for (b = chan->channel.ban; b && b->mask[0]; b = b->next) {
           if (wild_match(b->mask, user) || wild_match(user, b->mask)) {
             if (e->lastactive < now - 60 && !isexempted(chan, e->mask)) {
@@ -468,20 +462,20 @@
 
 static void refresh_invite(struct chanset_t *chan, char *user)
 {
-  maskrec	*i;
-  int		 cycle;
+  maskrec *i;
+  int cycle;
 
   /* Check global invites in first cycle and channel invites
-     in second cycle. */
+   * in second cycle. */
   for (cycle = 0; cycle < 2; cycle++) {
     for (i = cycle ? chan->invites : global_invites; i; i = i->next) {
       if (wild_match(i->mask, user) &&
-	  ((i->flags & MASKREC_STICKY) || (chan->channel.mode & CHANINV))) {
+          ((i->flags & MASKREC_STICKY) || (chan->channel.mode & CHANINV))) {
         if (i->lastactive < now - 60 && !isinvited(chan, i->mask)) {
           do_mask(chan, chan->channel.invite, i->mask, 'I');
-	  i->lastactive = now;
-	  return;
-	}
+          i->lastactive = now;
+          return;
+        }
       }
     }
   }
@@ -491,17 +485,17 @@
  */
 static void enforce_bans(struct chanset_t *chan)
 {
-  char		 me[UHOSTLEN];
-  masklist	*b;
+  char me[UHOSTLEN];
+  masklist *b;
 
   if (!me_op(chan) && !me_halfop(chan))
-    return;			/* Can't do it :( */
+    return;                     /* Can't do it :( */
   simple_sprintf(me, "%s!%s", botname, botuserhost);
   /* Go through all bans, kicking the users. */
   for (b = chan->channel.ban; b && b->mask[0]; b = b->next) {
     if (!wild_match(b->mask, me))
       if (!isexempted(chan, b->mask))
-	kick_all(chan, b->mask, IRC_YOUREBANNED, 1);
+        kick_all(chan, b->mask, IRC_YOUREBANNED, 1);
   }
 }
 
@@ -512,16 +506,15 @@
  */
 static void recheck_bans(struct chanset_t *chan)
 {
-  maskrec	*u;
-  int		 cycle;
+  maskrec *u;
+  int cycle;
 
-  /* Check global bans in first cycle and channel bans
-     in second cycle. */
+  /* Check global bans in first cycle and channel bans in second cycle. */
   for (cycle = 0; cycle < 2; cycle++) {
     for (u = cycle ? chan->bans : global_bans; u; u = u->next)
       if (!isbanned(chan, u->mask) && (!channel_dynamicbans(chan) ||
-				       (u->flags & MASKREC_STICKY)))
-	add_mode(chan, '+', 'b', u->mask);
+          (u->flags & MASKREC_STICKY)))
+        add_mode(chan, '+', 'b', u->mask);
   }
 }
 
@@ -532,12 +525,12 @@
  */
 static void recheck_exempts(struct chanset_t *chan)
 {
-  maskrec	*e;
-  masklist	*b;
-  int		 cycle;
+  maskrec *e;
+  masklist *b;
+  int cycle;
 
   /* Check global exempts in first cycle and channel exempts
-     in second cycle. */
+   * in second cycle. */
   for (cycle = 0; cycle < 2; cycle++) {
     for (e = cycle ? chan->exempts : global_exempts; e; e = e->next) {
       if (!isexempted(chan, e->mask) &&
@@ -546,8 +539,8 @@
       for (b = chan->channel.ban; b && b->mask[0]; b = b->next) {
         if ((wild_match(b->mask, e->mask) || wild_match(e->mask, b->mask)) &&
             !isexempted(chan, e->mask))
-	  add_mode(chan,'+','e',e->mask);
-	/* do_mask(chan, chan->channel.exempt, e->mask, 'e');*/
+          add_mode(chan, '+', 'e', e->mask);
+        /* do_mask(chan, chan->channel.exempt, e->mask, 'e'); */
       }
     }
   }
@@ -560,20 +553,20 @@
  */
 static void recheck_invites(struct chanset_t *chan)
 {
-  maskrec	*ir;
-  int		 cycle;
+  maskrec *ir;
+  int cycle;
 
   /* Check global invites in first cycle and channel invites
-     in second cycle. */
-  for (cycle = 0; cycle < 2; cycle++)  {
+   * in second cycle. */
+  for (cycle = 0; cycle < 2; cycle++) {
     for (ir = cycle ? chan->invites : global_invites; ir; ir = ir->next) {
       /* If invite isn't set and (channel is not dynamic invites and not invite
        * only) or invite is sticky.
        */
       if (!isinvited(chan, ir->mask) && ((!channel_dynamicinvites(chan) &&
           !(chan->channel.mode & CHANINV)) || ir->flags & MASKREC_STICKY))
-	add_mode(chan, '+', 'I', ir->mask);
-	/* do_mask(chan, chan->channel.invite, ir->mask, 'I');*/
+        add_mode(chan, '+', 'I', ir->mask);
+      /* do_mask(chan, chan->channel.invite, ir->mask, 'I'); */
     }
   }
 }
@@ -581,7 +574,7 @@
 /* Resets the masks on the channel.
  */
 static void resetmasks(struct chanset_t *chan, masklist *m, maskrec *mrec,
-		       maskrec *global_masks, char mode)
+                       maskrec *global_masks, char mode)
 {
   if (!me_op(chan) && !me_halfop(chan))
     return;                     /* Can't do it */
@@ -594,18 +587,18 @@
 
   /* Make sure the intended masks are still there */
   switch (mode) {
-    case 'b':
-      recheck_bans(chan);
-      break;
-    case 'e':
-      recheck_exempts(chan);
-      break;
-    case 'I':
-      recheck_invites(chan);
-      break;
-    default:
-      putlog(LOG_MISC, "*", "(!) Invalid mode '%c' in resetmasks()", mode);
-      break;
+  case 'b':
+    recheck_bans(chan);
+    break;
+  case 'e':
+    recheck_exempts(chan);
+    break;
+  case 'I':
+    recheck_invites(chan);
+    break;
+  default:
+    putlog(LOG_MISC, "*", "(!) Invalid mode '%c' in resetmasks()", mode);
+    break;
   }
 }
 static void check_this_ban(struct chanset_t *chan, char *banmask, int sticky)
@@ -623,15 +616,13 @@
            u_match_mask(chan->exempts, user))))
       refresh_ban_kick(chan, user, m->nick);
   }
-  if (!isbanned(chan, banmask) &&
-      (!channel_dynamicbans(chan) || sticky))
+  if (!isbanned(chan, banmask) && (!channel_dynamicbans(chan) || sticky))
     add_mode(chan, '+', 'b', banmask);
 }
 
 static void recheck_channel_modes(struct chanset_t *chan)
 {
-  int cur = chan->channel.mode,
-      mns = chan->mode_mns_prot,
+  int cur = chan->channel.mode, mns = chan->mode_mns_prot,
       pls = chan->mode_pls_prot;
 
   if (!(chan->status & CHAN_ASKEDMODES)) {
@@ -692,20 +683,23 @@
 
       sprintf(s, "%d", chan->limit_prot);
       add_mode(chan, '+', 'l', s);
-    } else if ((mns & CHANLIMIT) && (chan->channel.maxmembers != 0))
+    }
+    else if ((mns & CHANLIMIT) && (chan->channel.maxmembers != 0))
       add_mode(chan, '-', 'l', "");
     if (chan->key_prot[0]) {
       if (rfc_casecmp(chan->channel.key, chan->key_prot) != 0) {
         if (chan->channel.key[0])
-	  add_mode(chan, '-', 'k', chan->channel.key);
+          add_mode(chan, '-', 'k', chan->channel.key);
         add_mode(chan, '+', 'k', chan->key_prot);
       }
-    } else if ((mns & CHANKEY) && (chan->channel.key[0]))
+    }
+    else if ((mns & CHANKEY) && (chan->channel.key[0]))
       add_mode(chan, '-', 'k', chan->channel.key);
   }
 }
 
-static void check_this_member(struct chanset_t *chan, char *nick, struct flag_record *fr)
+static void check_this_member(struct chanset_t *chan, char *nick,
+                              struct flag_record *fr)
 {
   memberlist *m;
   char s[UHOSTLEN], *p;
@@ -733,17 +727,18 @@
         else {
           set_delay(chan, m->nick);
           m->flags |= SENTOP;
-	}
-      } else if (!chan_hasop(m) && !chan_hashalfop(m) && (chan_halfop(*fr) ||
-                 (glob_halfop(*fr) && !chan_dehalfop(*fr))) &&
-                 (channel_autohalfop(chan) || glob_autohalfop(*fr) ||
-                 chan_autohalfop(*fr))) {
+        }
+      }
+      else if (!chan_hasop(m) && !chan_hashalfop(m) && (chan_halfop(*fr) ||
+               (glob_halfop(*fr) && !chan_dehalfop(*fr))) &&
+               (channel_autohalfop(chan) || glob_autohalfop(*fr) ||
+               chan_autohalfop(*fr))) {
         if (!chan->aop_min)
           add_mode(chan, '+', 'h', m->nick);
         else {
           set_delay(chan, m->nick);
           m->flags |= SENTHALFOP;
-	}
+        }
       }
     }
     if (chan_hasvoice(m) && (chan_quiet(*fr) || (glob_quiet(*fr) &&
@@ -762,20 +757,20 @@
   }
 
   sprintf(s, "%s!%s", m->nick, m->userhost);
-  if (use_invites && (u_match_mask(global_invites,s) ||
+  if (use_invites && (u_match_mask(global_invites, s) ||
       u_match_mask(chan->invites, s)))
     refresh_invite(chan, s);
-  if (!(use_exempts && (u_match_mask(global_exempts ,s) ||
+  if (!(use_exempts && (u_match_mask(global_exempts, s) ||
       u_match_mask(chan->exempts, s)))) {
     if (u_match_mask(global_bans, s) || u_match_mask(chan->bans, s))
       refresh_ban_kick(chan, s, m->nick);
     if (!chan_sentkick(m) && (chan_kick(*fr) || glob_kick(*fr)) &&
-	(me_op(chan) || (me_halfop(chan) && !chan_hasop(m)))) {
+        (me_op(chan) || (me_halfop(chan) && !chan_hasop(m)))) {
       check_exemptlist(chan, s);
       quickban(chan, m->userhost);
       p = get_user(&USERENTRY_COMMENT, m->user);
       dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, m->nick,
-	      p ? p : IRC_POLITEKICK);
+              p ? p : IRC_POLITEKICK);
       m->flags |= SENTKICK;
     }
   }
@@ -787,17 +782,17 @@
   memberlist *m;
   struct userrec *u;
   struct chanset_t *chan;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   for (chan = chanset; chan; chan = chan->next)
     for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
       sprintf(s, "%s!%s", m->nick, m->userhost);
       u = m->user ? m->user : get_user_by_host(s);
       if ((u && !egg_strcasecmp(u->handle, hand) && delete < 2) ||
-	  (!u && delete == 2 && wild_match(host, fixfrom(s)))) {
-	u = delete ? NULL : u;
-	get_user_flagrec(u, &fr, chan->dname);
-	check_this_member(chan, m->nick, &fr);
+          (!u && delete == 2 && wild_match(host, fixfrom(s)))) {
+        u = delete ? NULL : u;
+        get_user_flagrec(u, &fr, chan->dname);
+        check_this_member(chan, m->nick, &fr);
       }
     }
 }
@@ -808,26 +803,26 @@
 {
   memberlist *m;
   char s[UHOSTLEN];
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   static int stacking = 0;
   int stop_reset = 0;
 
   if (stacking)
-    return;			/* wewps */
+    return;                     /* wewps */
   if (!userlist)                /* Bot doesnt know anybody */
     return;                     /* ... it's better not to deop everybody */
   stacking++;
   /* Okay, sort through who needs to be deopped. */
-  for (m = chan->channel.member; m && m->nick[0]; m = m->next) { 
+  for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
     sprintf(s, "%s!%s", m->nick, m->userhost);
     if (!m->user && !m->tried_getuser) {
-	    m->tried_getuser = 1;
-	    m->user = get_user_by_host(s);
+      m->tried_getuser = 1;
+      m->user = get_user_by_host(s);
     }
     get_user_flagrec(m->user, &fr, chan->dname);
-      if (glob_bot(fr) && chan_hasop(m) && !match_my_nick(m->nick))
-	stop_reset = 1;
-      check_this_member(chan, m->nick, &fr);
+    if (glob_bot(fr) && chan_hasop(m) && !match_my_nick(m->nick))
+      stop_reset = 1;
+    check_this_member(chan, m->nick, &fr);
   }
   if (dobans) {
     if (channel_nouserbans(chan) && !stop_reset)
@@ -836,20 +831,19 @@
       recheck_bans(chan);
     if (use_invites) {
       if (channel_nouserinvites(chan) && !stop_reset)
-	resetinvites(chan);
+        resetinvites(chan);
       else
-	recheck_invites(chan);
+        recheck_invites(chan);
     }
     if (use_exempts) {
       if (channel_nouserexempts(chan) && !stop_reset)
-	resetexempts(chan);
+        resetexempts(chan);
       else
-	recheck_exempts(chan);
+        recheck_exempts(chan);
     }
     if (channel_enforcebans(chan))
       enforce_bans(chan);
-    if ((chan->status & CHAN_ASKEDMODES) &&
-	!channel_inactive(chan)) 
+    if ((chan->status & CHAN_ASKEDMODES) && !channel_inactive(chan))
       dprintf(DP_MODE, "MODE %s\n", chan->name);
     recheck_channel_modes(chan);
   }
@@ -861,7 +855,7 @@
  */
 static int got324(char *from, char *msg)
 {
-  int i = 1, ok =0;
+  int i = 1, ok = 0;
   char *p, *q, *chname;
   struct chanset_t *chan;
 
@@ -907,40 +901,42 @@
     if (msg[i] == 'k') {
       chan->channel.mode |= CHANKEY;
       p = strchr(msg, ' ');
-      if (p != NULL) {		/* Test for null key assignment */
-	p++;
-	q = strchr(p, ' ');
-	if (q != NULL) {
-	  *q = 0;
-	  set_key(chan, p);
-	  strcpy(p, q + 1);
-	} else {
-	  set_key(chan, p);
-	  *p = 0;
-	}
+      if (p != NULL) {          /* Test for null key assignment */
+        p++;
+        q = strchr(p, ' ');
+        if (q != NULL) {
+          *q = 0;
+          set_key(chan, p);
+          strcpy(p, q + 1);
+        }
+        else {
+          set_key(chan, p);
+          *p = 0;
+        }
       }
       if ((chan->channel.mode & CHANKEY) && (!chan->channel.key[0] ||
-	  !strcmp("*", chan->channel.key)))
-	/* Undernet use to show a blank channel key if one was set when
-	 * you first joined a channel; however, this has been replaced by
-	 * an asterisk and this has been agreed upon by other major IRC 
-	 * networks so we'll check for an asterisk here as well 
-	 * (guppy 22Dec2001) */ 
+          !strcmp("*", chan->channel.key)))
+        /* Undernet use to show a blank channel key if one was set when
+         * you first joined a channel; however, this has been replaced by
+         * an asterisk and this has been agreed upon by other major IRC 
+         * networks so we'll check for an asterisk here as well 
+         * (guppy 22Dec2001) */
         chan->status |= CHAN_ASKEDMODES;
     }
     if (msg[i] == 'l') {
       p = strchr(msg, ' ');
-      if (p != NULL) {		/* test for null limit assignment */
-	p++;
-	q = strchr(p, ' ');
-	if (q != NULL) {
-	  *q = 0;
-	  chan->channel.maxmembers = atoi(p);
-	  strcpy(p, q + 1);
-	} else {
-	  chan->channel.maxmembers = atoi(p);
-	  *p = 0;
-	}
+      if (p != NULL) {          /* test for null limit assignment */
+        p++;
+        q = strchr(p, ' ');
+        if (q != NULL) {
+          *q = 0;
+          chan->channel.maxmembers = atoi(p);
+          strcpy(p, q + 1);
+        }
+        else {
+          chan->channel.maxmembers = atoi(p);
+          *p = 0;
+        }
       }
     }
     i++;
@@ -951,27 +947,27 @@
 }
 
 static int got352or4(struct chanset_t *chan, char *user, char *host,
-		     char *nick, char *flags)
+                     char *nick, char *flags)
 {
   char userhost[UHOSTLEN];
   memberlist *m;
 
-  m = ismember(chan, nick);	/* In my channel list copy? */
-  if (!m) {			/* Nope, so update */
-    m = newmember(chan);	/* Get a new channel entry */
-    m->joined = m->split = m->delay = 0L;	/* Don't know when he joined */
-    m->flags = 0;		/* No flags for now */
-    m->last = now;		/* Last time I saw him */
+  m = ismember(chan, nick);     /* In my channel list copy? */
+  if (!m) {                     /* Nope, so update */
+    m = newmember(chan);        /* Get a new channel entry */
+    m->joined = m->split = m->delay = 0L;       /* Don't know when he joined */
+    m->flags = 0;               /* No flags for now */
+    m->last = now;              /* Last time I saw him */
   }
-  strcpy(m->nick, nick);	/* Store the nick in list */
+  strcpy(m->nick, nick);        /* Store the nick in list */
   /* Store the userhost */
   simple_sprintf(m->userhost, "%s@%s", user, host);
   simple_sprintf(userhost, "%s!%s", nick, m->userhost);
   /* Combine n!u at h */
-  m->user = NULL;		/* No handle match (yet) */
-  if (match_my_nick(nick)) {	/* Is it me? */
-    strcpy(botuserhost, m->userhost);	/* Yes, save my own userhost */
-    m->joined = now;		/* set this to keep the whining masses happy */
+  m->user = NULL;               /* No handle match (yet) */
+  if (match_my_nick(nick)) {    /* Is it me? */
+    strcpy(botuserhost, m->userhost);   /* Yes, save my own userhost */
+    m->joined = now;            /* set this to keep the whining masses happy */
   }
   if (strchr(flags, '@') != NULL)
     m->flags |= (CHANOP | WASOP);
@@ -1003,15 +999,15 @@
   char *nick, *user, *host, *chname, *flags;
   struct chanset_t *chan;
 
-  newsplit(&msg);		/* Skip my nick - effeciently */
-  chname = newsplit(&msg);	/* Grab the channel */
-  chan = findchan(chname);	/* See if I'm on channel */
-  if (chan) {			/* Am I? */
-    user = newsplit(&msg);	/* Grab the user */
-    host = newsplit(&msg);	/* Grab the host */
-    newsplit(&msg);		/* Skip the server */
-    nick = newsplit(&msg);	/* Grab the nick */
-    flags = newsplit(&msg);	/* Grab the flags */
+  newsplit(&msg);               /* Skip my nick - effeciently */
+  chname = newsplit(&msg);      /* Grab the channel */
+  chan = findchan(chname);      /* See if I'm on channel */
+  if (chan) {                   /* Am I? */
+    user = newsplit(&msg);      /* Grab the user */
+    host = newsplit(&msg);      /* Grab the host */
+    newsplit(&msg);             /* Skip the server */
+    nick = newsplit(&msg);      /* Grab the nick */
+    flags = newsplit(&msg);     /* Grab the flags */
     got352or4(chan, user, host, nick, flags);
   }
   return 0;
@@ -1025,16 +1021,16 @@
   struct chanset_t *chan;
 
   if (use_354) {
-    newsplit(&msg);		/* Skip my nick - effeciently */
+    newsplit(&msg);             /* Skip my nick - effeciently */
     if (msg[0] && (strchr(CHANMETA, msg[0]) != NULL)) {
-      chname = newsplit(&msg);	/* Grab the channel */
-      chan = findchan(chname);	/* See if I'm on channel */
-      if (chan) {		/* Am I? */
-	user = newsplit(&msg);	/* Grab the user */
-	host = newsplit(&msg);	/* Grab the host */
-	nick = newsplit(&msg);	/* Grab the nick */
-	flags = newsplit(&msg);	/* Grab the flags */
-	got352or4(chan, user, host, nick, flags);
+      chname = newsplit(&msg);  /* Grab the channel */
+      chan = findchan(chname);  /* See if I'm on channel */
+      if (chan) {               /* Am I? */
+        user = newsplit(&msg);  /* Grab the user */
+        host = newsplit(&msg);  /* Grab the host */
+        nick = newsplit(&msg);  /* Grab the nick */
+        flags = newsplit(&msg); /* Grab the flags */
+        got352or4(chan, user, host, nick, flags);
       }
     }
   }
@@ -1061,12 +1057,12 @@
   /* Am *I* on the channel now? if not, well d0h. */
   if (!ismember(chan, botname)) {
     putlog(LOG_MISC | LOG_JOIN, chan->dname, "Oops, I'm not really on %s.",
-	   chan->dname);
+           chan->dname);
     clear_channel(chan, 1);
     chan->status &= ~CHAN_ACTIVE;
     dprintf(DP_MODE, "JOIN %s %s\n",
-	    (chan->name[0]) ? chan->name : chan->dname,
-	    chan->channel.key[0] ? chan->channel.key : chan->key_prot);
+            (chan->name[0]) ? chan->name : chan->dname,
+            chan->channel.key[0] ? chan->channel.key : chan->key_prot);
   }
   else if (me_op(chan))
     recheck_channel(chan, 1);
@@ -1240,12 +1236,12 @@
 
   newsplit(&msg);
   chname = newsplit(&msg);
-  if (chname && chname[0]=='!') {
+  if (chname && chname[0] == '!') {
     chan = findchan_by_dname(chname);
     if (!chan) {
       chan = findchan(chname);
       if (!chan)
-        return 0;       /* Ignore it */
+        return 0;               /* Ignore it */
       /* We have the channel unique name, so we have attempted to join
        * a specific !channel that doesnt exist. Now attempt to join the
        * channel using it's short name.
@@ -1254,7 +1250,8 @@
              "Unique channel %s does not exist... Attempting to join with "
              "short name.", chname);
       dprintf(DP_SERVER, "JOIN %s\n", chan->dname);
-    } else {
+    }
+    else {
       /* We have found the channel, so the server has given us the short
        * name. Prefix another '!' to it, and attempt the join again...
        */
@@ -1290,13 +1287,14 @@
     putlog(LOG_JOIN, chan->dname, IRC_CHANFULL, chan->dname);
     check_tcl_need(chan->dname, "limit");
 
-    chan = findchan_by_dname(chname); 
+    chan = findchan_by_dname(chname);
     if (!chan)
       return 0;
 
     if (chan->need_limit[0])
       do_tcl("need-limit", chan->need_limit);
-  } else
+  }
+  else
     putlog(LOG_JOIN, chname, IRC_CHANFULL, chname);
   return 0;
 }
@@ -1325,13 +1323,14 @@
     putlog(LOG_JOIN, chan->dname, IRC_CHANINVITEONLY, chan->dname);
     check_tcl_need(chan->dname, "invite");
 
-    chan = findchan_by_dname(chname); 
+    chan = findchan_by_dname(chname);
     if (!chan)
       return 0;
 
     if (chan->need_invite[0])
       do_tcl("need-invite", chan->need_invite);
-  } else
+  }
+  else
     putlog(LOG_JOIN, chname, IRC_CHANINVITEONLY, chname);
   return 0;
 }
@@ -1360,13 +1359,14 @@
     putlog(LOG_JOIN, chan->dname, IRC_BANNEDFROMCHAN, chan->dname);
     check_tcl_need(chan->dname, "unban");
 
-    chan = findchan_by_dname(chname); 
+    chan = findchan_by_dname(chname);
     if (!chan)
       return 0;
 
     if (chan->need_unban[0])
       do_tcl("need-unban", chan->need_unban);
-  } else
+  }
+  else
     putlog(LOG_JOIN, chname, IRC_BANNEDFROMCHAN, chname);
   return 0;
 }
@@ -1398,17 +1398,19 @@
       chan->channel.key = (char *) channel_malloc(1);
       chan->channel.key[0] = 0;
       dprintf(DP_MODE, "JOIN %s %s\n", chan->dname, chan->key_prot);
-    } else {
+    }
+    else {
       check_tcl_need(chan->dname, "key");
 
-      chan = findchan_by_dname(chname); 
+      chan = findchan_by_dname(chname);
       if (!chan)
         return 0;
 
       if (chan->need_key[0])
-	do_tcl("need-key", chan->need_key);
+        do_tcl("need-key", chan->need_key);
     }
-  } else
+  }
+  else
     putlog(LOG_JOIN, chname, IRC_BADCHANKEY, chname);
   return 0;
 }
@@ -1425,7 +1427,7 @@
   nick = splitnick(&from);
   if (!rfc_casecmp(last_invchan, msg))
     if (now - last_invtime < 30)
-      return 0;		/* Two invites to the same channel in 30 seconds? */
+      return 0; /* Two invites to the same channel in 30 seconds? */
   putlog(LOG_MISC, "*", "%s!%s invited me to %s", nick, from, msg);
   strncpy(last_invchan, msg, 299);
   last_invchan[299] = 0;
@@ -1452,7 +1454,8 @@
   if (k && k[0]) {
     chan->channel.topic = (char *) channel_malloc(strlen(k) + 1);
     strcpy(chan->channel.topic, k);
-  } else
+  }
+  else
     chan->channel.topic = NULL;
 }
 
@@ -1539,7 +1542,7 @@
     for (m2 = chan->channel.member; m2 && m2->nick[0]; m2 = m2->next)
       if (m2->delay && !(m2->flags & FULL_DELAY)) {
         m2->delay = a_delay;
-        if (count + 1 >=  modesperline)
+        if (count + 1 >= modesperline)
           m2->flags |= FULL_DELAY;
       }
   if (count + 1 >= modesperline)
@@ -1557,7 +1560,7 @@
   memberlist *m;
   masklist *b;
   struct userrec *u;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   fixcolon(chname);
   chan = findchan(chname);
@@ -1566,35 +1569,36 @@
      * name now. This will happen when we initially join the channel, as we
      * dont know the unique channel name that the server has made up. <cybah>
      */
-    int	l_chname = strlen(chname);
+    int l_chname = strlen(chname);
 
     if (l_chname > (CHANNEL_ID_LEN + 1)) {
       ch_dname = nmalloc(l_chname + 1);
       if (ch_dname) {
-	egg_snprintf(ch_dname, l_chname + 2, "!%s",
-		     chname + (CHANNEL_ID_LEN + 1));
-	chan = findchan_by_dname(ch_dname);
-	if (!chan) {
-	  /* Hmm.. okay. Maybe the admin's a genius and doesn't know the
-	   * difference between id and descriptive channel names. Search
-	   * the channel name in the dname list using the id-name.
-	   */
-	   chan = findchan_by_dname(chname);
-	   if (chan) {
-	     /* Duh, I was right. Mark this channel as inactive and log
-	      * the incident.
-	      */
-	     chan->status |= CHAN_INACTIVE;
-	     putlog(LOG_MISC, "*", "Deactivated channel %s, because it uses "
-		    "an ID channel-name. Use the descriptive name instead.",
-		    chname);
-	     dprintf(DP_SERVER, "PART %s\n", chname);
-	     goto exit;
-	   }
-	}
+        egg_snprintf(ch_dname, l_chname + 2, "!%s",
+                     chname + (CHANNEL_ID_LEN + 1));
+        chan = findchan_by_dname(ch_dname);
+        if (!chan) {
+          /* Hmm.. okay. Maybe the admin's a genius and doesn't know the
+           * difference between id and descriptive channel names. Search
+           * the channel name in the dname list using the id-name.
+           */
+          chan = findchan_by_dname(chname);
+          if (chan) {
+            /* Duh, I was right. Mark this channel as inactive and log
+             * the incident.
+             */
+            chan->status |= CHAN_INACTIVE;
+            putlog(LOG_MISC, "*", "Deactivated channel %s, because it uses "
+                   "an ID channel-name. Use the descriptive name instead.",
+                   chname);
+            dprintf(DP_SERVER, "PART %s\n", chname);
+            goto exit;
+          }
+        }
       }
     }
-  } else if (!chan) {
+  }
+  else if (!chan) {
     /* As this is not a !chan, we need to search for it by display name now.
      * Unlike !chan's, we dont need to remove the unique part.
      */
@@ -1605,21 +1609,22 @@
     strcpy(uhost, from);
     nick = splitnick(&uhost);
     if (match_my_nick(nick)) {
-    putlog(LOG_MISC, "*", "joined %s but didn't want to!", chname);
-    dprintf(DP_MODE, "PART %s\n", chname);
+      putlog(LOG_MISC, "*", "joined %s but didn't want to!", chname);
+      dprintf(DP_MODE, "PART %s\n", chname);
     }
-  } else if (!channel_pending(chan)) {
+  }
+  else if (!channel_pending(chan)) {
     chan->status &= ~CHAN_STOP_CYCLE;
     strcpy(uhost, from);
     nick = splitnick(&uhost);
     detect_chan_flood(nick, uhost, from, chan, FLOOD_JOIN, NULL);
 
     chan = findchan(chname);
-    if (!chan) {   
+    if (!chan) {
       if (ch_dname)
-	chan = findchan_by_dname(ch_dname);
+        chan = findchan_by_dname(ch_dname);
       else
-	chan = findchan_by_dname(chname);
+        chan = findchan_by_dname(chname);
     }
     if (!chan)
       /* The channel doesn't exist anymore, so get out of here. */
@@ -1627,152 +1632,153 @@
 
     /* Grab last time joined before we update it */
     u = get_user_by_host(from);
-    get_user_flagrec(u, &fr, chan->dname); /* Lam: fix to work with !channels */
+    get_user_flagrec(u, &fr, chan->dname);      /* Lam: fix to work with !channels */
     if (!channel_active(chan) && !match_my_nick(nick)) {
       /* uh, what?!  i'm on the channel?! */
       putlog(LOG_MISC, chan->dname,
-	     "confused bot: guess I'm on %s and didn't realize it",
-	     chan->dname);
+             "confused bot: guess I'm on %s and didn't realize it",
+             chan->dname);
       chan->status |= CHAN_ACTIVE;
       chan->status &= ~CHAN_PEND;
       reset_chan_info(chan);
-    } else {
+    }
+    else {
       m = ismember(chan, nick);
       if (m && m->split && !egg_strcasecmp(m->userhost, uhost)) {
-	check_tcl_rejn(nick, uhost, u, chan->dname);
+        check_tcl_rejn(nick, uhost, u, chan->dname);
 
-	chan = findchan(chname);
-	if (!chan) {
-	  if (ch_dname)
-	    chan = findchan_by_dname(ch_dname);
-	  else
-	    chan = findchan_by_dname(chname);
+        chan = findchan(chname);
+        if (!chan) {
+          if (ch_dname)
+            chan = findchan_by_dname(ch_dname);
+          else
+            chan = findchan_by_dname(chname);
         }
         if (!chan)
           /* The channel doesn't exist anymore, so get out of here. */
           goto exit;
 
-	/* The tcl binding might have deleted the current user. Recheck. */
-	u = get_user_by_host(from);
-	m->split = 0;
-	m->last = now;
-	m->delay = 0L;
-	m->flags = (chan_hasop(m) ? WASOP : 0);
-	m->user = u;
-	set_handle_laston(chan->dname, u, now);
-	m->flags |= STOPWHO;
-	putlog(LOG_JOIN, chan->dname, "%s (%s) returned to %s.", nick, uhost,
-	       chan->dname);
-      } else {
-	if (m)
-	  killmember(chan, nick);
-	m = newmember(chan);
-	m->joined = now;
-	m->split = 0L;
-	m->flags = 0;
-	m->last = now;
-	m->delay = 0L;
-	strcpy(m->nick, nick);
-	strcpy(m->userhost, uhost);
-	m->user = u;
-	m->flags |= STOPWHO;
-
-	check_tcl_join(nick, uhost, u, chan->dname);
-
-	/* The tcl binding might have deleted the current user and the
-	 * current channel, so we'll now have to re-check whether they
-	 * both still exist.
-	 */
-	chan = findchan(chname);
-	if (!chan) {
-	  if (ch_dname)
-	    chan = findchan_by_dname(ch_dname);
-	  else
-	    chan = findchan_by_dname(chname);
-	}
-	if (!chan)
-	  /* The channel doesn't exist anymore, so get out of here. */
-	  goto exit;
-
-	/* The record saved in the channel record always gets updated,
-	   so we can use that. */
-	u = m->user;
-
-	if (match_my_nick(nick)) {
-	  /* It was me joining! Need to update the channel record with the
-	   * unique name for the channel (as the server see's it). <cybah>
-	   */
-	  strncpy(chan->name, chname, 81);
-	  chan->name[80] = 0;
-	  chan->status &= ~CHAN_JUPED;
+        /* The tcl binding might have deleted the current user. Recheck. */
+        u = get_user_by_host(from);
+        m->split = 0;
+        m->last = now;
+        m->delay = 0L;
+        m->flags = (chan_hasop(m) ? WASOP : 0);
+        m->user = u;
+        set_handle_laston(chan->dname, u, now);
+        m->flags |= STOPWHO;
+        putlog(LOG_JOIN, chan->dname, "%s (%s) returned to %s.", nick, uhost,
+               chan->dname);
+      }
+      else {
+        if (m)
+          killmember(chan, nick);
+        m = newmember(chan);
+        m->joined = now;
+        m->split = 0L;
+        m->flags = 0;
+        m->last = now;
+        m->delay = 0L;
+        strcpy(m->nick, nick);
+        strcpy(m->userhost, uhost);
+        m->user = u;
+        m->flags |= STOPWHO;
+
+        check_tcl_join(nick, uhost, u, chan->dname);
+
+        /* The tcl binding might have deleted the current user and the
+         * current channel, so we'll now have to re-check whether they
+         * both still exist.
+         */
+        chan = findchan(chname);
+        if (!chan) {
+          if (ch_dname)
+            chan = findchan_by_dname(ch_dname);
+          else
+            chan = findchan_by_dname(chname);
+        }
+        if (!chan)
+          /* The channel doesn't exist anymore, so get out of here. */
+          goto exit;
+
+        /* The record saved in the channel record always gets updated,
+         * so we can use that. */
+        u = m->user;
+
+        if (match_my_nick(nick)) {
+          /* It was me joining! Need to update the channel record with the
+           * unique name for the channel (as the server see's it). <cybah>
+           */
+          strncpy(chan->name, chname, 81);
+          chan->name[80] = 0;
+          chan->status &= ~CHAN_JUPED;
 
           /* ... and log us joining. Using chan->dname for the channel is
-	   * important in this case. As the config file will never contain
-	   * logs with the unique name.
+           * important in this case. As the config file will never contain
+           * logs with the unique name.
+           */
+          if (chname[0] == '!')
+            putlog(LOG_JOIN | LOG_MISC, chan->dname, "%s joined %s (%s)",
+                   nick, chan->dname, chname);
+          else
+            putlog(LOG_JOIN | LOG_MISC, chan->dname, "%s joined %s.", nick,
+                   chname);
+          reset_chan_info(chan);
+        }
+        else {
+          struct chanuserrec *cr;
+
+          putlog(LOG_JOIN, chan->dname,
+                 "%s (%s) joined %s.", nick, uhost, chan->dname);
+          /* Don't re-display greeting if they've been on the channel
+           * recently.
            */
-	  if (chname[0] == '!')
-	    putlog(LOG_JOIN | LOG_MISC, chan->dname, "%s joined %s (%s)",
-	           nick, chan->dname, chname);
-	  else
-	    putlog(LOG_JOIN | LOG_MISC, chan->dname, "%s joined %s.", nick,
-	           chname);
-	  reset_chan_info(chan);
-	} else {
-	  struct chanuserrec *cr;
-
-	  putlog(LOG_JOIN, chan->dname,
-		 "%s (%s) joined %s.", nick, uhost, chan->dname);
-	  /* Don't re-display greeting if they've been on the channel
-	   * recently.
-	   */
-	  if (u) {
-	    struct laston_info *li = 0;
-
-	    cr = get_chanrec(m->user, chan->dname);
-	    if (!cr && no_chanrec_info)
-	      li = get_user(&USERENTRY_LASTON, m->user);
-	    if (channel_greet(chan) && use_info &&
-		((cr && now - cr->laston > wait_info) ||
-		 (no_chanrec_info &&
-		  (!li || now - li->laston > wait_info)))) {
-	      char s1[512], *s;
-
-	      if (!(u->flags & USER_BOT)) {
-		s = get_user(&USERENTRY_INFO, u);
-		get_handle_chaninfo(u->handle, chan->dname, s1);
-		/* Locked info line overides non-locked channel specific
-		 * info line.
-		 */
-		if (!s || (s1[0] && (s[0] != '@' || s1[0] == '@')))
-		  s = s1;
-		if (s[0] == '@')
-		  s++;
-		if (s && s[0])
-		  dprintf(DP_HELP, "PRIVMSG %s :[%s] %s\n",
-			  chan->name, nick, s);
-	      }
-	    }
-	  }
-	  set_handle_laston(chan->dname, u, now);
-	}
+          if (u) {
+            struct laston_info *li = 0;
+
+            cr = get_chanrec(m->user, chan->dname);
+            if (!cr && no_chanrec_info)
+              li = get_user(&USERENTRY_LASTON, m->user);
+            if (channel_greet(chan) && use_info &&
+                ((cr && now - cr->laston > wait_info) ||
+                (no_chanrec_info && (!li || now - li->laston > wait_info)))) {
+              char s1[512], *s;
+
+              if (!(u->flags & USER_BOT)) {
+                s = get_user(&USERENTRY_INFO, u);
+                get_handle_chaninfo(u->handle, chan->dname, s1);
+                /* Locked info line overides non-locked channel specific
+                 * info line.
+                 */
+                if (!s || (s1[0] && (s[0] != '@' || s1[0] == '@')))
+                  s = s1;
+                if (s[0] == '@')
+                  s++;
+                if (s && s[0])
+                  dprintf(DP_HELP, "PRIVMSG %s :[%s] %s\n",
+                          chan->name, nick, s);
+              }
+            }
+          }
+          set_handle_laston(chan->dname, u, now);
+        }
       }
       /* ok, the op-on-join,etc, tests...first only both if Im opped */
       if (me_op(chan) || me_halfop(chan)) {
-	/* Check for and reset exempts and invites.
-	 *
-	 * This will require further checking to account for when to use the
-	 * various modes.
-	 */
-	if (u_match_mask(global_invites,from) ||
-	    u_match_mask(chan->invites, from))
-	  refresh_invite(chan, from);
-	if (!(use_exempts &&
-	      (u_match_mask(global_exempts,from) ||
-	       u_match_mask(chan->exempts, from)))) {
+        /* Check for and reset exempts and invites.
+         *
+         * This will require further checking to account for when to use the
+         * various modes.
+         */
+        if (u_match_mask(global_invites, from) ||
+            u_match_mask(chan->invites, from))
+          refresh_invite(chan, from);
+        if (!(use_exempts && (u_match_mask(global_exempts, from) ||
+            u_match_mask(chan->exempts, from)))) {
           if (channel_enforcebans(chan) && !chan_op(fr) && !glob_op(fr) &&
               !glob_friend(fr) && !chan_friend(fr) && !chan_sentkick(m) &&
               !(use_exempts && isexempted(chan, from)) && (me_op(chan) ||
-	      (me_halfop(chan) && !chan_hasop(m)))) {
+              (me_halfop(chan) && !chan_hasop(m)))) {
             for (b = chan->channel.ban; b->mask[0]; b = b->next) {
               if (wild_match(b->mask, from)) {
                 dprintf(DP_SERVER, "KICK %s %s :%s\n", chname, m->nick,
@@ -1782,48 +1788,48 @@
               }
             }
           }
-	  /* If it matches a ban, dispose of them. */
-	  if (u_match_mask(global_bans, from) ||
-	      u_match_mask(chan->bans, from)) {
-	    refresh_ban_kick(chan, from, nick);
-	  /* Likewise for kick'ees */
-	  } else if (!chan_sentkick(m) && (glob_kick(fr) || chan_kick(fr)) &&
-		     (me_op(chan) || (me_halfop(chan) && !chan_hasop(m)))) {
-	    check_exemptlist(chan, from);
-	    quickban(chan, from);
-	    p = get_user(&USERENTRY_COMMENT, m->user);
-	    dprintf(DP_MODE, "KICK %s %s :%s\n", chname, nick,
-		    (p && (p[0] != '@')) ? p : IRC_COMMENTKICK);
-	    m->flags |= SENTKICK;
-	  }
-	}
-	if ((chan_op(fr) || (glob_op(fr) && !chan_deop(fr))) &&
-	    (channel_autoop(chan) || glob_autoop(fr) || chan_autoop(fr))) {
-	  if (!chan->aop_min)
-	    add_mode(chan, '+', 'o', nick);
-	  else {
+          /* If it matches a ban, dispose of them. */
+          if (u_match_mask(global_bans, from) || u_match_mask(chan->bans, from))
+            refresh_ban_kick(chan, from, nick);
+          else if (!chan_sentkick(m) && (glob_kick(fr) || chan_kick(fr)) &&
+                   (me_op(chan) || (me_halfop(chan) && !chan_hasop(m)))) {
+            check_exemptlist(chan, from);
+            quickban(chan, from);
+            p = get_user(&USERENTRY_COMMENT, m->user);
+            dprintf(DP_MODE, "KICK %s %s :%s\n", chname, nick,
+                    (p && (p[0] != '@')) ? p : IRC_COMMENTKICK);
+            m->flags |= SENTKICK;
+          }
+        }
+        if ((chan_op(fr) || (glob_op(fr) && !chan_deop(fr))) &&
+            (channel_autoop(chan) || glob_autoop(fr) || chan_autoop(fr))) {
+          if (!chan->aop_min)
+            add_mode(chan, '+', 'o', nick);
+          else {
             set_delay(chan, nick);
             m->flags |= SENTOP;
-	  }
-	} else if ((chan_halfop(fr) || (glob_halfop(fr) && !chan_dehalfop(fr))) &&
-		   (channel_autohalfop(chan) || glob_autohalfop(fr) ||
-		   chan_autohalfop(fr))) {
-           if (!chan->aop_min)
-             add_mode(chan, '+', 'h', nick);
-           else {
-             set_delay(chan, nick);
-             m->flags |= SENTHALFOP;
-           }
-	} else if ((channel_autovoice(chan) && (chan_voice(fr) ||
-		   (glob_voice(fr) && !chan_quiet(fr)))) || ((glob_gvoice(fr) ||
-		   chan_gvoice(fr)) && !chan_quiet(fr))) {
-           if (!chan->aop_min)
-             add_mode(chan, '+', 'v', nick);
-           else {
-             set_delay(chan, nick);
-             m->flags |= SENTVOICE;
-           }
-         }
+          }
+        }
+        else if ((chan_halfop(fr) || (glob_halfop(fr) &&
+                 !chan_dehalfop(fr))) && (channel_autohalfop(chan) ||
+                 glob_autohalfop(fr) || chan_autohalfop(fr))) {
+          if (!chan->aop_min)
+            add_mode(chan, '+', 'h', nick);
+          else {
+            set_delay(chan, nick);
+            m->flags |= SENTHALFOP;
+          }
+        }
+        else if ((channel_autovoice(chan) && (chan_voice(fr) ||
+                 (glob_voice(fr) && !chan_quiet(fr)))) || ((glob_gvoice(fr) ||
+                 chan_gvoice(fr)) && !chan_quiet(fr))) {
+          if (!chan->aop_min)
+            add_mode(chan, '+', 'v', nick);
+          else {
+            set_delay(chan, nick);
+            m->flags |= SENTVOICE;
+          }
+        }
       }
     }
   }
@@ -1857,33 +1863,38 @@
     if (!channel_active(chan)) {
       /* whoa! */
       putlog(LOG_MISC, chan->dname,
-	  "confused bot: guess I'm on %s and didn't realize it", chan->dname);
+             "confused bot: guess I'm on %s and didn't realize it",
+             chan->dname);
       chan->status |= CHAN_ACTIVE;
       chan->status &= ~CHAN_PEND;
       reset_chan_info(chan);
     }
     set_handle_laston(chan->dname, u, now);
-    check_tcl_part(nick, from, u, chan->dname, msg); /* This must be directly above the killmember, in case
-    							we're doing anything to the record that would affect
-							the above */
+    /* This must be directly above the killmember, in case we're doing anything
+     * to the record that would affect the above */
+    check_tcl_part(nick, from, u, chan->dname, msg);
+
     chan = findchan(chname);
     if (!chan)
       return 0;
 
     killmember(chan, nick);
     if (msg[0])
-      putlog(LOG_JOIN, chan->dname, "%s (%s) left %s (%s).", nick, from, chan->dname, msg);
+      putlog(LOG_JOIN, chan->dname, "%s (%s) left %s (%s).", nick, from,
+             chan->dname, msg);
     else
-      putlog(LOG_JOIN, chan->dname, "%s (%s) left %s.", nick, from, chan->dname);
+      putlog(LOG_JOIN, chan->dname, "%s (%s) left %s.", nick, from,
+             chan->dname);
     /* If it was me, all hell breaks loose... */
     if (match_my_nick(nick)) {
       clear_channel(chan, 1);
       chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
       if (!channel_inactive(chan))
-	dprintf(DP_MODE, "JOIN %s %s\n",
-	        (chan->name[0]) ? chan->name : chan->dname,
-	        chan->channel.key[0] ? chan->channel.key : chan->key_prot);
-    } else
+        dprintf(DP_MODE, "JOIN %s %s\n",
+                (chan->name[0]) ? chan->name : chan->dname,
+                chan->channel.key[0] ? chan->channel.key : chan->key_prot);
+    }
+    else
       check_lonely_channel(chan);
   }
   return 0;
@@ -1898,7 +1909,7 @@
   memberlist *m;
   struct chanset_t *chan;
   struct userrec *u;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   strncpy(buf2, origmsg, 510);
   buf2[510] = 0;
@@ -1914,7 +1925,7 @@
             (chan->name[0]) ? chan->name : chan->dname,
             chan->channel.key[0] ? chan->channel.key : chan->key_prot);
     clear_channel(chan, 1);
-    return 0; /* rejoin if kicked before getting needed info <Wcc[08/08/02]> */
+    return 0;                   /* rejoin if kicked before getting needed info <Wcc[08/08/02]> */
   }
   if (channel_active(chan)) {
     fixcolon(msg);
@@ -1925,7 +1936,7 @@
 
     chan = findchan(chname);
     if (!chan)
-      return 0;     
+      return 0;
 
     m = ismember(chan, whodid);
     if (m)
@@ -1934,7 +1945,7 @@
     get_user_flagrec(u, &fr, chan->dname);
     set_handle_laston(chan->dname, u, now);
     check_tcl_kick(whodid, uhost, u, chan->dname, nick, msg);
- 
+
     chan = findchan(chname);
     if (!chan)
       return 0;
@@ -1949,7 +1960,7 @@
       maybe_revenge(chan, from, s1, REVENGE_KICK);
     }
     putlog(LOG_MODES, chan->dname, "%s kicked from %s by %s: %s", s1,
-	   chan->dname, from, msg);
+           chan->dname, from, msg);
     /* Kicked ME?!? the sods! */
     if (match_my_nick(nick)) {
       chan->status &= ~(CHAN_ACTIVE | CHAN_PEND);
@@ -1957,7 +1968,8 @@
               (chan->name[0]) ? chan->name : chan->dname,
               chan->channel.key[0] ? chan->channel.key : chan->key_prot);
       clear_channel(chan, 1);
-    } else {
+    }
+    else {
       killmember(chan, nick);
       check_lonely_channel(chan);
     }
@@ -1974,32 +1986,32 @@
   memberlist *m, *mm;
   struct chanset_t *chan, *oldchan = NULL;
   struct userrec *u;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   strcpy(uhost, from);
   nick = splitnick(&uhost);
   fixcolon(msg);
-  clear_chanlist_member(nick);	/* Cache for nick 'nick' is meaningless now. */
+  clear_chanlist_member(nick);  /* Cache for nick 'nick' is meaningless now. */
   for (chan = chanset; chan; chan = chan->next) {
     oldchan = chan;
-    chname = chan->dname; 
+    chname = chan->dname;
     m = ismember(chan, nick);
     if (m) {
       putlog(LOG_JOIN, chan->dname, "Nick change: %s -> %s", nick, msg);
       m->last = now;
       if (rfc_casecmp(nick, msg)) {
-	/* Not just a capitalization change */
-	mm = ismember(chan, msg);
-	if (mm) {
-	  /* Someone on channel with old nick?! */
-	  if (mm->split)
-	    putlog(LOG_JOIN, chan->dname,
-		   "Possible future nick collision: %s", mm->nick);
-	  else
-	    putlog(LOG_MISC, chan->dname,
-		   "* Bug: nick change to existing nick");
-	  killmember(chan, mm->nick);
-	}
+        /* Not just a capitalization change */
+        mm = ismember(chan, msg);
+        if (mm) {
+          /* Someone on channel with old nick?! */
+          if (mm->split)
+            putlog(LOG_JOIN, chan->dname,
+                   "Possible future nick collision: %s", mm->nick);
+          else
+            putlog(LOG_MISC, chan->dname,
+                   "* Bug: nick change to existing nick");
+          killmember(chan, mm->nick);
+        }
       }
       /*
        * Banned?
@@ -2015,30 +2027,31 @@
       }
       /* don't fill the serverqueue with modes or kicks in a nickflood */
       if (chan_sentkick(m) || chan_sentdeop(m) || chan_sentop(m) ||
-	  chan_sentdehalfop(m) || chan_senthalfop(m) || chan_sentdevoice(m) ||
-	  chan_sentvoice(m))
-	m->flags |= STOPCHECK;
+          chan_sentdehalfop(m) || chan_senthalfop(m) || chan_sentdevoice(m) ||
+          chan_sentvoice(m))
+        m->flags |= STOPCHECK;
       /* Any pending kick or mode to the old nick is lost. */
-	m->flags &= ~(SENTKICK | SENTDEOP | SENTOP | SENTDEHALFOP | SENTHALFOP |
-		      SENTVOICE | SENTDEVOICE);
+      m->flags &= ~(SENTKICK | SENTDEOP | SENTOP | SENTDEHALFOP | SENTHALFOP |
+                    SENTVOICE | SENTDEVOICE);
       /* nick-ban or nick is +k or something? */
       if (!chan_stopcheck(m)) {
-	get_user_flagrec(m->user ? m->user : get_user_by_host(s1), &fr, chan->dname);
-	check_this_member(chan, m->nick, &fr);
-      }
-      u = get_user_by_host(from); /* make sure this is in the loop, someone could have changed the record
-                                     in an earlier iteration of the loop */
+        get_user_flagrec(m->user ? m->user : get_user_by_host(s1), &fr,
+                         chan->dname);
+        check_this_member(chan, m->nick, &fr);
+      }
+      /* Make sure this is in the loop, someone could have changed the record
+       * in an earlier iteration of the loop. */
+      u = get_user_by_host(from);
       found = 1;
       check_tcl_nick(nick, uhost, u, chan->dname, msg);
-    
+
       if (!findchan_by_dname(chname)) {
-	chan = oldchan;
+        chan = oldchan;
         continue;
       }
     }
   }
-  if (!found)
-  {
+  if (!found) {
     u = get_user_by_host(from);
     s1[0] = '*';
     s1[1] = 0;
@@ -2058,7 +2071,7 @@
   struct chanset_t *chan, *oldchan = NULL;
   struct userrec *u;
 
-  strcpy(from2,from);
+  strcpy(from2, from);
   u = get_user_by_host(from2);
   nick = splitnick(&from);
   fixcolon(msg);
@@ -2074,12 +2087,13 @@
     z1 = strchr(p + 1, '.');
     z2 = strchr(msg, '.');
     if (z1 && z2 && (*(z1 + 1) != 0) && (z1 - 1 != p) &&
-	(z2 + 1 != p) && (z2 != msg)) {
+        (z2 + 1 != p) && (z2 != msg)) {
       /* Server split, or else it looked like it anyway (no harm in
        * assuming)
        */
       split = 1;
-    } else
+    }
+    else
       *p = ' ';
   }
   for (chan = chanset; chan; chan = chan->next) {
@@ -2088,32 +2102,31 @@
     m = ismember(chan, nick);
     if (m) {
       u = get_user_by_host(from2);
-      if (u) {
-        set_handle_laston(chan->dname, u, now); /* If you remove this, the bot will crash when the user record in question
-						   is removed/modified during the tcl binds below, and the users was on more
-						   than one monitored channel */
-      }
+      if (u)
+        /* If you remove this, the bot will crash when the user record in
+         * question is removed/modified during the tcl binds below, and the
+         * users was on more than one monitored channel */
+        set_handle_laston(chan->dname, u, now); 
       if (split) {
-	m->split = now;
-	check_tcl_splt(nick, from, u, chan->dname);
+        m->split = now;
+        check_tcl_splt(nick, from, u, chan->dname);
 
-	if (!findchan_by_dname(chname)) {
+        if (!findchan_by_dname(chname)) {
           chan = oldchan;
-	  continue;
+          continue;
         }
-	putlog(LOG_JOIN, chan->dname, "%s (%s) got netsplit.", nick,
-	       from);
-      } else {
-	check_tcl_sign(nick, from, u, chan->dname, msg);
-
-	if (!findchan_by_dname(chname)) {
-	  chan = oldchan;
-	  continue;
-	}
-	putlog(LOG_JOIN, chan->dname, "%s (%s) left irc: %s", nick,
-	       from, msg);
-	killmember(chan, nick);
-	check_lonely_channel(chan);
+        putlog(LOG_JOIN, chan->dname, "%s (%s) got netsplit.", nick, from);
+      }
+      else {
+        check_tcl_sign(nick, from, u, chan->dname, msg);
+
+        if (!findchan_by_dname(chname)) {
+          chan = oldchan;
+          continue;
+        }
+        putlog(LOG_JOIN, chan->dname, "%s (%s) left irc: %s", nick, from, msg);
+        killmember(chan, nick);
+        check_lonely_channel(chan);
       }
     }
   }
@@ -2125,10 +2138,11 @@
     if (!rfc_casecmp(nick, origbotname)) {
       putlog(LOG_MISC, "*", IRC_GETORIGNICK, origbotname);
       dprintf(DP_SERVER, "NICK %s\n", origbotname);
-    } else if (alt[0]) {
+    }
+    else if (alt[0]) {
       if (!rfc_casecmp(nick, alt) && strcmp(botname, origbotname)) {
-	putlog(LOG_MISC, "*", IRC_GETALTNICK, alt);
-	dprintf(DP_SERVER, "NICK %s\n", alt);
+        putlog(LOG_MISC, "*", IRC_GETALTNICK, alt);
+        dprintf(DP_SERVER, "NICK %s\n", alt);
       }
     }
   }
@@ -2146,7 +2160,7 @@
   int ignoring;
   struct userrec *u;
   memberlist *m;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   if (!strchr("&#!+@$", msg[0]))
     return 0;
@@ -2155,7 +2169,7 @@
   realto = (to[0] == '@') ? to + 1 : to;
   chan = findchan(realto);
   if (!chan)
-    return 0;			/* Private msg to an unknown channel?? */
+    return 0;                   /* Private msg to an unknown channel?? */
   fixcolon(msg);
   strcpy(uhost, from);
   nick = splitnick(&uhost);
@@ -2166,33 +2180,30 @@
     m = ismember(chan, nick);
     /* Discard -- kick user if it was to the channel */
     if ((me_op(chan) || (me_halfop(chan) && !chan_hasop(m))) && m &&
-	!chan_sentkick(m) && !chan_friend(fr) && !glob_friend(fr) &&
-	!(channel_dontkickops(chan) &&
-	  (chan_op(fr) || (glob_op(fr) && !chan_deop(fr)))) &&	/* arthur2 */
-	!(use_exempts && ban_fun &&
-	  /* don't kickban if permanent exempted -- Eule */
-	  (u_match_mask(global_exempts, from) ||
-	   u_match_mask(chan->exempts, from)))) {
+        !chan_sentkick(m) && !chan_friend(fr) && !glob_friend(fr) &&
+        !(channel_dontkickops(chan) && (chan_op(fr) || (glob_op(fr) &&
+        !chan_deop(fr)))) && !(use_exempts && ban_fun &&
+        (u_match_mask(global_exempts, from) ||
+        u_match_mask(chan->exempts, from)))) {
       if (ban_fun) {
-	check_exemptlist(chan, from);
-	u_addban(chan, quickban(chan, uhost), botnetnick,
-		IRC_FUNKICK, now + (60 * chan->ban_time), 0);
+        check_exemptlist(chan, from);
+        u_addban(chan, quickban(chan, uhost), botnetnick,
+                 IRC_FUNKICK, now + (60 * chan->ban_time), 0);
       }
       if (kick_fun) {
-	/* This can induce kickflood - arthur2 */
-	dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, nick,
-		IRC_FUNKICK);
-	m->flags |= SENTKICK;
+        /* This can induce kickflood - arthur2 */
+        dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, nick, IRC_FUNKICK);
+        m->flags |= SENTKICK;
       }
     }
     if (!ignoring) {
       putlog(LOG_MODES, "*", "Avalanche from %s!%s in %s - ignoring",
-	     nick, uhost, chan->dname);
+             nick, uhost, chan->dname);
       p = strchr(uhost, '@');
       if (p)
-	p++;
+        p++;
       else
-	p = uhost;
+        p = uhost;
       simple_sprintf(buf2, "*!*@%s", p);
       addignore(buf2, botnetnick, "ctcp avalanche", now + (60 * ignore_time));
     }
@@ -2212,8 +2223,8 @@
       strcpy(ctcp, p1);
       strcpy(p1 - 1, p + 1);
       detect_chan_flood(nick, uhost, from, chan,
-			strncmp(ctcp, "ACTION ", 7) ?
-			FLOOD_CTCP : FLOOD_PRIVMSG, NULL);
+                        strncmp(ctcp, "ACTION ", 7) ?
+                        FLOOD_CTCP : FLOOD_PRIVMSG, NULL);
 
       chan = findchan(realto);
       if (!chan)
@@ -2222,31 +2233,32 @@
       /* Respond to the first answer_ctcp */
       p = strchr(msg, 1);
       if (ctcp_count < answer_ctcp) {
-	ctcp_count++;
-	if (ctcp[0] != ' ') {
-	  code = newsplit(&ctcp);
-	  u = get_user_by_host(from);
-	  if (!ignoring || trigger_on_ignore) {
-	    if (!check_tcl_ctcp(nick, uhost, u, to, code, ctcp)) {
-
-	      chan = findchan(realto); 
-	      if (!chan)
-		return 0;
+        ctcp_count++;
+        if (ctcp[0] != ' ') {
+          code = newsplit(&ctcp);
+          u = get_user_by_host(from);
+          if (!ignoring || trigger_on_ignore) {
+            if (!check_tcl_ctcp(nick, uhost, u, to, code, ctcp)) {
+
+              chan = findchan(realto);
+              if (!chan)
+                return 0;
 
-	      update_idle(chan->dname, nick);
+              update_idle(chan->dname, nick);
+            }
+            if (!ignoring) {
+              /* Log DCC, it's to a channel damnit! */
+              if (!strcmp(code, "ACTION")) {
+                putlog(LOG_PUBLIC, chan->dname, "Action: %s %s", nick, ctcp);
+              }
+              else {
+                putlog(LOG_PUBLIC, chan->dname,
+                       "CTCP %s: %s from %s (%s) to %s", code, ctcp, nick,
+                       from, to);
+              }
             }
-	    if (!ignoring) {
-	      /* Log DCC, it's to a channel damnit! */
-	      if (!strcmp(code, "ACTION")) {
-		putlog(LOG_PUBLIC, chan->dname, "Action: %s %s", nick, ctcp);
-	      } else {
-		putlog(LOG_PUBLIC, chan->dname,
-		       "CTCP %s: %s from %s (%s) to %s", code, ctcp, nick,
-		       from, to);
-	      }
-	    }
-	  }
-	}
+          }
+        }
       }
     }
   }
@@ -2254,13 +2266,15 @@
   if (ctcp_reply[0]) {
     if (ctcp_mode != 2) {
       dprintf(DP_HELP, "NOTICE %s :%s\n", nick, ctcp_reply);
-    } else {
+    }
+    else {
       if (now - last_ctcp > flud_ctcp_time) {
-	dprintf(DP_HELP, "NOTICE %s :%s\n", nick, ctcp_reply);
-	count_ctcp = 1;
-      } else if (count_ctcp < flud_ctcp_thr) {
-	dprintf(DP_HELP, "NOTICE %s :%s\n", nick, ctcp_reply);
-	count_ctcp++;
+        dprintf(DP_HELP, "NOTICE %s :%s\n", nick, ctcp_reply);
+        count_ctcp = 1;
+      }
+      else if (count_ctcp < flud_ctcp_thr) {
+        dprintf(DP_HELP, "NOTICE %s :%s\n", nick, ctcp_reply);
+        count_ctcp++;
       }
       last_ctcp = now;
     }
@@ -2275,19 +2289,19 @@
 
     if (!ignoring || trigger_on_ignore) {
       if (check_tcl_pub(nick, uhost, chan->dname, msg))
-	return 0;
+        return 0;
       check_tcl_pubm(nick, uhost, chan->dname, msg);
 
       chan = findchan(realto);
       if (!chan)
-	return 0;
+        return 0;
 
     }
     if (!ignoring) {
       if (to[0] == '@')
-	putlog(LOG_PUBLIC, chan->dname, "@<%s> %s", nick, msg);
+        putlog(LOG_PUBLIC, chan->dname, "@<%s> %s", nick, msg);
       else
-	putlog(LOG_PUBLIC, chan->dname, "<%s> %s", nick, msg);
+        putlog(LOG_PUBLIC, chan->dname, "<%s> %s", nick, msg);
     }
     update_idle(chan->dname, nick);
   }
@@ -2303,7 +2317,7 @@
   struct userrec *u;
   memberlist *m;
   struct chanset_t *chan;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   int ignoring;
 
   if (!strchr(CHANMETA "@", *msg))
@@ -2313,7 +2327,7 @@
   realto = (*to == '@') ? to + 1 : to;
   chan = findchan(realto);
   if (!chan)
-    return 0;			/* Notice to an unknown channel?? */
+    return 0;                   /* Notice to an unknown channel?? */
   fixcolon(msg);
   strcpy(uhost, from);
   nick = splitnick(&uhost);
@@ -2322,24 +2336,20 @@
     get_user_flagrec(u, &fr, chan->dname);
     m = ismember(chan, nick);
     /* Discard -- kick user if it was to the channel */
-    if (me_op(chan) && m && !chan_sentkick(m) &&
-	!chan_friend(fr) && !glob_friend(fr) &&
-	!(channel_dontkickops(chan) &&
-	  (chan_op(fr) || (glob_op(fr) && !chan_deop(fr)))) &&	/* arthur2 */
-	!(use_exempts && ban_fun &&
-	  /* don't kickban if permanent exempted -- Eule */
-	  (u_match_mask(global_exempts,from) ||
-	   u_match_mask(chan->exempts, from)))) {
+    if (me_op(chan) && m && !chan_sentkick(m) && !chan_friend(fr) &&
+        !glob_friend(fr) && !(channel_dontkickops(chan) && (chan_op(fr) ||
+        (glob_op(fr) && !chan_deop(fr)))) && !(use_exempts && ban_fun &&
+        (u_match_mask(global_exempts, from) ||
+        u_match_mask(chan->exempts, from)))) {
       if (ban_fun) {
-	check_exemptlist(chan, from);
-	u_addban(chan, quickban(chan, uhost), botnetnick,
-		IRC_FUNKICK, now + (60 * chan->ban_time), 0);
+        check_exemptlist(chan, from);
+        u_addban(chan, quickban(chan, uhost), botnetnick,
+                 IRC_FUNKICK, now + (60 * chan->ban_time), 0);
       }
       if (kick_fun) {
-	/* This can induce kickflood - arthur2 */
-	dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, nick,
-		IRC_FUNKICK);
-	m->flags |= SENTKICK;
+        /* This can induce kickflood - arthur2 */
+        dprintf(DP_SERVER, "KICK %s %s :%s\n", chan->name, nick, IRC_FUNKICK);
+        m->flags |= SENTKICK;
       }
     }
     if (!ignoring)
@@ -2360,28 +2370,29 @@
       strcpy(p1 - 1, p + 1);
       p = strchr(msg, 1);
       detect_chan_flood(nick, uhost, from, chan,
-			strncmp(ctcp, "ACTION ", 7) ?
-			FLOOD_CTCP : FLOOD_PRIVMSG, NULL);
+                        strncmp(ctcp, "ACTION ", 7) ?
+                        FLOOD_CTCP : FLOOD_PRIVMSG, NULL);
 
-      chan = findchan(realto); 
+      chan = findchan(realto);
       if (!chan)
-	return 0;
+        return 0;
 
       if (ctcp[0] != ' ') {
-	code = newsplit(&ctcp);
-	if (!ignoring || trigger_on_ignore) {
-	  check_tcl_ctcr(nick, uhost, u, chan->dname, code, msg);
-
-	  chan = findchan(realto); 
-	  if (!chan)
-	    return 0;
-
-	  if (!ignoring) {
-	    putlog(LOG_PUBLIC, chan->dname, "CTCP reply %s: %s from %s (%s) to %s",
-		   code, msg, nick, from, chan->dname);
-	    update_idle(chan->dname, nick);
-	  }
-	}
+        code = newsplit(&ctcp);
+        if (!ignoring || trigger_on_ignore) {
+          check_tcl_ctcr(nick, uhost, u, chan->dname, code, msg);
+
+          chan = findchan(realto);
+          if (!chan)
+            return 0;
+
+          if (!ignoring) {
+            putlog(LOG_PUBLIC, chan->dname,
+                   "CTCP reply %s: %s from %s (%s) to %s", code, msg, nick,
+                   from, chan->dname);
+            update_idle(chan->dname, nick);
+          }
+        }
       }
     }
   }
@@ -2389,16 +2400,16 @@
     /* Check even if we're ignoring the host. (modified by Eule 17.7.99) */
     detect_chan_flood(nick, uhost, from, chan, FLOOD_NOTICE, NULL);
 
-    chan = findchan(realto); 
+    chan = findchan(realto);
     if (!chan)
       return 0;
 
     if (!ignoring || trigger_on_ignore) {
       check_tcl_notc(nick, uhost, u, to, msg);
 
-      chan = findchan(realto); 
+      chan = findchan(realto);
       if (!chan)
-	return 0;
+        return 0;
     }
 
     if (!ignoring)
@@ -2408,35 +2419,34 @@
   return 0;
 }
 
-static cmd_t irc_raw[] =
-{
-  {"324",	"",	(Function) got324,	"irc:324"},
-  {"352",	"",	(Function) got352,	"irc:352"},
-  {"354",	"",	(Function) got354,	"irc:354"},
-  {"315",	"",	(Function) got315,	"irc:315"},
-  {"367",	"",	(Function) got367,	"irc:367"},
-  {"368",	"",	(Function) got368,	"irc:368"},
-  {"403",	"",	(Function) got403,	"irc:403"},
-  {"405",	"",	(Function) got405,	"irc:405"},
-  {"471",	"",	(Function) got471,	"irc:471"},
-  {"473",	"",	(Function) got473,	"irc:473"},
-  {"474",	"",	(Function) got474,	"irc:474"},
-  {"475",	"",	(Function) got475,	"irc:475"},
-  {"INVITE",	"",	(Function) gotinvite,	"irc:invite"},
-  {"TOPIC",	"",	(Function) gottopic,	"irc:topic"},
-  {"331",	"",	(Function) got331,	"irc:331"},
-  {"332",	"",	(Function) got332,	"irc:332"},
-  {"JOIN",	"",	(Function) gotjoin,	"irc:join"},
-  {"PART",	"",	(Function) gotpart,	"irc:part"},
-  {"KICK",	"",	(Function) gotkick,	"irc:kick"},
-  {"NICK",	"",	(Function) gotnick,	"irc:nick"},
-  {"QUIT",	"",	(Function) gotquit,	"irc:quit"},
-  {"PRIVMSG",	"",	(Function) gotmsg,	"irc:msg"},
-  {"NOTICE",	"",	(Function) gotnotice,	"irc:notice"},
-  {"MODE",	"",	(Function) gotmode,	"irc:mode"},
-  {"346",	"",	(Function) got346,	"irc:346"},
-  {"347",	"",	(Function) got347,	"irc:347"},
-  {"348",	"",	(Function) got348,	"irc:348"},
-  {"349",	"",	(Function) got349,	"irc:349"},
-  {NULL,	NULL,	NULL,			NULL}
+static cmd_t irc_raw[] = {
+  {"324",     "",   (Function) got324,       "irc:324"},
+  {"352",     "",   (Function) got352,       "irc:352"},
+  {"354",     "",   (Function) got354,       "irc:354"},
+  {"315",     "",   (Function) got315,       "irc:315"},
+  {"367",     "",   (Function) got367,       "irc:367"},
+  {"368",     "",   (Function) got368,       "irc:368"},
+  {"403",     "",   (Function) got403,       "irc:403"},
+  {"405",     "",   (Function) got405,       "irc:405"},
+  {"471",     "",   (Function) got471,       "irc:471"},
+  {"473",     "",   (Function) got473,       "irc:473"},
+  {"474",     "",   (Function) got474,       "irc:474"},
+  {"475",     "",   (Function) got475,       "irc:475"},
+  {"INVITE",  "",   (Function) gotinvite, "irc:invite"},
+  {"TOPIC",   "",   (Function) gottopic,   "irc:topic"},
+  {"331",     "",   (Function) got331,       "irc:331"},
+  {"332",     "",   (Function) got332,       "irc:332"},
+  {"JOIN",    "",   (Function) gotjoin,     "irc:join"},
+  {"PART",    "",   (Function) gotpart,     "irc:part"},
+  {"KICK",    "",   (Function) gotkick,     "irc:kick"},
+  {"NICK",    "",   (Function) gotnick,     "irc:nick"},
+  {"QUIT",    "",   (Function) gotquit,     "irc:quit"},
+  {"PRIVMSG", "",   (Function) gotmsg,       "irc:msg"},
+  {"NOTICE",  "",   (Function) gotnotice, "irc:notice"},
+  {"MODE",    "",   (Function) gotmode,     "irc:mode"},
+  {"346",     "",   (Function) got346,       "irc:346"},
+  {"347",     "",   (Function) got347,       "irc:347"},
+  {"348",     "",   (Function) got348,       "irc:348"},
+  {"349",     "",   (Function) got349,       "irc:349"},
+  {NULL,      NULL, NULL,                         NULL}
 };
Index: eggdrop1.6/src/mod/irc.mod/cmdsirc.c
diff -u eggdrop1.6/src/mod/irc.mod/cmdsirc.c:1.46 eggdrop1.6/src/mod/irc.mod/cmdsirc.c:1.47
--- eggdrop1.6/src/mod/irc.mod/cmdsirc.c:1.46	Mon Dec 23 20:30:08 2002
+++ eggdrop1.6/src/mod/irc.mod/cmdsirc.c	Tue Jan 28 00:37:26 2003
@@ -2,7 +2,7 @@
  * chancmds.c -- part of irc.mod
  *   handles commands directly relating to channel interaction
  *
- * $Id: cmdsirc.c,v 1.46 2002/12/24 02:30:08 wcc Exp $
+ * $Id: cmdsirc.c,v 1.47 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -35,7 +35,8 @@
       dprintf(idx, "No such channel.\n");
       return 0;
     }
-  } else {
+  }
+  else {
     chname = dcc[idx].u.chat->con_chan;
     chan = findchan_by_dname(chname);
     if (!chan) {
@@ -60,7 +61,8 @@
       dprintf(idx, "No such channel.\n");
       return 0;
     }
-  } else {
+  }
+  else {
     chname = dcc[idx].u.chat->con_chan;
     chan = findchan_by_dname(chname);
     if (!chan) {
@@ -81,9 +83,9 @@
  */
 static char *getnick(char *handle, struct chanset_t *chan)
 {
-  char			 s[UHOSTLEN];
-  struct userrec	*u;
-  register memberlist	*m;
+  char s[UHOSTLEN];
+  struct userrec *u;
+  register memberlist *m;
 
   for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
     egg_snprintf(s, sizeof s, "%s!%s", m->nick, m->userhost);
@@ -119,10 +121,8 @@
     dprintf(idx, "Cannot say to %s: It is moderated.\n", chan->dname);
     return;
   }
-  putlog(LOG_CMDS, "*", "#%s# (%s) act %s", dcc[idx].nick,
-	 chan->dname, par);
-  dprintf(DP_HELP, "PRIVMSG %s :\001ACTION %s\001\n",
-	  chan->name, par);
+  putlog(LOG_CMDS, "*", "#%s# (%s) act %s", dcc[idx].nick, chan->dname, par);
+  dprintf(DP_HELP, "PRIVMSG %s :\001ACTION %s\001\n", chan->name, par);
   dprintf(idx, "Action to %s: %s\n", chan->dname, par);
 }
 
@@ -131,9 +131,9 @@
   char *nick;
 
   nick = newsplit(&par);
-  if (!par[0]) {
+  if (!par[0])
     dprintf(idx, "Usage: msg <nick> <message>\n");
-  } else {
+  else {
     putlog(LOG_CMDS, "*", "#%s# msg %s %s", dcc[idx].nick, nick, par);
     dprintf(DP_HELP, "PRIVMSG %s :%s\n", nick, par);
     dprintf(idx, "Msg to %s: %s\n", nick, par);
@@ -195,11 +195,11 @@
   }
   if (!me_op(chan) && !me_halfop(chan)) {
     dprintf(idx, "I can't help you now because I'm not a channel op or halfop"
-	    " on %s.\n", chan->dname);
+            " on %s.\n", chan->dname);
     return;
   }
   putlog(LOG_CMDS, "*", "#%s# (%s) kickban %s", dcc[idx].nick,
-	 chan->dname, par);
+         chan->dname, par);
   nick = newsplit(&par);
   if ((nick[0] == '@') || (nick[0] == '-')) {
     bantype = nick[0];
@@ -235,7 +235,7 @@
     dprintf(idx, "%s is another channel bot!\n", nick);
     return;
   }
-  if (use_exempts && (u_match_mask(global_exempts,s) ||
+  if (use_exempts && (u_match_mask(global_exempts, s) ||
       u_match_mask(chan->exempts, s))) {
     dprintf(idx, "%s is permanently exempted!\n", nick);
     return;
@@ -244,22 +244,22 @@
     add_mode(chan, '-', 'o', m->nick);
   check_exemptlist(chan, s);
   switch (bantype) {
-    case '@':
-      s1 = strchr(s, '@');
-      s1 -= 3;
-      s1[0] = '*';
-      s1[1] = '!';
-      s1[2] = '*';
-      break;
-    case '-':
-      s1 = strchr(s, '!');
-      s1[1] = '*';
-      s1--;
-      s1[0] = '*';
-      break;
-    default:
-      s1 = quickban(chan, m->userhost);
-      break;
+  case '@':
+    s1 = strchr(s, '@');
+    s1 -= 3;
+    s1[0] = '*';
+    s1[1] = '!';
+    s1[2] = '*';
+    break;
+  case '-':
+    s1 = strchr(s, '!');
+    s1[1] = '*';
+    s1--;
+    s1[0] = '*';
+    break;
+  default:
+    s1 = quickban(chan, m->userhost);
+    break;
   }
   if (bantype == '@' || bantype == '-')
     do_mask(chan, chan->channel.ban, s1, 'b');
@@ -291,11 +291,10 @@
   }
   if (!me_op(chan) && !me_halfop(chan)) {
     dprintf(idx, "I can't help you now because I'm not a chan op or halfop on"
-	    " %s.\n", chan->dname);
+            " %s.\n", chan->dname);
     return;
   }
-  putlog(LOG_CMDS, "*", "#%s# (%s) voice %s", dcc[idx].nick,
-	 chan->dname, nick);
+  putlog(LOG_CMDS, "*", "#%s# (%s) voice %s", dcc[idx].nick, chan->dname, nick);
   m = ismember(chan, nick);
   if (!m) {
     dprintf(idx, "%s is not on %s.\n", nick, chan->dname);
@@ -326,11 +325,11 @@
   }
   if (!me_op(chan) && !me_halfop(chan)) {
     dprintf(idx, "I can't do that right now I'm not a chan op or halfop on"
-	    " %s.\n", chan->dname);
+            " %s.\n", chan->dname);
     return;
   }
   putlog(LOG_CMDS, "*", "#%s# (%s) devoice %s", dcc[idx].nick,
-	 chan->dname, nick);
+         chan->dname, nick);
   m = ismember(chan, nick);
   if (!m) {
     dprintf(idx, "%s is not on %s.\n", nick, chan->dname);
@@ -361,11 +360,10 @@
   }
   if (!me_op(chan)) {
     dprintf(idx, "I can't help you now because I'm not a chan op on %s.\n",
-	    chan->dname);
+            chan->dname);
     return;
   }
-  putlog(LOG_CMDS, "*", "#%s# (%s) op %s", dcc[idx].nick,
-	 chan->dname, nick);
+  putlog(LOG_CMDS, "*", "#%s# (%s) op %s", dcc[idx].nick, chan->dname, nick);
   m = ismember(chan, nick);
   if (!m) {
     dprintf(idx, "%s is not on %s.\n", nick, chan->dname);
@@ -378,8 +376,8 @@
     dprintf(idx, "%s is currently being auto-deopped.\n", m->nick);
     return;
   }
-  if (channel_bitch(chan)
-      && !(chan_op(victim) || (glob_op(victim) && !chan_deop(victim)))) {
+  if (channel_bitch(chan) && !(chan_op(victim) || (glob_op(victim) &&
+      !chan_deop(victim)))) {
     dprintf(idx, "%s is not a registered op.\n", m->nick);
     return;
   }
@@ -407,11 +405,11 @@
   }
   if (!me_op(chan)) {
     dprintf(idx, "I can't help you now because I'm not a chan op on %s.\n",
-	    chan->dname);
+            chan->dname);
     return;
   }
   putlog(LOG_CMDS, "*", "#%s# (%s) halfop %s", dcc[idx].nick,
-	 chan->dname, nick);
+         chan->dname, nick);
   m = ismember(chan, nick);
   if (!m) {
     dprintf(idx, "%s is not on %s.\n", nick, chan->dname);
@@ -424,7 +422,7 @@
     dprintf(idx, "%s is currently being auto-dehalfopped.\n", m->nick);
     return;
   }
-  if (channel_bitch(chan) && !(chan_op(victim) || chan_op(victim) || 
+  if (channel_bitch(chan) && !(chan_op(victim) || chan_op(victim) ||
       (glob_op(victim) && !chan_deop(victim)) || (glob_halfop(victim) &&
       !chan_dehalfop(victim)))) {
     dprintf(idx, "%s is not a registered halfop.\n", m->nick);
@@ -454,11 +452,10 @@
   }
   if (!me_op(chan)) {
     dprintf(idx, "I can't help you now because I'm not a chan op on %s.\n",
-	    chan->dname);
+            chan->dname);
     return;
   }
-  putlog(LOG_CMDS, "*", "#%s# (%s) deop %s", dcc[idx].nick,
-	 chan->dname, nick);
+  putlog(LOG_CMDS, "*", "#%s# (%s) deop %s", dcc[idx].nick, chan->dname, nick);
   m = ismember(chan, nick);
   if (!m) {
     dprintf(idx, "%s is not on %s.\n", nick, chan->dname);
@@ -505,11 +502,11 @@
   }
   if (!me_op(chan)) {
     dprintf(idx, "I can't help you now because I'm not a chan op on %s.\n",
-	    chan->dname);
+            chan->dname);
     return;
   }
   putlog(LOG_CMDS, "*", "#%s# (%s) dehalfop %s", dcc[idx].nick,
-	 chan->dname, nick);
+         chan->dname, nick);
   m = ismember(chan, nick);
   if (!m) {
     dprintf(idx, "%s is not on %s.\n", nick, chan->dname);
@@ -564,11 +561,10 @@
   }
   if (!me_op(chan) && !me_halfop(chan)) {
     dprintf(idx, "I can't help you now because I'm not a channel op or halfop"
-	    " on %s.\n", chan->dname);
+            " on %s.\n", chan->dname);
     return;
   }
-  putlog(LOG_CMDS, "*", "#%s# (%s) kick %s", dcc[idx].nick,
-	 chan->dname, par);
+  putlog(LOG_CMDS, "*", "#%s# (%s) kick %s", dcc[idx].nick, chan->dname, par);
   nick = newsplit(&par);
   if (!par[0])
     par = "request";
@@ -583,7 +579,7 @@
   }
   if (!me_op(chan) && chan_hasop(m)) {
     dprintf(idx, "I can't help you now because halfops cannot kick ops.\n",
-	    chan->dname);
+            chan->dname);
     return;
   }
   egg_snprintf(s, sizeof s, "%s!%s", m->nick, m->userhost);
@@ -620,11 +616,11 @@
   if (!(chan = has_oporhalfop(idx, par)))
     return;
   putlog(LOG_CMDS, "*", "#%s# (%s) invite %s", dcc[idx].nick, chan->dname,
-	 nick);
+         nick);
   if (!me_op(chan) && !me_halfop(chan)) {
     if (chan->channel.mode & CHANINV) {
       dprintf(idx, "I can't help you now because I'm not a channel op or"
-	      " halfop on %s.\n", chan->dname);
+              " halfop on %s.\n", chan->dname);
       return;
     }
     if (!channel_active(chan)) {
@@ -654,7 +650,7 @@
     return;
   chname = newsplit(&par);
   putlog(LOG_CMDS, "*", "#%s# (%s) channel", dcc[idx].nick,
-	 !chname[0] ? dcc[idx].u.chat->con_chan : chname);
+         !chname[0] ? dcc[idx].u.chat->con_chan : chname);
   if (!chname[0])
     chan = findchan_by_dname(dcc[idx].u.chat->con_chan);
   else
@@ -671,46 +667,47 @@
   else
     egg_snprintf(s1, sizeof s1, "%s %s", IRC_DESIRINGCHAN, chan->dname);
   dprintf(idx, "%s, %d member%s, mode %s:\n", s1, chan->channel.members,
-	  chan->channel.members == 1 ? "" : "s", s);
+          chan->channel.members == 1 ? "" : "s", s);
   if (chan->channel.topic)
     dprintf(idx, "%s: %s\n", IRC_CHANNELTOPIC, chan->channel.topic);
   if (channel_active(chan)) {
     /* find max nicklen and handlen */
     maxnicklen = maxhandlen = 0;
     for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-	if(strlen(m->nick) > maxnicklen)
-	    maxnicklen = strlen(m->nick);
-	if(m->user)
-	    if(strlen(m->user->handle) > maxhandlen)
-		maxhandlen = strlen(m->user->handle);
+      if (strlen(m->nick) > maxnicklen)
+        maxnicklen = strlen(m->nick);
+      if ((m->user) && (strlen(m->user->handle) > maxhandlen))
+        maxhandlen = strlen(m->user->handle);
     }
-    if(maxnicklen < 9) maxnicklen = 9;
-    if(maxhandlen < 9) maxhandlen = 9;
-    
+    if (maxnicklen < 9)
+      maxnicklen = 9;
+    if (maxhandlen < 9)
+      maxhandlen = 9;
+
     dprintf(idx, "(n = owner, m = master, o = op, d = deop, b = bot)\n");
-    egg_snprintf(format, sizeof format, " %%-%us %%-%us %%-6s %%-5s %%s\n", 
-			maxnicklen, maxhandlen);
+    egg_snprintf(format, sizeof format, " %%-%us %%-%us %%-6s %%-5s %%s\n",
+                 maxnicklen, maxhandlen);
     dprintf(idx, format, "NICKNAME", "HANDLE", " JOIN", "IDLE", "USER at HOST");
     for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
       if (m->joined > 0) {
-	if ((now - (m->joined)) > 86400)
-	  egg_strftime(s, 6, "%d%b", localtime(&(m->joined)));
-	else
-	  egg_strftime(s, 6, "%H:%M", localtime(&(m->joined)));
-      } else
-	strncpyz(s, " --- ", sizeof s);
-      if (m->user == NULL) {
-	egg_snprintf(s1, sizeof s1, "%s!%s", m->nick, m->userhost);
-	m->user = get_user_by_host(s1);
+        if ((now - (m->joined)) > 86400)
+          egg_strftime(s, 6, "%d%b", localtime(&(m->joined)));
+        else
+          egg_strftime(s, 6, "%H:%M", localtime(&(m->joined)));
       }
+      else
+        strncpyz(s, " --- ", sizeof s);
       if (m->user == NULL) {
-	strncpyz(handle, "*", sizeof handle);
-      } else {
-	strncpyz(handle, m->user->handle, sizeof handle);
+        egg_snprintf(s1, sizeof s1, "%s!%s", m->nick, m->userhost);
+        m->user = get_user_by_host(s1);
       }
+      if (m->user == NULL)
+        strncpyz(handle, "*", sizeof handle);
+      else
+        strncpyz(handle, m->user->handle, sizeof handle);
       get_user_flagrec(m->user, &user, chan->dname);
       /* Determine status char to use */
-      if (glob_bot(user) && (glob_op(user)||chan_op(user)))
+      if (glob_bot(user) && (glob_op(user) || chan_op(user)))
         atrflag = 'B';
       else if (glob_bot(user))
         atrflag = 'b';
@@ -775,49 +772,52 @@
       else if (chan_exempt(user))
         atrflag = 'e';
       else
-	atrflag = ' ';
+        atrflag = ' ';
       if (chan_hasop(m))
-	chanflag = '@';
+        chanflag = '@';
       else if (chan_hashalfop(m))
-	chanflag = '%';
+        chanflag = '%';
       else if (chan_hasvoice(m))
-	chanflag = '+';
+        chanflag = '+';
       else
-	chanflag = ' ';
+        chanflag = ' ';
       if (chan_issplit(m)) {
-        egg_snprintf(format, sizeof format, 
-			"%%c%%-%us %%-%us %%s %%c     <- netsplit, %%lus\n", 
-			maxnicklen, maxhandlen);
-	dprintf(idx, format, chanflag, m->nick, handle, s, atrflag,
-		now - (m->split));
-      } else if (!rfc_casecmp(m->nick, botname)) {
-        egg_snprintf(format, sizeof format, 
-			"%%c%%-%us %%-%us %%s %%c     <- it's me!\n", 
-			maxnicklen, maxhandlen);
-	dprintf(idx, format, chanflag, m->nick, handle, s, atrflag);
-      } else {
-	/* Determine idle time */
-	if (now - (m->last) > 86400)
-	  egg_snprintf(s1, sizeof s1, "%2lud", ((now - (m->last)) / 86400));
-	else if (now - (m->last) > 3600)
-	  egg_snprintf(s1, sizeof s1, "%2luh", ((now - (m->last)) / 3600));
-	else if (now - (m->last) > 180)
-	  egg_snprintf(s1, sizeof s1, "%2lum", ((now - (m->last)) / 60));
-	else
-	  strncpyz(s1, "   ", sizeof s1);
-	egg_snprintf(format, sizeof format, "%%c%%-%us %%-%us %%s %%c %%s  %%s\n", 
-			maxnicklen, maxhandlen);
-	dprintf(idx, format, chanflag, m->nick,	handle, s, atrflag, s1, 
-		    m->userhost);
+        egg_snprintf(format, sizeof format,
+                     "%%c%%-%us %%-%us %%s %%c     <- netsplit, %%lus\n",
+                     maxnicklen, maxhandlen);
+        dprintf(idx, format, chanflag, m->nick, handle, s, atrflag,
+                now - (m->split));
+      }
+      else if (!rfc_casecmp(m->nick, botname)) {
+        egg_snprintf(format, sizeof format,
+                     "%%c%%-%us %%-%us %%s %%c     <- it's me!\n",
+                     maxnicklen, maxhandlen);
+        dprintf(idx, format, chanflag, m->nick, handle, s, atrflag);
+      }
+      else {
+        /* Determine idle time */
+        if (now - (m->last) > 86400)
+          egg_snprintf(s1, sizeof s1, "%2lud", ((now - (m->last)) / 86400));
+        else if (now - (m->last) > 3600)
+          egg_snprintf(s1, sizeof s1, "%2luh", ((now - (m->last)) / 3600));
+        else if (now - (m->last) > 180)
+          egg_snprintf(s1, sizeof s1, "%2lum", ((now - (m->last)) / 60));
+        else
+          strncpyz(s1, "   ", sizeof s1);
+        egg_snprintf(format, sizeof format,
+                     "%%c%%-%us %%-%us %%s %%c %%s  %%s\n", maxnicklen,
+                     maxhandlen);
+        dprintf(idx, format, chanflag, m->nick, handle, s, atrflag, s1,
+                m->userhost);
       }
       if (chan_fakeop(m))
-	dprintf(idx, "    (%s)\n", IRC_FAKECHANOP);
+        dprintf(idx, "    (%s)\n", IRC_FAKECHANOP);
       if (chan_sentop(m))
-	dprintf(idx, "    (%s)\n", IRC_PENDINGOP);
+        dprintf(idx, "    (%s)\n", IRC_PENDINGOP);
       if (chan_sentdeop(m))
-	dprintf(idx, "    (%s)\n", IRC_PENDINGDEOP);
+        dprintf(idx, "    (%s)\n", IRC_PENDINGDEOP);
       if (chan_sentkick(m))
-	dprintf(idx, "    (%s)\n", IRC_PENDINGKICK);
+        dprintf(idx, "    (%s)\n", IRC_PENDINGKICK);
     }
   }
   dprintf(idx, "%s\n", IRC_ENDCHANINFO);
@@ -829,8 +829,10 @@
 
   if (par[0] && (strchr(CHANMETA, par[0]) != NULL)) {
     char *chname = newsplit(&par);
+
     chan = has_oporhalfop(idx, chname);
-  } else
+  }
+  else
     chan = has_oporhalfop(idx, "");
   if (chan) {
     if (!channel_active(chan)) {
@@ -838,20 +840,20 @@
       return;
     }
     if (!par[0]) {
-      if (chan->channel.topic) {
-	dprintf(idx, "The topic for %s is: %s\n", chan->dname,
-		chan->channel.topic);
-      } else {
-	dprintf(idx, "No topic is set for %s\n", chan->dname);
-      }
-    } else if (channel_optopic(chan) && !me_op(chan) && !me_halfop(chan)) {
+      if (chan->channel.topic)
+        dprintf(idx, "The topic for %s is: %s\n", chan->dname,
+                chan->channel.topic);
+      else
+        dprintf(idx, "No topic is set for %s\n", chan->dname);
+    }
+    else if (channel_optopic(chan) && !me_op(chan) && !me_halfop(chan))
       dprintf(idx, "I'm not a channel op or halfop on %s and the channel is"
-		  " +t.\n", chan->dname);
-    } else {
+              " +t.\n", chan->dname);
+    else {
       dprintf(DP_SERVER, "TOPIC %s :%s\n", chan->name, par);
       dprintf(idx, "Changing topic...\n");
       putlog(LOG_CMDS, "*", "#%s# (%s) topic %s", dcc[idx].nick,
-	     chan->dname, par);
+             chan->dname, par);
     }
   }
 }
@@ -905,7 +907,7 @@
   int statichost = 0;
   char *p1 = s1;
 
-  if ((!par[0]) || ((par[0]=='!') && (!par[1]))) {
+  if ((!par[0]) || ((par[0] == '!') && (!par[1]))) {
     dprintf(idx, "Usage: adduser <nick> [handle]\n");
     return;
   }
@@ -919,17 +921,19 @@
 
   if (!par[0]) {
     hand = nick;
-  } else {
+  }
+  else {
     char *p;
     int ok = 1;
 
     for (p = par; *p; p++)
       if ((*p <= 32) || (*p >= 127))
-	ok = 0;
+        ok = 0;
     if (!ok) {
       dprintf(idx, "You can't have strange characters in a nick.\n");
       return;
-    } else if (strchr("-,+*=:!.@#;$", par[0]) != NULL) {
+    }
+    else if (strchr("-,+*=:!.@#;$", par[0]) != NULL) {
       dprintf(idx, "You can't start a nick with '%c'.\n", par[0]);
       return;
     }
@@ -954,7 +958,7 @@
     return;
   }
   u = get_user_by_handle(userlist, hand);
-  if (u && (u->flags & (USER_OWNER|USER_MASTER)) &&
+  if (u && (u->flags & (USER_OWNER | USER_MASTER)) &&
       !(atr & USER_OWNER) && egg_strcasecmp(dcc[idx].nick, hand)) {
     dprintf(idx, "You can't add hostmasks to the bot owner/master.\n");
     return;
@@ -966,10 +970,10 @@
     p1 = strchr(s1, '!');
     if (strchr("~^+=-", p1[1])) {
       if (strict_host)
-	p1[1] = '?';
+        p1[1] = '?';
       else {
-	p1[1] = '!';
-	p1++;
+        p1[1] = '!';
+        p1++;
       }
     }
     p1--;
@@ -978,14 +982,15 @@
   if (!u) {
     dprintf(idx, "Added [%s]%s with no password.\n", hand, p1);
     userlist = adduser(userlist, hand, p1, "-", USER_DEFAULT);
-  } else {
+  }
+  else {
     dprintf(idx, "Added hostmask %s to %s.\n", p1, u->handle);
     addhost_by_handle(hand, p1);
     get_user_flagrec(u, &user, chan->dname);
     check_this_user(hand, 0, NULL);
   }
   putlog(LOG_CMDS, "*", "#%s# adduser %s %s", dcc[idx].nick, nick,
-	 hand == nick ? "" : hand);
+         hand == nick ? "" : hand);
 }
 
 static void cmd_deluser(struct userrec *u, int idx, char *par)
@@ -993,7 +998,7 @@
   char *nick, s[UHOSTLEN];
   struct chanset_t *chan;
   memberlist *m = NULL;
-  struct flag_record victim = {FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0};
+  struct flag_record victim = { FR_GLOBAL | FR_CHAN | FR_ANYWH, 0, 0, 0, 0, 0 };
 
   if (!par[0]) {
     dprintf(idx, "Usage: deluser <nick>\n");
@@ -1028,25 +1033,30 @@
   if ((glob_owner(victim) && egg_strcasecmp(dcc[idx].nick, nick)) ||
       isowner(u->handle)) {
     dprintf(idx, "You can't remove a bot owner!\n");
-  } else if (glob_botmast(victim) && !glob_owner(user)) {
+  }
+  else if (glob_botmast(victim) && !glob_owner(user)) {
     dprintf(idx, "You can't remove a bot master!\n");
-  } else if (chan_owner(victim) && !glob_owner(user)) {
+  }
+  else if (chan_owner(victim) && !glob_owner(user)) {
     dprintf(idx, "You can't remove a channel owner!\n");
-  } else if (chan_master(victim) && !(glob_owner(user) || chan_owner(user))) {
+  }
+  else if (chan_master(victim) && !(glob_owner(user) || chan_owner(user))) {
     dprintf(idx, "You can't remove a channel master!\n");
-  } else if (glob_bot(victim) && !glob_owner(user)) {
+  }
+  else if (glob_bot(victim) && !glob_owner(user)) {
     dprintf(idx, "You can't remove a bot!\n");
-  } else {
+  }
+  else {
     char buf[HANDLEN + 1];
 
     strncpyz(buf, u->handle, sizeof buf);
     buf[HANDLEN] = 0;
     if (deluser(u->handle)) {
-      dprintf(idx, "Deleted %s.\n", buf); /* ?!?! :) */
+      dprintf(idx, "Deleted %s.\n", buf);       /* ?!?! :) */
       putlog(LOG_CMDS, "*", "#%s# deluser %s [%s]", dcc[idx].nick, nick, buf);
-    } else {
-      dprintf(idx, "Failed.\n");
     }
+    else
+      dprintf(idx, "Failed.\n");
   }
 }
 
@@ -1060,49 +1070,49 @@
       dprintf(idx, "%s\n", IRC_NOMONITOR);
     else {
       get_user_flagrec(u, &user, par);
-      if (!glob_master(user) && !chan_master(user)) {
-	dprintf(idx, "You are not a master on %s.\n", chan->dname);
-      } else if (!channel_active(chan)) {
-	dprintf(idx, "I'm not on %s at the moment!\n", chan->dname);
-      } else {
-	putlog(LOG_CMDS, "*", "#%s# reset %s", dcc[idx].nick, par);
-	dprintf(idx, "Resetting channel info for %s...\n", chan->dname);
-	reset_chan_info(chan);
+      if (!glob_master(user) && !chan_master(user))
+        dprintf(idx, "You are not a master on %s.\n", chan->dname);
+      else if (!channel_active(chan))
+        dprintf(idx, "I'm not on %s at the moment!\n", chan->dname);
+      else {
+        putlog(LOG_CMDS, "*", "#%s# reset %s", dcc[idx].nick, par);
+        dprintf(idx, "Resetting channel info for %s...\n", chan->dname);
+        reset_chan_info(chan);
       }
     }
-  } else if (!(u->flags & USER_MASTER)) {
+  }
+  else if (!(u->flags & USER_MASTER))
     dprintf(idx, "You are not a Bot Master.\n");
-  } else {
+  else {
     putlog(LOG_CMDS, "*", "#%s# reset all", dcc[idx].nick);
     dprintf(idx, "Resetting channel info for all channels...\n");
     for (chan = chanset; chan; chan = chan->next) {
       if (channel_active(chan))
-	reset_chan_info(chan);
+        reset_chan_info(chan);
     }
   }
 }
 
-static cmd_t irc_dcc[] =
-{
-  {"adduser",		"m|m",	 (Function) cmd_adduser,		NULL},
-  {"deluser",		"m|m",	 (Function) cmd_deluser,		NULL},
-  {"reset",		"m|m",	 (Function) cmd_reset,		NULL},
-  {"resetbans",		"o|o",	 (Function) cmd_resetbans,	NULL},
-  {"resetexempts",	"o|o",	 (Function) cmd_resetexempts,	NULL},
-  {"resetinvites",	"o|o",	 (Function) cmd_resetinvites,	NULL},
-  {"act",		"o|o",	 (Function) cmd_act,		NULL},
-  {"channel",		"o|o",	 (Function) cmd_channel,		NULL},
-  {"deop",		"o|o",	 (Function) cmd_deop,		NULL},
-  {"dehalfop",		"o|o",	 (Function) cmd_dehalfop,		NULL},
-  {"invite",		"o|o",	 (Function) cmd_invite,		NULL},
-  {"kick",		"lo|lo", (Function) cmd_kick,		NULL},
-  {"kickban",		"lo|lo", (Function) cmd_kickban,		NULL},
-  {"msg",		"o",	 (Function) cmd_msg,		NULL},
-  {"voice",		"o|o",	 (Function) cmd_voice,		NULL},
-  {"devoice",		"o|o",	 (Function) cmd_devoice,		NULL},
-  {"op",		"o|o",	 (Function) cmd_op,		NULL},
-  {"halfop",		"o|o",	 (Function) cmd_halfop,		NULL},
-  {"say",		"o|o",	 (Function) cmd_say,		NULL},
-  {"topic",		"o|o",	 (Function) cmd_topic,		NULL},
-  {NULL,		NULL,	 NULL,				NULL}
+static cmd_t irc_dcc[] = {
+  {"adduser",      "m|m",   (Function) cmd_adduser,      NULL},
+  {"deluser",      "m|m",   (Function) cmd_deluser,      NULL},
+  {"reset",        "m|m",   (Function) cmd_reset,        NULL},
+  {"resetbans",    "o|o",   (Function) cmd_resetbans,    NULL},
+  {"resetexempts", "o|o",   (Function) cmd_resetexempts, NULL},
+  {"resetinvites", "o|o",   (Function) cmd_resetinvites, NULL},
+  {"act",          "o|o",   (Function) cmd_act,          NULL},
+  {"channel",      "o|o",   (Function) cmd_channel,      NULL},
+  {"deop",         "o|o",   (Function) cmd_deop,         NULL},
+  {"dehalfop",     "o|o",   (Function) cmd_dehalfop,     NULL},
+  {"invite",       "o|o",   (Function) cmd_invite,       NULL},
+  {"kick",         "lo|lo", (Function) cmd_kick,         NULL},
+  {"kickban",      "lo|lo", (Function) cmd_kickban,      NULL},
+  {"msg",          "o",     (Function) cmd_msg,          NULL},
+  {"voice",        "o|o",   (Function) cmd_voice,        NULL},
+  {"devoice",      "o|o",   (Function) cmd_devoice,      NULL},
+  {"op",           "o|o",   (Function) cmd_op,           NULL},
+  {"halfop",       "o|o",   (Function) cmd_halfop,       NULL},
+  {"say",          "o|o",   (Function) cmd_say,          NULL},
+  {"topic",        "o|o",   (Function) cmd_topic,        NULL},
+  {NULL,           NULL,    NULL,                        NULL}
 };
Index: eggdrop1.6/src/mod/irc.mod/help/set/irc.help
diff -u eggdrop1.6/src/mod/irc.mod/help/set/irc.help:1.1 eggdrop1.6/src/mod/irc.mod/help/set/irc.help:1.2
--- eggdrop1.6/src/mod/irc.mod/help/set/irc.help:1.1	Thu Oct 21 14:23:07 1999
+++ eggdrop1.6/src/mod/irc.mod/help/set/irc.help	Tue Jan 28 00:37:26 2003
@@ -29,11 +29,11 @@
 %{help=set bounce-exempts}%{+n}
 ### %bset bounce-exempts%b 0/1
    do you want the bot to reverse any +e modes set by servers?
-   this is an IRCNET feature.
+   this is an IRCnet feature.
 %{help=set bounce-invites}%{+n}
 ### %bset bounce-invites%b 0/1
    do you want the bot to reverse any +I modes set by servers?
-   this is an IRCNET feature.
+   this is an IRCnet feature.
 %{help=set bounce-modes}%{+n}
 ### %bset bounce-modes%b 0/1
    do you want the bot to reverse all server modes?
@@ -46,16 +46,16 @@
 ### %bset max-exempts%b <#>
    if there are more than max-exempts active +e modes on a channel,
    then the bot won't try to put more exemptions. thus it won't flood
-   the irc server. this is an IRCNET feature.
+   the irc server. this is an IRCnet feature.
 %{help=set max-invites}%{+n}
 ### %bset max-invites%b <#>
    if there are more than max-invites active +I modes on a channel,
    then the bot won't try to put more invitations. thus it won't flood
-   the irc server. this is an IRCNET feature.
+   the irc server. this is an IRCnet feature.
 %{help=set max-modes}%{+n}
 ### %bset max-modes%b <#>
    there is a global limit for +b/+e/+I modes. this limit is set to
-   30 on 2.10 irc servers. this is an IRCNET feature.
+   30 on 2.10 irc servers. this is an IRCnet feature.
 %{help=set kick-bogus}%{+n}
 ### %bset kick-bogus%b 0/1
    do you want the bot to kick bogus usernames?
Index: eggdrop1.6/src/mod/irc.mod/irc.c
diff -u eggdrop1.6/src/mod/irc.mod/irc.c:1.85 eggdrop1.6/src/mod/irc.mod/irc.c:1.86
--- eggdrop1.6/src/mod/irc.mod/irc.c:1.85	Tue Jan 14 19:42:21 2003
+++ eggdrop1.6/src/mod/irc.mod/irc.c	Tue Jan 28 00:37:26 2003
@@ -2,7 +2,7 @@
  * irc.c -- part of irc.mod
  *   support for channels within the bot
  *
- * $Id: irc.c,v 1.85 2003/01/15 01:42:21 wcc Exp $
+ * $Id: irc.c,v 1.86 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -40,12 +40,12 @@
 static int ctcp_mode;
 static int net_type;
 static int strict_host;
-static int wait_split = 300;		/* Time to wait for user to return from
-					   net-split. */
-static int max_bans = 20;		/* Modified by net-type 1-4 */
+static int wait_split = 300;    /* Time to wait for user to return from
+                                 * net-split. */
+static int max_bans = 20;       /* Modified by net-type 1-4 */
 static int max_exempts = 20;
 static int max_invites = 20;
-static int max_modes = 20;		/* Modified by net-type 1-4 */
+static int max_modes = 20;      /* Modified by net-type 1-4 */
 static int bounce_bans = 1;
 static int bounce_exempts = 0;
 static int bounce_invites = 0;
@@ -54,22 +54,22 @@
 static int wait_info = 15;
 static int invite_key = 1;
 static int no_chanrec_info = 0;
-static int modesperline = 3;		/* Number of modes per line to send. */
-static int mode_buf_len = 200;		/* Maximum bytes to send in 1 mode. */
-static int use_354 = 0;			/* Use ircu's short 354 /who
-					   responses. */
-static int kick_method = 1;		/* How many kicks does the irc network
-					   support at once?
-					   0 = as many as possible.
-					       (Ernst 18/3/1998) */
+static int modesperline = 3;    /* Number of modes per line to send. */
+static int mode_buf_len = 200;  /* Maximum bytes to send in 1 mode. */
+static int use_354 = 0;         /* Use ircu's short 354 /who
+                                 * responses. */
+static int kick_method = 1;     /* How many kicks does the irc network
+                                 * support at once?
+                                 * 0 = as many as possible.
+                                 * (Ernst 18/3/1998) */
 static int kick_fun = 0;
 static int ban_fun = 0;
-static int keepnick = 1;		/* Keep nick */
-static int prevent_mixing = 1;		/* To prevent mixing old/new modes */
-static int rfc_compliant = 1;		/* net-type changing modifies this */
+static int keepnick = 1;        /* Keep nick */
+static int prevent_mixing = 1;  /* To prevent mixing old/new modes */
+static int rfc_compliant = 1;   /* net-type changing modifies this */
 
-static int include_lk = 1;		/* For correct calculation
-					   in real_add_mode. */
+static int include_lk = 1;      /* For correct calculation
+                                 * in real_add_mode. */
 
 #include "chan.c"
 #include "mode.c"
@@ -82,8 +82,8 @@
  * true (1) if we want to, false (0) if not.
  */
 static int want_to_revenge(struct chanset_t *chan, struct userrec *u,
-			   struct userrec *u2, char *badnick, char *victim,
-			   int mevictim)
+                           struct userrec *u2, char *badnick, char *victim,
+                           int mevictim)
 {
   struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
@@ -94,28 +94,19 @@
   get_user_flagrec(u, &fr, chan->dname);
 
   /* Kickee is not a friend? */
-  if (!chan_friend(fr) && !glob_friend(fr) &&
-      /* ... and they didn't kick themself? */
-      rfc_casecmp(badnick, victim)) {
-    /* They kicked me? */
-    if (mevictim) {
-      /* ... and I'm allowed to take revenge? <snicker> */
-      if (channel_revengebot(chan))
-        return 1;
-    /* Do we revenge for our users ... and do we actually know the victim? */
-    } else if (channel_revenge(chan) && u2) {
+  if (!chan_friend(fr) && !glob_friend(fr) && rfc_casecmp(badnick, victim)) {
+    if (mevictim && channel_revengebot(chan))
+      return 1;
+    else if (channel_revenge(chan) && u2) {
       struct flag_record fr2 = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
       get_user_flagrec(u2, &fr2, chan->dname);
       /* Protecting friends? */
-      if ((channel_protectfriends(chan) &&
-	   /* ... and victim is valid friend? */
-	   (chan_friend(fr2) || (glob_friend(fr2) && !chan_deop(fr2)))) ||
-	  /* ... or protecting ops */
-	  (channel_protectops(chan) &&
-	   /* ... and kicked is valid op? */
-	   (chan_op(fr2) || (glob_op(fr2) && !chan_deop(fr2)))))
-	return 1;
+      if ((channel_protectfriends(chan) && (chan_friend(fr2) ||
+          (glob_friend(fr2) && !chan_deop(fr2)))) ||
+          (channel_protectops(chan) && (chan_op(fr2) || (glob_op(fr2) &&
+          !chan_deop(fr2)))))
+        return 1;
     }
   }
   return 0;
@@ -124,8 +115,8 @@
 /* Dependant on revenge_mode, punish the offender.
  */
 static void punish_badguy(struct chanset_t *chan, char *whobad,
-			  struct userrec *u, char *badnick, char *victim,
-			  int mevictim, int type)
+                          struct userrec *u, char *badnick, char *victim,
+                          int mevictim, int type)
 {
   char reason[1024], ct[81], *kick_msg;
   memberlist *m;
@@ -156,23 +147,20 @@
   putlog(LOG_MISC, chan->dname, "Punishing %s (%s)", badnick, reason);
 
   /* Set the offender +d */
-  if ((chan->revenge_mode > 0) &&
-      /* ... unless there's no more to do */
-      !(chan_deop(fr) || glob_deop(fr))) {
+  if ((chan->revenge_mode > 0) && !(chan_deop(fr) || glob_deop(fr))) {
     char s[UHOSTLEN], s1[UHOSTLEN];
     memberlist *mx = NULL;
 
     /* Removing op */
     if (chan_op(fr) || (glob_op(fr) && !chan_deop(fr))) {
       fr.match = FR_CHAN;
-      if (chan_op(fr)) {
+      if (chan_op(fr))
         fr.chan &= ~USER_OP;
-      } else {
+      else
         fr.chan |= USER_DEOP;
-      }
       set_user_flagrec(u, &fr, chan->dname);
       putlog(LOG_MISC, "*", "No longer opping %s[%s] (%s)", u->handle, whobad,
-	     reason);
+             reason);
     }
     /* ... or just setting to deop */
     else if (u) {
@@ -197,8 +185,9 @@
 
           i = atoi(s1 + 3);
           simple_sprintf(s1 + 3, "%d", i + 1);
-        } else
-          strcpy(s1, "bad1");		/* Start with '1' */
+        }
+        else
+          strcpy(s1, "bad1");   /* Start with '1' */
       }
       userlist = adduser(userlist, s1, s, "-", 0);
       fr.match = FR_CHAN;
@@ -231,14 +220,10 @@
     }
   }
   /* Kick the offender */
-  if ((chan->revenge_mode > 1) &&
-      /* ... or don't we kick ops? */
-      (!channel_dontkickops(chan) ||
-        !(chan_op(fr) || (glob_op(fr) && !chan_deop(fr)))) &&
-      /* ... or have we sent the kick already? */
-      !chan_sentkick(m) &&
-      /* ... and can I actually do anything about it? */
-      (me_op(chan) || (me_halfop(chan) && !chan_hasop(m))) && !mevictim) {
+  if ((chan->revenge_mode > 1) && (!channel_dontkickops(chan) ||
+      !(chan_op(fr) || (glob_op(fr) && !chan_deop(fr)))) &&
+      !chan_sentkick(m) && (me_op(chan) || (me_halfop(chan) &&
+      !chan_hasop(m))) && !mevictim) {
     dprintf(DP_MODE, "KICK %s %s :%s\n", chan->name, badnick, kick_msg);
     m->flags |= SENTKICK;
   }
@@ -248,7 +233,7 @@
  * by the revenge_mode flag.
  */
 static void maybe_revenge(struct chanset_t *chan, char *whobad,
-			  char *whovictim, int type)
+                          char *whovictim, int type)
 {
   char *badnick, *victim;
   int mevictim;
@@ -268,7 +253,7 @@
 
   /* Do we want to revenge? */
   if (!want_to_revenge(chan, u, u2, badnick, victim, mevictim))
-    return;	/* No, leave them alone ... */
+    return;                     /* No, leave them alone ... */
 
   /* Haha! Do the vengeful thing ... */
   punish_badguy(chan, whobad, u, badnick, victim, mevictim, type);
@@ -308,7 +293,7 @@
 {
   for (; m && m->mask[0] && rfc_casecmp(m->mask, s); m = m->next);
   if (m->mask[0])
-    return;			/* Already existent mask */
+    return;                     /* Already existent mask */
 
   m->next = (masklist *) channel_malloc(sizeof(masklist));
   m->next->next = NULL;
@@ -348,11 +333,11 @@
    * them though, to keep the bot from crashing.
    */
   if (chan->channel.members < 0) {
-     chan->channel.members = 0;
-     for (x = chan->channel.member; x && x->nick[0]; x = x->next)
-       chan->channel.members++;
-     putlog(LOG_MISC, "*", "(!) actually I know of %d members.",
-	    chan->channel.members);
+    chan->channel.members = 0;
+    for (x = chan->channel.member; x && x->nick[0]; x = x->next)
+      chan->channel.members++;
+    putlog(LOG_MISC, "*", "(!) actually I know of %d members.",
+           chan->channel.members);
   }
   if (!chan->channel.member) {
     chan->channel.member = (memberlist *) channel_malloc(sizeof(memberlist));
@@ -396,7 +381,7 @@
  */
 static int me_voice(struct chanset_t *chan)
 {
-  memberlist	*mx;
+  memberlist *mx;
 
   mx = ismember(chan, botname);
   if (!mx)
@@ -427,7 +412,7 @@
 {
   /* Don't reset the channel if we're already resetting it */
   if (channel_inactive(chan)) {
-    dprintf(DP_MODE,"PART %s\n", chan->name);
+    dprintf(DP_MODE, "PART %s\n", chan->name);
     return;
   }
   if (!channel_pending(chan)) {
@@ -441,13 +426,11 @@
       chan->status |= CHAN_ASKEDBANS;
       dprintf(DP_MODE, "MODE %s +b\n", chan->name);
     }
-    if (!(chan->ircnet_status & CHAN_ASKED_EXEMPTS) &&
-	use_exempts == 1) {
+    if (!(chan->ircnet_status & CHAN_ASKED_EXEMPTS) && use_exempts == 1) {
       chan->ircnet_status |= CHAN_ASKED_EXEMPTS;
       dprintf(DP_MODE, "MODE %s +e\n", chan->name);
     }
-    if (!(chan->ircnet_status & CHAN_ASKED_INVITED) &&
-	use_invites == 1) {
+    if (!(chan->ircnet_status & CHAN_ASKED_INVITED) && use_invites == 1) {
       chan->ircnet_status |= CHAN_ASKED_INVITED;
       dprintf(DP_MODE, "MODE %s +I\n", chan->name);
     }
@@ -471,7 +454,7 @@
     dprintf(DP_SERVER, "PART %s\n", chan->name);
 
     /* As we don't know of this channel anymore when we receive the server's
-       ack for the above PART, we have to notify about it _now_. */
+     * ack for the above PART, we have to notify about it _now_. */
     check_tcl_part(botname, botuserhost, NULL, chan->dname, NULL);
   }
 }
@@ -497,21 +480,21 @@
       voice = 0;
       halfops = 0;
       for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
-	if (chan_hasop(m))
-	  chops++;
+        if (chan_hasop(m))
+          chops++;
         else if (chan_hashalfop(m))
           halfops++;
-	else if (chan_hasvoice(m))
-	  voice++;
+        else if (chan_hasvoice(m))
+          voice++;
       }
       nonops = (chan->channel.members - (chops + voice + halfops));
 
       for (bans = 0, b = chan->channel.ban; b->mask[0]; b = b->next)
-	bans++;
+        bans++;
       for (exempts = 0, b = chan->channel.exempt; b->mask[0]; b = b->next)
-	exempts++;
+        exempts++;
       for (invites = 0, b = chan->channel.invite; b->mask[0]; b = b->next)
-	invites++;
+        invites++;
 
       sprintf(s, "%d", exempts);
       sprintf(s2, "%d", invites);
@@ -545,20 +528,22 @@
     if (!chan_issplit(m))
       i++;
   if (i == 1 && channel_cycle(chan) && !channel_stop_cycle(chan)) {
-    if (chan->name[0] != '+') {	/* Its pointless to cycle + chans for ops */
+    if (chan->name[0] != '+') { /* Its pointless to cycle + chans for ops */
       putlog(LOG_MISC, "*", "Trying to cycle %s to regain ops.", chan->dname);
       dprintf(DP_MODE, "PART %s\n", chan->name);
       /* If it's a !chan, we need to recreate the channel with !!chan <cybah> */
       dprintf(DP_MODE, "JOIN %s%s %s\n", (chan->dname[0] == '!') ? "!" : "",
-	      chan->dname, chan->key_prot);
+              chan->dname, chan->key_prot);
       whined = 0;
     }
-  } else if (any_ops(chan)) {
+  }
+  else if (any_ops(chan)) {
     whined = 0;
     check_tcl_need(chan->dname, "op");
     if (chan->need_op[0])
       do_tcl("need-op", chan->need_op);
-  } else {
+  }
+  else {
     /* Other people here, but none are ops. If there are other bots make
      * them LEAVE!
      */
@@ -570,27 +555,28 @@
        * help(services), we cant get them - Raist
        */
       if (chan->name[0] != '+' && channel_logstatus(chan))
-	putlog(LOG_MISC, "*", "%s is active but has no ops :(", chan->dname);
+        putlog(LOG_MISC, "*", "%s is active but has no ops :(", chan->dname);
       whined = 1;
     }
     for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
       sprintf(s, "%s!%s", m->nick, m->userhost);
       u = get_user_by_host(s);
       if (!match_my_nick(m->nick) && (!u || !(u->flags & USER_BOT))) {
-	ok = 0;
-	break;
+        ok = 0;
+        break;
       }
     }
     if (ok && channel_cycle(chan)) {
       /* ALL bots!  make them LEAVE!!! */
       for (m = chan->channel.member; m && m->nick[0]; m = m->next)
-	if (!match_my_nick(m->nick))
-	  dprintf(DP_SERVER, "PRIVMSG %s :go %s\n", m->nick, chan->dname);
-    } else {
+        if (!match_my_nick(m->nick))
+          dprintf(DP_SERVER, "PRIVMSG %s :go %s\n", m->nick, chan->dname);
+    }
+    else {
       /* Some humans on channel, but still op-less */
       check_tcl_need(chan->dname, "op");
       if (chan->need_op[0])
-	do_tcl("need-op", chan->need_op);
+        do_tcl("need-op", chan->need_op);
     }
   }
 }
@@ -601,100 +587,99 @@
   memberlist *m, *n;
   char s[UHOSTLEN];
   struct chanset_t *chan;
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
   if (!server_online)
     return;
   for (chan = chanset; chan; chan = chan->next) {
     if (channel_active(chan)) {
       if (me_op(chan) || me_halfop(chan)) {
-	if (channel_dynamicbans(chan) && chan->ban_time)
-	  for (b = chan->channel.ban; b->mask[0]; b = b->next)
-	    if (now - b->timer > 60 * chan->ban_time &&
-		!u_sticky_mask(chan->bans, b->mask) &&
-		!u_sticky_mask(global_bans, b->mask) &&
-		expired_mask(chan, b->who)) {
-	      putlog(LOG_MODES, chan->dname,
-		     "(%s) Channel ban on %s expired.",
-		     chan->dname, b->mask);
-	      add_mode(chan, '-', 'b', b->mask);
-	      b->timer = now;
-	    }
-
-	if (use_exempts && channel_dynamicexempts(chan) && chan->exempt_time)
-	  for (e = chan->channel.exempt; e->mask[0]; e = e->next)
-	    if (now - e->timer > 60 * chan->exempt_time &&
-		!u_sticky_mask(chan->exempts, e->mask) &&
-		!u_sticky_mask(global_exempts, e->mask) &&
-		expired_mask(chan, e->who)) {
-	      /* Check to see if it matches a ban */
-	      int match = 0;
-
-	      for (b = chan->channel.ban; b->mask[0]; b = b->next)
-		if (wild_match(b->mask, e->mask) ||
-		    wild_match(e->mask, b->mask)) {
-		  match = 1;
-		  break;
-	      }
-	      /* Leave this extra logging in for now. Can be removed later
-	       * Jason
-	       */
-	      if (match) {
-		putlog(LOG_MODES, chan->dname,
-		       "(%s) Channel exemption %s NOT expired. Exempt still set!",
-		       chan->dname, e->mask);
-	      } else {
-		putlog(LOG_MODES, chan->dname,
-		       "(%s) Channel exemption on %s expired.",
-		       chan->dname, e->mask);
-		add_mode(chan, '-', 'e', e->mask);
-	      }
-	      e->timer = now;
-	    }
-
-	if (use_invites && channel_dynamicinvites(chan) &&
-	    chan->invite_time && !(chan->channel.mode & CHANINV))
-	  for (b = chan->channel.invite; b->mask[0]; b = b->next)
-	    if (now - b->timer > 60 * chan->invite_time &&
-		!u_sticky_mask(chan->invites, b->mask) &&
-		!u_sticky_mask(global_invites, b->mask) &&
-		expired_mask(chan, b->who)) {
-	      putlog(LOG_MODES, chan->dname,
-		     "(%s) Channel invitation on %s expired.",
-		     chan->dname, b->mask);
-	      add_mode(chan, '-', 'I', b->mask);
-	      b->timer = now;
-	    }
-
-	if (chan->idle_kick)
-	  for (m = chan->channel.member; m && m->nick[0]; m = m->next)
-	    if (now - m->last >= chan->idle_kick * 60 &&
-		!match_my_nick(m->nick) && !chan_issplit(m)) {
-	      sprintf(s, "%s!%s", m->nick, m->userhost);
-	      get_user_flagrec(m->user ? m->user : get_user_by_host(s),
-			       &fr, chan->dname);
-	      if ((!(glob_bot(fr) || glob_friend(fr) || (glob_op(fr) &&
-		  !chan_deop(fr)) || chan_friend(fr) || chan_op(fr))) &&
-		  (me_op(chan) || (me_halfop(chan) && !chan_hasop(m)))) {
-		dprintf(DP_SERVER, "KICK %s %s :idle %d min\n", chan->name,
-			m->nick, chan->idle_kick);
-		m->flags |= SENTKICK;
-	      }
-	    }
+        if (channel_dynamicbans(chan) && chan->ban_time)
+          for (b = chan->channel.ban; b->mask[0]; b = b->next)
+            if (now - b->timer > 60 * chan->ban_time &&
+                !u_sticky_mask(chan->bans, b->mask) &&
+                !u_sticky_mask(global_bans, b->mask) &&
+                expired_mask(chan, b->who)) {
+              putlog(LOG_MODES, chan->dname,
+                     "(%s) Channel ban on %s expired.", chan->dname, b->mask);
+              add_mode(chan, '-', 'b', b->mask);
+              b->timer = now;
+            }
+
+        if (use_exempts && channel_dynamicexempts(chan) && chan->exempt_time)
+          for (e = chan->channel.exempt; e->mask[0]; e = e->next)
+            if (now - e->timer > 60 * chan->exempt_time &&
+                !u_sticky_mask(chan->exempts, e->mask) &&
+                !u_sticky_mask(global_exempts, e->mask) &&
+                expired_mask(chan, e->who)) {
+              /* Check to see if it matches a ban */
+              int match = 0;
+
+              for (b = chan->channel.ban; b->mask[0]; b = b->next)
+                if (wild_match(b->mask, e->mask) ||
+                    wild_match(e->mask, b->mask)) {
+                  match = 1;
+                  break;
+                }
+              /* Leave this extra logging in for now. Can be removed later
+               * Jason
+               */
+              if (match) {
+                putlog(LOG_MODES, chan->dname,
+                       "(%s) Channel exemption %s NOT expired. Exempt still set!",
+                       chan->dname, e->mask);
+              }
+              else {
+                putlog(LOG_MODES, chan->dname,
+                       "(%s) Channel exemption on %s expired.",
+                       chan->dname, e->mask);
+                add_mode(chan, '-', 'e', e->mask);
+              }
+              e->timer = now;
+            }
+
+        if (use_invites && channel_dynamicinvites(chan) &&
+            chan->invite_time && !(chan->channel.mode & CHANINV))
+          for (b = chan->channel.invite; b->mask[0]; b = b->next)
+            if (now - b->timer > 60 * chan->invite_time &&
+                !u_sticky_mask(chan->invites, b->mask) &&
+                !u_sticky_mask(global_invites, b->mask) &&
+                expired_mask(chan, b->who)) {
+              putlog(LOG_MODES, chan->dname,
+                     "(%s) Channel invitation on %s expired.",
+                     chan->dname, b->mask);
+              add_mode(chan, '-', 'I', b->mask);
+              b->timer = now;
+            }
+
+        if (chan->idle_kick)
+          for (m = chan->channel.member; m && m->nick[0]; m = m->next)
+            if (now - m->last >= chan->idle_kick * 60 &&
+                !match_my_nick(m->nick) && !chan_issplit(m)) {
+              sprintf(s, "%s!%s", m->nick, m->userhost);
+              get_user_flagrec(m->user ? m->user : get_user_by_host(s),
+                               &fr, chan->dname);
+              if ((!(glob_bot(fr) || glob_friend(fr) || (glob_op(fr) &&
+                  !chan_deop(fr)) || chan_friend(fr) || chan_op(fr))) &&
+                  (me_op(chan) || (me_halfop(chan) && !chan_hasop(m)))) {
+                dprintf(DP_SERVER, "KICK %s %s :idle %d min\n", chan->name,
+                        m->nick, chan->idle_kick);
+                m->flags |= SENTKICK;
+              }
+            }
       }
       for (m = chan->channel.member; m && m->nick[0]; m = n) {
-	n = m->next;
-	if (m->split && now - m->split > wait_split) {
-	  sprintf(s, "%s!%s", m->nick, m->userhost);
-	  check_tcl_sign(m->nick, m->userhost,
-			 m->user ? m->user : get_user_by_host(s),
-			 chan->dname, "lost in the netsplit");
-	  putlog(LOG_JOIN, chan->dname,
-		 "%s (%s) got lost in the net-split.",
-		 m->nick, m->userhost);
-	  killmember(chan, m->nick);
-	}
-	m = n;
+        n = m->next;
+        if (m->split && now - m->split > wait_split) {
+          sprintf(s, "%s!%s", m->nick, m->userhost);
+          check_tcl_sign(m->nick, m->userhost,
+                         m->user ? m->user : get_user_by_host(s),
+                         chan->dname, "lost in the netsplit");
+          putlog(LOG_JOIN, chan->dname,
+                 "%s (%s) got lost in the net-split.", m->nick, m->userhost);
+          killmember(chan, m->nick);
+        }
+        m = n;
       }
       check_lonely_channel(chan);
     }
@@ -711,6 +696,7 @@
   char x[20];
 
   BADARGS(7, 7, " nick user at host handle desto/chan keyword/nick text");
+  
   CHECKVALIDITY(channels_6char);
   sprintf(x, "%d", F(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]));
   Tcl_AppendResult(irp, x, NULL);
@@ -722,6 +708,7 @@
   Function F = (Function) cd;
 
   BADARGS(6, 6, " nick user at host handle channel text");
+  
   CHECKVALIDITY(channels_5char);
   F(argv[1], argv[2], argv[3], argv[4], argv[5]);
   return TCL_OK;
@@ -732,6 +719,7 @@
   Function F = (Function) cd;
 
   BADARGS(5, 5, " nick uhost hand chan/param");
+  
   CHECKVALIDITY(channels_4char);
   F(argv[1], argv[2], argv[3], argv[4]);
   return TCL_OK;
@@ -742,15 +730,16 @@
   Function F = (Function) cd;
 
   BADARGS(3, 3, " channel type");
+  
   CHECKVALIDITY(channels_2char);
   F(argv[1], argv[2]);
   return TCL_OK;
 }
 
 static void check_tcl_joinspltrejn(char *nick, char *uhost, struct userrec *u,
-			       char *chname, p_tcl_bind_list table)
+                                   char *chname, p_tcl_bind_list table)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   char args[1024];
 
   simple_sprintf(args, "%s %s!%s", chname, nick, uhost);
@@ -760,15 +749,15 @@
   Tcl_SetVar(interp, "_jp3", u ? u->handle : "*", 0);
   Tcl_SetVar(interp, "_jp4", chname, 0);
   check_tcl_bind(table, args, &fr, " $_jp1 $_jp2 $_jp3 $_jp4",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+                 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
 }
 
 /* we handle part messages now *sigh* (guppy 27Jan2000) */
 
 static void check_tcl_part(char *nick, char *uhost, struct userrec *u,
-			       char *chname, char *text)
+                           char *chname, char *text)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   char args[1024];
 
   simple_sprintf(args, "%s %s!%s", chname, nick, uhost);
@@ -779,14 +768,14 @@
   Tcl_SetVar(interp, "_p4", chname, 0);
   Tcl_SetVar(interp, "_p5", text ? text : "", 0);
   check_tcl_bind(H_part, args, &fr, " $_p1 $_p2 $_p3 $_p4 $_p5",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+                 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
 }
 
 static void check_tcl_signtopcnick(char *nick, char *uhost, struct userrec *u,
-				   char *chname, char *reason,
-				   p_tcl_bind_list table)
+                                   char *chname, char *reason,
+                                   p_tcl_bind_list table)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   char args[1024];
 
   if (table == H_sign)
@@ -800,14 +789,14 @@
   Tcl_SetVar(interp, "_stnm4", chname, 0);
   Tcl_SetVar(interp, "_stnm5", reason, 0);
   check_tcl_bind(table, args, &fr, " $_stnm1 $_stnm2 $_stnm3 $_stnm4 $_stnm5",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+                 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
 }
 
 static void check_tcl_kickmode(char *nick, char *uhost, struct userrec *u,
-			       char *chname, char *dest, char *reason,
-			       p_tcl_bind_list table)
+                               char *chname, char *dest, char *reason,
+                               p_tcl_bind_list table)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   char args[512];
 
   get_user_flagrec(u, &fr, chname);
@@ -821,13 +810,14 @@
   Tcl_SetVar(interp, "_kick4", chname, 0);
   Tcl_SetVar(interp, "_kick5", dest, 0);
   Tcl_SetVar(interp, "_kick6", reason, 0);
-  check_tcl_bind(table, args, &fr, " $_kick1 $_kick2 $_kick3 $_kick4 $_kick5 $_kick6",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+  check_tcl_bind(table, args, &fr,
+                 " $_kick1 $_kick2 $_kick3 $_kick4 $_kick5 $_kick6",
+                 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
 }
 
 static int check_tcl_pub(char *nick, char *from, char *chname, char *msg)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   int x;
   char buf[512], *args = buf, *cmd, host[161], *hand;
   struct userrec *u;
@@ -844,7 +834,7 @@
   Tcl_SetVar(interp, "_pub4", chname, 0);
   Tcl_SetVar(interp, "_pub5", args, 0);
   x = check_tcl_bind(H_pub, cmd, &fr, " $_pub1 $_pub2 $_pub3 $_pub4 $_pub5",
-		     MATCH_EXACT | BIND_USE_ATTR | BIND_HAS_BUILTINS);
+                     MATCH_EXACT | BIND_USE_ATTR | BIND_HAS_BUILTINS);
   if (x == BIND_NOMATCH)
     return 0;
   if (x == BIND_EXEC_LOG)
@@ -854,7 +844,7 @@
 
 static void check_tcl_pubm(char *nick, char *from, char *chname, char *msg)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   char buf[1024], host[161];
   struct userrec *u;
 
@@ -868,7 +858,7 @@
   Tcl_SetVar(interp, "_pubm4", chname, 0);
   Tcl_SetVar(interp, "_pubm5", msg, 0);
   check_tcl_bind(H_pubm, buf, &fr, " $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5",
-		 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
+                 MATCH_MASK | BIND_USE_ATTR | BIND_STACKABLE);
 }
 
 static void check_tcl_need(char *chname, char *type)
@@ -878,38 +868,38 @@
   simple_sprintf(buf, "%s %s", chname, type);
   Tcl_SetVar(interp, "_need1", chname, 0);
   Tcl_SetVar(interp, "_need2", type, 0);
-  check_tcl_bind(H_need, buf, 0, " $_need1 $_need2", MATCH_MASK | BIND_STACKABLE);
+  check_tcl_bind(H_need, buf, 0, " $_need1 $_need2",
+                 MATCH_MASK | BIND_STACKABLE);
 }
 
-static tcl_ints myints[] =
-{
-  {"learn-users",		&learn_users,		0},	/* arthur2 */
-  {"wait-split",		&wait_split,		0},
-  {"wait-info",			&wait_info,		0},
-  {"bounce-bans",		&bounce_bans,		0},
-  {"bounce-exempts",		&bounce_exempts,	0},
-  {"bounce-invites",		&bounce_invites,	0},
-  {"bounce-modes",		&bounce_modes,		0},
-  {"modes-per-line",		&modesperline,		0},
-  {"mode-buf-length",		&mode_buf_len,		0},
-  {"use-354",			&use_354,		0},
-  {"kick-method",		&kick_method,		0},
-  {"kick-fun",			&kick_fun,		0},
-  {"ban-fun",			&ban_fun,		0},
-  {"invite-key",		&invite_key,		0},
-  {"no-chanrec-info",		&no_chanrec_info,	0},
-  {"max-bans",			&max_bans,		0},
-  {"max-exempts",		&max_exempts,		0},
-  {"max-invites",		&max_invites,		0},
-  {"max-modes",			&max_modes,		0},
-  {"net-type",			&net_type,		0},
-  {"strict-host",		&strict_host,		0},	/* arthur2 */
-  {"ctcp-mode",			&ctcp_mode,		0},	/* arthur2 */
-  {"keep-nick",			&keepnick,		0},	/* guppy */
-  {"prevent-mixing",		&prevent_mixing,	0},
-  {"rfc-compliant",		&rfc_compliant,		0},
-  {"include-lk",		&include_lk,		0},
-  {NULL,			NULL,			0}	/* arthur2 */
+static tcl_ints myints[] = {
+  {"learn-users",     &learn_users,     0}, /* arthur2 */
+  {"wait-split",      &wait_split,      0},
+  {"wait-info",       &wait_info,       0},
+  {"bounce-bans",     &bounce_bans,     0},
+  {"bounce-exempts",  &bounce_exempts,  0},
+  {"bounce-invites",  &bounce_invites,  0},
+  {"bounce-modes",    &bounce_modes,    0},
+  {"modes-per-line",  &modesperline,    0},
+  {"mode-buf-length", &mode_buf_len,    0},
+  {"use-354",         &use_354,         0},
+  {"kick-method",     &kick_method,     0},
+  {"kick-fun",        &kick_fun,        0},
+  {"ban-fun",         &ban_fun,         0},
+  {"invite-key",      &invite_key,      0},
+  {"no-chanrec-info", &no_chanrec_info, 0},
+  {"max-bans",        &max_bans,        0},
+  {"max-exempts",     &max_exempts,     0},
+  {"max-invites",     &max_invites,     0},
+  {"max-modes",       &max_modes,       0},
+  {"net-type",        &net_type,        0},
+  {"strict-host",     &strict_host,     0}, /* arthur2 */
+  {"ctcp-mode",       &ctcp_mode,       0}, /* arthur2 */
+  {"keep-nick",       &keepnick,        0}, /* guppy */
+  {"prevent-mixing",  &prevent_mixing,  0},
+  {"rfc-compliant",   &rfc_compliant,   0},
+  {"include-lk",      &include_lk,      0},
+  {NULL,              NULL,             0}  /* arthur2 */
 };
 
 /* Flush the modes for EVERY channel.
@@ -920,12 +910,12 @@
   memberlist *m;
 
   if (modesperline > MODES_PER_LINE_MAX)
-    modesperline = MODES_PER_LINE_MAX; 
+    modesperline = MODES_PER_LINE_MAX;
   for (chan = chanset; chan; chan = chan->next) {
     for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
       if (m->delay && m->delay <= now) {
-	m->delay = 0L;
-	m->flags &= ~FULL_DELAY;
+        m->delay = 0L;
+        m->flags &= ~FULL_DELAY;
         if (chan_sentop(m)) {
           m->flags &= ~SENTOP;
           add_mode(chan, '+', 'o', m->nick);
@@ -946,7 +936,7 @@
 
 static void irc_report(int idx, int details)
 {
-  struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
   char ch[1024], q[160], *p;
   int k, l;
   struct chanset_t *chan;
@@ -959,21 +949,21 @@
     if (idx == DP_STDOUT || glob_master(fr) || chan_master(fr)) {
       p = NULL;
       if (!channel_inactive(chan)) {
-	if (chan->status & CHAN_JUPED)
-	  p = MISC_JUPED;
-	else if (!(chan->status & CHAN_ACTIVE))
-	  p = MISC_TRYING;
-	else if (chan->status & CHAN_PEND)
-	  p = MISC_PENDING;
-	else if ((chan->dname[0] != '+') && !me_op(chan))
-	  p = MISC_WANTOPS;
+        if (chan->status & CHAN_JUPED)
+          p = MISC_JUPED;
+        else if (!(chan->status & CHAN_ACTIVE))
+          p = MISC_TRYING;
+        else if (chan->status & CHAN_PEND)
+          p = MISC_PENDING;
+        else if ((chan->dname[0] != '+') && !me_op(chan))
+          p = MISC_WANTOPS;
       }
       l = simple_sprintf(ch, "%s%s%s%s, ", chan->dname, p ? "(" : "",
-			 p ? p : "", p ? ")" : "");
+                         p ? p : "", p ? ")" : "");
       if ((k + l) > 70) {
-	dprintf(idx, "   %s\n", q);
-	strcpy(q, "          ");
-	k = 10;
+        dprintf(idx, "   %s\n", q);
+        strcpy(q, "          ");
+        k = 10;
       }
       k += my_strcpy(q + k, ch);
     }
@@ -987,7 +977,7 @@
 static void do_nettype()
 {
   switch (net_type) {
-  case 0:		/* Efnet */
+  case 0:                      /* EFnet */
     kick_method = 1;
     modesperline = 4;
     use_354 = 0;
@@ -998,7 +988,7 @@
     rfc_compliant = 1;
     include_lk = 0;
     break;
-  case 1:		/* Ircnet */
+  case 1:                      /* IRCnet */
     kick_method = 4;
     modesperline = 3;
     use_354 = 0;
@@ -1009,7 +999,7 @@
     rfc_compliant = 1;
     include_lk = 1;
     break;
-  case 2:		/* Undernet */
+  case 2:                      /* UnderNet */
     kick_method = 1;
     modesperline = 6;
     use_354 = 1;
@@ -1020,7 +1010,7 @@
     rfc_compliant = 1;
     include_lk = 1;
     break;
-  case 3:		/* Dalnet */
+  case 3:                      /* DALnet */
     kick_method = 1;
     modesperline = 6;
     use_354 = 0;
@@ -1031,7 +1021,7 @@
     rfc_compliant = 0;
     include_lk = 1;
     break;
-  case 4:		/* hybrid-6+ */
+  case 4:                      /* Hybrid-6+ */
     kick_method = 1;
     modesperline = 4;
     use_354 = 0;
@@ -1113,43 +1103,42 @@
   del_hook(HOOK_ADD_MODE, (Function) real_add_mode);
   del_hook(HOOK_IDLE, (Function) flush_modes);
   Tcl_UntraceVar(interp, "rfc-compliant",
-		 TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-		 traced_rfccompliant, NULL);
+                 TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
+                 traced_rfccompliant, NULL);
   Tcl_UntraceVar(interp, "net-type",
-		 TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-		 traced_nettype, NULL);
+                 TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
+                 traced_nettype, NULL);
   module_undepend(MODULE_NAME);
   return NULL;
 }
 
 EXPORT_SCOPE char *irc_start();
 
-static Function irc_table[] =
-{
+static Function irc_table[] = {
   /* 0 - 3 */
   (Function) irc_start,
   (Function) irc_close,
   (Function) irc_expmem,
   (Function) irc_report,
   /* 4 - 7 */
-  (Function) & H_splt,		/* p_tcl_bind_list		*/
-  (Function) & H_rejn,		/* p_tcl_bind_list		*/
-  (Function) & H_nick,		/* p_tcl_bind_list		*/
-  (Function) & H_sign,		/* p_tcl_bind_list		*/
+  (Function) & H_splt,          /* p_tcl_bind_list              */
+  (Function) & H_rejn,          /* p_tcl_bind_list              */
+  (Function) & H_nick,          /* p_tcl_bind_list              */
+  (Function) & H_sign,          /* p_tcl_bind_list              */
   /* 8 - 11 */
-  (Function) & H_join,		/* p_tcl_bind_list		*/
-  (Function) & H_part,		/* p_tcl_bind_list		*/
-  (Function) & H_mode,		/* p_tcl_bind_list		*/
-  (Function) & H_kick,		/* p_tcl_bind_list		*/
+  (Function) & H_join,          /* p_tcl_bind_list              */
+  (Function) & H_part,          /* p_tcl_bind_list              */
+  (Function) & H_mode,          /* p_tcl_bind_list              */
+  (Function) & H_kick,          /* p_tcl_bind_list              */
   /* 12 - 15 */
-  (Function) & H_pubm,		/* p_tcl_bind_list		*/
-  (Function) & H_pub,		/* p_tcl_bind_list		*/
-  (Function) & H_topc,		/* p_tcl_bind_list		*/
+  (Function) & H_pubm,          /* p_tcl_bind_list              */
+  (Function) & H_pub,           /* p_tcl_bind_list              */
+  (Function) & H_topc,          /* p_tcl_bind_list              */
   (Function) recheck_channel,
   /* 16 - 19 */
   (Function) me_op,
   (Function) recheck_channel_modes,
-  (Function) & H_need,		/* p_tcl_bind_list		*/
+  (Function) & H_need,          /* p_tcl_bind_list              */
   (Function) do_channel_part,
   /* 20 - 23 */
   (Function) check_this_ban,
@@ -1160,7 +1149,7 @@
   (Function) getchanmode,
 };
 
-char *irc_start(Function * global_funcs)
+char *irc_start(Function *global_funcs)
 {
   struct chanset_t *chan;
 
@@ -1191,11 +1180,11 @@
   add_hook(HOOK_ADD_MODE, (Function) real_add_mode);
   add_hook(HOOK_IDLE, (Function) flush_modes);
   Tcl_TraceVar(interp, "net-type",
-	       TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-	       traced_nettype, NULL);
+               TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
+               traced_nettype, NULL);
   Tcl_TraceVar(interp, "rfc-compliant",
-	       TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
-	       traced_rfccompliant, NULL);
+               TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_TRACE_UNSETS,
+               traced_rfccompliant, NULL);
   add_tcl_ints(myints);
   add_builtins(H_dcc, irc_dcc);
   add_builtins(H_msg, C_msg);
Index: eggdrop1.6/src/mod/irc.mod/irc.h
diff -u eggdrop1.6/src/mod/irc.mod/irc.h:1.22 eggdrop1.6/src/mod/irc.mod/irc.h:1.23
--- eggdrop1.6/src/mod/irc.mod/irc.h:1.22	Tue Jan 14 19:42:21 2003
+++ eggdrop1.6/src/mod/irc.mod/irc.h	Tue Jan 28 00:37:26 2003
@@ -1,7 +1,7 @@
 /*
  * irc.h -- part of irc.mod
  *
- * $Id: irc.h,v 1.22 2003/01/15 01:42:21 wcc Exp $
+ * $Id: irc.h,v 1.23 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -34,18 +34,18 @@
 #define check_tcl_mode(a,b,c,d,e,f) check_tcl_kickmode(a,b,c,d,e,f,H_mode)
 #define check_tcl_kick(a,b,c,d,e,f) check_tcl_kickmode(a,b,c,d,e,f,H_kick)
 
-#define REVENGE_KICK 1		/* Kicked victim	*/
-#define REVENGE_DEOP 2		/* Took op		*/
+#define REVENGE_KICK 1          /* Kicked victim        */
+#define REVENGE_DEOP 2          /* Took op              */
 
 #ifdef MAKING_IRC
 static void check_tcl_need(char *, char *);
 static void check_tcl_kickmode(char *, char *, struct userrec *, char *,
-			       char *, char *, p_tcl_bind_list);
+                               char *, char *, p_tcl_bind_list);
 static void check_tcl_joinspltrejn(char *, char *, struct userrec *, char *,
-			       p_tcl_bind_list);
+                                   p_tcl_bind_list);
 static void check_tcl_part(char *, char *, struct userrec *, char *, char *);
 static void check_tcl_signtopcnick(char *, char *, struct userrec *u, char *,
-				   char *, p_tcl_bind_list);
+                                   char *, p_tcl_bind_list);
 static void check_tcl_pubm(char *, char *, char *, char *);
 static int check_tcl_pub(char *, char *, char *, char *);
 static int me_op(struct chanset_t *);
@@ -72,13 +72,14 @@
 static void set_key(struct chanset_t *, char *);
 static void maybe_revenge(struct chanset_t *, char *, char *, int);
 static int detect_chan_flood(char *, char *, char *, struct chanset_t *, int,
-			     char *);
+                             char *);
 static void newmask(masklist *, char *, char *);
 static char *quickban(struct chanset_t *, char *);
 static void got_op(struct chanset_t *chan, char *nick, char *from, char *who,
- 		   struct userrec *opu, struct flag_record *opper);
-static void got_halfop(struct chanset_t *chan, char *nick, char *from, char *who,
- 		   struct userrec *opu, struct flag_record *opper);
+                   struct userrec *opu, struct flag_record *opper);
+static void got_halfop(struct chanset_t *chan, char *nick, char *from,
+                       char *who, struct userrec *opu,
+                       struct flag_record *opper);
 static int killmember(struct chanset_t *chan, char *nick);
 static void check_lonely_channel(struct chanset_t *chan);
 static int gotmode(char *, char *);
@@ -118,6 +119,6 @@
 /* 24 - 27 */
 #define getchanmode ((char *(*)(struct chanset_t *))irc_funcs[24])
 
-#endif				/* MAKING_IRC */
+#endif /* MAKING_IRC */
 
-#endif				/* _EGG_MOD_IRC_IRC_H */
+#endif /* _EGG_MOD_IRC_IRC_H */
Index: eggdrop1.6/src/mod/irc.mod/mode.c
diff -u eggdrop1.6/src/mod/irc.mod/mode.c:1.67 eggdrop1.6/src/mod/irc.mod/mode.c:1.68
--- eggdrop1.6/src/mod/irc.mod/mode.c:1.67	Mon Dec 23 20:30:08 2002
+++ eggdrop1.6/src/mod/irc.mod/mode.c	Tue Jan 28 00:37:26 2003
@@ -4,7 +4,7 @@
  *   channel mode changes and the bot's reaction to them
  *   setting and getting the current wanted channel modes
  *
- * $Id: mode.c,v 1.67 2002/12/24 02:30:08 wcc Exp $
+ * $Id: mode.c,v 1.68 2003/01/28 06:37:26 wcc Exp $
  */
 /*
  * Copyright (C) 1997 Robey Pointer
@@ -37,14 +37,14 @@
 #define INVITE  0x40
 #define CHHOP   0x80
 
-static struct flag_record user   = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-static struct flag_record victim = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
+static struct flag_record user = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
+static struct flag_record victim = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
 
 static void flush_mode(struct chanset_t *chan, int pri)
 {
-  char		*p, out[512], post[512];
-  size_t	postsize = sizeof(post);
-  int		i, plus = 2;		/* 0 = '-', 1 = '+', 2 = none */
+  char *p, out[512], post[512];
+  size_t postsize = sizeof(post);
+  int i, plus = 2;              /* 0 = '-', 1 = '+', 2 = none */
 
   p = out;
   post[0] = 0, postsize--;
@@ -79,7 +79,7 @@
     nfree(chan->key), chan->key = NULL;
   }
 
-  /* max +l is signed 2^32 on ircnet at least... so makesure we've got at least
+  /* max +l is signed 2^32 on IRCnet at least... so makesure we've got at least
    * a 13 char buffer for '-2147483647 \0'. We'll be overwriting the existing
    * terminating null in 'post', so makesure postsize >= 12.
    */
@@ -90,7 +90,8 @@
     *p++ = 'l';
 
     /* 'sizeof(post) - 1' is used because we want to overwrite the old null */
-    postsize -= sprintf(&post[(sizeof(post) - 1) - postsize], "%d ", chan->limit);
+    postsize -=
+      sprintf(&post[(sizeof(post) - 1) - postsize], "%d ", chan->limit);
 
     chan->limit = 0;
   }
@@ -110,17 +111,16 @@
 
   /* Do -{b,e,I} before +{b,e,I} to avoid the server ignoring overlaps */
   for (i = 0; i < modesperline; i++) {
-    if ((chan->cmode[i].type & MINUS) &&
-        postsize > strlen(chan->cmode[i].op)) {
+    if ((chan->cmode[i].type & MINUS) && postsize > strlen(chan->cmode[i].op)) {
       if (plus) {
         *p++ = '-', plus = 0;
       }
 
       *p++ = ((chan->cmode[i].type & BAN) ? 'b' :
               ((chan->cmode[i].type & CHOP) ? 'o' :
-               ((chan->cmode[i].type & CHHOP) ? 'h' :
-                ((chan->cmode[i].type & EXEMPT) ? 'e' :
-                 ((chan->cmode[i].type & INVITE) ? 'I' : 'v')))));
+              ((chan->cmode[i].type & CHHOP) ? 'h' :
+              ((chan->cmode[i].type & EXEMPT) ? 'e' :
+              ((chan->cmode[i].type & INVITE) ? 'I' : 'v')))));
 
       postsize -= egg_strcatn(post, chan->cmode[i].op, sizeof(post));
       postsize -= egg_strcatn(post, " ", sizeof(post));
@@ -132,17 +132,16 @@
 
   /* now do all the + modes... */
   for (i = 0; i < modesperline; i++) {
-    if ((chan->cmode[i].type & PLUS) &&
-        postsize > strlen(chan->cmode[i].op)) {
+    if ((chan->cmode[i].type & PLUS) && postsize > strlen(chan->cmode[i].op)) {
       if (plus != 1) {
         *p++ = '+', plus = 1;
       }
 
       *p++ = ((chan->cmode[i].type & BAN) ? 'b' :
               ((chan->cmode[i].type & CHOP) ? 'o' :
-               ((chan->cmode[i].type & CHHOP) ? 'h' :
-                ((chan->cmode[i].type & EXEMPT) ? 'e' :
-                 ((chan->cmode[i].type & INVITE) ? 'I' : 'v')))));
+              ((chan->cmode[i].type & CHHOP) ? 'h' :
+              ((chan->cmode[i].type & EXEMPT) ? 'e' :
+              ((chan->cmode[i].type & INVITE) ? 'I' : 'v')))));
 
       postsize -= egg_strcatn(post, chan->cmode[i].op, sizeof(post));
       postsize -= egg_strcatn(post, " ", sizeof(post));
@@ -158,6 +157,7 @@
   if (post[0]) {
     /* remove the trailing space... */
     size_t index = (sizeof(post) - 1) - postsize;
+
     if (index > 0 && post[index - 1] == ' ')
       post[index - 1] = 0;
 
@@ -175,7 +175,7 @@
 /* Queue a channel mode change
  */
 static void real_add_mode(struct chanset_t *chan,
-			  char plus, char mode, char *op)
+                          char plus, char mode, char *op)
 {
   int i, type, modes, l;
   masklist *m;
@@ -183,7 +183,7 @@
   char s[21];
 
   if (!me_op(chan))
-    return;			/* No point in queueing the mode */
+    return;                     /* No point in queueing the mode */
 
   if (mode == 'o' || mode == 'h' || mode == 'v') {
     mx = ismember(chan, op);
@@ -192,32 +192,32 @@
 
     if (plus == '-' && mode == 'o') {
       if (chan_sentdeop(mx) || !chan_hasop(mx))
-	return;
+        return;
       mx->flags |= SENTDEOP;
     }
     if (plus == '+' && mode == 'o') {
       if (chan_sentop(mx) || chan_hasop(mx))
-	return;
+        return;
       mx->flags |= SENTOP;
     }
     if (plus == '-' && mode == 'h') {
       if (chan_sentdehalfop(mx) || !chan_hashalfop(mx))
-	return;
+        return;
       mx->flags |= SENTDEHALFOP;
     }
     if (plus == '+' && mode == 'h') {
       if (chan_senthalfop(mx) || chan_hashalfop(mx))
-	return;
+        return;
       mx->flags |= SENTHALFOP;
     }
     if (plus == '-' && mode == 'v') {
       if (chan_sentdevoice(mx) || !chan_hasvoice(mx))
-	return;
+        return;
       mx->flags |= SENTDEVOICE;
     }
     if (plus == '+' && mode == 'v') {
       if (chan_sentvoice(mx) || chan_hasvoice(mx))
-	return;
+        return;
       mx->flags |= SENTVOICE;
     }
   }
@@ -227,82 +227,75 @@
       chan->compat = 2;
     else
       chan->compat = 1;
-  } else if (mode == 'e' || mode == 'I') {
+  }
+  else if (mode == 'e' || mode == 'I') {
     if (prevent_mixing && chan->compat == 1)
       flush_mode(chan, NORMAL);
-  } else if (prevent_mixing && chan->compat == 2)
+  }
+  else if (prevent_mixing && chan->compat == 2)
     flush_mode(chan, NORMAL);
 
-  if (mode == 'o' || mode == 'h' || mode == 'b' || mode == 'v' || mode == 'e' || mode == 'I') {
-    type = (plus == '+' ? PLUS : MINUS) |
-	   (mode == 'o' ? CHOP :
-	    (mode == 'h' ? CHHOP :
-	     (mode == 'b' ? BAN :
-	      (mode == 'v' ? VOICE :
-	       (mode == 'e' ? EXEMPT : INVITE)))));
-
+  if (mode == 'o' || mode == 'h' || mode == 'b' || mode == 'v' || mode == 'e' ||
+      mode == 'I') {
+    type = (plus == '+' ? PLUS : MINUS) | (mode == 'o' ? CHOP : (mode == 'h' ?
+           CHHOP : (mode == 'b' ? BAN : (mode == 'v' ? VOICE : (mode == 'e' ?
+           EXEMPT : INVITE)))));
     /*
-     * FIXME: Some networks remove overlapped bans, IrcNet does not
+     * FIXME: Some networks remove overlapped bans, IRCNet does not
      *        (poptix/drummer)
      *
-     * Note:  On ircnet ischanXXX() should be used, otherwise isXXXed().
+     * Note:  On IRCnet ischanXXX() should be used, otherwise isXXXed().
      */
     /* If removing a non-existant mask... */
-    if ((plus == '-' &&
-         ((mode == 'b' && !ischanban(chan, op)) ||
-          (mode == 'e' && !ischanexempt(chan, op)) ||
-          (mode == 'I' && !ischaninvite(chan, op)))) ||
-        /* or adding an existant mask... */
-        (plus == '+' &&
-         ((mode == 'b' && ischanban(chan, op)) ||
-          (mode == 'e' && ischanexempt(chan, op)) ||
-          (mode == 'I' && ischaninvite(chan, op)))))
-      return;	/* ...nuke it */
+    if ((plus == '-' && ((mode == 'b' && !ischanban(chan, op)) ||
+        (mode == 'e' && !ischanexempt(chan, op)) ||
+        (mode == 'I' && !ischaninvite(chan, op)))) || (plus == '+' &&
+        ((mode == 'b' && ischanban(chan, op)) ||
+        (mode == 'e' && ischanexempt(chan, op)) ||
+        (mode == 'I' && ischaninvite(chan, op)))))
+      return;
 
     /* If there are already max_bans bans, max_exempts exemptions,
      * max_invites invitations or max_modes +b/+e/+I modes on the
      * channel, don't try to add one more.
      */
     if (plus == '+' && (mode == 'b' || mode == 'e' || mode == 'I')) {
-      int	bans = 0, exempts = 0, invites = 0;
+      int bans = 0, exempts = 0, invites = 0;
 
       for (m = chan->channel.ban; m && m->mask[0]; m = m->next)
-	bans++;
-      if (mode == 'b')
-	if (bans >= max_bans)
-	  return;
+        bans++;
+      if ((mode == 'b') && (bans >= max_bans))
+        return;
 
       for (m = chan->channel.exempt; m && m->mask[0]; m = m->next)
-	exempts++;
-      if (mode == 'e')
-	if (exempts >= max_exempts)
-	  return;
+        exempts++;
+      if ((mode == 'e') && (exempts >= max_exempts))
+        return;
 
       for (m = chan->channel.invite; m && m->mask[0]; m = m->next)
-	invites++;
-      if (mode == 'I')
-	if (invites >= max_invites)
-	  return;
+        invites++;
+      if ((mode == 'I') && (invites >= max_invites))
+        return;
 
       if (bans + exempts + invites >= max_modes)
-	return;
+        return;
     }
 
     /* op-type mode change */
     for (i = 0; i < modesperline; i++)
       if (chan->cmode[i].type == type && chan->cmode[i].op != NULL &&
-	  !rfc_casecmp(chan->cmode[i].op, op))
-	return;			/* Already in there :- duplicate */
+          !rfc_casecmp(chan->cmode[i].op, op))
+        return;                 /* Already in there :- duplicate */
     l = strlen(op) + 1;
     if (chan->bytes + l > mode_buf_len)
       flush_mode(chan, NORMAL);
     for (i = 0; i < modesperline; i++)
       if (chan->cmode[i].type == 0) {
-	chan->cmode[i].type = type;
-	chan->cmode[i].op = (char *) channel_malloc(l);
-	chan->bytes += l;	/* Add 1 for safety */
-	strcpy(chan->cmode[i].op, op);
-	break;
+        chan->cmode[i].type = type;
+        chan->cmode[i].op = (char *) channel_malloc(l);
+        chan->bytes += l;       /* Add 1 for safety */
+        strcpy(chan->cmode[i].op, op);
+        break;
       }
   }
 
@@ -333,15 +326,16 @@
       strcpy(s, chan->mns);
     if (!strchr(s, mode)) {
       if (plus == '+') {
-	chan->pls[strlen(chan->pls) + 1] = 0;
-	chan->pls[strlen(chan->pls)] = mode;
-      } else {
-	chan->mns[strlen(chan->mns) + 1] = 0;
-	chan->mns[strlen(chan->mns)] = mode;
+        chan->pls[strlen(chan->pls) + 1] = 0;
+        chan->pls[strlen(chan->pls)] = mode;
+      }
+      else {
+        chan->mns[strlen(chan->mns) + 1] = 0;
+        chan->mns[strlen(chan->mns)] = mode;
       }
     }
   }
-  modes = modesperline;			/* Check for full buffer. */
+  modes = modesperline;         /* Check for full buffer. */
   for (i = 0; i < modesperline; i++)
     if (chan->cmode[i].type)
       modes--;
@@ -352,7 +346,7 @@
   if (include_lk && chan->key)
     modes--;
   if (modes < 1)
-    flush_mode(chan, NORMAL);		/* Full buffer! Flush modes. */
+    flush_mode(chan, NORMAL);   /* Full buffer! Flush modes. */
 }
 
 
@@ -360,30 +354,28 @@
  *    Mode parsing functions
  */
 
-static void got_key(struct chanset_t *chan, char *nick, char *from,
-		    char *key)
+static void got_key(struct chanset_t *chan, char *nick, char *from, char *key)
 {
-  if ((!nick[0]) && (bounce_modes))
+  if (!nick[0] && bounce_modes)
     reversing = 1;
+
   if (((reversing) && !(chan->key_prot[0])) ||
-      ((chan->mode_mns_prot & CHANKEY) &&
-       !(glob_master(user) || glob_bot(user) || chan_master(user)))) {
-    if (strlen(key) != 0) {
+      ((chan->mode_mns_prot & CHANKEY) && !(glob_master(user) ||
+      glob_bot(user) || chan_master(user)))) {
+    if (strlen(key) != 0)
       add_mode(chan, '-', 'k', key);
-    } else {
+    else
       add_mode(chan, '-', 'k', "");
-    }
   }
 }
 
 static void got_op(struct chanset_t *chan, char *nick, char *from,
-		   char *who, struct userrec *opu, struct flag_record *opper)
+                   char *who, struct userrec *opu, struct flag_record *opper)
 {
   memberlist *m;
   char s[UHOSTLEN];
   struct userrec *u;
-  int check_chan = 0;
-  int snm = chan->stopnethack_mode;
+  int check_chan = 0, snm = chan->stopnethack_mode;
 
   m = ismember(chan, who);
   if (!m) {
@@ -400,7 +392,8 @@
   if (!m->user) {
     simple_sprintf(s, "%s!%s", m->nick, m->userhost);
     u = get_user_by_host(s);
-  } else
+  }
+  else
     u = m->user;
 
   get_user_flagrec(u, &victim, chan->dname);
@@ -410,61 +403,54 @@
   m->flags |= CHANOP;
   check_tcl_mode(nick, from, opu, chan->dname, "+o", who);
   /* Added new meaning of WASOP:
-   * in mode binds it means: was he op before get (de)opped
-   * (stupid IrcNet allows opped users to be opped again and
-   *  opless users to be deopped)
-   * script now can use [wasop nick chan] proc to check
-   * if user was op or wasnt  (drummer)
+   * In mode binds it means: was the user an op before got (de)opped. A script
+   * now can use [wasop nick chan] to check if user was op or wasnt.
+   * (drummer)
    */
   m->flags &= ~SENTOP;
 
   if (channel_pending(chan))
     return;
 
-  /* I'm opped, and the opper isn't me */
-  if (me_op(chan) && !match_my_nick(who) &&
-    /* and it isn't a server op */
-	   nick[0]) {
-    /* Channis is +bitch, and the opper isn't a global master or a bot */
+  if (me_op(chan) && !match_my_nick(who) && nick[0]) {
     if (channel_bitch(chan) && !(glob_master(*opper) || glob_bot(*opper)) &&
-	/* ... and the *opper isn't a channel master */
-	!chan_master(*opper) &&
-	/* ... and the oppee isn't global op/master/bot */
-	!(glob_op(victim) || glob_bot(victim)) &&
-	/* ... and the oppee isn't a channel op/master */
-	!chan_op(victim))
+        !chan_master(*opper) && !(glob_op(victim) || glob_bot(victim)) &&
+        !chan_op(victim))
       add_mode(chan, '-', 'o', who);
-      /* Opped is channel +d or global +d */
-    else if ((chan_deop(victim) ||
-		(glob_deop(victim) && !chan_op(victim))) &&
-	       !glob_master(*opper) && !chan_master(*opper))
+    else if ((chan_deop(victim) || (glob_deop(victim) && !chan_op(victim))) &&
+             !glob_master(*opper) && !chan_master(*opper))
       add_mode(chan, '-', 'o', who);
     else if (reversing)
       add_mode(chan, '-', 'o', who);
-  } else if (reversing && !match_my_nick(who))
+  }
+  else if (reversing && !match_my_nick(who))
     add_mode(chan, '-', 'o', who);
   if (!nick[0] && me_op(chan) && !match_my_nick(who)) {
     if (chan_deop(victim) || (glob_deop(victim) && !chan_op(victim))) {
       m->flags |= FAKEOP;
       add_mode(chan, '-', 'o', who);
-    } else if (snm > 0 && snm < 7 && !((channel_autoop(chan) || glob_autoop(victim) ||
-	       chan_autoop(victim)) && (chan_op(victim) || (glob_op(victim) &&
-               !chan_deop(victim)))) && !glob_exempt(victim) && !chan_exempt(victim)) {
-      if (snm == 5) snm = channel_bitch(chan) ? 1 : 3;
-      if (snm == 6) snm = channel_bitch(chan) ? 4 : 2;
-      if (chan_wasoptest(victim) || glob_wasoptest(victim) ||
-      snm == 2) {
+    }
+    else if (snm > 0 && snm < 7 && !((channel_autoop(chan) ||
+             glob_autoop(victim) || chan_autoop(victim)) && (chan_op(victim) ||
+             (glob_op(victim) && !chan_deop(victim)))) &&
+             !glob_exempt(victim) && !chan_exempt(victim)) {
+      if (snm == 5)
+        snm = channel_bitch(chan) ? 1 : 3;
+      if (snm == 6)
+        snm = channel_bitch(chan) ? 4 : 2;
+      if (chan_wasoptest(victim) || glob_wasoptest(victim) || snm == 2) {
         if (!chan_wasop(m)) {
           m->flags |= FAKEOP;
           add_mode(chan, '-', 'o', who);
         }
-      } else if (!(chan_op(victim) ||
-		 (glob_op(victim) && !chan_deop(victim)))) {
-		  if (snm == 1 || snm == 4 || (snm == 3 && !chan_wasop(m))) {
-		    add_mode(chan, '-', 'o', who);
-		    m->flags |= FAKEOP;
+      }
+      else if (!(chan_op(victim) || (glob_op(victim) && !chan_deop(victim)))) {
+        if (snm == 1 || snm == 4 || (snm == 3 && !chan_wasop(m))) {
+          add_mode(chan, '-', 'o', who);
+          m->flags |= FAKEOP;
         }
-      } else if (snm == 4 && !chan_wasop(m)) {
+      }
+      else if (snm == 4 && !chan_wasop(m)) {
         add_mode(chan, '-', 'o', who);
         m->flags |= FAKEOP;
       }
@@ -476,7 +462,8 @@
 }
 
 static void got_halfop(struct chanset_t *chan, char *nick, char *from,
-		   char *who, struct userrec *opu, struct flag_record *opper)
+                       char *who, struct userrec *opu,
+                       struct flag_record *opper)
 {
   memberlist *m;
   char s[UHOSTLEN];
@@ -498,7 +485,8 @@
   if (!m->user) {
     simple_sprintf(s, "%s!%s", m->nick, m->userhost);
     u = get_user_by_host(s);
-  } else
+  }
+  else
     u = m->user;
 
   get_user_flagrec(u, &victim, chan->dname);
@@ -514,42 +502,47 @@
 
   if (me_op(chan) && !match_my_nick(who) && nick[0]) {
     if (channel_bitch(chan) && !(glob_master(*opper) || glob_bot(*opper)) &&
-	!chan_master(*opper) && !(glob_halfop(victim) || glob_op(victim) ||
-	glob_bot(victim)) && !chan_op(victim) && !chan_halfop(victim))
+        !chan_master(*opper) && !(glob_halfop(victim) || glob_op(victim) ||
+        glob_bot(victim)) && !chan_op(victim) && !chan_halfop(victim))
       add_mode(chan, '-', 'h', who);
     else if ((chan_dehalfop(victim) || (glob_dehalfop(victim) &&
-	     !chan_halfop(victim))) && !glob_master(*opper) &&
-	     !chan_master(*opper))
+             !chan_halfop(victim))) && !glob_master(*opper) &&
+             !chan_master(*opper))
       add_mode(chan, '-', 'h', who);
     else if (reversing)
       add_mode(chan, '-', 'h', who);
-  } else if (reversing && !match_my_nick(who))
+  }
+  else if (reversing && !match_my_nick(who))
     add_mode(chan, '-', 'h', who);
   if (!nick[0] && me_op(chan) && !match_my_nick(who)) {
     if (chan_dehalfop(victim) || (glob_dehalfop(victim) &&
-	!chan_halfop(victim))) {
+        !chan_halfop(victim))) {
       m->flags |= FAKEHALFOP;
       add_mode(chan, '-', 'h', who);
-    } else if (snm > 0 && snm < 7 && !((channel_autohalfop(chan) || 
-	       glob_autohalfop(victim) || chan_autohalfop(victim)) &&
-	       (chan_halfop(victim) || (glob_halfop(victim) &&
-	       !chan_dehalfop(victim)))) && !glob_exempt(victim) &&
-	       !chan_exempt(victim)) {
-      if (snm == 5) snm = channel_bitch(chan) ? 1 : 3;
-      if (snm == 6) snm = channel_bitch(chan) ? 4 : 2;
-      if (chan_washalfoptest(victim) || glob_washalfoptest(victim) ||
-	  snm == 2) {
+    }
+    else if (snm > 0 && snm < 7 && !((channel_autohalfop(chan) ||
+             glob_autohalfop(victim) || chan_autohalfop(victim)) &&
+             (chan_halfop(victim) || (glob_halfop(victim) &&
+             !chan_dehalfop(victim)))) && !glob_exempt(victim) &&
+             !chan_exempt(victim)) {
+      if (snm == 5)
+        snm = channel_bitch(chan) ? 1 : 3;
+      if (snm == 6)
+        snm = channel_bitch(chan) ? 4 : 2;
+      if (chan_washalfoptest(victim) || glob_washalfoptest(victim) || snm == 2) {
         if (!chan_washalfop(m)) {
           m->flags |= FAKEHALFOP;
           add_mode(chan, '-', 'h', who);
         }
-      } else if (!(chan_halfop(victim) || (glob_halfop(victim) &&
-	         !chan_dehalfop(victim)))) {
+      }
+      else if (!(chan_halfop(victim) || (glob_halfop(victim) &&
+               !chan_dehalfop(victim)))) {
         if (snm == 1 || snm == 4 || (snm == 3 && !chan_washalfop(m))) {
           add_mode(chan, '-', 'h', who);
-	  m->flags |= FAKEHALFOP;
+          m->flags |= FAKEHALFOP;
         }
-      } else if (snm == 4 && !chan_washalfop(m)) {
+      }
+      else if (snm == 4 && !chan_washalfop(m)) {
         add_mode(chan, '-', 'h', who);
         m->flags |= FAKEHALFOP;
       }
@@ -561,7 +554,7 @@
 }
 
 static void got_deop(struct chanset_t *chan, char *nick, char *from,
-		     char *who, struct userrec *opu)
+                     char *who, struct userrec *opu)
 {
   memberlist *m;
   char s[UHOSTLEN], s1[UHOSTLEN];
@@ -600,28 +593,25 @@
 
     /* if they aren't d|d then check if they are something we should protect */
     if (!glob_deop(victim) && !chan_deop(victim)) {
-      if (channel_protectops(chan) && (glob_master(victim) || chan_master(victim) ||
-	       glob_op(victim) || chan_op(victim)))
-	ok = 0;
+      if (channel_protectops(chan) && (glob_master(victim) ||
+          chan_master(victim) || glob_op(victim) || chan_op(victim)))
+        ok = 0;
       else if (channel_protectfriends(chan) && (glob_friend(victim) ||
-	       chan_friend(victim)))
-	ok = 0;
+               chan_friend(victim)))
+        ok = 0;
     }
 
-    /* do we want to reop victim? */
+    /* reop? */
     if ((reversing || !ok) && had_halfop && !match_my_nick(nick) &&
-	rfc_casecmp(who, nick) && !match_my_nick(who) &&
-	/* Is the deopper NOT a master or bot? */
-	!glob_master(user) && !chan_master(user) && !glob_bot(user) &&
-	((chan_op(victim) || (glob_op(victim) && !chan_deop(victim))) ||
-	 !channel_bitch(chan)))
-      /* Then we'll bless the victim */
+        rfc_casecmp(who, nick) && !match_my_nick(who) && !glob_master(user) &&
+        !chan_master(user) && !glob_bot(user) && ((chan_op(victim) ||
+        (glob_op(victim) && !chan_deop(victim))) || !channel_bitch(chan)))
       add_mode(chan, '+', 'o', who);
   }
 
   if (!nick[0])
     putlog(LOG_MODES, chan->dname, "TS resync (%s): %s deopped by %s",
-	   chan->dname, who, from);
+           chan->dname, who, from);
   /* Check for mass deop */
   if (nick[0])
     detect_chan_flood(nick, from, s1, chan, FLOOD_DEOP, who);
@@ -642,21 +632,21 @@
     memberlist *m2;
 
     for (m2 = chan->channel.member; m2 && m2->nick[0]; m2 = m2->next)
-	m2->flags &= ~(SENTKICK | SENTDEOP | SENTOP | SENTVOICE | SENTDEVOICE);
+      m2->flags &= ~(SENTKICK | SENTDEOP | SENTOP | SENTVOICE | SENTDEVOICE);
 
     check_tcl_need(chan->dname, "op");
     if (chan->need_op[0])
       do_tcl("need-op", chan->need_op);
     if (!nick[0])
       putlog(LOG_MODES, chan->dname, "TS resync deopped me on %s :(",
-	     chan->dname);
+             chan->dname);
   }
   if (nick[0])
     maybe_revenge(chan, s1, s, REVENGE_DEOP);
 }
 
 static void got_dehalfop(struct chanset_t *chan, char *nick, char *from,
-		   char *who, struct userrec *opu)
+                         char *who, struct userrec *opu)
 {
   memberlist *m;
   char s[UHOSTLEN], s1[UHOSTLEN];
@@ -695,25 +685,25 @@
 
     /* if they aren't r|r then check if they are something we should protect */
     if (!glob_dehalfop(victim) && !chan_dehalfop(victim)) {
-      if (channel_protecthalfops(chan) && (glob_master(victim) || chan_master(victim) ||
-	  glob_halfop(victim) || chan_halfop(victim)))
-	ok = 0;
+      if (channel_protecthalfops(chan) && (glob_master(victim) ||
+          chan_master(victim) || glob_halfop(victim) || chan_halfop(victim)))
+        ok = 0;
       else if (channel_protectfriends(chan) && (glob_friend(victim) ||
-	       chan_friend(victim)))
-	ok = 0;
+               chan_friend(victim)))
+        ok = 0;
     }
 
     if ((reversing || !ok) && had_halfop && !match_my_nick(nick) &&
-	rfc_casecmp(who, nick) && !match_my_nick(who) && !glob_master(user) &&
-	!chan_master(user) && !glob_bot(user) && ((chan_halfop(victim) ||
-	(glob_halfop(victim) && !chan_dehalfop(victim))) ||
-	!channel_bitch(chan)))
+        rfc_casecmp(who, nick) && !match_my_nick(who) && !glob_master(user) &&
+        !chan_master(user) && !glob_bot(user) && ((chan_halfop(victim) ||
+        (glob_halfop(victim) && !chan_dehalfop(victim))) ||
+        !channel_bitch(chan)))
       add_mode(chan, '+', 'h', who);
   }
 
   if (!nick[0])
     putlog(LOG_MODES, chan->dname, "TS resync (%s): %s deopped by %s",
-	   chan->dname, who, from);
+           chan->dname, who, from);
   if (!(m->flags & (CHANVOICE | STOPWHO))) {
     dprintf(DP_HELP, "WHO %s\n", m->nick);
     m->flags |= STOPWHO;
@@ -751,10 +741,10 @@
         if (u) {
           get_user_flagrec(u, &victim, chan->dname);