diff -uNrd -x CVS ircd-ratbox-1.4-2/ChangeLog bcnet-ircd-1.2.2/ChangeLog
--- ircd-ratbox-1.4-2/ChangeLog	Mon Apr 26 13:55:27 2004
+++ bcnet-ircd-1.2.2/ChangeLog	Sun May  9 10:35:58 2004
@@ -1,64 +1,3 @@
-leeh        2004/04/26 13:55:00 EDT	(20040426_1)
-
-  Modified files:        (Branch: RATBOX_1)
-    .                    RELNOTES 
-  Log:
-  - update RELNOTES
-  
-  Revision   Changes    Path
-  1.77.2.41  +13 -0     ircd-ratbox/RELNOTES
-
-
-
-leeh        2004/04/26 13:47:46 EDT	(20040426_0)
-
-  Modified files:        (Branch: RATBOX_1)
-    src                  channel.c 
-  Log:
-  - fix coming out of splitmode when we use split_delay and we arent
-    out of split anymore when the delay ends
-  
-  Revision    Changes    Path
-  7.381.2.11  +7 -0      ircd-ratbox/src/channel.c
-
-
-
-leeh        2004/04/22 14:58:54 EDT	(20040422_2)
-
-  Modified files:        (Branch: RATBOX_1)
-    doc                  ircd.8 
-  Log:
-  - update of ircd manpage via Jeremy
-  
-  Revision  Changes    Path
-  1.6.16.2  +15 -7     ircd-ratbox/doc/ircd.8
-
-
-
-leeh        2004/04/22 14:42:10 EDT	(20040422_1)
-
-  Modified files:        (Branch: RATBOX_1)
-    src                  s_conf.c 
-  Log:
-  - default split_delay to 60 seconds, 15s just isnt enough to finish a burst
-  
-  Revision    Changes    Path
-  7.416.2.25  +1 -1      ircd-ratbox/src/s_conf.c
-
-
-
-leeh        2004/04/22 14:37:27 EDT	(20040422_0)
-
-  Modified files:        (Branch: RATBOX_1)
-    help/opers           list 
-  Log:
-  - update LIST help with new modifiers
-  
-  Revision  Changes    Path
-  1.1.16.1  +8 -4      ircd-ratbox/help/opers/list
-
-
-
 leeh        2004/04/21 16:42:05 EDT	(20040421_3)
 
   Modified files:        (Branch: RATBOX_1)
diff -uNrd -x CVS ircd-ratbox-1.4-2/README.bcnet.txt bcnet-ircd-1.2.2/README.bcnet.txt
--- ircd-ratbox-1.4-2/README.bcnet.txt	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/README.bcnet.txt	Mon May 10 05:16:29 2004
@@ -0,0 +1,75 @@
+Changes to BCNet IRCd
+Version 1.2.0
+http://bcnet.blackcode.com/
+For help or support please visit: http://www.blackcode.com/forums/viewforum.php?f=21
+
+What is BCNet IRCd?
+BCNet IRCd is ratbox ircd (www.ircd-ratbox.org) with a set of patches. The idea of it
+was to make an IRCd more suitable for the BCNet IRC network. BcNet-IRCd uses version
+ircd-ratbox-1.3-2. The patches used are listed below:
+
+-Umode +X (hostmask spoofing) by Jeremy http://archive.cvs.freeworld.nu/patches/
+-Services Shortcut Generator by Hwy/Jeremy http://ircd.botbay.net/shortcuts/
+-Server<-->server ping module by Hwy http://ircd.botbay.net/pub/hwy-mods/
+-Nglist module by Hwy http://ircd.botbay.net/pub/hwy-mods/
+-Operlist module by Hwy http://ircd.botbay.net/pub/hwy-mods/
+-Modified include/config.h and include/ircd_defs.h to be compatible with the BCNet Network
+-Modified modules/Makefile.in to automatically compile added modules
+-Added chanmode +c (color stripping mode) http://ircd.botbay.net/pub/ratbox/3-Feature/androsyn/
+-Added help for NGLIST and SPING
+-Modified Makefile.in in doc/ so that example.conf and example.efnet.conf are no longer needed
+
+How to Use the IPMASK Patch
+-Edit your config and any auth block you want spoofed put flags = mask; in that block
+-Do not put the flags = mask; in any auth block that is already spoofed
+
+How to user the services shortcut generator
+-m_services.so is automatically installed and configure for BCNet
+-If you are not on BCNet and need to create your own module go here:
+ http://ircd.botbay.net/shortcuts/
+
+How to use server-->server ping module
+-/quote help sping
+
+How to use operlist module
+-/quote help operlist
+
+How to use nglist module
+-/quote help nglist
+
+What ./configure options does BCNet use?
+For FreeBSD:
+./configure --prefix=$HOME/bcnet-ircd --with-maxclients=1024  
+--with-nicklen=14 --with-topiclen=500 --enable-shared-modules 
+--disable-openssl --disable-assert --enable-small-net 
+--disable-ipv6 --enable-kque
+
+For Linux:
+./configure --prefix=$HOME/bcnet-ircd --with-maxclients=1024 
+--with-nicklen=14 --with-topiclen=500 --enable-shared-modules 
+--enable-rtsigio --disable-openssl --disable-assert 
+--enable-small-net --disable-ipv6
+
+Major Changes
+1.1.0:
+-removed 005 "This server utilizes IP masking." It could break some clients
+-new IPMASK patch used
+-ratbox-1.3-2 is now used as base
+-removed chghost and sethost commands
+
+1.1.1:
+-removed my own +c patch and put Androsyn's instead. mine broke some clients
+-Jeremy's ipmask patch now masks single dotted hosts differently
+-new IPMASK patch is used
+
+1.2.0:
+-ircd-ratbox-1.4-1 is now used as base
+-new IPMASK patch is used
+
+1.2.1:
+-used ratbox stable CVS to have a fixed /list on mIRC
+-modified Jeremy's IPMASK patch to apply properly and not break /list
+
+1.2.2:
+-update the m_services.c module, a core has been fixed
+-m_services.c automatically compiles and installs (for BCNet servers only)
diff -uNrd -x CVS ircd-ratbox-1.4-2/RELNOTES bcnet-ircd-1.2.2/RELNOTES
--- ircd-ratbox-1.4-2/RELNOTES	Mon Apr 26 13:54:56 2004
+++ bcnet-ircd-1.2.2/RELNOTES	Sun May  9 10:35:58 2004
@@ -1,19 +1,6 @@
 
 This is the current release of the 'RATBOX_1' tree of ircd-ratbox.
 
--- ircd-ratbox-1.4-2
-- remove the EOB command and force it via PING/PONG, fixing a bug with
-  sendq_eob
-- fixed problems with clients not being removed properly from reject cache
-- allow "LIST <n,>m" to search for channels with <n and >m users
-- fix giving no such kline on successful remote unkline
-- add ELIST 005 token, described in include/supported.h
-- /quote set maxclients is now an alias for /quote set max
-- raise split_delay to 60s, 15 just isnt enough for a burst on efnet
-- update of ircd manpage via Jeremy
-- we could come out of splitmode if we split again whilst waiting for split
-  delay, fixed.
-
 -- ircd-ratbox-1.4-1
 - init_netio() was in the wrong place, causing cpu spins on fbsd when kqueue
   was enabled.
@@ -76,4 +63,4 @@
 Other files recommended for reading: BUGS, README.FIRST, INSTALL
 
 --------------------------------------------------------------------------------
-$Id: RELNOTES,v 1.77.2.41 2004/04/26 17:54:56 leeh Exp $
+$Id: RELNOTES,v 1.77.2.40 2004/04/10 22:41:19 leeh Exp $
diff -uNrd -x CVS ircd-ratbox-1.4-2/bcnet-patches/umode-X-1.4.diff bcnet-ircd-1.2.2/bcnet-patches/umode-X-1.4.diff
--- ircd-ratbox-1.4-2/bcnet-patches/umode-X-1.4.diff	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/bcnet-patches/umode-X-1.4.diff	Sun May  9 10:35:58 2004
@@ -0,0 +1,1097 @@
+diff -uNrd ircd-ratbox-stable/doc/example.conf ircd-ratbox-stable+ipmask/doc/example.conf
+--- ircd-ratbox-stable/doc/example.conf	Thu Apr  8 08:57:47 2004
++++ ircd-ratbox-stable+ipmask/doc/example.conf	Sat Apr 10 19:57:11 2004
+@@ -239,6 +239,8 @@
+ 	 * no_tilde      (old - flag)	| don't prefix ~ to username if no ident
+ 	 * need_ident    (old + flag)	| require ident for user in this class
+ 	 * restricted			| prevent user from sending mode changes
++     * mask					| mask the users hostname
++	 * mask_notice			| give a notice when masking this host
+ 	 */
+ 	flags = kline_exempt, exceed_limit;
+ 	
+@@ -264,7 +266,7 @@
+ 	user = "*@*";
+ 	class = "users";
+ 	
+-	flags = restricted, need_ident;
++	flags = restricted, need_ident, mask, mask_notice;
+ };
+ 
+ /* operator {}: defines ircd operators. (OLD O:)
+diff -uNrd ircd-ratbox-stable/include/client.h ircd-ratbox-stable+ipmask/include/client.h
+--- ircd-ratbox-stable/include/client.h	Wed Mar 24 18:03:44 2004
++++ ircd-ratbox-stable+ipmask/include/client.h	Sat Apr 10 20:20:35 2004
+@@ -145,6 +145,7 @@
+ 	 * considered a read-only field after the client has registered.
+ 	 */
+ 	char host[HOSTLEN + 1];	/* client's hostname */
++	char rhost[HOSTLEN + 1];
+ 	/*
+ 	 * client->info for unix clients will normally contain the info from the 
+ 	 * gcos field in /etc/passwd but anything can go here.
+@@ -378,6 +379,8 @@
+ #define UMODE_ADMIN        0x40000	/* Admin on server */
+ #define UMODE_HIDDENOPER   0x80000	/* Oper hidden from stats p */
+ 
++#define UMODE_IPMASK	   0x100000
++
+ #define UMODE_ALL	   UMODE_SERVNOTICE
+ 
+ 
+@@ -417,7 +420,7 @@
+                          OPER_HIDDENOPER)
+ 
+ #define SEND_UMODES  (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP | \
+-                      UMODE_ADMIN)
++                      UMODE_ADMIN | UMODE_IPMASK)
+ #define ALL_UMODES   (SEND_UMODES | UMODE_SERVNOTICE | UMODE_CCONN | \
+                       UMODE_REJ | UMODE_SKILL | UMODE_FULL | UMODE_SPY | \
+                       UMODE_NCHANGE | UMODE_OPERWALL | UMODE_DEBUG | \
+@@ -499,6 +502,8 @@
+ 
+ #define SetGotId(x)             ((x)->flags |= FLAGS_GOTID)
+ #define IsGotId(x)              (((x)->flags & FLAGS_GOTID) != 0)
++
++#define IsMasked(x)				((x)->umodes & UMODE_IPMASK)
+ 
+ /*
+  * flags2 macros.
+diff -uNrd ircd-ratbox-stable/include/numeric.h ircd-ratbox-stable+ipmask/include/numeric.h
+--- ircd-ratbox-stable/include/numeric.h	Mon Apr  5 12:24:04 2004
++++ ircd-ratbox-stable+ipmask/include/numeric.h	Sat Apr 10 19:57:11 2004
+@@ -183,12 +183,15 @@
+ #define RPL_ENDOFBANLIST     368
+ /* rpl_endofwhowas above (369) */
+ 
++#define RPL_WHOWASREALHOST   370
+ #define RPL_INFO             371
+ #define RPL_MOTD             372
+ #define RPL_INFOSTART        373
+ #define RPL_ENDOFINFO        374
+ #define RPL_MOTDSTART        375
+ #define RPL_ENDOFMOTD        376
++
++#define RPL_WHOISHOST        378 /* -Jeremy */
+ 
+ #define RPL_YOUREOPER        381
+ #define RPL_REHASHING        382
+diff -uNrd ircd-ratbox-stable/include/s_conf.h ircd-ratbox-stable+ipmask/include/s_conf.h
+--- ircd-ratbox-stable/include/s_conf.h	Thu Apr  8 08:57:47 2004
++++ ircd-ratbox-stable+ipmask/include/s_conf.h	Sat Apr 10 19:57:11 2004
+@@ -140,6 +140,9 @@
+ #define CONF_FLAGS_CRYPTLINK            0x00400000
+ #define CONF_FLAGS_VHOSTED		0x00800000
+ #define CONF_FLAGS_TB			0x01000000
++
++#define CONF_FLAGS_IPMASK		0x02000000
++#define CONF_FLAGS_MASK_NOTICE	0x04000000
+ /* Macros for struct ConfItem */
+ 
+ #define IsLimitIp(x)            ((x)->flags & CONF_FLAGS_LIMIT_IP)
+@@ -162,6 +165,8 @@
+ #define IsConfCryptLink(x)      ((x)->flags & CONF_FLAGS_CRYPTLINK)
+ #define IsConfVhosted(x)	((x)->flags & CONF_FLAGS_VHOSTED)
+ #define IsConfTburst(x)		((x)->flags & CONF_FLAGS_TB)
++#define IsConfDoMaskIp(x)		((x)->flags & CONF_FLAGS_IPMASK)
++#define IsConfMaskNotice(x)		((x)->flags & CONF_FLAGS_MASK_NOTICE)
+ 
+ /* flag definitions for opers now in client.h */
+ 
+diff -uNrd ircd-ratbox-stable/include/s_serv.h ircd-ratbox-stable+ipmask/include/s_serv.h
+--- ircd-ratbox-stable/include/s_serv.h	Mon Apr  5 12:24:04 2004
++++ ircd-ratbox-stable+ipmask/include/s_serv.h	Sat Apr 10 19:57:11 2004
+@@ -73,12 +73,13 @@
+ #define CAP_UNKLN       0x00100000	/* supports remote unkline */
+ #define CAP_CLUSTER	0x00200000	/* supports clustering */
+ #define CAP_ENCAP	0x00400000
++#define CAP_IPMASK  0x00800000
+ 
+ #define CAP_MASK        (CAP_QS  | CAP_EX   | CAP_CHW  | \
+                          CAP_IE  | CAP_EOB  | CAP_KLN  | \
+                          CAP_GLN | CAP_CLUSTER | CAP_ENCAP | \
+                          CAP_ZIP  | CAP_ENC | \
+-                         CAP_KNOCK  | CAP_UNKLN)
++                         CAP_KNOCK  | CAP_UNKLN | CAP_IPMASK)
+ 
+ #ifdef HAVE_LIBZ
+ #define CAP_ZIP_SUPPORTED       CAP_ZIP
+diff -uNrd ircd-ratbox-stable/include/s_user.h ircd-ratbox-stable+ipmask/include/s_user.h
+--- ircd-ratbox-stable/include/s_user.h	Fri Apr  2 08:45:45 2004
++++ ircd-ratbox-stable+ipmask/include/s_user.h	Sat Apr 10 20:04:58 2004
+@@ -44,7 +44,7 @@
+ extern int do_local_user(char *, struct Client *, struct Client *, char *, char *, char *, char *);
+ 
+ extern int do_remote_user(char *, struct Client *, struct Client *,
+-			  char *, char *, char *, char *);
++			  char *, char *, char *, char *, char *);
+ 
+ extern int user_modes_from_c_to_bitmask[];
+ extern void show_isupport(struct Client *);
+diff -uNrd ircd-ratbox-stable/include/supported.h ircd-ratbox-stable+ipmask/include/supported.h
+--- ircd-ratbox-stable/include/supported.h	Thu Apr  8 08:57:48 2004
++++ ircd-ratbox-stable+ipmask/include/supported.h	Sat Apr 10 20:05:39 2004
+@@ -64,7 +64,8 @@
+ 		  " CALLERID" \
+ 		  " ETRACE" \
+ 		  " WALLCHOPS" \
+-		  " SAFELIST"
++		  " SAFELIST" \
++		  " IPMASK"
+ 
+ #define FEATURES2VALUES ConfigServerHide.disable_local_channels ? "#" : "#&", \
+                         ConfigChannel.use_except ? "e" : "", \
+diff -uNrd ircd-ratbox-stable/include/whowas.h ircd-ratbox-stable+ipmask/include/whowas.h
+--- ircd-ratbox-stable/include/whowas.h	Mon Mar 15 11:19:45 2004
++++ ircd-ratbox-stable+ipmask/include/whowas.h	Sat Apr 10 19:57:11 2004
+@@ -51,6 +51,7 @@
+ 	char name[NICKLEN];
+ 	char username[USERLEN + 1];
+ 	char hostname[HOSTLEN + 1];
++	char rhostname[HOSTLEN + 1];
+ 	const char *servername;
+ 	char realname[REALLEN + 1];
+ 	time_t logoff;
+diff -uNrd ircd-ratbox-stable/modules/Makefile.in ircd-ratbox-stable+ipmask/modules/Makefile.in
+--- ircd-ratbox-stable/modules/Makefile.in	Mon Apr  5 12:24:06 2004
++++ ircd-ratbox-stable+ipmask/modules/Makefile.in	Sat Apr 10 19:57:11 2004
+@@ -87,6 +87,7 @@
+   m_set.c \
+   m_stats.c \
+   m_svinfo.c \
++  m_svs.c \
+   m_tb.c \
+   m_testline.c \
+   m_testmask.c \
+diff -uNrd ircd-ratbox-stable/modules/core/m_nick.c ircd-ratbox-stable+ipmask/modules/core/m_nick.c
+--- ircd-ratbox-stable/modules/core/m_nick.c	Wed Mar 24 18:03:46 2004
++++ ircd-ratbox-stable+ipmask/modules/core/m_nick.c	Sat Apr 10 20:03:17 2004
+@@ -277,7 +277,7 @@
+ 	}
+ 
+ 	/* parc == 3 on nickchange, parc == 9 on new nick */
+-	if((IsClient(source_p) && (parc != 3)) || (IsServer(source_p) && (parc != 9)))
++	if((IsClient(source_p) && (parc != 3)) || (IsServer(source_p) && ((parc != 9) && (parc != 10))))
+ 	{
+ 		char tbuf[BUFSIZE] = { 0 };
+ 		int j;
+@@ -302,23 +302,30 @@
+ 	/* fix the length of the nick */
+ 	strlcpy(nick, parv[1], sizeof(nick));
+ 
+-	if(check_clean_nick(client_p, source_p, nick, parv[1], 
+-			    (parc == 9 ? parv[7] : (char *)source_p->user->server)))
+-		return;
++    if ((parc == 9) || (parc == 10))
++	{
++		if (check_clean_nick(client_p, source_p, nick, parv[1], parv[7]))
++			return;
++	}
++	else
++	{
++		if (check_clean_nick(client_p, source_p, nick, parv[1], (char *)source_p->user->server))
++			return;
++	}
+ 
+-	if(parc == 9)
++	if(parc == 9 || parc == 10)
+ 	{
+ 		if(check_clean_user(client_p, nick, parv[5], parv[7]) ||
+ 		   check_clean_host(client_p, nick, parv[6], parv[7]))
+ 			return;
+ 
+ 		/* check the length of the clients gecos */
+-		if(strlen(parv[8]) > REALLEN)
++		if(strlen(parv[(parc > 9)? 9 : 8]) > REALLEN)
+ 		{
+ 			sendto_realops_flags(UMODE_ALL, L_ALL,
+ 					     "Long realname from server %s for %s", parv[7],
+ 					     parv[1]);
+-			parv[8][REALLEN] = '\0';
++			parv[(parc > 9)? 9 : 8][REALLEN] = '\0';
+ 		}
+ 
+ 		if(IsServer(source_p))
+@@ -591,7 +598,8 @@
+ 			}
+ 
+ 			return do_remote_user(nick, client_p, source_p, parv[5], parv[6],
+-					      parv[7], parv[8]);
++					      parv[7], (parc > 9)? parv[8] : NULL,
++						parv[(parc > 9)? 9 : 8]);
+ 		}
+ 	}
+ 	else if(source_p->name[0])
+diff -uNrd ircd-ratbox-stable/modules/m_svs.c ircd-ratbox-stable+ipmask/modules/m_svs.c
+--- ircd-ratbox-stable/modules/m_svs.c	Wed Dec 31 17:00:00 1969
++++ ircd-ratbox-stable+ipmask/modules/m_svs.c	Sat Apr 10 19:57:11 2004
+@@ -0,0 +1,243 @@
++/************************************************************************
++ *   IRC - Internet Relay Chat, doc/example_module.c
++ *   Copyright (C) 2001 Hybrid Development Team
++ *
++ *   This program is free software; you can redistribute it and/or modify
++ *   it under the terms of the GNU General Public License as published by
++ *   the Free Software Foundation; either version 1, or (at your option)
++ *   any later version.
++ *
++ *   This program is distributed in the hope that it will be useful,
++ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *   GNU General Public License for more details.
++ *
++ *   You should have received a copy of the GNU General Public License
++ *   along with this program; if not, write to the Free Software
++ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ *
++ *   $Id: m_svs.c,v 1.6 2003/11/05 18:29:47 jeremy Exp $
++ */
++
++/* List of ircd includes from ../include/ */
++#include "stdinc.h"
++#include "handlers.h"
++#include "client.h"
++#include "common.h"     /* FALSE bleah */
++#include "ircd.h"
++#include "irc_string.h"
++#include "numeric.h"
++#include "fdlist.h"
++#include "s_bsd.h"
++#include "s_conf.h"
++#include "s_log.h"
++#include "s_serv.h"
++#include "send.h"
++#include "msg.h"
++#include "parse.h"
++#include "modules.h"
++
++#include "s_user.h"  /* send_umode_out() */
++#include "channel_mode.h" /* MODE_ADD & MOD_DEL */
++#include "hash.h"
++
++static void ms_svshost(struct Client *client_p, struct Client *source_p,
++                    int parc, char *parv[]);
++static void mo_svshost(struct Client *client_p, struct Client *source_p,
++                    int parc, char *parv[]);
++
++static void remove_host(struct Client *, char *);
++static void change_host(struct Client *, char *, char *);
++
++/* CHGHOST/SVSHOST/SETHOST */
++struct Message svshost_msgtab = {
++  "SVSHOST", 0, 0, 0, 0, MFLG_SLOW, 0,
++  {m_ignore, m_ignore, ms_svshost, m_ignore}
++};
++struct Message chghost_msgtab = {
++  "CHGHOST", 0, 0, 2, 3, MFLG_SLOW, 0,
++  {m_ignore, m_not_oper, m_ignore, mo_svshost}
++};
++struct Message sethost_msgtab = {
++  "SETHOST", 0, 0, 2, 3, MFLG_SLOW, 0,
++  {m_ignore, m_not_oper, m_ignore, mo_svshost}
++};
++
++#ifndef STATIC_MODULES
++/* Here we tell it what to do when the module is loaded */
++void
++_modinit(void)
++{
++  /* This will add the commands in test_msgtab (which is above) */
++  /* SVSHOST/CHGHOST/SETHOST */
++  mod_add_cmd(&svshost_msgtab);
++  mod_add_cmd(&chghost_msgtab);
++  mod_add_cmd(&sethost_msgtab);
++}
++
++/* here we tell it what to do when the module is unloaded */
++void
++_moddeinit(void)
++{
++  /* This will remove the commands in test_msgtab (which is above) */
++  /* SVSHOST/CHGHOST/SETHOST */
++  mod_del_cmd(&svshost_msgtab);
++  mod_del_cmd(&chghost_msgtab);
++  mod_del_cmd(&sethost_msgtab);
++}
++
++/* When we last modified the file (shown in /modlist), this is usually:
++ */
++const char *_version = "$Revision: 1.6 $";
++#endif
++
++/*
++ * mo_svshost
++ *      parv[0] = sender prefix
++ *      parv[1] = target nickname
++ *      parv[2] = new hostname
++ */
++static void mo_svshost(struct Client *client_p, struct Client *source_p,
++                   int parc, char *parv[])
++{
++  struct Client *target_p;
++  char *nick, hostname[HOSTLEN+1];
++  int remove = 0;
++
++  nick = parv[1];
++
++  if(parc > 2)
++    strlcpy(hostname, parv[2], HOSTLEN);
++
++  if(!isalpha(nick[0]))
++    if(nick[0] == '-')
++      remove = 1;
++
++  if(remove > 0)
++    {
++      nick++;
++      remove_host(source_p, nick);
++    }
++  else
++    {
++      if (parc != 3)
++        {
++          sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "CHGHOST");
++          return;
++        }
++      change_host(source_p, nick, (hostname)? hostname : NULL);
++    }
++
++  return;
++}
++
++static void remove_host(struct Client *source_p, char *nick)
++{
++  struct Client *target_p;
++
++  if ((target_p = find_client(nick)) == NULL)
++    {
++      sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, target_p->name);
++      return;
++    }
++
++  strcpy(target_p->host, target_p->rhost);
++
++  sendto_one(source_p, "Reset %s's Host", target_p->name);
++  return;
++}
++
++static void change_host(struct Client *source_p, char *nick, char *host)
++{
++  struct Client *target_p;
++  char oldhost[HOSTLEN+1];
++  int setflags;
++
++  if ((target_p = find_client(nick)) == NULL)
++    {
++      sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, nick);
++      return;
++    }
++
++  /* check at this point for a valid hostname, and if its null
++     which it shouldn't be at this point */
++  if (!valid_hostname(host) || (host == NULL) || (strlen(host) > HOSTLEN))
++    {
++      sendto_one(source_p, "%s :Invalid Hostname", host);
++      return;
++    }
++
++  if(!strchr(host, '.') && !strchr(host, ':'))
++    {
++      sendto_one(source_p, "Hostname's must contain one . or :");
++      return;
++    }
++
++  /* Preserve the old hostname until we are finished */
++  strcpy(oldhost, target_p->host);
++
++  /* Prevent any unnecessary bursts */
++  if(!strcmp(oldhost, host))
++    {
++      sendto_one(source_p, "%s :Hostname Identical", host);
++      return;
++    }
++
++  if(MyClient(target_p) && IsMasked(target_p))
++    {
++      setflags = target_p->umodes;
++      target_p->umodes &= ~UMODE_IPMASK;
++      send_umode_out(target_p, target_p, setflags);
++    }
++
++  strcpy(target_p->host, host);
++  sendto_realops_flags(UMODE_ALL, L_ALL, "CHGHOST was used on %s (%s -> %s)", nick, oldhost, host);
++  ilog(L_NOTICE, "%s changed %s's hostname (%s -> %s)", source_p->name, nick, oldhost, host);
++  sendto_server(NULL, NULL, CAP_IPMASK, NOCAPS, ":%s SVSHOST %s %s %s", source_p->name, target_p->name, oldhost, host);
++
++  sendto_one(source_p, "Changed %s's Host (%s -> %s)", nick, oldhost, host);
++  return;
++}
++
++/*
++ * ms_svshost
++ *      parv[0] = sender prefix
++ *      parv[1] = target nickname
++ *      parv[2] = new hostname
++ */
++static void ms_svshost(struct Client *client_p, struct Client *source_p,
++                   int parc, char *parv[])
++{
++  struct Client *target_p;
++  char *nick;
++  int setflags;
++  nick = parv[1];
++
++  if (parc != 4)
++    return;
++
++  sendto_server(client_p, NULL, CAP_IPMASK, NOCAPS, ":%s SVSHOST %s %s %s", parv[0], parv[1], parv[2], parv[3]);
++
++  target_p = find_client(nick);  
++  strcpy(target_p->host, parv[3]);
++
++  if(!IsServer(client_p))
++    {
++      sendto_realops_flags(UMODE_ALL, L_ALL, "CHGHOST was used on %s (%s -> %s)", nick, parv[2], parv[3]);
++      ilog(L_NOTICE, "%s changed %s's hostname (%s -> %s)", parv[0], nick, parv[2], parv[3]);
++    }
++  else
++    {
++      /* Changing the host on a masked user?
++         if so pull +X */
++      if(MyClient(target_p) && IsMasked(target_p))
++        {
++          setflags = target_p->umodes;
++          target_p->umodes &= ~UMODE_IPMASK;
++          send_umode_out(target_p, target_p, setflags);
++        }
++      ilog(L_NOTICE, "Caught SVSHOST from server [%s], Possibly a change of UMODE_ISMASK", parv[0]);
++    }
++
++  return;
++}
+diff -uNrd ircd-ratbox-stable/modules/m_whois.c ircd-ratbox-stable+ipmask/modules/m_whois.c
+--- ircd-ratbox-stable/modules/m_whois.c	Mon Apr  5 12:24:07 2004
++++ ircd-ratbox-stable+ipmask/modules/m_whois.c	Sat Apr 10 19:57:11 2004
+@@ -303,6 +303,9 @@
+ 		   target_p->username, target_p->host, target_p->info);
+ 	server_name = (char *) target_p->user->server;
+ 
++  if((IsOper(source_p)) || (source_p == target_p))
++    sendto_one(source_p, form_str(RPL_WHOISHOST), me.name, source_p->name, target_p->name, target_p->rhost);
++
+ 	cur_len = mlen = ircsprintf(buf, form_str(RPL_WHOISCHANNELS), me.name, source_p->name, target_p->name);
+ 	t = buf + mlen;
+ 
+diff -uNrd ircd-ratbox-stable/modules/m_whowas.c ircd-ratbox-stable+ipmask/modules/m_whowas.c
+--- ircd-ratbox-stable/modules/m_whowas.c	Mon Mar 15 11:19:50 2004
++++ ircd-ratbox-stable+ipmask/modules/m_whowas.c	Sat Apr 10 19:57:11 2004
+@@ -154,6 +154,10 @@
+ 				sendto_one(source_p, form_str(RPL_WHOISSERVER),
+ 					   me.name, parv[0], temp->name,
+ 					   temp->servername, myctime(temp->logoff));
++
++          if(IsOper(source_p))
++            sendto_one(source_p, form_str(RPL_WHOWASREALHOST), me.name, parv[0], temp->name, temp->hostname, temp->rhostname);
++
+ 			cur++;
+ 			found++;
+ 		}
+diff -uNrd ircd-ratbox-stable/src/Makefile.in ircd-ratbox-stable+ipmask/src/Makefile.in
+--- ircd-ratbox-stable/src/Makefile.in	Wed Mar 24 18:03:46 2004
++++ ircd-ratbox-stable+ipmask/src/Makefile.in	Sat Apr 10 19:57:11 2004
+@@ -69,6 +69,7 @@
+   hash.c                        \
+   hook.c                        \
+   hostmask.c                    \
++  ipmask.c						\
+   irc_string.c                  \
+   ircd.c                        \
+   ircd_signal.c                 \
+diff -uNrd ircd-ratbox-stable/src/client.c ircd-ratbox-stable+ipmask/src/client.c
+--- ircd-ratbox-stable/src/client.c	Wed Mar 24 18:03:46 2004
++++ ircd-ratbox-stable+ipmask/src/client.c	Sat Apr 10 19:57:11 2004
+@@ -1541,7 +1541,7 @@
+ 		if(IsPerson(source_p))
+ 			sendto_realops_flags(UMODE_CCONN, L_ALL,
+ 					     "Client exiting: %s (%s@%s) [%s] [%s]",
+-					     source_p->name, source_p->username, source_p->host,
++					     source_p->name, source_p->username, source_p->rhost,
+ 					     comment,
+ #ifdef HIDE_SPOOF_IPS
+ 					     IsIPSpoof(source_p) ? "255.255.255.255" :
+diff -uNrd ircd-ratbox-stable/src/hostmask.c ircd-ratbox-stable+ipmask/src/hostmask.c
+--- ircd-ratbox-stable/src/hostmask.c	Wed Mar 24 12:38:21 2004
++++ ircd-ratbox-stable+ipmask/src/hostmask.c	Sat Apr 10 19:57:11 2004
+@@ -454,6 +454,9 @@
+ 	aconf = find_conf_by_address(client_p->host, &client_p->localClient->ip,
+ 				     CONF_KILL, client_p->localClient->aftype, client_p->username);
+ 
++	if (!aconf)
++		aconf = find_conf_by_address(client_p->rhost, &client_p->localClient->ip, CONF_KILL, client_p->localClient->aftype, client_p->username);
++
+ 	return aconf;
+ }
+ 
+@@ -470,6 +473,9 @@
+ 
+ 	aconf = find_conf_by_address(client_p->host, &client_p->localClient->ip,
+ 				     CONF_GLINE, client_p->localClient->aftype, client_p->username);
++
++	if (!aconf)
++		aconf = find_conf_by_address(client_p->rhost, &client_p->localClient->ip, CONF_GLINE, client_p->localClient->aftype, client_p->username);
+ 
+ 	return aconf;
+ }
+diff -uNrd ircd-ratbox-stable/src/ipmask.c ircd-ratbox-stable+ipmask/src/ipmask.c
+--- ircd-ratbox-stable/src/ipmask.c	Wed Dec 31 17:00:00 1969
++++ ircd-ratbox-stable+ipmask/src/ipmask.c	Sat Apr 10 20:42:33 2004
+@@ -0,0 +1,248 @@
++/*
++ *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
++ *  FreeWorld-ircd:
++ *  ipmask.c: IP Masking routines.
++ *
++ *  Copyright (C) 2002 by the past and present ircd coders, and others.
++ *
++ *  This program is free software; you can redistribute it and/or modify
++ *  it under the terms of the GNU General Public License as published by
++ *  the Free Software Foundation; either version 2 of the License, or
++ *  (at your option) any later version.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program; if not, write to the Free Software
++ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
++ *  USA
++ *
++ *  $Id: ipmask.c,v 1.2 2003/10/20 06:30:42 ircd Exp $
++ */
++
++#include "stdinc.h"
++#include "tools.h"
++#include "s_user.h"
++#include "channel.h"
++#include "channel_mode.h"
++#include "class.h"
++#include "client.h"
++#include "common.h"
++#include "fdlist.h"
++#include "hash.h"
++#include "irc_string.h"
++#include "sprintf_irc.h"
++#include "ircd.h"
++#include "listener.h"
++#include "motd.h"
++#include "ircd_handler.h"
++#include "msg.h"
++#include "numeric.h"
++#include "s_bsd.h"
++#include "s_conf.h"
++#include "s_log.h"
++#include "s_serv.h"
++#include "s_stats.h"
++#include "scache.h"
++#include "send.h"
++#include "supported.h"
++#include "whowas.h"
++#include "memory.h"
++#include "packet.h"
++
++void maskip (struct Client *);
++int calculate_ip (struct Client *);
++
++void maskip (struct Client *client_p)
++{
++	char buf[HOSTLEN];
++	int i = 0,j = 0,k = 0;
++	char *tmp = NULL;
++	char *tmp2 = NULL;
++	char *tmp3 = NULL;
++	char *tmp4 = NULL;
++	static char mask[HOSTLEN];
++
++	strlcpy(buf, client_p->rhost, HOSTLEN);
++	j = strlen(buf);
++    mask[0] = '\0';
++
++	if(strchr(buf, '.'))
++	{
++		k = calculate_ip (client_p);
++		if(!isdigit(buf[j - 1]))
++		{
++			tmp = strchr(buf, '.');
++			*tmp = '\0';
++			tmp++;
++			tmp2 = strchr(tmp, '.');
++
++			if(tmp2 != NULL)
++				ircsprintf(mask, "%s-%d.%s", ServerInfo.network_name, k, tmp);
++
++		}
++		else
++		{
++			tmp = strrchr(buf, '.');
++			*tmp = '\0';
++			tmp--;
++
++			ircsprintf(mask, "%s.%d", buf, k);
++		}
++
++		if (mask[0] != '\0') {
++			sendto_realops_flags(UMODE_DEBUG, L_ALL, "Applying mask (%s) to %s", mask, client_p->name);
++			strlcpy(client_p->host, mask, HOSTLEN);
++		}
++	}
++
++
++#ifdef IPV6
++	if(strchr(buf, ':'))
++	{
++		tmp = strrchr(buf, ':');
++		*tmp = '\0';
++		tmp--;
++		tmp2 = strrchr(tmp, ':');
++
++		if(tmp2 != NULL)
++		{
++			tmp3 = strrchr(tmp2, ':');
++
++			if(tmp3 != NULL)
++			{
++				tmp4 = strrchr(tmp3, ':');
++				*tmp4 = '\0';
++				tmp4--;
++			}
++			ircsprintf(mask, "%s::IPV6", buf);
++		}
++
++		if (mask[0] != '\0') {
++			sendto_realops_flags(UMODE_DEBUG, L_ALL, "Applying mask (%s) to %s", mask, client_p->name);
++			strlcpy(client_p->host, mask, HOSTLEN);
++		}
++	}
++#endif
++
++}
++
++int calculate_ip (struct Client *client_p)
++{
++  char buffer[BUFSIZE];
++  char *tmp, *tmp2, *tmp3;
++  int a,b,c,d,e;
++
++/*  if (!MyClient(client_p))
++    return;*/
++
++  strcpy(buffer, client_p->localClient->sockhost);
++
++  if (strchr(buffer, ':'))
++    return 0;
++
++  if ((tmp = strchr(buffer, '.')) != NULL)
++  {
++    *tmp = '\0';
++    tmp++;
++
++    if ((tmp2 = strchr(tmp, '.')) != NULL)
++    {
++      *tmp2 = '\0';
++      tmp2++;
++
++      if ((tmp3 = strchr(tmp2, '.')) != NULL)
++      {
++        *tmp3 = '\0';
++        tmp3++;
++      }
++    }
++  }
++
++  a = atoi(buffer);
++  b = atoi(tmp);
++  c = atoi(tmp2);
++  d = atoi(tmp3);
++
++  e = a + b + c + d;
++  e = e * e * 1024 % 100000;
++
++  return e;
++}
++
++char *ret_maskip(struct Client *client_p)
++{
++        char buf[HOSTLEN];
++        int i = 0,j = 0,k = 0;
++        char *tmp = NULL;
++        char *tmp2 = NULL;
++        char *tmp3 = NULL;
++        char *tmp4 = NULL;
++        static char mask[HOSTLEN];
++
++        strlcpy(buf, client_p->rhost, HOSTLEN);
++        j = strlen(buf);
++        mask[0] = '\0';
++  
++        if(strchr(buf, '.'))
++        {
++                k = calculate_ip (client_p);
++                if(!isdigit(buf[j - 1]))
++                {
++                        tmp = strchr(buf, '.');
++                        *tmp = '\0';
++                        tmp++;
++                        tmp2 = strchr(tmp, '.');
++  
++                        if(tmp2 != NULL)
++                                ircsprintf(mask, "%s-%d.%s", ServerInfo.network_name, k, tmp);
++
++			else
++			    ircsprintf (mask, "%s-%d.%s", ServerInfo.network_name, k, buf);
++			    //strcpy (mask, client_p->host);
++ 
++                }
++                else
++                {
++                        tmp = strrchr(buf, '.');
++                        *tmp = '\0';
++                        tmp--;
++  
++                        ircsprintf(mask, "%s.%d", buf, k);
++                }  
++
++        }
++
++
++#ifdef IPV6
++        if(strchr(buf, ':'))
++        {
++                tmp = strrchr(buf, ':');
++                *tmp = '\0';
++                tmp--;
++                tmp2 = strrchr(tmp, ':');
++
++                if(tmp2 != NULL)
++                {
++                        tmp3 = strrchr(tmp2, ':');
++
++                        if(tmp3 != NULL)
++                        {
++                                tmp4 = strrchr(tmp3, ':');
++                                *tmp4 = '\0';
++                                tmp4--;
++                        }
++                        ircsprintf(mask, "%s::IPV6", buf);
++                }  
++
++        }
++#endif
++
++	if (mask[0] != '\0')
++		return mask;
++	else
++		return client_p->host;
++}
+diff -uNrd ircd-ratbox-stable/src/messages.tab ircd-ratbox-stable+ipmask/src/messages.tab
+--- ircd-ratbox-stable/src/messages.tab	Mon Apr  5 12:24:08 2004
++++ ircd-ratbox-stable+ipmask/src/messages.tab	Sat Apr 10 19:57:11 2004
+@@ -24,7 +24,7 @@
+ /* 001  RPL_WELCOME, */ ":%s 001 %s :Welcome to the %s Internet Relay Chat Network %s",
+ /* 002  RPL_YOURHOST,*/ ":%s 002 %s :Your host is %s, running version %s",
+ /* 003  RPL_CREATED, */ ":%s 003 %s :This server was created %s",
+-/* 004  RPL_MYINFO, */ ":%s 004 %s %s %s oiwszcerkfydnxbauglZ biklmnopstveI bkloveI",
++/* 004  RPL_MYINFO, */ ":%s 004 %s %s %s oiwszcerkfydnxbauglZX biklmnopstveI bkloveI",
+ /* 005  RPL_ISUPPORT, */ ":%s 005 %s %s :are supported by this server",
+ /* 006 */       NULL,
+ /* 007 */       NULL,
+@@ -394,7 +394,7 @@
+ /* 367 RPL_BANLIST, */          ":%s 367 %s %s %s %s %lu",
+ /* 368 RPL_ENDOFBANLIST, */     ":%s 368 %s %s :End of Channel Ban List",
+ /* 369 RPL_ENDOFWHOWAS, */      ":%s 369 %s %s :End of WHOWAS",
+-/* 370 */       NULL,
++/* 370 RPL_WHOWASREALHOST, */   ":%s 370 %s :%s was connected from *@%s [%s]", 
+ /* 371 RPL_INFO, */             ":%s 371 %s :%s",
+ /* 372 RPL_MOTD, */             ":%s 372 %s :- %s",
+ /* 373 RPL_INFOSTART, */        ":%s 373 %s :Server INFO",
+@@ -402,7 +402,7 @@
+ /* 375 RPL_MOTDSTART, */        ":%s 375 %s :- %s Message of the Day - ",
+ /* 376 RPL_ENDOFMOTD, */        ":%s 376 %s :End of /MOTD command.",
+ /* 377 */       NULL,
+-/* 378 */       NULL,
++/* 378 RPL_WHOISHOST */         ":%s 378 %s :%s is connected from *@%s",
+ /* 379 */       NULL,
+ /* 380 */       NULL,
+ /* 381 RPL_YOUREOPER, */        ":%s 381 %s :You have entered... the Vanity Zone!.",
+diff -uNrd ircd-ratbox-stable/src/newconf.c ircd-ratbox-stable+ipmask/src/newconf.c
+--- ircd-ratbox-stable/src/newconf.c	Thu Apr  8 08:57:49 2004
++++ ircd-ratbox-stable+ipmask/src/newconf.c	Sat Apr 10 19:57:11 2004
+@@ -112,6 +112,8 @@
+ 	{"restricted", CONF_FLAGS_RESTRICTED},
+ 	{"need_ident", CONF_FLAGS_NEED_IDENTD},
+ 	{"have_ident", CONF_FLAGS_NEED_IDENTD},
++	{"mask", CONF_FLAGS_IPMASK},
++	{"mask_notice", CONF_FLAGS_MASK_NOTICE},
+ 	{NULL}
+ };
+ 
+@@ -1412,6 +1414,28 @@
+ 	DupString(yy_achead->className, data);
+ }
+ 
++static void
++conf_set_auth_mask(void *data)
++{
++	int yesno = *(unsigned int *) data;
++
++	if (yesno)
++		yy_achead->flags |= CONF_FLAGS_IPMASK;
++	else
++		yy_achead->flags &= ~CONF_FLAGS_IPMASK;
++}
++
++static void
++conf_set_auth_mask_notice (void *data)
++{
++	int yesno = *(unsigned int *) data;
++
++	if (yesno)
++		yy_achead->flags |= CONF_FLAGS_MASK_NOTICE;
++	else
++		yy_achead->flags &= ~CONF_FLAGS_MASK_NOTICE;
++}
++
+ static int
+ conf_begin_resv(struct TopConf *tc)
+ {
+@@ -3066,6 +3090,8 @@
+ 	add_conf_item("auth", "flood_exempt", CF_YESNO, conf_set_auth_flood_exempt);
+ 	add_conf_item("auth", "redirserv", CF_QSTRING, conf_set_auth_redir_serv);
+ 	add_conf_item("auth", "redirport", CF_INT, conf_set_auth_redir_port);
++	add_conf_item("auth", "mask", CF_YESNO, conf_set_auth_mask);
++	add_conf_item("auth", "mask_notice", CF_YESNO, conf_set_auth_mask_notice);
+ 	add_conf_item("auth", "flags", CF_STRING | CF_FLIST, conf_set_auth_flags);
+ 
+ 	add_top_conf("resv", conf_begin_resv, conf_end_resv);
+diff -uNrd ircd-ratbox-stable/src/s_conf.c ircd-ratbox-stable+ipmask/src/s_conf.c
+--- ircd-ratbox-stable/src/s_conf.c	Thu Apr  8 08:57:50 2004
++++ ircd-ratbox-stable+ipmask/src/s_conf.c	Sat Apr 10 19:57:11 2004
+@@ -56,6 +56,7 @@
+ #include "patricia.h"
+ #include "reject.h"
+ 
++char *ret_maskip(struct Client *);
+ 
+ struct config_server_hide ConfigServerHide;
+ 
+@@ -534,6 +535,16 @@
+ 			SetNeedId(client_p);
+ 		if(IsConfRestricted(aconf))
+ 			SetRestricted(client_p);
++
++
++		strlcpy (client_p->rhost, client_p->host, sizeof(client_p->rhost));
++		if(IsConfDoMaskIp(aconf))
++		{
++			strcpy (client_p->host, ret_maskip(client_p));
++			client_p->umodes |= UMODE_IPMASK;
++			if(IsConfMaskNotice(aconf))
++				sendto_realops_flags (UMODE_ALL, L_ALL, "%s masking: %s as %s", client_p->name, client_p->rhost, client_p->host);
++		}
+ 
+ 		/* Thanks for spoof idea amm */
+ 		if(IsConfDoSpoofIp(aconf))
+diff -uNrd ircd-ratbox-stable/src/s_serv.c ircd-ratbox-stable+ipmask/src/s_serv.c
+--- ircd-ratbox-stable/src/s_serv.c	Thu Apr  8 08:57:50 2004
++++ ircd-ratbox-stable+ipmask/src/s_serv.c	Sat Apr 10 19:57:11 2004
+@@ -96,6 +96,7 @@
+ 	{ "UNKLN",	CAP_UNKLN },
+ 	{ "CLUSTER",	CAP_CLUSTER },
+ 	{ "ENCAP",	CAP_ENCAP },
++	{ "IPMASK", CAP_IPMASK },
+ 	{ 0, 		0 }
+ };
+ 
+@@ -791,13 +792,15 @@
+ 		ubuf[1] = '\0';
+ 	}
+ 
+-		sendto_one(client_p, "NICK %s %d %lu %s %s %s %s :%s",
++		sendto_one(client_p, "NICK %s %d %lu %s %s %s %s %s :%s",
+ 			   target_p->name,
+ 			   target_p->hopcount + 1,
+ 			   (unsigned long) target_p->tsinfo,
+ 			   ubuf,
+ 			   target_p->username, target_p->host,
+-			   target_p->user->server, target_p->info);
++			   target_p->user->server,
++			   IsCapable (client_p, CAP_IPMASK)? target_p->rhost : "", target_p->info);
++
+ }
+ 
+ /*
+diff -uNrd ircd-ratbox-stable/src/s_user.c ircd-ratbox-stable+ipmask/src/s_user.c
+--- ircd-ratbox-stable/src/s_user.c	Sat Apr  3 12:31:30 2004
++++ ircd-ratbox-stable+ipmask/src/s_user.c	Sat Apr 10 20:04:02 2004
+@@ -54,11 +54,13 @@
+ #include "memory.h"
+ #include "packet.h"
+ #include "reject.h"
++#include "hostmask.h"
+ 
+ static void report_and_set_user_flags(struct Client *, struct ConfItem *);
+ static int check_X_line(struct Client *client_p, struct Client *source_p);
+ void user_welcome(struct Client *source_p);
+ int oper_up(struct Client *source_p, struct ConfItem *aconf);
++char *ret_maskip(struct Client *);
+ 
+ extern char *crypt();
+ 
+@@ -88,6 +90,7 @@
+ 	{UMODE_UNAUTH, 'u'},
+ 	{UMODE_WALLOP, 'w'},
+ 	{UMODE_EXTERNAL, 'x'},
++    {UMODE_IPMASK, 'X'},
+ 	{UMODE_SPY, 'y'},
+ 	{UMODE_OPERWALL, 'z'},
+ 	{UMODE_OPERSPY, 'Z'},
+@@ -462,7 +465,7 @@
+ 		 ipaddr, HOSTIPLEN);
+ 	sendto_realops_flags(UMODE_CCONN, L_ALL,
+ 			     "Client connecting: %s (%s@%s) [%s] {%s} [%s]",
+-			     nick, source_p->username, source_p->host,
++			     nick, source_p->username, source_p->rhost,
+ #ifdef HIDE_SPOOF_IPS
+ 			     IsIPSpoof(source_p) ? "255.255.255.255" :
+ #endif
+@@ -608,13 +611,21 @@
+ 		ubuf[1] = '\0';
+ 	}
+ 
+-	sendto_server(client_p, NULL, NOCAPS, NOCAPS,
++	sendto_server(client_p, NULL, NOCAPS, CAP_IPMASK,
+ 		      "NICK %s %d %lu %s %s %s %s :%s",
+ 		      nick, source_p->hopcount + 1, 
+ 		      (unsigned long) source_p->tsinfo, ubuf, 
+ 		      source_p->username, source_p->host, user->server,
+ 		      source_p->info);
+ 
++    sendto_server(client_p, NULL, CAP_IPMASK, NOCAPS,
++              "NICK %s %d %lu %s %s %s %s %s :%s",
++              nick, source_p->hopcount + 1,
++              (unsigned long) source_p->tsinfo, ubuf,
++              source_p->username, source_p->host, user->server,
++			  source_p->rhost,
++              source_p->info);
++
+ 	return 0;
+ }
+ 
+@@ -841,7 +852,7 @@
+  */
+ int
+ do_remote_user(char *nick, struct Client *client_p, struct Client *source_p,
+-	       char *username, char *host, char *server, char *realname)
++	       char *username, char *host, char *server, char *rhost, char *realname)
+ {
+ 	unsigned int oflags;
+ 	struct User *user;
+@@ -862,6 +873,11 @@
+ 	strlcpy(source_p->host, host, sizeof(source_p->host));
+ 	strlcpy(source_p->info, realname, sizeof(source_p->info));
+ 
++	if(rhost)
++		strlcpy(source_p->rhost, rhost, sizeof(source_p->rhost));
++	else
++		strlcpy(source_p->rhost, "unavailable", sizeof(source_p->rhost));
++
+ 	return register_remote_user(client_p, source_p, source_p->name, username);
+ }
+ 
+@@ -882,7 +898,8 @@
+ 	struct Client *target_p;
+ 	int what, setflags;
+ 	int badflag = NO;	/* Only send one bad flag notice */
+-	char buf[BUFSIZE];
++	char buf[BUFSIZE], oldhost[HOSTLEN];
++	struct ConfItem* aconf;
+ 
+ 	what = MODE_ADD;
+ 
+@@ -984,6 +1001,47 @@
+ 					}
+ 				}
+ 				break;
++
++				case 'X':
++				if (MyClient(source_p))
++				{
++					aconf = find_address_conf (source_p->rhost, source_p->username, &source_p->localClient->ip, source_p->localClient->aftype);
++
++					strcpy (oldhost, source_p->host);
++
++					if(what == MODE_ADD)
++					{
++						if(IsConfDoSpoofIp(aconf))
++						{
++							source_p->umodes &= ~UMODE_IPMASK;
++							break;
++						}
++
++						if(IsMasked(source_p))
++						{
++							if(!strcmp(ret_maskip(source_p), source_p->host))
++								break;
++
++							source_p->umodes |= UMODE_IPMASK;
++							strcpy(source_p->host, ret_maskip(source_p));
++						}
++
++						source_p->umodes |= UMODE_IPMASK;
++						strcpy(source_p->host, ret_maskip(source_p));
++					}
++
++					if(what == MODE_DEL)
++					{
++						if(!IsMasked(source_p))
++							break;
++
++						source_p->umodes &= ~UMODE_IPMASK;
++						strcpy(source_p->host, source_p->rhost);
++					}
++
++					sendto_server (NULL, NULL, CAP_IPMASK, NOCAPS, ":%s SVSHOST %s %s %s", me.name, source_p->name, oldhost, source_p->host);
++			}
++			break;
+ 
+ 			case 'p':
+ 				if (MyConnect(source_p))
+diff -uNrd ircd-ratbox-stable/src/version.c.SH ircd-ratbox-stable+ipmask/src/version.c.SH
+--- ircd-ratbox-stable/src/version.c.SH	Sun Jul  6 08:01:03 2003
++++ ircd-ratbox-stable+ipmask/src/version.c.SH	Sat Apr 10 20:19:54 2004
+@@ -52,10 +52,12 @@
+ #include "patchlevel.h"
+ #include "serno.h"
+ 
++#define PATCHVER PATCHLEVEL "+ipmask-1.4"
++
+ const char *generation = "$generation";
+ const char *creation = "$creation";
+ const char *platform = "$uname";
+-const char *ircd_version = PATCHLEVEL;
++const char *ircd_version = PATCHVER;
+ const char *serno = SERIALNUM;
+ 
+ const char *infotext[] =
+diff -uNrd ircd-ratbox-stable/src/whowas.c ircd-ratbox-stable+ipmask/src/whowas.c
+--- ircd-ratbox-stable/src/whowas.c	Mon Mar 15 11:19:57 2004
++++ ircd-ratbox-stable+ipmask/src/whowas.c	Sat Apr 10 19:57:11 2004
+@@ -88,6 +88,7 @@
+ 	strlcpy(who->name, client_p->name, sizeof(who->name));
+ 	strcpy(who->username, client_p->username);
+ 	strcpy(who->hostname, client_p->host);
++	strcpy(who->rhostname, client_p->rhost);
+ 	strcpy(who->realname, client_p->info);
+ 
+ 	who->servername = client_p->user->server;
diff -uNrd -x CVS ircd-ratbox-1.4-2/bcnet-patches/umode_c.patch bcnet-ircd-1.2.2/bcnet-patches/umode_c.patch
--- ircd-ratbox-1.4-2/bcnet-patches/umode_c.patch	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/bcnet-patches/umode_c.patch	Sun May  9 10:35:58 2004
@@ -0,0 +1,89 @@
+Index: include/channel_mode.h
+===================================================================
+RCS file: /cvsroot/ircd-ratbox/include/Attic/channel_mode.h,v
+retrieving revision 7.22.2.3
+diff -u -r7.22.2.3 channel_mode.h
+--- a/include/channel_mode.h	7 Nov 2003 00:00:37 -0000	7.22.2.3
++++ b/include/channel_mode.h	25 Feb 2004 02:14:47 -0000
+@@ -86,7 +86,7 @@
+ #define MODE_EXCEPTION  0x0800
+ #define MODE_INVEX	0x2000
+ #define MODE_HIDEOPS    0x4000
+-
++#define MODE_NOCOLOR	0x8000
+ /*
+  * mode flags which take another parameter (With PARAmeterS)
+  */
+Index: modules/core/m_message.c
+===================================================================
+RCS file: /cvsroot/ircd-ratbox/modules/core/m_message.c,v
+retrieving revision 1.131.2.5
+diff -u -r1.131.2.5 m_message.c
+--- a/modules/core/m_message.c	8 Jan 2004 01:20:17 -0000	1.131.2.5
++++ b/modules/core/m_message.c	25 Feb 2004 02:14:47 -0000
+@@ -53,6 +53,29 @@
+ 	int flags;
+ };
+ 
++/* check to see if the message has any color chars in it. */
++static int msg_has_colors(const char *msg)
++{
++ 
++    const char *c;
++    if (msg==NULL) return 0;
++    c=msg;
++    while(*c)
++    {
++        if(*c == '\003' || *c == '\033' || *c == '\026' || *c == '\037')
++            break;
++        else
++            c++;
++    }
++
++    if(*c)
++        return 1;
++
++    return 0;
++}
++ 
++
++
+ static int build_target_list(int p_or_n, const char *command,
+ 			     struct Client *client_p,
+ 			     struct Client *source_p, char *nicks_channels, const char *text);
+@@ -439,7 +462,7 @@
+ 	}
+ 
+ 	/* chanops and voiced can flood their own channel with impunity */
+-	if((result = can_send(chptr, source_p, NULL)))
++	if((result = can_send(chptr, source_p, NULL)) && !(chptr->mode.mode & MODE_NOCOLOR && msg_has_colors(text)))
+ 	{
+ 		if(result == CAN_SEND_OPV ||
+ 		   !flood_attack_channel(p_or_n, source_p, chptr, chptr->chname))
+Index: src/channel_mode.c
+===================================================================
+RCS file: /cvsroot/ircd-ratbox/src/Attic/channel_mode.c,v
+retrieving revision 7.107.2.7
+diff -u -r7.107.2.7 channel_mode.c
+--- a/src/channel_mode.c	7 Nov 2003 00:00:44 -0000	7.107.2.7
++++ b/src/channel_mode.c	25 Feb 2004 02:14:47 -0000
+@@ -332,7 +332,9 @@
+ 		*mbuf++ = 'i';
+ 	if(chptr->mode.mode & MODE_NOPRIVMSGS)
+ 		*mbuf++ = 'n';
+-
++	if(chptr->mode.mode & MODE_NOCOLOR)
++		*mbuf++ = 'c';
++		
+ 	if(chptr->mode.limit)
+ 	{
+ 		*mbuf++ = 'l';
+@@ -1309,7 +1311,7 @@
+   {chm_nosuch, NULL},
+   {chm_nosuch, NULL},				  /* a */
+   {chm_ban, NULL},                                /* b */
+-  {chm_nosuch, NULL},                             /* c */
++  {chm_simple, (void *) MODE_NOCOLOR},            /* c */
+   {chm_nosuch, NULL},                             /* d */
+   {chm_except, NULL},                             /* e */
+   {chm_nosuch, NULL},                             /* f */
diff -uNrd -x CVS ircd-ratbox-1.4-2/doc/Makefile.in bcnet-ircd-1.2.2/doc/Makefile.in
--- ircd-ratbox-1.4-2/doc/Makefile.in	Fri Sep 13 18:20:51 2002
+++ bcnet-ircd-1.2.2/doc/Makefile.in	Sun May  9 10:35:57 2004
@@ -30,7 +30,7 @@
 mandir          = @prefix@/man8
 MANPAGES        = ircd.8
 
-CONFS		= example.conf example.efnet.conf
+CONFS		= bcnet.sample.conf
 DEFAULTCONFS	= kline.conf dline.conf xline.conf resv.conf
 DEFAULTCONFSCP  = ircd.motd
 
diff -uNrd -x CVS ircd-ratbox-1.4-2/doc/bcnet.sample.conf bcnet-ircd-1.2.2/doc/bcnet.sample.conf
--- ircd-ratbox-1.4-2/doc/bcnet.sample.conf	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/doc/bcnet.sample.conf	Sun May  9 10:35:57 2004
@@ -0,0 +1,1042 @@
+/* BCNet-IRCd-1.0.0 Sample Config
+ * Done by wassup
+ * Most documentation taken from sample ratbox sample config
+ * Small amount of documentation taken from freeworld sample config
+ */
+
+/* IMPORTANT NOTES:
+ *
+ * class {} blocks MUST be specified before anything that uses them.  That
+ * means they must be defined before auth {} and before connect {}.
+ *
+ * auth {} blocks MUST be specified in order of precedence.  The first one
+ * that matches a user will be used.  So place spoofs first, then specials,
+ * then general access, then restricted.
+ *
+ * Both shell style (#) and C style comments are supported.
+ *
+ * Files may be included by either:
+ *        .include "filename"
+ *        .include <filename>
+ *
+ * Times/durations are written as:
+ *        12 hours 30 minutes 1 second
+ *        
+ * Valid units of time:
+ *        month, week, day, hour, minute, second
+ *
+ * Valid units of size:
+ *        megabyte/mbyte/mb, kilobyte/kbyte/kb, byte
+ *
+ * Sizes and times may be singular or plural.  
+ */
+
+/* serverinfo {}:  Contains information about the server. (OLD M:) */
+serverinfo {
+	/* name: the name of our server */
+	name = "sample.server";
+
+	/* description: the description of our server.  '[' and ']' may not
+	 * be used here for compatibility with older servers.
+	 */
+	description = "Sample Server";
+
+	/* network info: the name and description of the network this server
+	 * is on.  Shown in the 005 reply and used with serverhiding.
+	 */
+	network_name = "TestNet";
+	network_desc = "Test Servers";
+
+	/* hub: allow this server to act as a hub and have multiple servers
+	 * connected to it.
+	 */
+	hub = yes;
+
+	/* vhost: the IP to bind to when we connect outward to ipv4 servers.
+	 * This should be an ipv4 IP only.
+	 */
+	#vhost = "192.169.0.1";
+
+	/* vhost6: the IP to bind to when we connect outward to ipv6 servers.
+	 * This should be an ipv6 IP only.
+	 */
+	#vhost6 = "3ffe:80e8:546::2";
+
+	/* rsa key: the path to the file containing our rsa key for cryptlink.
+	 *
+	 * Example command to store a 2048 bit RSA keypair in
+	 * rsa.key, and the public key in rsa.pub:
+	 * 
+	 * 	openssl genrsa -out rsa.key 2048
+	 *	openssl rsa -in rsa.key -pubout -out rsa.pub
+	 *	chown <ircd-user>.<ircd.group> rsa.key rsa.pub
+	 *	chmod 0600 rsa.key
+	 *	chmod 0644 rsa.pub
+	 */
+     #rsa_private_key_file = "/home/alex/bcnet-ircd/rsa.key";
+
+    /* SSL certificate file, used for client SSL connections
+     *
+     * To create a new certificate file use this:
+     * openssl req -new -x509 -days 730 -config /etc/ssl/openssl.cnf -key rsa.key -out cert.pem
+     */
+    #ssl_certificate_file = "/home/alex/bcnet-ircd/cert.pem";
+
+    /* Certification Authority certificate file, used to sign
+     * ssl_certificate_file. Shouldn't be used if certificate
+     * is self-signed
+     */
+    #ssl_ca_certificate_file = "/home/alex/bcnet-ircd/ca.pem";
+
+};
+
+/* admin {}: contains admin information about the server. (OLD A:) */
+admin {
+	name = "Smurf target";
+	description = "Main Server Administrator";
+	email = "<syn@packets.r.us>";
+};
+	
+/* logging {}: contains information about logfiles. */
+logging {
+	/* log level: the amount of detail to log in ircd.log.  The
+	 * higher, the more information is logged.  May be changed
+	 * once the server is running via /quote SET LOG.  Either:
+	 * L_CRIT, L_ERROR, L_WARN, L_NOTICE, L_TRACE, L_INFO or L_DEBUG
+	 */
+	log_level = L_INFO;
+
+	/* logfiles: the logfiles to use for user connects, /oper uses,
+	 * and failed /oper.  These files must exist for logging to be used.
+	 */
+	fname_userlog = "logs/userlog";
+	fname_operlog = "logs/operlog";
+	fname_foperlog = "logs/foperlog";
+};
+
+/* class {}: contain information about classes for users (OLD Y:) */
+class "users" {
+	/* You can either put the class name here or with the class itself
+	/* name: the name of the class.  classes are text now */
+	/* name = "users"; */
+
+	/* ping time: how often a client must reply to a PING from the
+	 * server before they are dropped.
+	 */
+	ping_time = 2 minutes;
+
+        /* number per ident: the number of users per user@host networkwide
+         * allowed to connect.  Unidented connections are classified as
+         * the same ident.
+         */
+        number_per_ident = 2;
+
+	/* number per ip: the number of local users per host allowed */
+	number_per_ip = 3;
+
+        /* number per ip global: the number of network wide connections
+         * per host allowed for a user, including connections to the
+         * local server.
+         */
+        number_per_ip_global = 5;
+
+	/* number per cidr: the number of local connections from the
+	 * CIDR bitlen allowed.  If the server is compiled with ipv6, 96
+	 * must be added to the bitlen for ipv4 connections.
+	 */
+	number_per_cidr = 30;
+	cidr_bitlen = 24;
+
+	/* max number: the maximum number of users allowed in this class */
+	max_number = 100;
+
+	/* sendq: the amount of data allowed in a clients queue before
+	 * they are dropped.
+	 */
+	sendq = 100 kbytes;
+};
+
+class "restricted" {
+	ping_time = 1 minute 30 seconds;
+	number_per_ip = 1;
+	max_number = 100;
+	sendq = 60kb;
+};
+
+class "opers" {
+	ping_time = 5 minutes;
+	number_per_ip = 10;
+	max_number = 100;
+	sendq = 100kbytes;
+};
+
+class "server" {
+	ping_time = 5 minutes;
+
+	/* connectfreq: only used in server classes.  specifies the delay
+	 * between autoconnecting to servers.
+	 */
+	connectfreq = 5 minutes;
+
+	/* max number: the amount of servers to autoconnect to */
+	max_number = 1;
+
+	/* sendq: servers need a higher sendq as they send more data */
+	sendq=2 megabytes;
+	
+	/* sendq eob: servers sendq after a burst has finished */
+	sendq_eob = 1024 kbytes;
+};
+
+/* listen {}: contain information about the ports ircd listens on (OLD P:) */
+listen {
+	/* port: the specific port to listen on.  if no host is specified
+	 * before, it will listen on all available IPs.
+	 *
+	 * ports are seperated via a comma, a range may be specified using ".."
+	 */
+	
+	/* port: listen on all available IPs, ports 5000 and 6665 to 6669 */
+	port = 5000, 6665 .. 6669;
+
+	/* host: set a specific IP/host the ports after the line will listen 
+	 * on.  This may be ipv4 or ipv6.
+	 */
+	host = "1.2.3.4";
+	port = 7000, 7001;
+
+	#host = "3ffe:1234:a:b:c::d";
+	#port = 7002;	
+};
+
+/* auth {}: allow users to connect to the ircd (OLD I:) */
+auth {
+	/* user: the user@host allowed to connect.  multiple IPv4/IPv6 user 
+	 * lines are permitted per auth block.
+	 */
+	user = "*@172.16.0.0/12";
+	user = "*test@123D:B567:*";
+
+        /* encrypted: specifies whether the password below is encrypted
+         * or not.  MD5 is supported, default is not encrypted
+         */
+        #encrypted = yes;
+
+	/* password: an optional password that is required to use this block */
+	password = "letmein";
+	
+	/* spoof: fake the users user@host to be be this.  You may either
+	 * specify a host or a user@host to spoof to.  This is free-form,
+	 * just do everyone a favour and dont abuse it. (OLD I: = flag)
+	 */
+        spoof = "I.still.hate.packets";
+
+        /* Possible flags in auth:
+         *
+         * spoof_notice                | give a notice when spoofing this host
+         * exceed_limit  (old > flag)  | allow user to exceed class user limits
+         * kline_exempt  (old ^ flag)  | exempt this user from k/g/xlines
+         * gline_exempt  (old _ flag)  | exempt this user from glines
+	   * spambot_exempt		   | exempt this user from spambot checks
+         * flood_exempt                | exempt this user from flood limits
+         *                                     USE WITH CAUTION
+         * no_tilde      (old - flag)  | don't prefix ~ to username if no ident
+         * need_ident    (old + flag)  | require ident for user in this class
+         * restricted                  | prevent user from sending mode changes
+         * mask		               | mask hosts in this block
+         */
+	flags = kline_exempt, exceed_limit;
+
+	/* class: the class the user is placed in */
+	class = "opers";
+};
+
+auth {
+	/* redirect: the server and port to redirect a user to.  A user does
+	 * not have to obey the redirection, the ircd just suggests to them
+	 * an alternative server.
+	 */
+	redirserv = "irc.fi";
+	redirport = 6667;
+	
+	user = "*.fi";
+
+	/* class: a class is required even though it is not used */
+	class = "users";
+};
+
+auth {
+	user = "*@*";
+	class = "users";
+	flags = mask;
+};
+
+/* operator "opername" {}: defines ircd operators. (OLD O:)
+ * ircd-ratbox no longer supports local operators, privileges are
+ * controlled via flags.
+ */
+operator "god" {
+
+	/* user: the user@host required for this operator.  CIDR is not
+	 * supported.  multiple user="" lines are supported.
+	 */
+	user = "*god@*";
+	user = "*@127.0.0.1";
+
+        /* encrypted: specifies whether the password below is encrypted
+         * or not.  default is encrypted.
+         */
+        #encrypted = no;
+
+	/* password: the password required to oper.  Unless encrypted=no;
+         * this will need to be encrypted using mkpasswd, MD5 is
+         * supported
+	 */
+	password = "etcnjl8juSU1E";
+
+	/* rsa key: the public key for this oper when using Challenge.
+	 * A password should not be defined when this is used, see 
+	 * doc/challenge.txt for more information.
+	 */
+	#rsa_public_key_file = "/usr/local/ircd/etc/oper.pub";
+
+	/* class: the class the oper joins when they successfully /oper */
+	class = "opers";
+
+	/* privileges: controls the activities and commands an oper are 
+	 * allowed to do on the server.  All options default to no.
+	 * Available options:
+	 *
+	 * local_kill:   allows local users to be /KILL'd
+	 * global_kill:  allows local and remote users to  (OLD 'O' flag)
+	 *               be /KILL'd
+	 * remote:       allows remote SQUIT and CONNECT   (OLD 'R' flag)
+	 * kline:        allows KILL, KLINE and DLINE      (OLD 'K' flag)
+	 * unkline:      allows UNKLINE and UNDLINE        (OLD 'U' flag)
+	 * gline:        allows GLINE                      (OLD 'G' flag)
+         * xline:        allows user to XLINE/UNXLINE
+	 * nick_changes: allows oper to see nickchanges    (OLD 'N' flag)
+	 *               via usermode +n
+	 * rehash:       allows oper to REHASH config      (OLD 'H' flag)
+	 * die:          allows DIE and RESTART            (OLD 'D' flag)
+         * operwall:     allows viewing/use of OPERWALL
+	 * admin:        gives admin privileges.  admins
+	 *               may (un)load modules etc.
+	 * hidden_admin: gives admin privileges except
+	 *		 will not have the admin lines in
+	 *		 stats p and whois.
+	 * oper_spy:     give access to operspy tools, if loaded
+	 */
+
+        flags = global_kill, remote, kline, unkline, gline,
+                die, rehash, admin, xline, operwall;
+
+        /* or in the old format */
+/*	global_kill = yes;
+ *      remote = yes;
+ *      kline = yes;
+ *      unkline = yes;
+ *      gline = yes;
+ *      die = yes;
+ *      rehash = yes;
+ *      nick_changes = yes;
+ *      admin = yes;
+ */
+};
+
+/* connect "servername" {}: controls servers we connect to (OLD C:, N:, H:, L:) */
+connect "irc.uplink.com" {
+
+	/* host: the host or IP to connect to.  If a hostname is used it
+	 * must match the reverse dns of the server.
+	 */
+	host = "192.168.0.1";
+
+	/* vhost: the host or IP to bind to for this connection.  If this
+	 * is not specified, the default vhost (in serverinfo {}) is used.
+	 * This works for both IPv4 and IPv6, providing the aftype is correct.
+	 */
+	# vhost = "192.168.0.50";
+
+	/* passwords: the passwords we send (OLD C:) and accept (OLD N:).
+	 * The remote server will have these passwords reversed.
+	 */
+	send_password = "password";		# OLD C:
+	accept_password = "anotherpassword";	# OLD N:
+
+	/* encrypted: controls whether the accept_password above has been
+	 * encrypted.  (OLD CRYPT_LINK_PASSWORD now optional per connect)
+	 */
+	encrypted = no;
+
+	/* port: the port to connect to this server on (OLD P:) */
+	port = 6666;
+
+	/* hub mask: the mask of servers that this server may hub. Multiple
+	 * entries are permitted (OLD H:)
+	 */
+	hub_mask = "*";
+
+	/* leaf mask: the mask of servers this server may not hub.  Multiple
+	 * entries are permitted.  Useful for forbidding EU -> US -> EU routes.
+         * (OLD L:)	
+         */
+	#leaf_mask = "*.uk";
+
+	/* class: the class this server is in */
+	class = "server";
+
+	/* autoconnect: controls whether we autoconnect to this server or not,
+	 * dependent on class limits.
+	 */
+	autoconn = no;
+	
+	/* compressed: controls whether traffic is compressed via ziplinks.
+	 * By default this is disabled (OLD c: (lowercased))
+	 */
+	#compressed = yes;
+
+	/* topicburst: controls whether topics are burst over this link.
+	 * by default this is disabled
+	 */
+	topicburst = yes;
+
+	/* masking: the servername we pretend to be when we connect */
+	#fakename = "*.arpa";
+};
+
+connect "encrypted.auth.example" {
+	host = "some.host.somewhere";
+	port = 6667;
+
+	/* cryptlink: enable full encryption for all data passing between our
+	 * server and this link and rsa authentication.
+	 */
+	cryptlink = yes;
+
+	/* rsa key: the path to the public keyfile of the server.  Used instead
+	 * of passwords.
+	 */
+	rsa_public_key_file = "etc/remote.server.keyfile";
+
+	/* cipher preference: set the preferred cipher for this link
+	 *
+	 * Available ciphers are:
+	 *      BF/256 BF/128 CAST/128 IDEA/128 RC5.16/128 
+	 *      RC5.12/128 RC5.8/128 3DES/168 DES/56
+	 *
+	 * NOTE:  Some ciphers may not be supported by your OpenSSL.
+	 *        Check the output from 'configure' for available ciphers.
+	 * 
+	 * NOTE2: To help you decide what cipher to use, tools/encspeed
+	 *        will show you approximately how fast each cipher is.
+	 *        However, blowfish is fast and secure, and is probably
+	 *        a good default for most situations.
+	 *
+	 * NOTE3: Default if none is set is BF/128
+	 *
+	 * The cipher *MUST* be the same in both directions.  If you
+	 * set a cipher preference, your uplink must set the same cipher,
+	 * else it will not link.
+	 */
+	#cipher_preference = "BF/256";
+};
+
+connect "ipv6.some.server" {
+        host = "3ffd:dead:beef::1";
+        send_password = "password";
+        accept_password = "password";
+        port = 6666;
+
+	/* aftype: controls whether the connection uses "ipv4" or "ipv6".
+	 * Default is ipv4.
+	 */
+	aftype = ipv6;
+        class = "server";
+};
+
+/* cluster {}; servers that have klines/unklines/locops shared automatically
+ * (OLD hyb6 SLAVE_SERVERS)
+ */
+cluster {
+	/* name: the server to share with, this can be a wildcard */
+	/* NOTE: clustering is only done for actions by LOCAL opers, so the
+	 * action will only be clustered to the servers that the originating
+	 * server has set as such.
+	 */
+	name = "*.lan";
+
+	/* type: list of what to share, options:
+	 *    kline   - share klines
+	 *    unkline - share unklines
+	 *    locops  - share locops
+	 *    xline   - share xlines
+	 *    unxline - share unxlines
+	 *    resv    - share resvs
+	 *    unresv  - share unresvs
+	 *    all     - share all of the above
+	 */
+	type = kline, unkline, locops;
+};
+
+/* shared {}: users that are allowed to remote kline (OLD U:) 
+ *
+ * EFnet Note: This can be effectively used for remote klines.
+ *             Please note that there is no password authentication
+ *             for users setting remote klines.  You must also be
+ *             /oper'd in order to issue a remote kline. 
+ */
+shared {
+	/* name: the server the user must be on to set klines.  If this is not
+	 * specified, the user will be allowed to kline from all servers.
+	 */
+	name = "irc2.some.server";
+
+	/* user: the user@host mask that is allowed to set klines.  If this is
+	 * not specified, all users on the server above will be allowed to set
+	 * a remote kline.
+	 */
+	user = "oper@my.host.is.spoofed";
+
+        /* type: list of what to share, options:
+	 *    kline   - allow oper/server to kline (default)
+	 *    unkline - allow oper/server to unkline
+	 *    xline   - allow oper/server to xline/unxline
+	 *    resv    - allow oper/server to resv/unresv
+	 *    all     - allow oper/server to do all of above
+	 */
+	type = kline, unkline;
+};
+
+/* kill {}: users that are not allowed to connect (OLD K:)
+ * Oper issued klines will be added to the specified kline config
+ */
+kill {
+	user = "bad@*.hacked.edu";
+	reason = "Obviously hacked account";
+};
+
+/* deny {}: IPs that are not allowed to connect (OLD D:) (before DNS/ident
+ * lookup) Oper issued dlines will be added to the specified dline config
+ */
+deny {
+	ip = "10.0.1.0/24";
+	reason = "Reconnecting vhosted bots";
+};
+
+/* exempt {}: IPs that are exempt from deny {} and Dlines. (OLD d:) 
+ *
+ * EFnet Note: exempt {} blocks are NOT hidden, so do NOT exempt
+ *             EFnet server IP's.
+ */
+exempt {
+	ip = "192.168.0.0/16";
+};
+
+/* resv {}: nicks and channels users may not use/join (OLD Q:) */
+resv {
+        /* reason: the reason for the proceeding resv's */
+        reason = "There are no services on this network";
+
+	/* resv: the nicks and channels users may not join/use */
+	nick = "nickserv";
+	nick = "chanserv";
+        nick = "operserv";
+        nick = "JUPES";
+        nick = "JUPE";
+        nick = "CH?NF?X"; 		# CHANFIX (services.int)
+        /* These are totally optional, but may be a good idea */
+	nick = "oper";
+	nick = "ircop";
+	nick = "op";
+	nick = "ident";
+	nick = "pass";
+	channel = "#jupedchan";
+
+	/* resv: wildcard masks are also supported in nicks only */
+	reason = "Clone bots";
+	nick = "clone*";
+};
+
+/* gecos {}:  The X: replacement, used for banning users based on their
+ * "realname".  The action may be either:
+ *      warn:   allow client to connect, but send message to opers
+ *      reject: drop clients but also send message to opers.
+ *      silent: silently drop clients who match.
+ */
+gecos {
+	name = "*sex*";
+	reason = "Possible spambot";
+	action = warn;
+};
+
+gecos {
+	name = "sub7server";
+	reason = "Trojan drone";
+	action = reject;
+};
+
+gecos {
+	name = "*http*";
+	reason = "Spambot";
+	action = silent;
+};
+
+/* The channel block contains options pertaining to channels */
+channel {
+	/* invex: Enable/disable channel mode +I, a n!u@h list of masks
+	 * that can join a +i channel without an invite.
+ 	 * 
+	 * EFNet Note: This MUST be run on efnet
+         */
+	use_invex = yes;
+
+	/* except: Enable/disable channel mode +e, a n!u@h list of masks
+	 * that can join a channel through a ban (+b).
+	 *
+       * EFNet Note: This MUST be run on efnet
+       */
+	use_except = yes;
+
+	/* knock: Allows users to request an invite to a channel that
+	 * is locked somehow (+ikl).  If the channel is +p or you are banned
+	 * the knock will not be sent.
+	 *
+       * EFnet Note:  As this feature is used by European servers, but
+       *              not North American ones, it has been left enabled
+       *              by default.  Please feel free to disable this
+       *              if you do not want to run channel knock.
+       */
+	use_knock = no;
+
+	/* knock delay: The amount of time a user must wait between issuing
+	 * the knock command.
+	 */
+	knock_delay = 5 minutes;
+
+	/* knock channel delay: How often a knock to any specific channel
+	 * is permitted, regardless of the user sending the knock.
+	 */
+	knock_delay_channel = 1 minute;
+
+	/* max chans: The maximum number of channels a user can join/be on. */
+	max_chans_per_user = 10;
+
+      /* quiet on ban: stop banned people talking in channels. */
+      quiet_on_ban = yes;
+
+      /* max bans: maximum number of +b/e/I modes in a channel */
+	/* EFNET approved 100 at 01/08/03 */
+      max_bans = 50;
+
+        /* splitcode: the ircd will check every 10s as to whether splitmode
+	 * should be disabled or not, so there may be a delay between a
+	 * netsplit ending and splitmode ending.
+	 *
+	 * both split users and split servers must be true to enter splitmode
+	 * 
+	 * you may force splitmode to be permanent by /quote set splitmode on
+	 */
+
+	/* split users: when the usercount is lower than this level, consider
+	 * ourselves split.  this must be set for automatic splitmode
+	 */
+	default_split_user_count = 0;
+
+	/* split servers: when the servercount is lower than this, consider
+	 * ourselves split.  this must be set for automatic splitmode
+	 */
+	default_split_server_count = 0;
+
+	/* split delay: the amount of time after the netsplit ends to come
+	 * out of splitmode.  0 disables.
+	 */
+	default_split_delay = 15 seconds;
+
+	/* split no create: disallow users creating channels on split */
+	no_create_on_split = no;
+
+	/* split: no join: disallow users joining channels at all on a split */
+	no_join_on_split = no;
+
+      /* no oper resvs: allow opers to join/talk through channel jupes */
+      no_oper_resvs = yes;
+
+	/* burst topicwho: when bursting topics, also burst the topic setter
+	 * NOTE: on efnet this will add about 500k-1mb to a burst.
+	 */
+	burst_topicwho = yes;
+};
+
+
+/* The serverhide block contains the options regarding serverhiding */
+serverhide {
+	/* flatten links: this option will show all servers in /links appear
+	 * that they are linked to this current server
+  	 * 	
+       * EFnet Note:  While this is not a requirement on EFnet, it
+       *              may be a good idea. 
+ 	 */
+	flatten_links = yes;
+
+	/* links delay: how often to update the links file when it is
+	 * flattened.
+	 */
+	links_delay = 5 minutes;
+
+	/* hidden: hide this server from a /links output on servers that
+	 * support it.  this allows hub servers to be hidden etc.
+	 */
+      hidden = no;
+
+	/* disable hidden: prevent servers hiding themselves from a
+	 * /links ouput.
+	 */
+	disable_hidden = no;
+
+	/* hide servers: hide remote servernames everywhere and instead use
+	 * network_name and network_desc.
+	 */
+	hide_servers = no;
+
+	/* disable remote: disable users doing commands on remote servers */
+	disable_remote_commands = no;
+
+	/* disable local channels: prevent users from joining &channels.
+	 * This is extreme, but it is still a flaw in serverhide.  It will
+	 * however remove far more from users than it will give back in
+	 * security.
+	 */
+	disable_local_channels = yes;
+};
+
+/* The general block contains many of the options that were once compiled
+ * in options in config.h.  The general block is read at start time.
+ */
+general {	
+	/* hide error messages: defines whether error messages from
+	 * servers are hidden or not.  These can sometimes contain IPs and
+	 * can have an adverse effect on server ip hiding.  Set to:
+	 *     yes:   hide from opers and admin
+	 *     opers: hide from opers only
+	 *     no:    do not hide error messages
+	 */
+	hide_error_messages = no;
+
+        /*
+         * default_operstring: defines the default oper response
+         * in /whois queries, eg "is an IRC Operator"
+         */
+	default_operstring = "is an IRC Operator";
+
+	/* default_adminstring: defines the default admin response
+	 * in /whois queries, eg "is a Server Administrator"
+	 */
+	default_adminstring = "is a Server Administrator";
+
+        /* tkline_expire_notices: give a notice to opers when a tkline
+         * expires
+         */
+      tkline_expire_notices = yes;
+
+	/* reject time: the amount of rejections through klines/dlines etc
+	 * allowed in the given time before the rejection is cached and
+	 * a pseudo temp dline is placed
+	 */
+	reject_ban_time = 1 minute;
+	reject_after_count = 3;
+
+	/* reject duration: the amount of time to cache the rejection */
+	reject_duration = 5 minutes;
+
+	/* floodcount: the default value of floodcount that is configurable
+	 * via /quote set floodcount.  This is the amount of lines a user
+	 * may send to any other user/channel in one second.
+	 */
+      default_floodcount = 6;
+
+	/* failed oper notice: send a notice to all opers on the server when 
+	 * someone tries to OPER and uses the wrong password, host or ident.
+	 */
+	failed_oper_notice = yes;
+
+	/* dots in ident: the amount of '.' characters permitted in an ident
+	 * reply before the user is rejected.
+	 */
+	dots_in_ident=2;
+
+     /* dot in ipv6: ircd-hybrid-6.0 and earlier will disallow hosts 
+	* without a '.' in them.  this will add one to the end.  only needed
+	* for older servers.
+	*/
+      dot_in_ip6_addr = no;
+
+     /* min nonwildcard: the minimum non wildcard characters in k/d/g lines
+	* placed via the server.  klines hand placed are exempt from limits.
+	* wildcard chars: '.' '*' '?' '@'
+	*/
+	min_nonwildcard = 2;
+
+	/* min nonwildcard simple: the minimum non wildcard characters in
+	 * xlines/resvs placed via the server.
+	 * wildcard chars: '*' '?'
+	 */
+	min_nonwildcard_simple = 3;
+
+      /* max accept: maximum allowed /accept's for +g usermode */
+      max_accept = 20;
+
+	/* nick flood: enable the nickflood control code */
+	anti_nick_flood = yes;
+
+	/* nick flood: the nick changes allowed in the specified period */
+	max_nick_time = 60 seconds;
+	max_nick_changes = 5;
+
+      /* anti spam time: the minimum time a user must be connected before
+	 * custom quit messages are allowed.
+	 */
+      anti_spam_exit_message_time = 5 minutes;
+
+	/* ts delta: the time delta allowed between server clocks before
+	 * a warning is given, or before the link is dropped.  all servers
+	 * should run ntpdate/rdate to keep clocks in sync
+	 */
+	ts_warn_delta = 30 seconds;
+	ts_max_delta = 5 minutes;
+
+	/* client exit: prepend a users quit message with "Client exit: " */
+	client_exit = yes;
+
+	/* kline reason: show the user the reason why they are k/d/glined 
+	 * on exit.  may give away who set k/dline when set via tcm.
+	 */
+	kline_with_reason = yes;
+
+	/* kline connection closed: make the users quit message on channels
+	 * to be "Connection closed", instead of the kline reason.
+	 */
+	kline_with_connection_closed = no;
+
+	/* kline delay: delay the checking of klines until a specified time.
+	 * This is useful for the large kline lists that appear on efnet
+	 * and can cause the ircd to stall.
+	 */
+	kline_delay = 0 seconds;
+
+	/* non redundant klines: flag and ignore redundant klines */
+	non_redundant_klines = yes;
+
+	/* warn no nline: warn opers about servers that try to connect but
+	 * we dont have a connect {} block for.  Twits with misconfigured 
+	 * servers can get really annoying with this enabled.
+	 */
+	warn_no_nline = yes;
+
+	/* stats o oper only: make stats o (opers) oper only */
+	stats_o_oper_only=yes;
+
+	/* stats P oper only: make stats P (ports) oper only
+	 * NOTE: users doing stats P will never be given the ips that the 
+	 * server listens on, simply the ports.
+	 */
+	stats_P_oper_only=yes;
+
+	/* stats c opy only: make stats c (connect {}) oper only */
+	stats_c_oper_only=yes;
+
+	/* stats h oper only: make stats h (hub_mask/leaf_mask) oper only */
+	stats_h_oper_only=yes;
+
+	/* stats y oper only: make stats y (class {}) oper only */
+	stats_y_oper_only=yes;
+
+	/* stats i oper only: make stats i (auth {}) oper only. set to:
+	 *     yes:    show users no auth blocks, made oper only.
+	 *     masked: show users first matching auth block
+	 *     no:     show users all auth blocks.
+	 */
+	stats_i_oper_only=yes;
+
+	/* stats k/K oper only: make stats k/K (klines) oper only.  set to:
+	 *     yes:    show users no auth blocks, made oper only
+	 *     masked: show users first matching auth block
+	 *     no:     show users all auth blocks.
+	 */
+	stats_k_oper_only=yes;
+
+	/* map oper only: make MAP oper only. */
+	map_oper_only = yes;
+
+	/* caller id wait: time between notifying a +g user that somebody
+	 * is messaging them.
+	 */
+	caller_id_wait = 1 minute;
+
+	/* pace wait simple: time between use of less intensive commands
+	 * (HELP, remote WHOIS, WHOWAS)
+	 */
+	pace_wait_simple = 2 second;
+
+	/* pace wait: time between more intensive commands
+	 * (ADMIN, INFO, LIST, LUSERS, MOTD, STATS, VERSION)
+	 */
+	pace_wait = 10 seconds;
+
+	/* short motd: send clients a notice telling them to read the motd
+	 * instead of forcing a motd to clients who may simply ignore it.
+	 */
+	short_motd = no;
+
+	/* ping cookies: require clients to respond exactly to a ping command,
+	 * can help block certain types of drones and FTP PASV mode spoofing.
+	 */
+	ping_cookie = no;
+
+	/* connect timeout: sets how long we should wait for a connection
+	 * request to succeed
+	 */
+	connect_timeout = 30 seconds;
+
+      /* disable auth: disables identd checking */
+	disable_auth = no;
+
+	/* no oper flood: increase flood limits for opers. */
+	no_oper_flood = yes;
+
+        /* use_whois_actually: send clients requesting a whois a numeric
+         * giving the real IP of non-spoofed clients to prevent DNS abuse.
+         */
+	use_whois_actually = no;
+
+	/* glines: enable glines, network wide temp klines 
+         *
+         * EFnet Note: This feature is required for European EFnet servers
+         *             and is used by several North American servers.  As
+         *             such, it has been left on by default.  If you
+         *             do not want your server to participate in G:Lines
+         *             you should disable this.  
+         */
+	glines = yes;
+
+	/* gline time: the amount of time a gline will remain before exiring */
+	gline_time = 2 day;
+
+	/* gline_min_cidr: If using a CIDR gline, the minimum length the 
+         * mask must be
+         */
+	gline_min_cidr = 16;
+
+	/* idletime: the maximum amount of time a user may idle before
+	 * they are disconnected, 0 disables
+	 */
+      idletime = 0;
+
+	/* REMOVE ME.  The following line checks you've been reading. */
+	havent_read_conf = 1;
+
+	/* max targets: the maximum amount of targets in a single 
+	 * PRIVMSG/NOTICE.  set to 999 NOT 0 for unlimited.
+	 */
+	max_targets = 50;
+
+	/* client flood: maximum number of lines in a clients queue before
+	 * they are dropped for flooding.
+	 */
+	client_flood = 20;
+
+        /* use help: whether an improved help system per command is available
+         * to users.  If this is disabled, users will just be shown a command
+         * list.
+         *
+         * EFNET NOTE: It is not recommended you enable this due to the method
+         * of reading help files.
+         */
+      use_help = yes;
+
+	/* message locale: the default message locale if gettext() is enabled
+	 * and working.
+	 * Use "custom" for the (in)famous Hybrid custom messages.
+	 * Use "standard" for the compiled in defaults.
+	 */
+	message_locale = "custom";
+
+	/* usermodes configurable: a list of usermodes for the options below
+	 *
+	 * +b - bots       - See bot and drone flooding notices
+	 * +c - cconn      - Client connection/quit notices
+	 * +d - debug      - See debugging notices
+	 * +f - full       - See I: line full notices
+	 * +g - callerid   - Server Side Ignore (for privmsgs etc)
+	 * +i - invisible  - Not shown in NAMES or WHO unless you share a 
+	 *                   a channel
+	 * +k - skill      - See server generated KILL messages
+	 * +l - locops     - See LOCOPS messages
+	 * +n - nchange    - See client nick changes
+	 * +r - rej        - See rejected client notices
+	 * +s - servnotice - See general server notices
+	 * +u - unauth     - See unauthorised client notices
+	 * +w - wallop     - See server generated WALLOPS
+	 * +x - external   - See remote server connection and split notices
+	 * +y - spy        - See LINKS, STATS, TRACE notices etc.
+	 * +z - operwall   - See oper generated WALLOPS
+	 * +Z - operspy    - See operspy notices
+	 */
+	 
+	/* oper only umodes: usermodes only opers may set */
+	oper_only_umodes = bots, cconn, debug, full, skill, nchange, 
+                     rej, spy, external, operwall, locops, unauth;
+
+	/* oper umodes: default usermodes opers get when they /oper */
+	oper_umodes = locops, servnotice, operwall, wallop, debug, 
+			external, skill, spy;
+
+	/* servlink path: path to 'servlink' program used by ircd to handle
+	 * encrypted/compressed server <-> server links.
+	 *
+	 * only define if servlink is not in same directory as ircd itself.
+	 */
+	#servlink_path = "/home/meat_30/irc/ratbox/bin/servlink";
+
+ 	/* default cipher: default cipher to use for cryptlink when none is
+	 * specified in connect block.
+	 */
+	default_cipher_preference = "BF/256";
+
+	/* use egd: if your system does not have *random devices yet you
+	 * want to use OpenSSL and encrypted links, enable this.  Beware -
+	 * EGD is *very* CPU intensive when gathering data for its pool
+	 */
+	#use_egd = yes;
+
+	/* egdpool path: path to EGD pool. Not necessary for OpenSSL >= 0.9.7
+	 * which automatically finds the path.
+	 */
+	#egdpool_path = "/var/run/egd-pool";
+
+	/* compression level: level of compression for compressed links between
+	 * servers.  
+	 *
+	 * values are between: 1 (least compression, fastest)
+	 *                and: 9 (most compression, slowest).
+	 */
+	compression_level = 6;
+
+  	/* fallback_to_ip6_int: This enables falling back to using the
+         * ip6.int domain for reverse IPv6 lookups if the lookup for
+  	 * ip6.arpa failed.  This is obviously a feature that should be
+  	 * removed upon the completion of the migration to ip6.arpa
+  	 */
+	#fallback_to_ip6_int = yes;
+};
+
+modules {
+	/* module path: paths to search for modules specified below and 
+	 * in /modload.
+	 */
+	path="/home/alex/bcnet-ircd/modules";
+	path="/home/alex/bcnet-ircd/modules/autoload";
+
+	/* module: the name of a module to load on startup/rehash */
+	#module=some_module.so;
+};
diff -uNrd -x CVS ircd-ratbox-1.4-2/doc/example.conf bcnet-ircd-1.2.2/doc/example.conf
--- ircd-ratbox-1.4-2/doc/example.conf	Wed Apr  7 16:37:42 2004
+++ bcnet-ircd-1.2.2/doc/example.conf	Sun May  9 10:35:57 2004
@@ -239,6 +239,8 @@
 	 * no_tilde      (old - flag)	| don't prefix ~ to username if no ident
 	 * need_ident    (old + flag)	| require ident for user in this class
 	 * restricted			| prevent user from sending mode changes
+     * mask					| mask the users hostname
+	 * mask_notice			| give a notice when masking this host
 	 */
 	flags = kline_exempt, exceed_limit;
 	
@@ -264,7 +266,7 @@
 	user = "*@*";
 	class = "users";
 	
-	flags = restricted, need_ident;
+	flags = restricted, need_ident, mask, mask_notice;
 };
 
 /* operator {}: defines ircd operators. (OLD O:)
diff -uNrd -x CVS ircd-ratbox-1.4-2/doc/ircd.8 bcnet-ircd-1.2.2/doc/ircd.8
--- ircd-ratbox-1.4-2/doc/ircd.8	Thu Apr 22 14:58:52 2004
+++ bcnet-ircd-1.2.2/doc/ircd.8	Sun May  9 10:35:57 2004
@@ -1,5 +1,5 @@
-.\" @(#)ircd.8 1.0 25 Oct 2001
-.\" $Id: ircd.8,v 1.6.16.2 2004/04/22 18:58:52 leeh Exp $
+.\" @(#)ircd.8 7b10 25 Oct 2001
+.\" $Id: ircd.8,v 1.6.16.1 2003/09/23 14:04:11 androsyn Exp $
 .TH IRCD 8 "ircd-ratbox 23 Sep 2003
 .SH NAME
 ircd \- The Internet Relay Chat Program Server 
@@ -7,8 +7,7 @@
 .hy 0
 .IP \fBircd\fP
 [-dlinefile filename] [-configfile filename] [-klinefile filename]
-[-logfile filename] [-pidfile filename] [-resvfile filename]
-[-xlinefile filename] [-conftest] [-foreground] [-version]
+[-logfile filename] [-pidfile filename] [-foreground] [-version] [-debug]
 .SH DESCRIPTION
 .LP
 \fIircd\fP is the server (daemon) program for the Internet Relay Chat
@@ -37,22 +36,15 @@
 Specifies the ircd.pid used. The option is used to override the default
 ircd.pid given at compile time.
 .TP
-.B \-resvfile filename
-Specifies the resv.conf file to be used for this ircdaemon. The option
-is used to override the default resv.conf given at compile time.
-.TP
-.B \-xlinefile filename
-Specifies the xline.conf file to be used for this ircdaemon. The option
-is used to override the default xline.conf given at compile time.
-.TP
-.B \-conftest
-Makes \fIircd\fP check the ircd.conf for errors
-.TP
 .B \-foreground
 Makes \fIircd\fP run in the foreground
 .TP
 .B \-version
 Makes \fIircd\fP print its version, and exit.
+.TP
+.B \-debug
+Makes \fIircd\fP start in debug mode.  \fIIrcd\fP must be compiled in DEBUGMODE
+for this to work.
 .SH USAGE
 If you plan to connect your \fIircd\fP server to an existing Irc-Network,
 you will need to alter your local IRC configuration file (typically named
@@ -126,4 +118,4 @@
 updated by W. Campbell, wcampbel@botbay.net
 .LP
 further modified for ircd-ratbox by Aaron Sethman, androsyn@ratbox.org
-.LP
+.LP
\ No newline at end of file
diff -uNrd -x CVS ircd-ratbox-1.4-2/help/opers/cmode bcnet-ircd-1.2.2/help/opers/cmode
--- ircd-ratbox-1.4-2/help/opers/cmode	Tue Jul  8 10:12:41 2003
+++ bcnet-ircd-1.2.2/help/opers/cmode	Sun May  9 10:35:57 2004
@@ -11,6 +11,8 @@
      +m     - Moderated.  Only opped/voiced users may talk in channel.
      +i     - Invite only.  Users need to be /invite'd or match a +I to
               join the channel.
+     +c     - Strip color. The server will strip any color from channel
+              messages.
 
 WITH PARAMETERS:
      +k     - Key.  Requires users to issue /join #channel KEY to join.
diff -uNrd -x CVS ircd-ratbox-1.4-2/help/opers/index bcnet-ircd-1.2.2/help/opers/index
--- ircd-ratbox-1.4-2/help/opers/index	Mon Apr  5 15:22:44 2004
+++ bcnet-ircd-1.2.2/help/opers/index	Sun May  9 10:35:57 2004
@@ -9,14 +9,15 @@
 KILL            KLINE           KNOCK           LINKS
 LIST            LOCOPS          LUSERS          MODLIST
 MODLOAD         MODRESTART      MODUNLOAD       MOTD
-NAMES           NICK            NOTICE          OPER
-OPERSPY         OPERWALL        PART            PASS
-PING            PONG            POST            PRIVMSG
-QUIT            REHASH          RESTART         RESV
-SERVER          SET             SJOIN           SQUIT
-STATS           SVINFO          TESTLINE        TESTMASK
-TIME            TOPIC           TRACE           UHELP
-UMODE           UNDLINE         UNGLINE         UNKLINE
-UNRESV          UNXLINE         USER            USERHOST
-USERS           VERSION         WALLOPS         WHO
-WHOIS           WHOWAS          XLINE
+NAMES           NGLIST          NICK            NOTICE          
+OPER            OPERLIST        OPERSPY         OPERWALL        
+PART            PASS            PING            PONG            
+POST            PRIVMSG         QUIT            REHASH          
+RESTART         RESV            SERVER          SET  
+SJOIN           SPING           SQUIT           STATS     
+SVINFO          TESTLINE        TESTMASK        TIME     
+TOPIC           TRACE           UHELP           UMODE
+UNDLINE         UNGLINE         UNKLINE         UNRESV
+UNXLINE         USER            USERHOST        USERS
+VERSION         WALLOPS         WHO             WHOIS
+WHOWAS          XLINE
diff -uNrd -x CVS ircd-ratbox-1.4-2/help/opers/list bcnet-ircd-1.2.2/help/opers/list
--- ircd-ratbox-1.4-2/help/opers/list	Thu Apr 22 14:37:22 2004
+++ bcnet-ircd-1.2.2/help/opers/list	Sun May  9 10:35:57 2004
@@ -1,4 +1,4 @@
-LIST [#channel]|[modifiers]
+LIST [#channel]
 
 Without any arguments, LIST will give an entire list of all
 channels which are not set as secret (+s). The list will be in
@@ -6,11 +6,7 @@
 
   <#channel> <amount of users> :[topic]
 
-If an argument supplied is a channel name, LIST will give just
-the statistics for the given channel.
-
-Modifiers are also supported, seperated by a comma:
-  <n - List channels with less than n users
-  >n - List channels with more than n users
+If an argument is supplied, LIST will give just the statistics
+for the given channel.
 
-eg LIST <100,>20
+See also: join
diff -uNrd -x CVS ircd-ratbox-1.4-2/help/opers/nglist bcnet-ircd-1.2.2/help/opers/nglist
--- ircd-ratbox-1.4-2/help/opers/nglist	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/help/opers/nglist	Sun May  9 10:35:57 2004
@@ -0,0 +1,13 @@
+List all local or global clients that have all lower case nicks and have 
+matching nicks and gecos's (a common drone pattern)
+
+/quote NGLIST
+  List all local clients with lowercase nicks and matching nicks and gecos
+  fields.
+/quote NGLIST 10
+  List the first 10 local clients as in above.
+/quote NGLIST -g
+  List all global clients as above.
+/quote NGLIST -g 10
+  List the first 10 global clients as above.
+
diff -uNrd -x CVS ircd-ratbox-1.4-2/help/opers/operlist bcnet-ircd-1.2.2/help/opers/operlist
--- ircd-ratbox-1.4-2/help/opers/operlist	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/help/opers/operlist	Sun May  9 10:35:57 2004
@@ -0,0 +1,6 @@
+m_operlist.c:
+/quote OPERLIST
+  List all opers on the network
+/quote OPERLIST *.uk
+  List all opers on servers matching *.uk
+
diff -uNrd -x CVS ircd-ratbox-1.4-2/help/opers/sping bcnet-ircd-1.2.2/help/opers/sping
--- ircd-ratbox-1.4-2/help/opers/sping	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/help/opers/sping	Sun May  9 10:35:57 2004
@@ -0,0 +1,7 @@
+Implements an ircu like server<->server PING, must be run on each server 
+on the path to function.
+
+/quote SPING <server>
+  Send a server<->server ping to <server>, giving you a time in seconds
+  formatted X.YYY
+
diff -uNrd -x CVS ircd-ratbox-1.4-2/include/client.h bcnet-ircd-1.2.2/include/client.h
--- ircd-ratbox-1.4-2/include/client.h	Wed Mar 24 19:30:45 2004
+++ bcnet-ircd-1.2.2/include/client.h	Sun May  9 10:35:58 2004
@@ -145,6 +145,7 @@
 	 * considered a read-only field after the client has registered.
 	 */
 	char host[HOSTLEN + 1];	/* client's hostname */
+	char rhost[HOSTLEN + 1];
 	/*
 	 * client->info for unix clients will normally contain the info from the 
 	 * gcos field in /etc/passwd but anything can go here.
@@ -378,6 +379,8 @@
 #define UMODE_ADMIN        0x40000	/* Admin on server */
 #define UMODE_HIDDENOPER   0x80000	/* Oper hidden from stats p */
 
+#define UMODE_IPMASK	   0x100000
+
 #define UMODE_ALL	   UMODE_SERVNOTICE
 
 
@@ -417,7 +420,7 @@
                          OPER_HIDDENOPER)
 
 #define SEND_UMODES  (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP | \
-                      UMODE_ADMIN)
+                      UMODE_ADMIN | UMODE_IPMASK)
 #define ALL_UMODES   (SEND_UMODES | UMODE_SERVNOTICE | UMODE_CCONN | \
                       UMODE_REJ | UMODE_SKILL | UMODE_FULL | UMODE_SPY | \
                       UMODE_NCHANGE | UMODE_OPERWALL | UMODE_DEBUG | \
@@ -499,6 +502,8 @@
 
 #define SetGotId(x)             ((x)->flags |= FLAGS_GOTID)
 #define IsGotId(x)              (((x)->flags & FLAGS_GOTID) != 0)
+
+#define IsMasked(x)				((x)->umodes & UMODE_IPMASK)
 
 /*
  * flags2 macros.
diff -uNrd -x CVS ircd-ratbox-1.4-2/include/config.h bcnet-ircd-1.2.2/include/config.h
--- ircd-ratbox-1.4-2/include/config.h	Mon Mar 15 13:19:44 2004
+++ bcnet-ircd-1.2.2/include/config.h	Sun May  9 10:35:58 2004
@@ -192,7 +192,7 @@
  * If this is undefined, opers will be allowed to see the real IP of spoofed
  * users in /trace etc.  If this is defined they will be shown a masked IP.
  */
-#define HIDE_SPOOF_IPS
+#undef HIDE_SPOOF_IPS
 
 /* TS5_ONLY
  *
diff -uNrd -x CVS ircd-ratbox-1.4-2/include/ircd_defs.h bcnet-ircd-1.2.2/include/ircd_defs.h
--- ircd-ratbox-1.4-2/include/ircd_defs.h	Mon Mar 15 13:19:44 2004
+++ bcnet-ircd-1.2.2/include/ircd_defs.h	Sun May  9 10:35:58 2004
@@ -86,9 +86,9 @@
 #define HOSTLEN         63	/* Length of hostname.  Updated to         */
 				/* comply with RFC1123                     */
 
-#define USERLEN         10
+#define USERLEN         14
 #define REALLEN         50
-#define KILLLEN         90
+#define KILLLEN         150
 #define CHANNELLEN      200
 
 #define REASONLEN	120
diff -uNrd -x CVS ircd-ratbox-1.4-2/include/numeric.h bcnet-ircd-1.2.2/include/numeric.h
--- ircd-ratbox-1.4-2/include/numeric.h	Mon Apr  5 15:22:46 2004
+++ bcnet-ircd-1.2.2/include/numeric.h	Sun May  9 10:35:58 2004
@@ -183,12 +183,15 @@
 #define RPL_ENDOFBANLIST     368
 /* rpl_endofwhowas above (369) */
 
+#define RPL_WHOWASREALHOST   370
 #define RPL_INFO             371
 #define RPL_MOTD             372
 #define RPL_INFOSTART        373
 #define RPL_ENDOFINFO        374
 #define RPL_MOTDSTART        375
 #define RPL_ENDOFMOTD        376
+
+#define RPL_WHOISHOST        378 /* -Jeremy */
 
 #define RPL_YOUREOPER        381
 #define RPL_REHASHING        382
diff -uNrd -x CVS ircd-ratbox-1.4-2/include/patchlevel.h bcnet-ircd-1.2.2/include/patchlevel.h
--- ircd-ratbox-1.4-2/include/patchlevel.h	Tue Apr 27 10:51:33 2004
+++ bcnet-ircd-1.2.2/include/patchlevel.h	Mon May 10 05:13:58 2004
@@ -21,9 +21,9 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: patchlevel.h,v 7.50.2.22 2004/04/27 14:51:33 androsyn Exp $
+ *  $Id: patchlevel.h,v 7.50.2.21 2004/04/10 22:38:58 leeh Exp $
  */
 
 #ifndef PATCHLEVEL
-#define PATCHLEVEL   "ircd-ratbox-1.4-2"
+#define PATCHLEVEL   "ircd-ratbox-1.4-1+BCNet-1.2.2"
 #endif
diff -uNrd -x CVS ircd-ratbox-1.4-2/include/s_conf.h bcnet-ircd-1.2.2/include/s_conf.h
--- ircd-ratbox-1.4-2/include/s_conf.h	Wed Apr  7 16:37:45 2004
+++ bcnet-ircd-1.2.2/include/s_conf.h	Sun May  9 10:35:58 2004
@@ -140,6 +140,9 @@
 #define CONF_FLAGS_CRYPTLINK            0x00400000
 #define CONF_FLAGS_VHOSTED		0x00800000
 #define CONF_FLAGS_TB			0x01000000
+
+#define CONF_FLAGS_IPMASK		0x02000000
+#define CONF_FLAGS_MASK_NOTICE	0x04000000
 /* Macros for struct ConfItem */
 
 #define IsLimitIp(x)            ((x)->flags & CONF_FLAGS_LIMIT_IP)
@@ -162,6 +165,8 @@
 #define IsConfCryptLink(x)      ((x)->flags & CONF_FLAGS_CRYPTLINK)
 #define IsConfVhosted(x)	((x)->flags & CONF_FLAGS_VHOSTED)
 #define IsConfTburst(x)		((x)->flags & CONF_FLAGS_TB)
+#define IsConfDoMaskIp(x)		((x)->flags & CONF_FLAGS_IPMASK)
+#define IsConfMaskNotice(x)		((x)->flags & CONF_FLAGS_MASK_NOTICE)
 
 /* flag definitions for opers now in client.h */
 
diff -uNrd -x CVS ircd-ratbox-1.4-2/include/s_serv.h bcnet-ircd-1.2.2/include/s_serv.h
--- ircd-ratbox-1.4-2/include/s_serv.h	Sun Apr 11 22:08:13 2004
+++ bcnet-ircd-1.2.2/include/s_serv.h	Sun May  9 10:35:58 2004
@@ -72,12 +72,13 @@
 #define CAP_UNKLN       0x00100000	/* supports remote unkline */
 #define CAP_CLUSTER	0x00200000	/* supports clustering */
 #define CAP_ENCAP	0x00400000
+#define CAP_IPMASK  0x00800000
 
 #define CAP_MASK        (CAP_QS  | CAP_EX   | CAP_CHW  | \
                          CAP_IE  | CAP_KLN  | \
                          CAP_GLN | CAP_CLUSTER | CAP_ENCAP | \
                          CAP_ZIP  | CAP_ENC | \
-                         CAP_KNOCK  | CAP_UNKLN)
+                         CAP_KNOCK  | CAP_UNKLN | CAP_IPMASK)
 
 #ifdef HAVE_LIBZ
 #define CAP_ZIP_SUPPORTED       CAP_ZIP
diff -uNrd -x CVS ircd-ratbox-1.4-2/include/s_user.h bcnet-ircd-1.2.2/include/s_user.h
--- ircd-ratbox-1.4-2/include/s_user.h	Sun Mar 28 06:45:14 2004
+++ bcnet-ircd-1.2.2/include/s_user.h	Sun May  9 10:35:58 2004
@@ -44,7 +44,7 @@
 extern int do_local_user(char *, struct Client *, struct Client *, char *, char *, char *, char *);
 
 extern int do_remote_user(char *, struct Client *, struct Client *,
-			  char *, char *, char *, char *);
+			  char *, char *, char *, char *, char *);
 
 extern int user_modes_from_c_to_bitmask[];
 extern void show_isupport(struct Client *);
diff -uNrd -x CVS ircd-ratbox-1.4-2/include/serno.h bcnet-ircd-1.2.2/include/serno.h
--- ircd-ratbox-1.4-2/include/serno.h	Mon Apr 26 13:55:08 2004
+++ bcnet-ircd-1.2.2/include/serno.h	Sun May  9 10:35:58 2004
@@ -1 +1 @@
-#define SERIALNUM "20040426_1"
+#define SERIALNUM "20040421_3"
diff -uNrd -x CVS ircd-ratbox-1.4-2/include/supported.h bcnet-ircd-1.2.2/include/supported.h
--- ircd-ratbox-1.4-2/include/supported.h	Wed Apr 21 11:07:13 2004
+++ bcnet-ircd-1.2.2/include/supported.h	Sun May  9 10:35:58 2004
@@ -65,7 +65,8 @@
 		  " ETRACE" \
 		  " WALLCHOPS" \
 		  " SAFELIST" \
-		  " ELIST=U"
+                  " ELIST=U" \
+		  " IPMASK"
 
 #define FEATURES2VALUES ConfigServerHide.disable_local_channels ? "#" : "#&", \
                         ConfigChannel.use_except ? "e" : "", \
diff -uNrd -x CVS ircd-ratbox-1.4-2/include/whowas.h bcnet-ircd-1.2.2/include/whowas.h
--- ircd-ratbox-1.4-2/include/whowas.h	Mon Mar 15 13:19:45 2004
+++ bcnet-ircd-1.2.2/include/whowas.h	Sun May  9 10:35:58 2004
@@ -51,6 +51,7 @@
 	char name[NICKLEN];
 	char username[USERLEN + 1];
 	char hostname[HOSTLEN + 1];
+	char rhostname[HOSTLEN + 1];
 	const char *servername;
 	char realname[REALLEN + 1];
 	time_t logoff;
diff -uNrd -x CVS ircd-ratbox-1.4-2/modules/Makefile.in bcnet-ircd-1.2.2/modules/Makefile.in
--- ircd-ratbox-1.4-2/modules/Makefile.in	Sun Apr 11 22:08:15 2004
+++ bcnet-ircd-1.2.2/modules/Makefile.in	Mon May 10 05:11:58 2004
@@ -86,6 +86,7 @@
   m_set.c \
   m_stats.c \
   m_svinfo.c \
+  m_svs.c \
   m_tb.c \
   m_testline.c \
   m_testmask.c \
@@ -101,7 +102,11 @@
   m_who.c \
   m_whois.c \
   m_whowas.c \
-  m_xline.c
+  m_xline.c \
+  m_nglist.c \
+  m_services.c \
+  m_sping.c \
+  m_operlist.c 
 
 ALL_SRCS = $(CORE_SRCS) \
            $(SRCS)
diff -uNrd -x CVS ircd-ratbox-1.4-2/modules/core/m_nick.c bcnet-ircd-1.2.2/modules/core/m_nick.c
--- ircd-ratbox-1.4-2/modules/core/m_nick.c	Wed Mar 24 19:30:52 2004
+++ bcnet-ircd-1.2.2/modules/core/m_nick.c	Sun May  9 10:35:58 2004
@@ -277,7 +277,7 @@
 	}
 
 	/* parc == 3 on nickchange, parc == 9 on new nick */
-	if((IsClient(source_p) && (parc != 3)) || (IsServer(source_p) && (parc != 9)))
+	if((IsClient(source_p) && (parc != 3)) || (IsServer(source_p) && ((parc != 9) && (parc != 10))))
 	{
 		char tbuf[BUFSIZE] = { 0 };
 		int j;
@@ -302,23 +302,30 @@
 	/* fix the length of the nick */
 	strlcpy(nick, parv[1], sizeof(nick));
 
-	if(check_clean_nick(client_p, source_p, nick, parv[1], 
-			    (parc == 9 ? parv[7] : (char *)source_p->user->server)))
-		return;
+    if ((parc == 9) || (parc == 10))
+	{
+		if (check_clean_nick(client_p, source_p, nick, parv[1], parv[7]))
+			return;
+	}
+	else
+	{
+		if (check_clean_nick(client_p, source_p, nick, parv[1], (char *)source_p->user->server))
+			return;
+	}
 
-	if(parc == 9)
+	if(parc == 9 || parc == 10)
 	{
 		if(check_clean_user(client_p, nick, parv[5], parv[7]) ||
 		   check_clean_host(client_p, nick, parv[6], parv[7]))
 			return;
 
 		/* check the length of the clients gecos */
-		if(strlen(parv[8]) > REALLEN)
+		if(strlen(parv[(parc > 9)? 9 : 8]) > REALLEN)
 		{
 			sendto_realops_flags(UMODE_ALL, L_ALL,
 					     "Long realname from server %s for %s", parv[7],
 					     parv[1]);
-			parv[8][REALLEN] = '\0';
+			parv[(parc > 9)? 9 : 8][REALLEN] = '\0';
 		}
 
 		if(IsServer(source_p))
@@ -591,7 +598,8 @@
 			}
 
 			return do_remote_user(nick, client_p, source_p, parv[5], parv[6],
-					      parv[7], parv[8]);
+					      parv[7], (parc > 9)? parv[8] : NULL,
+						parv[(parc > 9)? 9 : 8]);
 		}
 	}
 	else if(source_p->name[0])
diff -uNrd -x CVS ircd-ratbox-1.4-2/modules/m_nglist.c bcnet-ircd-1.2.2/modules/m_nglist.c
--- ircd-ratbox-1.4-2/modules/m_nglist.c	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/modules/m_nglist.c	Sun May  9 10:35:58 2004
@@ -0,0 +1,196 @@
+/*
+ *  m_nglist.c: Sentinel-like nick == gecos searching functionality.
+ *
+ *  Copyright 2003 by W. Campbell
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are
+ *  met:
+ *
+ *  1.Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer. 
+ *  2.Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution. 
+ *  3.The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission. 
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *  DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ *  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ *  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  $Id$
+ *
+ * Revision 1:  NGLIST, local and global
+ */
+
+/* List of ircd includes from ../include/ */
+#include "stdinc.h"
+#include "handlers.h"
+#include "client.h"
+#include "common.h"     /* FALSE bleah */
+#include "ircd.h"
+#include "irc_string.h"
+#include "numeric.h"
+#include "fdlist.h"
+#include "s_bsd.h"
+#include "s_conf.h"
+#include "s_log.h"
+#include "s_serv.h"
+#include "send.h"
+#include "msg.h"
+#include "parse.h"
+#include "modules.h"
+
+static void mo_nglist(struct Client *client_p, struct Client *source_p,
+                     int parc, char *parv[]);
+static int strislower(char *);
+
+struct Message nglist_msgtab = {
+  "NGLIST", 0, 0, 0, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_not_oper, m_ignore, mo_nglist}
+};
+
+#ifndef STATIC_MODULES
+void
+_modinit(void)
+{
+  mod_add_cmd(&nglist_msgtab);
+}
+
+void
+_moddeinit(void)
+{
+  mod_del_cmd(&nglist_msgtab);
+}
+
+const char *_version = "$Revision$";
+#endif
+
+#define UL_GLOBAL	1
+#define UL_LOCAL	2
+
+/*
+** mo_nglist
+** Syntax:  NGLIST [-l|-g] [limit]
+** Defaults:  local scope, limit to 0 (XXX - ratbox add default confitem)
+*/
+static void mo_nglist(struct Client *client_p, struct Client *source_p,
+                     int parc, char *parv[])
+{
+  int lim = 0;
+  int count = 0;
+  struct Client *target_p;
+  char *nickname;
+  int scope_flag = UL_LOCAL;
+  int got_scope = FALSE;
+  dlink_node *dl;
+
+  if (parc > 1)
+  {
+    if (parv[1][0] == '-')
+    {
+      got_scope = TRUE;
+      if (parv[1][1] == 'g')
+        scope_flag = UL_GLOBAL;
+      /* Otherwise, default to local */
+    }
+  }
+
+  if (got_scope == TRUE)
+  {
+    if (parc > 2)
+    {
+      lim = strtol(parv[2], NULL, 10);
+    }
+  }
+  else
+  {
+    if (parc > 1)
+    {
+      lim = strtol(parv[1], NULL, 10);
+    }
+  }
+
+  if (scope_flag == UL_GLOBAL)
+  {
+#ifdef CONFIG_RATBOX_LEVEL_1
+    DLINK_FOREACH(dl, global_client_list.head)
+    {
+      target_p = dl->data;
+#elif defined(CONFIG_H_LEVEL_7)
+    for (target_p = GlobalClientList; target_p; target_p = target_p->next)
+    {
+#endif
+      if (!IsPerson(target_p))
+        continue;
+      if ((lim > 0) && (count == lim))
+      {
+        sendto_one(source_p, ":%s NOTICE %s :NGLIST limit reached, %d clients "
+                   "shown", me.name, parv[0], count);
+        return;
+      }
+      if (strislower(target_p->name) &&
+          (irccmp(target_p->info, target_p->name) == 0))
+      {
+        /* XXX - should probably use a numeric here, RPL_WHO maybe? */
+        count++;
+        sendto_one(source_p, ":%s NOTICE %s :User %d: %s (%s@%s) [%s]",
+                   me.name, parv[0], count, target_p->name,
+                   target_p->username, target_p->host,
+                   target_p->user->server);
+      }
+    }
+  }
+  else
+  {
+    /* Local clients only */
+    DLINK_FOREACH(dl, lclient_list.head)
+    {
+      target_p = dl->data;
+
+      if ((lim > 0) && (count == lim))
+      {
+        sendto_one(source_p, ":%s NOTICE %s :NGLIST limit reached, %d clients "
+                   "shown", me.name, parv[0], count);
+        return;
+      }
+      if (strislower(target_p->name) &&
+          (irccmp(target_p->info, target_p->name) == 0))
+      {
+        /* XXX - should probably use a numeric here, RPL_WHO maybe? */
+        count++;
+        sendto_one(source_p, ":%s NOTICE %s :User %d: %s (%s@%s) [%s]",
+                   me.name, parv[0], count, target_p->name,
+                   target_p->username, target_p->host,
+                   target_p->user->server);
+      }
+    }
+  }
+  sendto_one(source_p, ":%s NOTICE %s :End of NGLIST.", me.name, parv[0]);
+}
+
+/* Return 1 if the string s is all lower case, return 0 if not */
+static int strislower(char *s)
+{
+  char *t;
+
+  if (s == NULL)
+    return 1;
+  for (t = s; *t != '\0'; t++)
+  {
+    if (islower((int) *t) == 0)
+    {
+      return 0;
+    }
+  }
+  return 1;
+}
diff -uNrd -x CVS ircd-ratbox-1.4-2/modules/m_operlist.c bcnet-ircd-1.2.2/modules/m_operlist.c
--- ircd-ratbox-1.4-2/modules/m_operlist.c	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/modules/m_operlist.c	Sun May  9 10:35:58 2004
@@ -0,0 +1,125 @@
+/*
+ *  m_operlist.c: List all (global) opers on the network or on a servermask
+ *                provided.
+ *
+ *  Copyright 2003 by W. Campbell
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are
+ *  met:
+ *
+ *  1.Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer. 
+ *  2.Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution. 
+ *  3.The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission. 
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *  DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ *  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ *  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  $Id$
+ *
+ */
+
+/* List of ircd includes from ../include/ */
+#include "stdinc.h"
+#include "handlers.h"
+#include "client.h"
+#include "common.h"     /* FALSE bleah */
+#include "ircd.h"
+#include "irc_string.h"
+#include "numeric.h"
+#include "fdlist.h"
+#include "s_bsd.h"
+#include "s_conf.h"
+#include "s_log.h"
+#include "s_serv.h"
+#include "send.h"
+#include "msg.h"
+#include "parse.h"
+#include "modules.h"
+#include "s_misc.h"
+
+static void mo_operlist(struct Client *client_p, struct Client *source_p,
+                     int parc, char *parv[]);
+
+struct Message operlist_msgtab = {
+  "OPERLIST", 0, 0, 0, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_not_oper, m_ignore, mo_operlist}
+};
+
+#ifndef STATIC_MODULES
+void
+_modinit(void)
+{
+  mod_add_cmd(&operlist_msgtab);
+}
+
+void
+_moddeinit(void)
+{
+  mod_del_cmd(&operlist_msgtab);
+}
+
+const char *_version = "$Revision$";
+#endif
+
+/*
+** mo_operlist
+** Syntax:  OPERLIST [servermask]
+** Default:  all servers
+*/
+static void mo_operlist(struct Client *client_p, struct Client *source_p,
+                        int parc, char *parv[])
+{		 
+  int count = 0;
+  struct Client *target_p;
+  dlink_node *dl;
+  char *smatch = NULL;
+
+  if (parc > 1)
+  {
+    smatch = parv[1];
+  }
+
+#ifdef CONFIG_RATBOX_LEVEL_1
+  DLINK_FOREACH(dl, global_client_list.head)
+  {
+    target_p = dl->data;
+#elif defined(CONFIG_H_LEVEL_7)
+  for (target_p = GlobalClientList; target_p; target_p = target_p->next)
+  {
+#endif
+    if (IsOper(target_p))
+    {
+      if (smatch != NULL)
+      {
+        if (match(smatch, target_p->user->server) == 0)
+        {
+          /* Not matched, the oper is not on the requested server */
+          continue;
+        }
+      }
+      sendto_one(source_p, ":%s %d %s p :[%c] %s (%s@%s) on %s",
+                 me.name, RPL_STATSDEBUG, source_p->name,
+                 IsAdmin(target_p) ? 'A' : 'O',
+                 target_p->name, target_p->username, target_p->host,
+                 target_p->user->server);
+      count++;
+    }
+  }
+  sendto_one(source_p, ":%s %d %s p :%d OPER(s)", me.name, RPL_STATSDEBUG,
+             source_p->name, count);
+}
+
diff -uNrd -x CVS ircd-ratbox-1.4-2/modules/m_services.c bcnet-ircd-1.2.2/modules/m_services.c
--- ircd-ratbox-1.4-2/modules/m_services.c	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/modules/m_services.c	Sun May  9 15:07:29 2004
@@ -0,0 +1,229 @@
+/* m_services.c - Script generated services commands definition file
+** Customized for BCNet
+** Copyright Jeremy Johnston (c) 2004
+** Based upon services.pl, W. Campbell (c) 2003-2004
+** Do not edit this file
+
+** Built from parse.inc.php:  and index.php: 
+*/
+
+#include "stdinc.h"
+#include "handlers.h"
+#include "client.h"
+#include "common.h"
+#include "ircd.h"
+#include "irc_string.h"
+#include "numeric.h"
+#include "fdlist.h"
+#include "s_bsd.h"
+#include "s_conf.h"
+#include "s_log.h"
+#include "s_serv.h"
+#include "send.h"
+#include "msg.h"
+#include "parse.h"
+#include "modules.h"
+
+#define SVS_nickserv_NICK "NickServ"
+#define SVS_nickserv_USERSERV "NickServ@services.blackcode.com"
+#define SVS_chanserv_NICK "ChanServ"
+#define SVS_chanserv_USERSERV "ChanServ@services.blackcode.com"
+#define SVS_hellserv_NICK "HellServ"
+#define SVS_hellserv_USERSERV "HellServ@services.blackcode.com"
+#define SVS_gameserv_NICK "GameServ"
+#define SVS_gameserv_USERSERV "GameServ@bcnet.gameserv"
+#define SVS_statsserv_NICK "StatServ"
+#define SVS_statsserv_USERSERV "StatServ@services.blackcode.com"
+
+char *reconstruct_parv(int parc, char *parv[]);
+
+static void m_nickserv(struct Client *client_p, struct Client *source_p, int parc, char *parv[]);
+static void m_chanserv(struct Client *client_p, struct Client *source_p, int parc, char *parv[]);
+static void m_hellserv(struct Client *client_p, struct Client *source_p, int parc, char *parv[]);
+static void m_gameserv(struct Client *client_p, struct Client *source_p, int parc, char *parv[]);
+static void m_statsserv(struct Client *client_p, struct Client *source_p, int parc, char *parv[]);
+
+struct Message nickserv_msgtab = {
+  "nickserv", 0, 0, 2, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_nickserv, m_ignore, m_nickserv}
+};
+
+struct Message ns_msgtab = {
+  "ns", 0, 0, 2, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_nickserv, m_ignore, m_nickserv}
+};
+
+struct Message chanserv_msgtab = {
+  "chanserv", 0, 0, 2, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_chanserv, m_ignore, m_chanserv}
+};
+
+struct Message cs_msgtab = {
+  "cs", 0, 0, 2, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_chanserv, m_ignore, m_chanserv}
+};
+
+struct Message hellserv_msgtab = {
+  "hellserv", 0, 0, 2, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_hellserv, m_ignore, m_hellserv}
+};
+
+struct Message hs_msgtab = {
+  "hs", 0, 0, 2, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_hellserv, m_ignore, m_hellserv}
+};
+
+struct Message gameserv_msgtab = {
+  "gameserv", 0, 0, 2, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_gameserv, m_ignore, m_gameserv}
+};
+
+struct Message gs_msgtab = {
+  "gs", 0, 0, 2, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_gameserv, m_ignore, m_gameserv}
+};
+
+struct Message statsserv_msgtab = {
+  "statsserv", 0, 0, 2, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_statsserv, m_ignore, m_statsserv}
+};
+
+struct Message ss_msgtab = {
+  "ss", 0, 0, 2, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_statsserv, m_ignore, m_statsserv}
+};
+
+#ifndef STATIC_MODULES
+void _modinit(void)
+{
+  mod_add_cmd(&nickserv_msgtab);
+  mod_add_cmd(&ns_msgtab);
+  mod_add_cmd(&chanserv_msgtab);
+  mod_add_cmd(&cs_msgtab);
+  mod_add_cmd(&hellserv_msgtab);
+  mod_add_cmd(&hs_msgtab);
+  mod_add_cmd(&gameserv_msgtab);
+  mod_add_cmd(&gs_msgtab);
+  mod_add_cmd(&statsserv_msgtab);
+  mod_add_cmd(&ss_msgtab);
+}
+
+void _moddeinit(void)
+{
+  mod_del_cmd(&nickserv_msgtab);
+  mod_del_cmd(&ns_msgtab);
+  mod_del_cmd(&chanserv_msgtab);
+  mod_del_cmd(&cs_msgtab);
+  mod_del_cmd(&hellserv_msgtab);
+  mod_del_cmd(&hs_msgtab);
+  mod_del_cmd(&gameserv_msgtab);
+  mod_del_cmd(&gs_msgtab);
+  mod_del_cmd(&statsserv_msgtab);
+  mod_del_cmd(&ss_msgtab);
+}
+const char *_version = "$Revision: 1.16 $";
+#endif
+
+char *reconstruct_parv(int parc, char *parv[])
+{
+  static char tmpbuf[BUFSIZE]; int i;
+
+  strlcpy (tmpbuf, parv[0], BUFSIZE);
+  for (i = 1; i < parc; i++)
+  {
+    strlcat (tmpbuf, " ", BUFSIZE);
+    strlcat (tmpbuf, parv[i], BUFSIZE);
+  }
+  return tmpbuf;
+}
+
+static void m_nickserv(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
+{
+  struct Client *target_p;
+
+  if (parv[1] == NULL)
+  {
+    sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
+    return;
+  }
+
+if ((target_p = find_person(SVS_nickserv_NICK)))
+  {
+    sendto_one(target_p, ":%s PRIVMSG %s :%s", parv[0], SVS_nickserv_USERSERV, reconstruct_parv(parc - 1, &parv[1]));
+  }
+  else
+    sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, parv[0], SVS_nickserv_NICK);
+}
+
+static void m_chanserv(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
+{
+  struct Client *target_p;
+
+  if (parv[1] == NULL)
+  {
+    sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
+    return;
+  }
+
+if ((target_p = find_person(SVS_chanserv_NICK)))
+  {
+    sendto_one(target_p, ":%s PRIVMSG %s :%s", parv[0], SVS_chanserv_USERSERV, reconstruct_parv(parc - 1, &parv[1]));
+  }
+  else
+    sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, parv[0], SVS_chanserv_NICK);
+}
+
+static void m_hellserv(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
+{
+  struct Client *target_p;
+
+  if (parv[1] == NULL)
+  {
+    sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
+    return;
+  }
+
+if ((target_p = find_person(SVS_hellserv_NICK)))
+  {
+    sendto_one(target_p, ":%s PRIVMSG %s :%s", parv[0], SVS_hellserv_USERSERV, reconstruct_parv(parc - 1, &parv[1]));
+  }
+  else
+    sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, parv[0], SVS_hellserv_NICK);
+}
+
+static void m_gameserv(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
+{
+  struct Client *target_p;
+
+  if (parv[1] == NULL)
+  {
+    sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
+    return;
+  }
+
+if ((target_p = find_person(SVS_gameserv_NICK)))
+  {
+    sendto_one(target_p, ":%s PRIVMSG %s :%s", parv[0], SVS_gameserv_USERSERV, reconstruct_parv(parc - 1, &parv[1]));
+  }
+  else
+    sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, parv[0], SVS_gameserv_NICK);
+}
+
+static void m_statsserv(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
+{
+  struct Client *target_p;
+
+  if (parv[1] == NULL)
+  {
+    sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
+    return;
+  }
+
+if ((target_p = find_person(SVS_statsserv_NICK)))
+  {
+    sendto_one(target_p, ":%s PRIVMSG %s :%s", parv[0], SVS_statsserv_USERSERV, reconstruct_parv(parc - 1, &parv[1]));
+  }
+  else
+    sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, parv[0], SVS_statsserv_NICK);
+}
+
diff -uNrd -x CVS ircd-ratbox-1.4-2/modules/m_sping.c bcnet-ircd-1.2.2/modules/m_sping.c
--- ircd-ratbox-1.4-2/modules/m_sping.c	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/modules/m_sping.c	Sun May  9 10:35:58 2004
@@ -0,0 +1,160 @@
+/*
+ *  m_sping.c: Implements timed server-server pinging
+ *
+ *  Copyright 2003 by W. Campbell
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are
+ *  met:
+ *
+ *  1.Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  2.Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *  3.The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ *  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *  DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ *  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ *  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ *  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ *  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ *  POSSIBILITY OF SUCH DAMAGE.
+ *
+ *  $Id$
+ */
+
+#include "stdinc.h"
+#include "handlers.h"
+#include "client.h"
+#include "common.h"     /* FALSE bleah */
+#include "ircd.h"
+#include "irc_string.h"
+#include "numeric.h"
+#include "fdlist.h"
+#include "s_bsd.h"
+#include "s_conf.h"
+#include "s_log.h"
+#include "s_serv.h"
+#include "send.h"
+#include "msg.h"
+#include "parse.h"
+#include "modules.h"
+
+static void ms_sping(struct Client *client_p, struct Client *source_p,
+                    int parc, char *parv[]);
+static void mo_sping(struct Client *client_p, struct Client *source_p,
+                    int parc, char *parv[]);
+static void ms_spong(struct Client *client_p, struct Client *source_p,
+                    int parc, char *parv[]);
+
+struct Message sping_msgtab = {
+  "SPING", 0, 0, 2, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_not_oper, ms_sping, mo_sping}
+};
+
+struct Message spong_msgtab = {
+  "SPONG", 0, 0, 5, 0, MFLG_SLOW, 0,
+  {m_unregistered, m_ignore, ms_spong, m_ignore}
+};
+
+#ifndef STATIC_MODULES
+void
+_modinit(void)
+{
+  mod_add_cmd(&sping_msgtab);
+  mod_add_cmd(&spong_msgtab);
+}
+
+void
+_moddeinit(void)
+{
+  mod_del_cmd(&sping_msgtab);
+  mod_del_cmd(&spong_msgtab);
+}
+
+const char *_version = "$Revision$";
+#endif
+
+static void ms_sping(struct Client *client_p, struct Client *source_p,
+                    int parc, char *parv[])
+{
+  if (hunt_server(client_p, source_p, ":%s SPING %s %s %s %s",
+                  1, parc, parv) == HUNTED_ISME)
+  {
+    sendto_one(source_p, ":%s SPONG %s %s %s %s", me.name, parv[0],
+               parv[2], parv[3], parv[4]);
+  }
+}
+
+static void ms_spong(struct Client *client_p, struct Client *source_p,
+                    int parc, char *parv[])
+{
+  struct timeval nowtv;
+  struct timeval prevtv;
+  struct Client *target_p;
+  double tdiff;
+
+  if (hunt_server(client_p, source_p, ":%s SPONG %s %s %s %s",
+                  1, parc, parv) == HUNTED_ISME)
+  {
+    /* Get the current time first, in order to prevent computational time
+    ** from being counted against a server
+    */
+    gettimeofday(&nowtv, NULL);
+    prevtv.tv_sec = strtol(parv[3], NULL, 10);
+    prevtv.tv_usec = strtol(parv[4], NULL, 10);
+
+    if (nowtv.tv_sec > prevtv.tv_sec)
+    {
+      nowtv.tv_usec += 1000000; /* Yes this is lame, manually do a subtraction
+                                ** carry
+                                */
+      nowtv.tv_sec--;
+    }
+
+    /* Assume that tv_usec in nowtv is always greater than prevtv's */
+    target_p = find_person(parv[2]);
+    if (target_p == NULL)
+      return;
+    tdiff = (nowtv.tv_sec - prevtv.tv_sec) +
+            ((nowtv.tv_usec - prevtv.tv_usec) / 1000000.0);
+    sendto_one(target_p, ":%s NOTICE %s :SPONG from %s:  %1.3f seconds",
+               me.name, target_p->name, source_p->name, tdiff);
+  }
+}
+
+static void mo_sping(struct Client *client_p, struct Client *source_p,
+                    int parc, char *parv[])
+{
+  struct timeval nowtv;
+  char *argv[6];
+  int argc;
+  char secbuf[12];
+  char usecbuf[8];
+
+  gettimeofday(&nowtv, NULL);
+
+  /* Syntax:  :sourceserver SPING destserver user tv_sec tv_usec */
+  argv[0] = me.name;
+  argv[1] = parv[1];
+  argv[2] = parv[0];
+  snprintf(secbuf, 12, "%ld", nowtv.tv_sec);
+  argv[3] = secbuf;
+  snprintf(usecbuf, 8, "%ld", nowtv.tv_usec);
+  argv[4] = usecbuf;
+  argc = 5;
+
+  if (hunt_server(client_p, source_p, ":%s SPING %s %s %s %s",
+                  1, argc, argv) == HUNTED_ISME)
+  {
+    sendto_one(source_p, ":%s NOTICE %s :Cannot SPING myself!", me.name,
+               parv[0]);
+  }
+}
diff -uNrd -x CVS ircd-ratbox-1.4-2/modules/m_svs.c bcnet-ircd-1.2.2/modules/m_svs.c
--- ircd-ratbox-1.4-2/modules/m_svs.c	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/modules/m_svs.c	Sun May  9 10:35:58 2004
@@ -0,0 +1,243 @@
+/************************************************************************
+ *   IRC - Internet Relay Chat, doc/example_module.c
+ *   Copyright (C) 2001 Hybrid Development Team
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 1, or (at your option)
+ *   any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *   $Id: m_svs.c,v 1.6 2003/11/05 18:29:47 jeremy Exp $
+ */
+
+/* List of ircd includes from ../include/ */
+#include "stdinc.h"
+#include "handlers.h"
+#include "client.h"
+#include "common.h"     /* FALSE bleah */
+#include "ircd.h"
+#include "irc_string.h"
+#include "numeric.h"
+#include "fdlist.h"
+#include "s_bsd.h"
+#include "s_conf.h"
+#include "s_log.h"
+#include "s_serv.h"
+#include "send.h"
+#include "msg.h"
+#include "parse.h"
+#include "modules.h"
+
+#include "s_user.h"  /* send_umode_out() */
+#include "channel_mode.h" /* MODE_ADD & MOD_DEL */
+#include "hash.h"
+
+static void ms_svshost(struct Client *client_p, struct Client *source_p,
+                    int parc, char *parv[]);
+static void mo_svshost(struct Client *client_p, struct Client *source_p,
+                    int parc, char *parv[]);
+
+static void remove_host(struct Client *, char *);
+static void change_host(struct Client *, char *, char *);
+
+/* CHGHOST/SVSHOST/SETHOST */
+struct Message svshost_msgtab = {
+  "SVSHOST", 0, 0, 0, 0, MFLG_SLOW, 0,
+  {m_ignore, m_ignore, ms_svshost, m_ignore}
+};
+struct Message chghost_msgtab = {
+  "CHGHOST", 0, 0, 2, 3, MFLG_SLOW, 0,
+  {m_ignore, m_not_oper, m_ignore, mo_svshost}
+};
+struct Message sethost_msgtab = {
+  "SETHOST", 0, 0, 2, 3, MFLG_SLOW, 0,
+  {m_ignore, m_not_oper, m_ignore, mo_svshost}
+};
+
+#ifndef STATIC_MODULES
+/* Here we tell it what to do when the module is loaded */
+void
+_modinit(void)
+{
+  /* This will add the commands in test_msgtab (which is above) */
+  /* SVSHOST/CHGHOST/SETHOST */
+  mod_add_cmd(&svshost_msgtab);
+//  mod_add_cmd(&chghost_msgtab);
+//  mod_add_cmd(&sethost_msgtab);
+}
+
+/* here we tell it what to do when the module is unloaded */
+void
+_moddeinit(void)
+{
+  /* This will remove the commands in test_msgtab (which is above) */
+  /* SVSHOST/CHGHOST/SETHOST */
+  mod_del_cmd(&svshost_msgtab);
+//  mod_del_cmd(&chghost_msgtab);
+//  mod_del_cmd(&sethost_msgtab);
+}
+
+/* When we last modified the file (shown in /modlist), this is usually:
+ */
+const char *_version = "$Revision: 1.6 $";
+#endif
+
+/*
+ * mo_svshost
+ *      parv[0] = sender prefix
+ *      parv[1] = target nickname
+ *      parv[2] = new hostname
+ */
+static void mo_svshost(struct Client *client_p, struct Client *source_p,
+                   int parc, char *parv[])
+{
+  struct Client *target_p;
+  char *nick, hostname[HOSTLEN+1];
+  int remove = 0;
+
+  nick = parv[1];
+
+  if(parc > 2)
+    strlcpy(hostname, parv[2], HOSTLEN);
+
+  if(!isalpha(nick[0]))
+    if(nick[0] == '-')
+      remove = 1;
+
+  if(remove > 0)
+    {
+      nick++;
+      remove_host(source_p, nick);
+    }
+  else
+    {
+      if (parc != 3)
+        {
+          sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "CHGHOST");
+          return;
+        }
+      change_host(source_p, nick, (hostname)? hostname : NULL);
+    }
+
+  return;
+}
+
+static void remove_host(struct Client *source_p, char *nick)
+{
+  struct Client *target_p;
+
+  if ((target_p = find_client(nick)) == NULL)
+    {
+      sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, target_p->name);
+      return;
+    }
+
+  strcpy(target_p->host, target_p->rhost);
+
+  sendto_one(source_p, "Reset %s's Host", target_p->name);
+  return;
+}
+
+static void change_host(struct Client *source_p, char *nick, char *host)
+{
+  struct Client *target_p;
+  char oldhost[HOSTLEN+1];
+  int setflags;
+
+  if ((target_p = find_client(nick)) == NULL)
+    {
+      sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, source_p->name, nick);
+      return;
+    }
+
+  /* check at this point for a valid hostname, and if its null
+     which it shouldn't be at this point */
+  if (!valid_hostname(host) || (host == NULL) || (strlen(host) > HOSTLEN))
+    {
+      sendto_one(source_p, "%s :Invalid Hostname", host);
+      return;
+    }
+
+  if(!strchr(host, '.') && !strchr(host, ':'))
+    {
+      sendto_one(source_p, "Hostname's must contain one . or :");
+      return;
+    }
+
+  /* Preserve the old hostname until we are finished */
+  strcpy(oldhost, target_p->host);
+
+  /* Prevent any unnecessary bursts */
+  if(!strcmp(oldhost, host))
+    {
+      sendto_one(source_p, "%s :Hostname Identical", host);
+      return;
+    }
+
+  if(MyClient(target_p) && IsMasked(target_p))
+    {
+      setflags = target_p->umodes;
+      target_p->umodes &= ~UMODE_IPMASK;
+      send_umode_out(target_p, target_p, setflags);
+    }
+
+  strcpy(target_p->host, host);
+  sendto_realops_flags(UMODE_ALL, L_ALL, "CHGHOST was used on %s (%s -> %s)", nick, oldhost, host);
+  ilog(L_NOTICE, "%s changed %s's hostname (%s -> %s)", source_p->name, nick, oldhost, host);
+  sendto_server(NULL, NULL, CAP_IPMASK, NOCAPS, ":%s SVSHOST %s %s %s", source_p->name, target_p->name, oldhost, host);
+
+  sendto_one(source_p, "Changed %s's Host (%s -> %s)", nick, oldhost, host);
+  return;
+}
+
+/*
+ * ms_svshost
+ *      parv[0] = sender prefix
+ *      parv[1] = target nickname
+ *      parv[2] = new hostname
+ */
+static void ms_svshost(struct Client *client_p, struct Client *source_p,
+                   int parc, char *parv[])
+{
+  struct Client *target_p;
+  char *nick;
+  int setflags;
+  nick = parv[1];
+
+  if (parc != 4)
+    return;
+
+  sendto_server(client_p, NULL, CAP_IPMASK, NOCAPS, ":%s SVSHOST %s %s %s", parv[0], parv[1], parv[2], parv[3]);
+
+  target_p = find_client(nick);  
+  strcpy(target_p->host, parv[3]);
+
+  if(!IsServer(client_p))
+    {
+      sendto_realops_flags(UMODE_ALL, L_ALL, "CHGHOST was used on %s (%s -> %s)", nick, parv[2], parv[3]);
+      ilog(L_NOTICE, "%s changed %s's hostname (%s -> %s)", parv[0], nick, parv[2], parv[3]);
+    }
+  else
+    {
+      /* Changing the host on a masked user?
+         if so pull +X */
+      if(MyClient(target_p) && IsMasked(target_p))
+        {
+          setflags = target_p->umodes;
+          target_p->umodes &= ~UMODE_IPMASK;
+          send_umode_out(target_p, target_p, setflags);
+        }
+      ilog(L_NOTICE, "Caught SVSHOST from server [%s], Possibly a change of UMODE_ISMASK", parv[0]);
+    }
+
+  return;
+}
diff -uNrd -x CVS ircd-ratbox-1.4-2/modules/m_whois.c bcnet-ircd-1.2.2/modules/m_whois.c
--- ircd-ratbox-1.4-2/modules/m_whois.c	Sun Apr  4 08:44:55 2004
+++ bcnet-ircd-1.2.2/modules/m_whois.c	Sun May  9 10:35:58 2004
@@ -303,6 +303,9 @@
 		   target_p->username, target_p->host, target_p->info);
 	server_name = (char *) target_p->user->server;
 
+  if((IsOper(source_p)) || (source_p == target_p))
+    sendto_one(source_p, form_str(RPL_WHOISHOST), me.name, source_p->name, target_p->name, target_p->rhost);
+
 	cur_len = mlen = ircsprintf(buf, form_str(RPL_WHOISCHANNELS), me.name, source_p->name, target_p->name);
 	t = buf + mlen;
 
diff -uNrd -x CVS ircd-ratbox-1.4-2/modules/m_whowas.c bcnet-ircd-1.2.2/modules/m_whowas.c
--- ircd-ratbox-1.4-2/modules/m_whowas.c	Mon Mar 15 13:19:50 2004
+++ bcnet-ircd-1.2.2/modules/m_whowas.c	Sun May  9 10:35:58 2004
@@ -154,6 +154,10 @@
 				sendto_one(source_p, form_str(RPL_WHOISSERVER),
 					   me.name, parv[0], temp->name,
 					   temp->servername, myctime(temp->logoff));
+
+          if(IsOper(source_p))
+            sendto_one(source_p, form_str(RPL_WHOWASREALHOST), me.name, parv[0], temp->name, temp->hostname, temp->rhostname);
+
 			cur++;
 			found++;
 		}
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/Makefile.in bcnet-ircd-1.2.2/src/Makefile.in
--- ircd-ratbox-1.4-2/src/Makefile.in	Wed Mar 24 19:30:54 2004
+++ bcnet-ircd-1.2.2/src/Makefile.in	Sun May  9 10:35:57 2004
@@ -69,6 +69,7 @@
   hash.c                        \
   hook.c                        \
   hostmask.c                    \
+  ipmask.c						\
   irc_string.c                  \
   ircd.c                        \
   ircd_signal.c                 \
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/channel.c bcnet-ircd-1.2.2/src/channel.c
--- ircd-ratbox-1.4-2/src/channel.c	Mon Apr 26 13:47:43 2004
+++ bcnet-ircd-1.2.2/src/channel.c	Sun May  9 10:35:57 2004
@@ -21,7 +21,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: channel.c,v 7.381.2.11 2004/04/26 17:47:43 leeh Exp $
+ *  $Id: channel.c,v 7.381.2.10 2004/04/07 20:37:49 androsyn Exp $
  */
 
 #include "stdinc.h"
@@ -892,13 +892,6 @@
 static void
 finish_splitmode(void *unused)
 {
-        /* dropped back into a netsplit during split_delay --fl */
-	if(Count.server < split_servers || Count.total < split_users)
-	{
-		eventAddIsh("check_splitmode", check_splitmode, NULL, 10);
-		return;
-	}
-
 	splitmode = 0;
 
 	sendto_realops_flags(UMODE_ALL, L_ALL,
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/client.c bcnet-ircd-1.2.2/src/client.c
--- ircd-ratbox-1.4-2/src/client.c	Wed Mar 24 19:30:54 2004
+++ bcnet-ircd-1.2.2/src/client.c	Sun May  9 10:35:57 2004
@@ -1541,7 +1541,7 @@
 		if(IsPerson(source_p))
 			sendto_realops_flags(UMODE_CCONN, L_ALL,
 					     "Client exiting: %s (%s@%s) [%s] [%s]",
-					     source_p->name, source_p->username, source_p->host,
+					     source_p->name, source_p->username, source_p->rhost,
 					     comment,
 #ifdef HIDE_SPOOF_IPS
 					     IsIPSpoof(source_p) ? "255.255.255.255" :
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/hostmask.c bcnet-ircd-1.2.2/src/hostmask.c
--- ircd-ratbox-1.4-2/src/hostmask.c	Tue Mar 23 12:35:54 2004
+++ bcnet-ircd-1.2.2/src/hostmask.c	Sun May  9 10:35:57 2004
@@ -454,6 +454,9 @@
 	aconf = find_conf_by_address(client_p->host, &client_p->localClient->ip,
 				     CONF_KILL, client_p->localClient->aftype, client_p->username);
 
+	if (!aconf)
+		aconf = find_conf_by_address(client_p->rhost, &client_p->localClient->ip, CONF_KILL, client_p->localClient->aftype, client_p->username);
+
 	return aconf;
 }
 
@@ -470,6 +473,9 @@
 
 	aconf = find_conf_by_address(client_p->host, &client_p->localClient->ip,
 				     CONF_GLINE, client_p->localClient->aftype, client_p->username);
+
+	if (!aconf)
+		aconf = find_conf_by_address(client_p->rhost, &client_p->localClient->ip, CONF_GLINE, client_p->localClient->aftype, client_p->username);
 
 	return aconf;
 }
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/ipmask.c bcnet-ircd-1.2.2/src/ipmask.c
--- ircd-ratbox-1.4-2/src/ipmask.c	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/src/ipmask.c	Sun May  9 10:35:57 2004
@@ -0,0 +1,248 @@
+/*
+ *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
+ *  FreeWorld-ircd:
+ *  ipmask.c: IP Masking routines.
+ *
+ *  Copyright (C) 2002 by the past and present ircd coders, and others.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+ *  USA
+ *
+ *  $Id: ipmask.c,v 1.2 2003/10/20 06:30:42 ircd Exp $
+ */
+
+#include "stdinc.h"
+#include "tools.h"
+#include "s_user.h"
+#include "channel.h"
+#include "channel_mode.h"
+#include "class.h"
+#include "client.h"
+#include "common.h"
+#include "fdlist.h"
+#include "hash.h"
+#include "irc_string.h"
+#include "sprintf_irc.h"
+#include "ircd.h"
+#include "listener.h"
+#include "motd.h"
+#include "ircd_handler.h"
+#include "msg.h"
+#include "numeric.h"
+#include "s_bsd.h"
+#include "s_conf.h"
+#include "s_log.h"
+#include "s_serv.h"
+#include "s_stats.h"
+#include "scache.h"
+#include "send.h"
+#include "supported.h"
+#include "whowas.h"
+#include "memory.h"
+#include "packet.h"
+
+void maskip (struct Client *);
+int calculate_ip (struct Client *);
+
+void maskip (struct Client *client_p)
+{
+	char buf[HOSTLEN];
+	int i = 0,j = 0,k = 0;
+	char *tmp = NULL;
+	char *tmp2 = NULL;
+	char *tmp3 = NULL;
+	char *tmp4 = NULL;
+	static char mask[HOSTLEN];
+
+	strlcpy(buf, client_p->rhost, HOSTLEN);
+	j = strlen(buf);
+    mask[0] = '\0';
+
+	if(strchr(buf, '.'))
+	{
+		k = calculate_ip (client_p);
+		if(!isdigit(buf[j - 1]))
+		{
+			tmp = strchr(buf, '.');
+			*tmp = '\0';
+			tmp++;
+			tmp2 = strchr(tmp, '.');
+
+			if(tmp2 != NULL)
+				ircsprintf(mask, "%s-%d.%s", ServerInfo.network_name, k, tmp);
+
+		}
+		else
+		{
+			tmp = strrchr(buf, '.');
+			*tmp = '\0';
+			tmp--;
+
+			ircsprintf(mask, "%s.%d", buf, k);
+		}
+
+		if (mask[0] != '\0') {
+			sendto_realops_flags(UMODE_DEBUG, L_ALL, "Applying mask (%s) to %s", mask, client_p->name);
+			strlcpy(client_p->host, mask, HOSTLEN);
+		}
+	}
+
+
+#ifdef IPV6
+	if(strchr(buf, ':'))
+	{
+		tmp = strrchr(buf, ':');
+		*tmp = '\0';
+		tmp--;
+		tmp2 = strrchr(tmp, ':');
+
+		if(tmp2 != NULL)
+		{
+			tmp3 = strrchr(tmp2, ':');
+
+			if(tmp3 != NULL)
+			{
+				tmp4 = strrchr(tmp3, ':');
+				*tmp4 = '\0';
+				tmp4--;
+			}
+			ircsprintf(mask, "%s::IPV6", buf);
+		}
+
+		if (mask[0] != '\0') {
+			sendto_realops_flags(UMODE_DEBUG, L_ALL, "Applying mask (%s) to %s", mask, client_p->name);
+			strlcpy(client_p->host, mask, HOSTLEN);
+		}
+	}
+#endif
+
+}
+
+int calculate_ip (struct Client *client_p)
+{
+  char buffer[BUFSIZE];
+  char *tmp, *tmp2, *tmp3;
+  int a,b,c,d,e;
+
+/*  if (!MyClient(client_p))
+    return;*/
+
+  strcpy(buffer, client_p->localClient->sockhost);
+
+  if (strchr(buffer, ':'))
+    return 0;
+
+  if ((tmp = strchr(buffer, '.')) != NULL)
+  {
+    *tmp = '\0';
+    tmp++;
+
+    if ((tmp2 = strchr(tmp, '.')) != NULL)
+    {
+      *tmp2 = '\0';
+      tmp2++;
+
+      if ((tmp3 = strchr(tmp2, '.')) != NULL)
+      {
+        *tmp3 = '\0';
+        tmp3++;
+      }
+    }
+  }
+
+  a = atoi(buffer);
+  b = atoi(tmp);
+  c = atoi(tmp2);
+  d = atoi(tmp3);
+
+  e = a + b + c + d;
+  e = e * e * 1024 % 100000;
+
+  return e;
+}
+
+char *ret_maskip(struct Client *client_p)
+{
+        char buf[HOSTLEN];
+        int i = 0,j = 0,k = 0;
+        char *tmp = NULL;
+        char *tmp2 = NULL;
+        char *tmp3 = NULL;
+        char *tmp4 = NULL;
+        static char mask[HOSTLEN];
+
+        strlcpy(buf, client_p->rhost, HOSTLEN);
+        j = strlen(buf);
+        mask[0] = '\0';
+  
+        if(strchr(buf, '.'))
+        {
+                k = calculate_ip (client_p);
+                if(!isdigit(buf[j - 1]))
+                {
+                        tmp = strchr(buf, '.');
+                        *tmp = '\0';
+                        tmp++;
+                        tmp2 = strchr(tmp, '.');
+  
+                        if(tmp2 != NULL)
+                                ircsprintf(mask, "%s-%d.%s", ServerInfo.network_name, k, tmp);
+
+			else
+			    ircsprintf (mask, "%s-%d.%s", ServerInfo.network_name, k, buf);
+			    //strcpy (mask, client_p->host);
+ 
+                }
+                else
+                {
+                        tmp = strrchr(buf, '.');
+                        *tmp = '\0';
+                        tmp--;
+  
+                        ircsprintf(mask, "%s.%d", buf, k);
+                }  
+
+        }
+
+
+#ifdef IPV6
+        if(strchr(buf, ':'))
+        {
+                tmp = strrchr(buf, ':');
+                *tmp = '\0';
+                tmp--;
+                tmp2 = strrchr(tmp, ':');
+
+                if(tmp2 != NULL)
+                {
+                        tmp3 = strrchr(tmp2, ':');
+
+                        if(tmp3 != NULL)
+                        {
+                                tmp4 = strrchr(tmp3, ':');
+                                *tmp4 = '\0';
+                                tmp4--;
+                        }
+                        ircsprintf(mask, "%s::IPV6", buf);
+                }  
+
+        }
+#endif
+
+	if (mask[0] != '\0')
+		return mask;
+	else
+		return client_p->host;
+}
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/messages.tab bcnet-ircd-1.2.2/src/messages.tab
--- ircd-ratbox-1.4-2/src/messages.tab	Mon Apr  5 15:22:56 2004
+++ bcnet-ircd-1.2.2/src/messages.tab	Sun May  9 10:35:57 2004
@@ -24,7 +24,7 @@
 /* 001  RPL_WELCOME, */ ":%s 001 %s :Welcome to the %s Internet Relay Chat Network %s",
 /* 002  RPL_YOURHOST,*/ ":%s 002 %s :Your host is %s, running version %s",
 /* 003  RPL_CREATED, */ ":%s 003 %s :This server was created %s",
-/* 004  RPL_MYINFO, */ ":%s 004 %s %s %s oiwszcerkfydnxbauglZ biklmnopstveI bkloveI",
+/* 004  RPL_MYINFO, */ ":%s 004 %s %s %s oiwszcerkfydnxbauglZX biklmnopstveI bkloveI",
 /* 005  RPL_ISUPPORT, */ ":%s 005 %s %s :are supported by this server",
 /* 006 */       NULL,
 /* 007 */       NULL,
@@ -394,7 +394,7 @@
 /* 367 RPL_BANLIST, */          ":%s 367 %s %s %s %s %lu",
 /* 368 RPL_ENDOFBANLIST, */     ":%s 368 %s %s :End of Channel Ban List",
 /* 369 RPL_ENDOFWHOWAS, */      ":%s 369 %s %s :End of WHOWAS",
-/* 370 */       NULL,
+/* 370 RPL_WHOWASREALHOST, */   ":%s 370 %s :%s was connected from *@%s [%s]", 
 /* 371 RPL_INFO, */             ":%s 371 %s :%s",
 /* 372 RPL_MOTD, */             ":%s 372 %s :- %s",
 /* 373 RPL_INFOSTART, */        ":%s 373 %s :Server INFO",
@@ -402,7 +402,7 @@
 /* 375 RPL_MOTDSTART, */        ":%s 375 %s :- %s Message of the Day - ",
 /* 376 RPL_ENDOFMOTD, */        ":%s 376 %s :End of /MOTD command.",
 /* 377 */       NULL,
-/* 378 */       NULL,
+/* 378 RPL_WHOISHOST */         ":%s 378 %s :%s is connected from *@%s",
 /* 379 */       NULL,
 /* 380 */       NULL,
 /* 381 RPL_YOUREOPER, */        ":%s 381 %s :You have entered... the Vanity Zone!.",
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/newconf.c bcnet-ircd-1.2.2/src/newconf.c
--- ircd-ratbox-1.4-2/src/newconf.c	Wed Apr  7 16:37:50 2004
+++ bcnet-ircd-1.2.2/src/newconf.c	Sun May  9 10:35:57 2004
@@ -112,6 +112,8 @@
 	{"restricted", CONF_FLAGS_RESTRICTED},
 	{"need_ident", CONF_FLAGS_NEED_IDENTD},
 	{"have_ident", CONF_FLAGS_NEED_IDENTD},
+	{"mask", CONF_FLAGS_IPMASK},
+	{"mask_notice", CONF_FLAGS_MASK_NOTICE},
 	{NULL}
 };
 
@@ -1412,6 +1414,28 @@
 	DupString(yy_achead->className, data);
 }
 
+static void
+conf_set_auth_mask(void *data)
+{
+	int yesno = *(unsigned int *) data;
+
+	if (yesno)
+		yy_achead->flags |= CONF_FLAGS_IPMASK;
+	else
+		yy_achead->flags &= ~CONF_FLAGS_IPMASK;
+}
+
+static void
+conf_set_auth_mask_notice (void *data)
+{
+	int yesno = *(unsigned int *) data;
+
+	if (yesno)
+		yy_achead->flags |= CONF_FLAGS_MASK_NOTICE;
+	else
+		yy_achead->flags &= ~CONF_FLAGS_MASK_NOTICE;
+}
+
 static int
 conf_begin_resv(struct TopConf *tc)
 {
@@ -3066,6 +3090,8 @@
 	add_conf_item("auth", "flood_exempt", CF_YESNO, conf_set_auth_flood_exempt);
 	add_conf_item("auth", "redirserv", CF_QSTRING, conf_set_auth_redir_serv);
 	add_conf_item("auth", "redirport", CF_INT, conf_set_auth_redir_port);
+	add_conf_item("auth", "mask", CF_YESNO, conf_set_auth_mask);
+	add_conf_item("auth", "mask_notice", CF_YESNO, conf_set_auth_mask_notice);
 	add_conf_item("auth", "flags", CF_STRING | CF_FLIST, conf_set_auth_flags);
 
 	add_top_conf("resv", conf_begin_resv, conf_end_resv);
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/s_conf.c bcnet-ircd-1.2.2/src/s_conf.c
--- ircd-ratbox-1.4-2/src/s_conf.c	Thu Apr 22 14:42:06 2004
+++ bcnet-ircd-1.2.2/src/s_conf.c	Sun May  9 10:35:57 2004
@@ -21,7 +21,7 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
  *
- *  $Id: s_conf.c,v 7.416.2.25 2004/04/22 18:42:06 leeh Exp $
+ *  $Id: s_conf.c,v 7.416.2.24 2004/04/07 20:37:50 androsyn Exp $
  */
 
 #include "stdinc.h"
@@ -56,6 +56,7 @@
 #include "patricia.h"
 #include "reject.h"
 
+char *ret_maskip(struct Client *);
 
 struct config_server_hide ConfigServerHide;
 
@@ -535,6 +536,16 @@
 		if(IsConfRestricted(aconf))
 			SetRestricted(client_p);
 
+
+		strlcpy (client_p->rhost, client_p->host, sizeof(client_p->rhost));
+		if(IsConfDoMaskIp(aconf))
+		{
+			strcpy (client_p->host, ret_maskip(client_p));
+			client_p->umodes |= UMODE_IPMASK;
+			if(IsConfMaskNotice(aconf))
+				sendto_realops_flags (UMODE_ALL, L_ALL, "%s masking: %s as %s", client_p->name, client_p->rhost, client_p->host);
+		}
+
 		/* Thanks for spoof idea amm */
 		if(IsConfDoSpoofIp(aconf))
 		{
@@ -1320,7 +1331,7 @@
 
 	ConfigChannel.default_split_user_count = 0;
 	ConfigChannel.default_split_server_count = 0;
-	ConfigChannel.default_split_delay = 60;
+	ConfigChannel.default_split_delay = 15;
 	ConfigChannel.no_join_on_split = NO;
 	ConfigChannel.no_create_on_split = YES;
 
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/s_serv.c bcnet-ircd-1.2.2/src/s_serv.c
--- ircd-ratbox-1.4-2/src/s_serv.c	Sun Apr 11 22:08:18 2004
+++ bcnet-ircd-1.2.2/src/s_serv.c	Sun May  9 10:35:57 2004
@@ -95,6 +95,7 @@
 	{ "UNKLN",	CAP_UNKLN },
 	{ "CLUSTER",	CAP_CLUSTER },
 	{ "ENCAP",	CAP_ENCAP },
+	{ "IPMASK", CAP_IPMASK },
 	{ 0, 		0 }
 };
 
@@ -790,13 +791,15 @@
 		ubuf[1] = '\0';
 	}
 
-		sendto_one(client_p, "NICK %s %d %lu %s %s %s %s :%s",
+		sendto_one(client_p, "NICK %s %d %lu %s %s %s %s %s :%s",
 			   target_p->name,
 			   target_p->hopcount + 1,
 			   (unsigned long) target_p->tsinfo,
 			   ubuf,
 			   target_p->username, target_p->host,
-			   target_p->user->server, target_p->info);
+			   target_p->user->server,
+			   IsCapable (client_p, CAP_IPMASK)? target_p->rhost : "", target_p->info);
+
 }
 
 /*
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/s_user.c bcnet-ircd-1.2.2/src/s_user.c
--- ircd-ratbox-1.4-2/src/s_user.c	Fri Apr  2 10:51:02 2004
+++ bcnet-ircd-1.2.2/src/s_user.c	Sun May  9 10:35:57 2004
@@ -54,11 +54,13 @@
 #include "memory.h"
 #include "packet.h"
 #include "reject.h"
+#include "hostmask.h"
 
 static void report_and_set_user_flags(struct Client *, struct ConfItem *);
 static int check_X_line(struct Client *client_p, struct Client *source_p);
 void user_welcome(struct Client *source_p);
 int oper_up(struct Client *source_p, struct ConfItem *aconf);
+char *ret_maskip(struct Client *);
 
 extern char *crypt();
 
@@ -88,6 +90,7 @@
 	{UMODE_UNAUTH, 'u'},
 	{UMODE_WALLOP, 'w'},
 	{UMODE_EXTERNAL, 'x'},
+    {UMODE_IPMASK, 'X'},
 	{UMODE_SPY, 'y'},
 	{UMODE_OPERWALL, 'z'},
 	{UMODE_OPERSPY, 'Z'},
@@ -462,7 +465,7 @@
 		 ipaddr, HOSTIPLEN);
 	sendto_realops_flags(UMODE_CCONN, L_ALL,
 			     "Client connecting: %s (%s@%s) [%s] {%s} [%s]",
-			     nick, source_p->username, source_p->host,
+			     nick, source_p->username, source_p->rhost,
 #ifdef HIDE_SPOOF_IPS
 			     IsIPSpoof(source_p) ? "255.255.255.255" :
 #endif
@@ -608,13 +611,21 @@
 		ubuf[1] = '\0';
 	}
 
-	sendto_server(client_p, NULL, NOCAPS, NOCAPS,
+	sendto_server(client_p, NULL, NOCAPS, CAP_IPMASK,
 		      "NICK %s %d %lu %s %s %s %s :%s",
 		      nick, source_p->hopcount + 1, 
 		      (unsigned long) source_p->tsinfo, ubuf, 
 		      source_p->username, source_p->host, user->server,
 		      source_p->info);
 
+    sendto_server(client_p, NULL, CAP_IPMASK, NOCAPS,
+              "NICK %s %d %lu %s %s %s %s %s :%s",
+              nick, source_p->hopcount + 1,
+              (unsigned long) source_p->tsinfo, ubuf,
+              source_p->username, source_p->host, user->server,
+			  source_p->rhost,
+              source_p->info);
+
 	return 0;
 }
 
@@ -841,7 +852,7 @@
  */
 int
 do_remote_user(char *nick, struct Client *client_p, struct Client *source_p,
-	       char *username, char *host, char *server, char *realname)
+	       char *username, char *host, char *server, char *rhost, char *realname)
 {
 	unsigned int oflags;
 	struct User *user;
@@ -862,6 +873,11 @@
 	strlcpy(source_p->host, host, sizeof(source_p->host));
 	strlcpy(source_p->info, realname, sizeof(source_p->info));
 
+	if(rhost)
+		strlcpy(source_p->rhost, rhost, sizeof(source_p->rhost));
+	else
+		strlcpy(source_p->rhost, "unavailable", sizeof(source_p->rhost));
+
 	return register_remote_user(client_p, source_p, source_p->name, username);
 }
 
@@ -882,7 +898,8 @@
 	struct Client *target_p;
 	int what, setflags;
 	int badflag = NO;	/* Only send one bad flag notice */
-	char buf[BUFSIZE];
+	char buf[BUFSIZE], oldhost[HOSTLEN];
+	struct ConfItem* aconf;
 
 	what = MODE_ADD;
 
@@ -984,6 +1001,47 @@
 					}
 				}
 				break;
+
+				case 'X':
+				if (MyClient(source_p))
+				{
+					aconf = find_address_conf (source_p->rhost, source_p->username, &source_p->localClient->ip, source_p->localClient->aftype);
+
+					strcpy (oldhost, source_p->host);
+
+					if(what == MODE_ADD)
+					{
+						if(IsConfDoSpoofIp(aconf))
+						{
+							source_p->umodes &= ~UMODE_IPMASK;
+							break;
+						}
+
+						if(IsMasked(source_p))
+						{
+							if(!strcmp(ret_maskip(source_p), source_p->host))
+								break;
+
+							source_p->umodes |= UMODE_IPMASK;
+							strcpy(source_p->host, ret_maskip(source_p));
+						}
+
+						source_p->umodes |= UMODE_IPMASK;
+						strcpy(source_p->host, ret_maskip(source_p));
+					}
+
+					if(what == MODE_DEL)
+					{
+						if(!IsMasked(source_p))
+							break;
+
+						source_p->umodes &= ~UMODE_IPMASK;
+						strcpy(source_p->host, source_p->rhost);
+					}
+
+					sendto_server (NULL, NULL, CAP_IPMASK, NOCAPS, ":%s SVSHOST %s %s %s", me.name, source_p->name, oldhost, source_p->host);
+			}
+			break;
 
 			case 'p':
 				if (MyConnect(source_p))
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/version.c bcnet-ircd-1.2.2/src/version.c
--- ircd-ratbox-1.4-2/src/version.c	Wed Dec 31 19:00:00 1969
+++ bcnet-ircd-1.2.2/src/version.c	Sun May  9 10:35:57 2004
@@ -0,0 +1,65 @@
+/*
+ *   IRC - Internet Relay Chat, src/version.c
+ *   Copyright (C) 1990 Chelsea Ashley Dyerman
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 1, or (at your option)
+ *   any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * This file is generated by version.c.SH. Any changes made will go away.
+ */
+
+#include "patchlevel.h"
+#include "serno.h"
+
+#define PATCHVER PATCHLEVEL "+ipmask-1.4"
+
+const char *generation = "1";
+const char *creation = "Sat Apr 24 2004 at 18:07:13 UTC";
+const char *platform = "Linux VariableCorp 2.4.18-bf2.4 #1 Son Apr 14 09:53:28 CEST 2002 i686 unknown";
+const char *ircd_version = PATCHVER;
+const char *serno = SERIALNUM;
+
+const char *infotext[] =
+{
+  "IRC --",
+  "Based on the original code written by Jarkko Oikarinen",
+  "Copyright 1988, 1989, 1990, 1991 University of Oulu, Computing Center",
+  "Copyright (c) 1996-2001 Hybrid Development Team", 
+  "Copyright (c) 2002-2003 ircd-ratbox Development Team",
+  "",
+  "This program is free software; you can redistribute it and/or",
+  "modify it under the terms of the GNU General Public License as",
+  "published by the Free Software Foundation; either version 1, or",
+  "(at your option) any later version.",
+  "",
+  " ",
+  "ircd-ratbox is an evolution where ircd-hybrid left off around version 7-rc1.  ",
+  "Currently the ircd-ratbox consists of the following developers:",
+  " ",
+  "AndroSyn, Aaron Sethman <androsyn -at- ratbox.org>",
+  "anfl, Lee Hardy <lee -at- leeh.co.uk>",
+  "larne, Edward Brocklesby <ejb -at- sdf.lonestar.org>",
+  " ",
+  "Special thanks for support, code and ideas to:",
+  "Hwy, W. Campbell <wcampbel -at- botbay.net>",
+  " ",
+  "Of course our work is based on the work of many, many others over the past",
+  "10 or so years since irc has existed, including the work done by the Hybrid",
+  "team, our thanks goes to them.",
+  " ",
+  "",
+  0,
+};
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/version.c.SH bcnet-ircd-1.2.2/src/version.c.SH
--- ircd-ratbox-1.4-2/src/version.c.SH	Sun Jul  6 11:01:03 2003
+++ bcnet-ircd-1.2.2/src/version.c.SH	Sun May  9 10:35:57 2004
@@ -52,10 +52,12 @@
 #include "patchlevel.h"
 #include "serno.h"
 
+#define PATCHVER PATCHLEVEL "+ipmask-1.4"
+
 const char *generation = "$generation";
 const char *creation = "$creation";
 const char *platform = "$uname";
-const char *ircd_version = PATCHLEVEL;
+const char *ircd_version = PATCHVER;
 const char *serno = SERIALNUM;
 
 const char *infotext[] =
diff -uNrd -x CVS ircd-ratbox-1.4-2/src/whowas.c bcnet-ircd-1.2.2/src/whowas.c
--- ircd-ratbox-1.4-2/src/whowas.c	Mon Mar 15 13:19:57 2004
+++ bcnet-ircd-1.2.2/src/whowas.c	Sun May  9 10:35:57 2004
@@ -88,6 +88,7 @@
 	strlcpy(who->name, client_p->name, sizeof(who->name));
 	strcpy(who->username, client_p->username);
 	strcpy(who->hostname, client_p->host);
+	strcpy(who->rhostname, client_p->rhost);
 	strcpy(who->realname, client_p->info);
 
 	who->servername = client_p->user->server;
