diff -uNrd ircd-ratbox-1.3-1/INSTALL.BGFree ircd-ratbox-bgfree-p1/INSTALL.BGFree
--- ircd-ratbox-1.3-1/INSTALL.BGFree	Wed Dec 31 19:00:00 1969
+++ ircd-ratbox-bgfree-p1/INSTALL.BGFree	Wed Jan 21 10:43:39 2004
@@ -0,0 +1,14 @@
+Steps:
+1. ./configure --prefix="/path/to/ircd/dir" --enable-bgfree
+2. make
+3. make install
+3. edit /path/to/ircd/dir/etc/example.bgfree.conf
+4. cp /path/to/ircd/dir/etc/example.bgfree.conf /path/to/ircd/dir/etc/ircd.conf
+5. run the ircd ;]
+
+no time for further explanation... ;]
+have fun
+
+MasterBo
+
+EOF
\ No newline at end of file
diff -uNrd ircd-ratbox-1.3-1/configure ircd-ratbox-bgfree-p1/configure
--- ircd-ratbox-1.3-1/configure	Wed Oct 15 14:06:49 2003
+++ ircd-ratbox-bgfree-p1/configure	Sat Jan 17 12:40:25 2004
@@ -61,6 +61,10 @@
 ac_help="$ac_help
   --enable-shared-modules      Enable shared modules.
   --disable-shared-modules     Disable shared modules. "
+ac_help="$ac_help
+
+  --enable-bgfree	       Enable BGFree's code and patches.
+  "
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -2544,6 +2548,7 @@
 	echo "$ac_t""$cf_rlimit_type" 1>&6
 fi
 
+
 echo $ac_n "checking for OpenSSL""... $ac_c" 1>&6
 echo "configure:2549: checking for OpenSSL" >&5
 # Check whether --enable-openssl or --disable-openssl was given.
@@ -3760,9 +3765,9 @@
 fi
 
 
-ac_cv_nicklen="9"
+ac_cv_nicklen="15"
 ac_cv_maxclients="3000"
-ac_cv_topiclen="120"
+ac_cv_topiclen="150"
 
 # Check whether --with-nicklen or --without-nicklen was given.
 if test "${with_nicklen+set}" = set; then
@@ -4652,6 +4657,26 @@
 
 fi
 
+echo $ac_n "checking whether to enable BGFree code""... $ac_c" 1>&6
+echo "configure:4660: checking whether to enable BGFree code" >&5
+# Check whether --enable-bgfree was given.
+if test "${enable_bgfree+set}" = set; then
+  enableval="$enable_bgfree"
+   cf_enable_bgfree=$enableval 
+else
+   cf_enable_bgfree="no" 
+fi
+
+if test "X$cf_enable_bgfree" != "Xno" ; then
+    BGFREE_CONF="example.bgfree.conf"
+    BGFREE_SRCS="m_svshint.c m_svsjoin.c m_svspart.c m_svsnick.c \\"
+    IRC_CFLAGS="$IRC_CFLAGS -DBGFREE"
+    echo "$ac_t""enabled" 1>&6
+else
+    BGFREE_SRCS=" "
+    BGFREE_CONF=" "
+    echo "$ac_t""disabled" 1>&6
+fi
 
 
 
@@ -4841,6 +4866,8 @@
 s%@MODULES_DEFINE@%$MODULES_DEFINE%g
 s%@MODULES_LIBS@%$MODULES_LIBS%g
 s%@MOD_TARGET@%$MOD_TARGET%g
+s%@BGFREE_SRCS@%$BGFREE_SRCS%g
+s%@BGFREE_CONF@%$BGFREE_CONF%g
 s%@SSL_INCLUDES@%$SSL_INCLUDES%g
 s%@SSL_LIBS@%$SSL_LIBS%g
 s%@INCDEP@%$INCDEP%g
@@ -5089,3 +5116,7 @@
 fi
 
 echo "$ac_t""Server is configured with NICKLEN=$ac_cv_nicklen and MAX_CLIENTS=$ac_cv_maxclients" 1>&6
+
+if test "${enable_bgfree+set}" = set; then
+    echo "$ac_t""BGFree's code and modules ready for build" 1>&6
+fi
\ No newline at end of file
diff -uNrd ircd-ratbox-1.3-1/doc/Makefile.in ircd-ratbox-bgfree-p1/doc/Makefile.in
--- ircd-ratbox-1.3-1/doc/Makefile.in	Fri Sep 13 18:20:51 2002
+++ ircd-ratbox-bgfree-p1/doc/Makefile.in	Thu Jan 15 13:36:18 2004
@@ -30,7 +30,7 @@
 mandir          = @prefix@/man8
 MANPAGES        = ircd.8
 
-CONFS		= example.conf example.efnet.conf
+CONFS		= example.conf example.efnet.conf @BGFREE_CONF@
 DEFAULTCONFS	= kline.conf dline.conf xline.conf resv.conf
 DEFAULTCONFSCP  = ircd.motd
 
diff -uNrd ircd-ratbox-1.3-1/doc/example.bgfree.conf ircd-ratbox-bgfree-p1/doc/example.bgfree.conf
--- ircd-ratbox-1.3-1/doc/example.bgfree.conf	Wed Dec 31 19:00:00 1969
+++ ircd-ratbox-bgfree-p1/doc/example.bgfree.conf	Wed Jan 21 10:22:51 2004
@@ -0,0 +1,354 @@
+###################################################################################################
+#             21.01.2004 Primeren Ircd.Conf za BGFree Network by Admistartor                      #
+###################################################################################################
+
+serverinfo {
+	name = "server.name.com";
+	description = "ot kude e servera";
+	network_name = "BGFree";
+        /* zaduljitelno za BGFree by maiz */
+	network_desc = "BGFree IRC Network";
+        /* zaduljitelno za BGFree by maiz */
+	hub = no;
+        /* novoprietite serveri zaduljitelno se linkvat kato lief by maiz */
+
+};
+
+admin {
+	name = "ime na admina realno + nick";
+	description = "IRC Server Administrator";
+	email = "<e-mail@na.admina>";
+};
+
+logging {
+	log_level = L_INFO;
+	fname_userlog = "logs/userlog";
+	fname_operlog = "logs/operlog";
+	fname_foperlog = "logs/foperlog";
+};
+
+class "users" {
+	ping_time = 2 minutes;
+        number_per_ident = 5;
+	number_per_ip = 5;
+        number_per_ip_global = 10;
+	number_per_cidr = 30;
+	cidr_bitlen = 24;
+	max_number = 100;
+	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 = 5 minutes;
+	max_number = 1;
+	sendq=2 megabytes;
+	sendq_eob = 500 kbytes;
+};
+
+listen {
+	
+	port = 6667, 7000, 9000;
+        /* zaduljitelno za BGFree by maiz */
+
+};
+
+auth {
+	user = "*user@*";
+        encrypted = yes;
+	password = "operpass";
+        spoof = "spoof.server.name.com";
+        /* spoof se pravi kakto sledva server.name.com by maiz */
+	flags = kline_exempt, 
+        gline_exempt, 
+        flood_exempt, 
+        exceed_limit;
+	class = "opers";
+};
+
+auth {
+	user = "*@*";
+	class = "users";
+	
+};
+operator "opernick" {
+        user = "*user@spoof.server.name.com";
+        encrypted = yes;
+        password = "XwWUc67/VmaaE";
+        class = "opers";
+        flags = global_kill, 
+        remote, 
+        kline, 
+        unkline, 
+        gline, 
+        nick_changes,
+        die, 
+        rehash, 
+        admin, 
+        xline, 
+        operwall, 
+        oper_spy;
+};
+
+connect "irc.server.com" {
+        host = "127.0.0.1";
+        send_password = "pass";
+        accept_password = "pass";
+        encrypted = no;
+        port = 9000;
+        /* zaduljiten port server2server link by maiz */
+        hub_mask = "*";
+        /* zaduljitelno kum HUB link by maiz */
+        leaf_mask = "*";
+        class = "server";
+        autoconn = yes;
+        /* zaduljitelno kum glavnia HUB by maiz */
+};
+
+##########################################################################################################
+# Zaduljitelni Nastroiki Za Irc Server na BGFree Network by Maiz Do Not Change!!! Da NE se Promeniat !!! #
+##########################################################################################################
+# cluster i shared zaduljitelo slaga LIEF servera za HUB-a kum koito e zakachen.Pri podavane na komadna  #
+#                                                                                                        #
+# /stats U                              shared/cluster triabva da izglejdat po slednia nachin za BGFree. #
+# U BGFree.Services <NULL>@<NULL> KU                                                                     #
+# U irc.worldnn.com <NULL>@<NULL> KU                                                                     #
+# U SocksCleaner.BGFree.net <NULL>@<NULL> KU                                                             #
+# U irc.masterbo.org <NULL>@<NULL> KU                                                                    #
+# U Gliner.BGFree.net <NULL>@<NULL> KU                                                                   #
+# End of /STATS report                                                                                   #
+#                                                                                                        #
+# Ako niamate tezi Nastroiki na irc servera .She budete razkacheni ot mrejata do vuvejdaneto im          #
+##########################################################################################################
+
+cluster {
+	name = "irc.worldnn.com";
+	type = kline, unkline, locops, xline;
+};
+
+cluster {
+        name = "BGFree.Services";
+        type = kline, unkline, locops, xline;
+};
+
+cluster {
+        name = "Gliner.BgFree.net";
+        type = kline, unkline, locops, xline;
+};
+
+cluster {
+        name = "SocksCleaner.bgfree.net";
+        type = kline, unkline, locops, xline;
+};
+
+cluster {
+        name = "irc.masterbo.org";
+        type = kline, unkline, locops, xline;
+};
+
+
+shared {
+	name = "BGFree.Services";
+	type = all;
+};
+
+shared {
+	name = "gliner.bgfree.net";
+	type = all;
+};
+
+shared {
+	name = "SocksCleaner.BGFree.net";
+	type = all;
+};
+
+
+kill {
+	user = "bad@*.hacked.edu";
+	reason = "Obviously hacked account";
+};
+
+deny {
+	ip = "192.168.1.0/24";
+	reason = "Reconnecting vhosted bots";
+};
+
+exempt {
+	ip = "193.68.181.224/16";
+};
+
+resv {
+        reason = "Services Nick On BGFree Network";
+
+	nick = "nickserv";
+	nick = "chanserv";
+	nick = "operserv";
+	nick = "memoserv";
+	nick = "helpserv";
+	nick = "hostserv";
+	nick = "adminserv";
+	nick = "splitserv";
+	nick = "statserv";
+	nick = "seenserv";
+	nick = "seen";
+	nick = "gliner";
+	nick = "NS";
+	nick = "CS";
+	nick = "MS";
+	nick = "HS";
+	nick = "OS";
+	nick = "SS";
+	nick = "global";
+        nick = "SockClean";
+        nick = "splitserv";
+        nick = "AdminServ";
+        nick = "jupeserv";
+        nick = "monitor";
+
+	reason = "Clone bots";
+	nick = "clone*";
+};
+
+gecos {
+	name = "*sex*";
+	reason = "Possible spambot";
+	action = warn;
+};
+
+gecos {
+	name = "sub7server";
+	reason = "Trojan drone";
+	action = reject;
+};
+
+gecos {
+	name = "*http*";
+	reason = "Spambot";
+	action = silent;
+};
+
+channel {
+	use_invex = yes;
+	use_except = yes;
+	use_knock = yes;
+	knock_delay = 5 minutes;
+	knock_delay_channel = 1 minute;
+	max_chans_per_user = 15;
+        quiet_on_ban = yes;
+        max_bans = 25;
+	persist_time = 30 minutes;
+	default_split_user_count = 0;
+	default_split_server_count = 0;
+	default_split_delay = 15 seconds;
+	no_create_on_split = no;
+	no_join_on_split = no;
+        no_oper_resvs = no;
+	burst_topicwho = yes;
+};
+
+
+serverhide {
+	flatten_links = no;
+	links_delay = 5 minutes;
+        hidden = no;
+	disable_hidden = no;
+	hide_servers = no;
+	disable_remote_commands = no;
+	disable_local_channels = no;
+};
+
+general {
+	hide_error_messages = opers;
+	default_operstring = "is an IRC Operator";
+	default_adminstring = "is a Server Administrator";
+        tkline_expire_notices = yes;
+	reject_ban_time = 1 minute;
+	reject_after_count = 3;
+	reject_duration = 5 minutes;
+        default_floodcount = 10;
+	failed_oper_notice = yes;
+	dots_in_ident=2;
+        dot_in_ip6_addr = no;
+	min_nonwildcard = 4;
+	min_nonwildcard_simple = 3;
+        max_accept = 20;
+	anti_nick_flood = yes;
+	max_nick_time = 20 seconds;
+	max_nick_changes = 5;
+        anti_spam_exit_message_time = 5 minutes;
+	ts_warn_delta = 30 seconds;
+	ts_max_delta = 5 minutes;
+	client_exit = yes;
+	kline_with_reason = yes;
+	kline_with_connection_closed = no;
+	kline_delay = 0 seconds;
+	non_redundant_klines = yes;
+	warn_no_nline = yes;
+	stats_o_oper_only=yes;
+	stats_P_oper_only=no;
+	stats_c_oper_only=yes;
+	stats_h_oper_only=yes;
+	stats_y_oper_only=yes;
+	stats_i_oper_only=yes;
+	stats_k_oper_only=masked;
+	map_oper_only = yes;
+	caller_id_wait = 1 minute;
+	pace_wait_simple = 1 second;
+	pace_wait = 10 seconds;
+	short_motd = no;
+	ping_cookie = no;
+	connect_timeout = 30 seconds;
+	disable_auth = no;
+	no_oper_flood = yes;
+	glines = yes;
+	gline_time = 1 day;
+	gline_min_cidr = 16;
+        idletime = 0;
+	max_targets = 4;
+	client_flood = 20;
+        use_help = yes;
+        use_whois_actually = no;
+	message_locale = "custom";
+	oper_only_umodes = bots, cconn, debug, full, skill, nchange, 
+                     rej, spy, external, operwall, locops, unauth;
+	oper_umodes = locops, servnotice, operwall, wallop;
+};
+
+spamcheck {
+    adv_text = "*http*";
+    adv_text = "*www.*";
+    adv_text = "*ftp*";
+    adv_text = "*join #*";
+    adv_text = "*ela v #*";
+    adv_text = "*come to #*";
+};
+
+modules {
+	/* module path: paths to search for modules specified below and 
+	 * in /modload.
+	 */
+	path = "/home/user/ircd/modules";
+	path = "/home/user/ircd/modules/autoload";
+
+};
+
+###################### VAJNO za jelaeshtite za link kum BGFree ############################################
+# Formata za link kum BGFree Network e na adres http://irc.masterbo.org/apply.php.                        #
+# Predi da ia podadete poglednete dali otgovariate na usloviata za link kum mrejata te sa na adres        #
+# http://irc.masterbo.org/policy.php?sp=serv .Ako imate problemi s instaliraneto na ircd-ratbox-BGFree-p1 #
+# mojete da ni namerite tuk irc.wordlnn.com 6667/7000/9000  v kanal #operwall ili <maiz@abv.bg>           #
+###########################################################################################################
diff -uNrd ircd-ratbox-1.3-1/doc/ircd.motd ircd-ratbox-bgfree-p1/doc/ircd.motd
--- ircd-ratbox-1.3-1/doc/ircd.motd	Thu Jun 26 10:01:14 2003
+++ ircd-ratbox-bgfree-p1/doc/ircd.motd	Sat Jan 17 10:02:31 2004
@@ -1,2 +1,8 @@
-This is the default ircd-ratbox MOTD.  You could replace it, but then noone
-would find out how much you love goats..
+   Welcome to BGFree network and thank you for using this server!
+-------------------------------------------------------------------
+Flood, SPAM, any kind of abuse & illegal activities concerning the
+correct functionality of the server/network or any legal rights,
+property or trademarks are forbidden. This may cause you to be 
+banned from the server or the entire network!
+-------------------------------------------------------------------
+     We hope that you'll enjoy your stay - BGFree Network Team
\ No newline at end of file
diff -uNrd ircd-ratbox-1.3-1/help/opers/cmode ircd-ratbox-bgfree-p1/help/opers/cmode
--- ircd-ratbox-1.3-1/help/opers/cmode	Tue Jul  8 10:12:41 2003
+++ ircd-ratbox-bgfree-p1/help/opers/cmode	Sat Jan 17 10:01:12 2004
@@ -12,6 +12,15 @@
      +i     - Invite only.  Users need to be /invite'd or match a +I to
               join the channel.
 
+ * The following modes are available only when compiled with --enable-bgfree *
+     +q	    - Join filter. Allows only NS identified users to join channel.
+     +z	    - No Repeat. Forbids repeating in the channel.
+     +H     - No SPAM. Forbits messages containing SPAM phrases.
+     +M     - Users with unregistered nicknames can not talk in the channel.
+     +C     - CTCP filter. CTCP messages are allowed only from +v/+o users.
+     +O     - Opers only. Only IRC operators can join the channel.
+     +A     - Admins only. Only IRC server admins can join the channel.
+     
 WITH PARAMETERS:
      +k     - Key.  Requires users to issue /join #channel KEY to join.
               PARAMS: /mode #channel +k key
diff -uNrd ircd-ratbox-1.3-1/help/users/umode ircd-ratbox-bgfree-p1/help/users/umode
--- ircd-ratbox-1.3-1/help/users/umode	Tue Nov 20 22:22:51 2001
+++ ircd-ratbox-bgfree-p1/help/users/umode	Sat Jan 17 09:56:32 2004
@@ -8,3 +8,8 @@
                   Use the /oper command to attain this.
          +i     - Designates this client 'invisible'.
          +g     - "caller id" mode only allow accept clients to message you
+
+ * The following modes are available only when compiled with --enable-bgfree *
+	 +S	- Silence mode allows only NS identified clients to message you
+	 +T	- Translation mode, translates ISO-8859-5 cyrillic to latin
+	 +Y	- Translation mode, translates windows-1251 cyrillic to latin
\ No newline at end of file
diff -uNrd ircd-ratbox-1.3-1/include/channel_mode.h ircd-ratbox-bgfree-p1/include/channel_mode.h
--- ircd-ratbox-1.3-1/include/channel_mode.h	Thu Nov  6 19:00:37 2003
+++ ircd-ratbox-bgfree-p1/include/channel_mode.h	Tue Jan 13 13:46:40 2004
@@ -87,6 +87,24 @@
 #define MODE_INVEX	0x2000
 #define MODE_HIDEOPS    0x4000
 
+#ifdef BGFREE
+/* +c +??? +C +M +H +z +A +O - MasterBo */
+#define MODE_NOCOLOR    0x1000  /* not by me.. don't remember - MasterBo */
+#define MODE_JOINF	    0x10000
+#define MODE_NOCTCP	    0x20000
+#define MODE_NOTALK	    0x40000
+#define MODE_NOSPAM	    0x80000
+#define MODE_NOREPEAT   0x100000
+
+#define MODE_ADMONLY	0x0200
+#define MODE_OPRONLY	0x8000
+
+#define NoColorChannel(x)       ((x) && ((x)->mode.mode & MODE_NOCOLOR))
+#define NoRepeatChannel(x)      ((x) && ((x)->mode.mode & MODE_NOREPEAT))
+#define AdminOnlyChan(x)	((x) && ((x)->mode.mode & MODE_ADMONLY))
+#define OpersOnlyChan(x)	((x) && ((x)->mode.mode & MODE_OPRONLY))
+#endif
+
 /*
  * mode flags which take another parameter (With PARAmeterS)
  */
diff -uNrd ircd-ratbox-1.3-1/include/client.h ircd-ratbox-bgfree-p1/include/client.h
--- ircd-ratbox-1.3-1/include/client.h	Thu Nov 27 15:20:10 2003
+++ ircd-ratbox-bgfree-p1/include/client.h	Sat Jan 17 09:39:16 2004
@@ -69,6 +69,10 @@
 {
 	dlink_list channel;	/* chain of channel pointer blocks */
 	dlink_list invited;	/* chain of invite pointer blocks */
+#ifdef BGFREE
+	dlink_list nokick;      /* chain of channels where the user can't be kicked */
+	dlink_list    repeat;         /* chain of last phrases per channel blocks */
+#endif
 	char *away;		/* pointer to away message */
 	time_t last_away;	/* Away since... */
 	time_t last;
@@ -89,6 +93,14 @@
 	dlink_list users;
 };
 
+#ifdef BGFREE
+struct Repeat {
+  struct Channel *chptr;      /* last phrase block */
+  char *text;
+  time_t lastphrase;
+};
+#endif
+
 struct SlinkRpl
 {
 	int command;
@@ -126,6 +138,10 @@
 	unsigned int umodes;	/* opers, normal users subset */
 	unsigned int flags;	/* client flags */
 	unsigned int flags2;	/* ugh. overflow */
+    
+  #ifdef BGFREE
+	unsigned int      svsflags;   /* services flags -zer0c00l */
+  #endif
 
 	int hopcount;		/* number of servers to this 0 = local */
 	unsigned short status;	/* Client type */
@@ -384,6 +400,16 @@
 #define UMODE_OPER         0x20000	/* Operator */
 #define UMODE_ADMIN        0x40000	/* Admin on server */
 
+#ifdef BGFREE
+#define FLAGS_SILENCE      0x400000 /* user's mode +S */
+#define FLAGS_TRANSWIN     0x1000000 /* translate cyrillic Windows-1251 */
+#define FLAGS_TRANSISO     0x2000000 /* translate cyrillic ISO-8859-5 */
+#define FLAGS_SVS_IDENT    0x00100  /* client has identified with services -zer0c00l */
+#define FLAGS_SVS_ADMIN    0x00200  /* client has identified as services admin -zer0c00l */
+// Gliner identified - MasterBo
+#define FLAGS_SVS_GLINER   0x00400
+#endif /* #ifdef BGFREE */
+
 #define UMODE_ALL	   UMODE_SERVNOTICE
 
 
@@ -419,13 +445,27 @@
 #define FLAGS2_FLOODDONE        0x800000
 #define FLAGS2_EXEMPTSPAMBOT	0x1000000
 
+#ifdef BGFREE
+#define SEND_UMODES  (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP | \
+                      UMODE_ADMIN | UMODE_CALLERID | FLAGS_SILENCE | \
+				      FLAGS_TRANSWIN | FLAGS_TRANSISO)
+#define ALL_UMODES   (SEND_UMODES | UMODE_SERVNOTICE | UMODE_CCONN | \
+                      UMODE_REJ | UMODE_SKILL | UMODE_FULL | UMODE_SPY | \
+                      UMODE_NCHANGE | UMODE_OPERWALL | UMODE_DEBUG | \
+                      UMODE_BOTS | UMODE_EXTERNAL | UMODE_LOCOPS | \
+ 					  UMODE_ADMIN | UMODE_UNAUTH | UMODE_CALLERID | UMODE_OPERSPY | \
+					  FLAGS_SILENCE | FLAGS_TRANSWIN | FLAGS_TRANSISO)
+#else
 #define SEND_UMODES  (UMODE_INVISIBLE | UMODE_OPER | UMODE_WALLOP | \
                       UMODE_ADMIN)
 #define ALL_UMODES   (SEND_UMODES | UMODE_SERVNOTICE | UMODE_CCONN | \
                       UMODE_REJ | UMODE_SKILL | UMODE_FULL | UMODE_SPY | \
                       UMODE_NCHANGE | UMODE_OPERWALL | UMODE_DEBUG | \
                       UMODE_BOTS | UMODE_EXTERNAL | UMODE_LOCOPS | \
- 		      UMODE_ADMIN | UMODE_UNAUTH | UMODE_CALLERID | UMODE_OPERSPY)
+ 					  UMODE_ADMIN | UMODE_UNAUTH | UMODE_CALLERID | UMODE_OPERSPY)
+#endif /* BGFREE */
+
+
 
 #define FLAGS_ID     (FLAGS_NEEDID | FLAGS_GOTID)
 
@@ -494,12 +534,33 @@
 #define SetCallerId(x)		((x)->umodes |= UMODE_CALLERID)
 #define IsSetCallerId(x)	((x)->umodes & UMODE_CALLERID)
 
+#ifdef BGFREE
+#define HasSilence(x)           ((x)->umodes & FLAGS_SILENCE)
+#define SetSilence(x)           ((x)->umodes |= FLAGS_SILENCE)
+#define IsSetTransWin(x)        ((x)->umodes & FLAGS_TRANSWIN)
+#define IsSetTransISO(x)        ((x)->umodes & FLAGS_TRANSISO)
+#endif
+
 #define SetNeedId(x)            ((x)->flags |= FLAGS_NEEDID)
 #define IsNeedId(x)             (((x)->flags & FLAGS_NEEDID) != 0)
 
 #define SetGotId(x)             ((x)->flags |= FLAGS_GOTID)
 #define IsGotId(x)              (((x)->flags & FLAGS_GOTID) != 0)
 
+#ifdef BGFREE
+#define IsNSId(x)               ((x)->svsflags & FLAGS_SVS_IDENT)
+#define SetNSId(x)              ((x)->svsflags |= FLAGS_SVS_IDENT)
+#define ClearNSId(x)            ((x)->svsflags &= ~FLAGS_SVS_IDENT)
+
+#define IsOSId(x)               ((x)->svsflags & FLAGS_SVS_ADMIN)
+#define SetOSId(x)              ((x)->svsflags |= FLAGS_SVS_ADMIN)
+#define ClearOSId(x)            ((x)->svsflags &= ~FLAGS_SVS_ADMIN)
+// Gliner Identified - MasterBo
+#define SetGLId(x)				((x)->svsflags |= FLAGS_SVS_GLINER)
+#define IsGLId(x)				((x)->svsflags & FLAGS_SVS_GLINER)
+#define ClearGLId(x)			((x)->svsflags &= ~FLAGS_SVS_GLINER);
+#endif
+
 /*
  * flags2 macros.
  */
@@ -591,5 +652,11 @@
 extern struct User *make_user(struct Client *);
 extern struct Server *make_server(struct Client *);
 
+#ifdef BGFREE
+extern char *translate(struct Client *client_p, char *buf);
+void add_nokick_chan(struct Client * cptr, char * chan);
+void del_nokick_chan(struct Client * cptr, char * chan);
+void clear_nokick_list(struct Client * cptr);
+#endif
 
 #endif /* INCLUDED_client_h */
diff -uNrd ircd-ratbox-1.3-1/include/defaults.h ircd-ratbox-bgfree-p1/include/defaults.h
--- ircd-ratbox-1.3-1/include/defaults.h	Sat Sep  6 16:18:11 2003
+++ ircd-ratbox-bgfree-p1/include/defaults.h	Tue Jan 13 14:08:47 2004
@@ -50,8 +50,8 @@
 #define TS_WARN_DELTA_MIN     10	/* min value for ts_warn_delta */
 #define TS_WARN_DELTA_DEFAULT 30	/* default for ts_warn_delta */
 /* ServerInfo default values */
-#define NETWORK_NAME_DEFAULT "EFnet"	/* default for network_name */
-#define NETWORK_DESC_DEFAULT "Eris Free Network"	/* default for network_desc */
+#define NETWORK_NAME_DEFAULT "BGFree"	/* default for network_name */
+#define NETWORK_DESC_DEFAULT "BGFree Network"	/* default for network_desc */
 /* General defaults */
 #define CLIENT_FLOOD_DEFAULT 20	/* default for client_flood */
 #define CLIENT_FLOOD_MAX     2000
diff -uNrd ircd-ratbox-1.3-1/include/modules.h ircd-ratbox-bgfree-p1/include/modules.h
--- ircd-ratbox-1.3-1/include/modules.h	Tue Jul  8 10:19:07 2003
+++ ircd-ratbox-bgfree-p1/include/modules.h	Tue Jan 13 14:17:01 2004
@@ -137,6 +137,11 @@
 extern struct Message squit_msgtab;
 extern struct Message stats_msgtab;
 extern struct Message svinfo_msgtab;
+#ifdef BGFREE
+extern struct Message svshint_msgtab;
+extern struct Message svsjoin_msgtab;
+extern struct Message svsnick_msgtab;
+#endif
 extern struct Message testline_msgtab;
 extern struct Message time_msgtab;
 extern struct Message topic_msgtab;
diff -uNrd ircd-ratbox-1.3-1/include/numeric.h ircd-ratbox-bgfree-p1/include/numeric.h
--- ircd-ratbox-1.3-1/include/numeric.h	Sun Oct 12 08:50:43 2003
+++ ircd-ratbox-bgfree-p1/include/numeric.h	Thu Jan 15 13:19:33 2004
@@ -117,6 +117,12 @@
 #define RPL_LOCALUSERS       265
 #define RPL_GLOBALUSERS      266
 
+#ifdef BGFREE
+#define RPL_IDENTUSERS       267        /* for showing id users -zer0c00l */
+#define RPL_OSIDUSERS        268	/* for showin' S admins -zer0c00l */
+#define RPL_GLIDUSERS        269	/* Gliner admins - MasterBol */
+#endif
+
 #define RPL_ACCEPTLIST	     281
 #define RPL_ENDOFACCEPT      282
 
@@ -151,6 +157,12 @@
 #define RPL_LISTEND          323
 #define RPL_CHANNELMODEIS    324
 
+#ifdef BGFREE
+#define RPL_SILENCE          325
+#define RPL_WHOISSVSHINT     326           /* identified with services -zer0c00l */
+#define RPL_OS_ID            327        /* identified as a services admin -zer0c00l */
+#endif
+
 #define RPL_CREATIONTIME     329
 
 #define RPL_NOTOPIC          331
@@ -220,6 +232,10 @@
 #define ERR_NOTOPLEVEL       413
 #define ERR_WILDTOPLEVEL     414
 
+#ifdef BGFREE
+#define ERR_SERV_NICK        415        /* error deoping service nick -zer0c00l */
+#endif
+
 #define ERR_TOOMANYMATCHES   416
 
 #define ERR_UNKNOWNCOMMAND   421
@@ -243,6 +259,10 @@
 
 #define ERR_NOTREGISTERED    451
 
+#ifdef BGFREE
+#define ERR_NOREPEATING	     452
+#endif
+
 #define ERR_ACCEPTFULL       456
 #define ERR_ACCEPTEXIST      457
 #define ERR_ACCEPTNOT        458
@@ -255,6 +275,11 @@
 #define ERR_YOUWILLBEBANNED  466
 #define ERR_KEYSET           467
 
+#ifdef BGFREE
+#define ERR_ADMINCHAN        469  // +A chan mode err
+#define ERR_OPERCHAN         470  // +O chan mode err
+#endif
+
 #define ERR_CHANNELISFULL    471
 #define ERR_UNKNOWNMODE      472
 #define ERR_INVITEONLYCHAN   473
@@ -271,7 +296,18 @@
 #define ERR_RESTRICTED       484
 #define ERR_BANNEDNICK       485
 
+#ifdef BGFREE
+#define ERR_NOCOLOR          489
+#define ERR_JOINF            490
+#endif
+
 #define ERR_NOOPERHOST       491
+
+#ifdef BGFREE
+#define ERR_NOCTCP           492
+#define ERR_NOTALK           493
+#define ERR_NOSPAM           494
+#endif
 
 #define ERR_UMODEUNKNOWNFLAG 501
 #define ERR_USERSDONTMATCH   502
diff -uNrd ircd-ratbox-1.3-1/include/patchlevel.h ircd-ratbox-bgfree-p1/include/patchlevel.h
--- ircd-ratbox-1.3-1/include/patchlevel.h	Fri Jan  9 15:05:13 2004
+++ ircd-ratbox-bgfree-p1/include/patchlevel.h	Sat Jan 17 13:18:15 2004
@@ -23,7 +23,10 @@
  *
  *  $Id: patchlevel.h,v 7.50.2.15 2004/01/09 20:05:13 androsyn Exp $
  */
-
+#ifndef BGFREE
 #ifndef PATCHLEVEL
 #define PATCHLEVEL   "ircd-ratbox-1.3-1"
+#endif
+#else
+#define PATCHLEVEL   "ircd-ratbox-BGFree-p1"
 #endif
diff -uNrd ircd-ratbox-1.3-1/include/s_conf.h ircd-ratbox-bgfree-p1/include/s_conf.h
--- ircd-ratbox-1.3-1/include/s_conf.h	Fri Dec 19 12:32:49 2003
+++ ircd-ratbox-bgfree-p1/include/s_conf.h	Tue Jan 13 14:29:57 2004
@@ -444,6 +444,11 @@
 
 extern int yylex(void);
 
+#ifdef BGFREE
+extern void add_adv_text(void *);
+extern int IsAdvQuit(char *);
+#endif
+
 extern unsigned long cidr_to_bitmask[];
 
 extern char conffilebuf[IRCD_BUFSIZE + 1];
diff -uNrd ircd-ratbox-1.3-1/include/s_misc.h ircd-ratbox-bgfree-p1/include/s_misc.h
--- ircd-ratbox-1.3-1/include/s_misc.h	Sat Jun 28 05:22:56 2003
+++ ircd-ratbox-bgfree-p1/include/s_misc.h	Tue Jan 13 14:31:29 2004
@@ -42,5 +42,11 @@
 #define _GMKv(x)  ( (x > _1TER) ? (float)(x/_1TER) : ((x > _1GIG) ? \
                (float)(x/_1GIG) : ((x > _1MEG) ? (float)(x/_1MEG) : (float)x)))
 
+#ifdef BGFREE
+/* for services' nicks -zer0c00l */
+extern long     s_check( char * szName );
+
+extern char *strip_color(const char *, int);
+#endif
 
 #endif
diff -uNrd ircd-ratbox-1.3-1/include/s_serv.h ircd-ratbox-bgfree-p1/include/s_serv.h
--- ircd-ratbox-1.3-1/include/s_serv.h	Thu Nov  6 19:00:37 2003
+++ ircd-ratbox-bgfree-p1/include/s_serv.h	Tue Jan 13 14:35:00 2004
@@ -252,6 +252,15 @@
 extern int MaxClientCount;	/* GLOBAL - highest number of clients */
 extern int MaxConnectionCount;	/* GLOBAL - highest number of connections */
 
+#ifdef BGFREE
+extern int CurrentIdentUsers;  /* Currently identified users to services -zer0c00l */
+extern int MaxIdentUsers;  /* Max identified users to services -zer0c00l */
+extern int CurrentOSidUsers; /* identified S admins -zer0c00l */
+extern int MaxOSidUsers;     /* maximum value */
+extern int CurrentGlinerUsers;     /* Gliner identified users */
+extern int MaxGlinerUsers;     /* Gliner users maximum value */
+#endif
+
 extern int refresh_user_links;
 
 /*
diff -uNrd ircd-ratbox-1.3-1/include/serno.h ircd-ratbox-bgfree-p1/include/serno.h
--- ircd-ratbox-1.3-1/include/serno.h	Fri Jan  9 15:05:14 2004
+++ ircd-ratbox-bgfree-p1/include/serno.h	Wed Jan 21 10:07:12 2004
@@ -1 +1,5 @@
+#ifndef BGFREE
 #define SERIALNUM "20040109_1"
+#else
+#define SERIALNUM "20040121_1"
+#endif
diff -uNrd ircd-ratbox-1.3-1/include/supported.h ircd-ratbox-bgfree-p1/include/supported.h
--- ircd-ratbox-1.3-1/include/supported.h	Mon Aug  4 15:35:23 2003
+++ ircd-ratbox-bgfree-p1/include/supported.h	Wed Jan 21 10:38:19 2004
@@ -55,6 +55,18 @@
         ConfigChannel.max_bans, \
         ConfigFileEntry.max_targets,NICKLEN-1,TOPICLEN,TOPICLEN
 
+#ifdef BGFREE
+#define FEATURES2 "CHANTYPES=%s" \
+                  " PREFIX=(ov)@+" \
+		  " CHANMODES=%s%sb,k,l,imnpstzqCHMAO" \
+		  " NETWORK=%s" \
+		  " CASEMAPPING=%s" \
+		  " CHARSET=ascii" \
+		  " CALLERID" \
+		  " SILENCE" \
+		  " ETRACE" \
+		  " WALLCHOPS"
+#else
 #define FEATURES2 "CHANTYPES=%s" \
                   " PREFIX=(ov)@+" \
 		  " CHANMODES=%s%sb,k,l,imnpst" \
@@ -64,6 +76,7 @@
 		  " CALLERID" \
 		  " ETRACE" \
 		  " WALLCHOPS"
+#endif /* BGFREE */
 
 #define FEATURES2VALUES ConfigServerHide.disable_local_channels ? "#" : "#&", \
                         ConfigChannel.use_except ? "e" : "", \
diff -uNrd ircd-ratbox-1.3-1/modules/Makefile.in ircd-ratbox-bgfree-p1/modules/Makefile.in
--- ircd-ratbox-1.3-1/modules/Makefile.in	Thu Nov 27 12:31:47 2003
+++ ircd-ratbox-bgfree-p1/modules/Makefile.in	Wed Jan 14 14:06:46 2004
@@ -87,6 +87,7 @@
   m_set.c \
   m_stats.c \
   m_svinfo.c \
+  @BGFREE_SRCS@
   m_tb.c \
   m_testline.c \
   m_time.c \
diff -uNrd ircd-ratbox-1.3-1/modules/core/m_kick.c ircd-ratbox-bgfree-p1/modules/core/m_kick.c
--- ircd-ratbox-1.3-1/modules/core/m_kick.c	Sun Nov  2 20:35:00 2003
+++ ircd-ratbox-bgfree-p1/modules/core/m_kick.c	Fri Jan 16 12:17:40 2004
@@ -171,6 +171,26 @@
 		return;
 	}
 
+#ifdef BGFREE
+        if (s_check(user)) {
+             sendto_one(source_p, form_str(ERR_SERV_NICK),
+                 me.name, parv[0], user);
+             return;
+        }
+	
+	if (IsOSId(who) && !IsOSId(source_p)) {
+             sendto_one(source_p, ":%s NOTICE %s : You can't kick Services Admin [%s/%s]",
+                 me.name, source_p->name,parv[2],parv[1]);
+             return;
+	}
+
+	if (dlinkFind(&who->user->nokick, chptr) != NULL) {
+             sendto_one(source_p, ":%s NOTICE %s : You can't kick someone who is on the nokick list [%s/%s]",
+                 me.name, source_p->name,parv[2],parv[1]);
+             return;
+	}
+#endif
+
 	msptr = find_channel_membership(chptr, who);
 	if(msptr != NULL)
 	{
diff -uNrd ircd-ratbox-1.3-1/modules/core/m_message.c ircd-ratbox-bgfree-p1/modules/core/m_message.c
--- ircd-ratbox-1.3-1/modules/core/m_message.c	Wed Jan  7 20:20:17 2004
+++ ircd-ratbox-bgfree-p1/modules/core/m_message.c	Thu Jan 15 14:38:14 2004
@@ -430,7 +430,50 @@
 	    struct Client *client_p, struct Client *source_p, struct Channel *chptr, const char *text)
 {
 	int result;
+#ifdef BGFREE
+	struct Channel *vchan = NULL;
+	char *chname = NULL;
+	struct ResvEntry *ptr;
+
+	chname = chptr->chname;
 
+	vchan = chptr;
+ 
+	if (find_color_ctcp(text, 1) && (vchan->mode.mode & MODE_NOCOLOR) &&
+        !(ptr = (struct ResvEntry *) get_nick_resv(source_p->name)))
+	  {
+	    sendto_one(source_p, form_str(ERR_NOCOLOR), me.name,
+        	   source_p->name, vchan->chname);
+	    return;
+        } else 
+	    if (find_color_ctcp(text, 0) && ircncmp(text, "\001ACTION", 7) && (vchan->mode.mode & MODE_NOCTCP) &&
+ 	    !((ptr = (struct ResvEntry *) get_nick_resv(source_p->name))) &&
+	    !is_chanop(find_channel_membership(vchan, source_p)) && !is_voiced(find_channel_membership(vchan, source_p))) {
+		sendto_one(source_p, form_str(ERR_NOCTCP), me.name,
+            		    source_p->name, vchan->chname);
+		return;
+	    } else 
+		if ((vchan->mode.mode & MODE_NOTALK) /* && ServicesOn */ &&
+		 (!IsNSId(source_p) /* || source_p->ns_reg + ConfigFileEntry.how_old >= time(NULL)*/)  &&
+		 !((ptr = (struct ResvEntry *) get_nick_resv(source_p->name))) &&
+		 !IsOper(source_p)) {
+			sendto_one(source_p, form_str(ERR_NOTALK), me.name,
+	        		    source_p->name, vchan->chname);
+			return;
+		 } else 
+		    if ((vchan->mode.mode & MODE_NOSPAM) && (IsAdvQuit(text))) {
+			sendto_one(source_p, form_str(ERR_NOSPAM), me.name,
+            			    source_p->name, vchan->chname);
+			return;
+		    } else 
+			if (!is_chanop(find_channel_membership(vchan, source_p)) && NoRepeatChannel(vchan) && !IsOper(source_p)) {
+			    if (check_repeat(source_p, vchan, text)) {
+				  sendto_one(source_p, form_str(ERR_NOREPEATING),
+		    				 me.name, source_p->name, vchan->chname);
+    				  return;
+			    }
+			}
+#endif /* BGFREE */
 	if(MyClient(source_p))
 	{
 		/* idle time shouldnt be reset by notices --fl */
@@ -444,6 +487,10 @@
 		if(result == CAN_SEND_OPV ||
 		   !flood_attack_channel(p_or_n, source_p, chptr, chptr->chname))
 		{
+#ifdef BGFREE
+		    if (NoColorChannel(chptr))
+        		text = strip_color(text, 0);
+#endif
 			sendto_channel_butone(client_p, source_p, chptr, command, ":%s", text);
 		}
 	}
@@ -474,12 +521,55 @@
 		  struct Client *source_p, struct Channel *chptr, int flags, const char *text)
 {
 	char c;
+	
+#ifdef BGFREE
+	struct Channel *vchan = NULL;
+	char *chname = NULL;
+	int type;
+	struct ResvEntry *ptr;
+#endif
 
 	if(flags & CHFL_VOICE)
 		c = '+';
 	else
 		c = '@';
 
+#ifdef BGFREE
+  chname = chptr->chname;
+  vchan = chptr;
+
+  if (find_color_ctcp(text, 1) && (vchan->mode.mode & MODE_NOCOLOR) &&
+      !((ptr = (struct ResvEntry *) get_nick_resv(source_p->name)) /* && !irccmp(ptr->reason, ConfigFileEntry.services_qline)*/))
+  {
+	sendto_one(source_p, form_str(ERR_NOCOLOR), me.name,
+               source_p->name, vchan->chname);
+	return;
+  } else if (find_color_ctcp(text, 0) && ircncmp(text, "\001ACTION", 7) && (vchan->mode.mode & MODE_NOCTCP) &&
+			 !((ptr = (struct ResvEntry *) get_nick_resv(source_p->name)) /*&& !irccmp(ptr->reason, ConfigFileEntry.services_qline)*/) &&
+		     !is_chanop(find_channel_membership(vchan, source_p)) && !is_voiced(find_channel_membership(vchan, source_p))) {
+	sendto_one(source_p, form_str(ERR_NOCTCP), me.name,
+               source_p->name, vchan->chname);
+	return;
+  } else if ((vchan->mode.mode & MODE_NOTALK) &&
+		     !IsNSId(source_p) &&
+		     !(ptr = (struct ResvEntry *) get_nick_resv(source_p->name)) &&
+		     !IsOper(source_p)) {
+    sendto_one(source_p, form_str(ERR_NOTALK), me.name,
+	           source_p->name, vchan->chname);
+	return;
+  } else if ((vchan->mode.mode & MODE_NOSPAM) && (IsAdvQuit(text))) {
+	sendto_one(source_p, form_str(ERR_NOSPAM), me.name,
+               source_p->name, vchan->chname);
+	return;
+  } else if (!is_chanop(find_channel_membership(vchan, source_p)) && NoRepeatChannel(vchan) && !IsOper(source_p)) {
+    if (check_repeat(source_p, vchan, text)) {
+	  sendto_one(source_p, form_str(ERR_NOREPEATING),
+		         me.name, source_p->name, vchan->chname);
+      return;
+    }
+  }
+#endif
+
 	if(MyClient(source_p))
 	{
 		/* idletime shouldnt be reset by notice --fl */
@@ -524,12 +614,31 @@
 static void
 msg_client(int p_or_n, const char *command, struct Client *source_p, struct Client *target_p, const char *text)
 {
+
+#ifdef BGFREE
+  struct ResvEntry *ptr;
+#endif
+
 	if(MyClient(source_p))
 	{
 		/* reset idle time for message if its not a notice */
 		if((p_or_n != NOTICE) && source_p->user)
 			source_p->user->last = CurrentTime;
 	}
+	
+#ifdef BGFREE
+	if (source_p->user && HasSilence(target_p) &&
+	    (target_p != source_p) && !IsOper(target_p) && !IsNSId(source_p))
+	{
+	  sendto_one(source_p, ":%s NOTICE %s :Error: %s is in silence mode and does NOT accept messages from unregistered/unidentified (too recently registered) nicknames",
+				 me.name, source_p->name, target_p->name);
+	  sendto_one(source_p, ":%s NOTICE %s :Error: If you want to send messages to %s you will have to identify or register your nickname",
+				 me.name, source_p->name, target_p->name);
+	  return;
+	} else if (source_p->user && (IsSetTransWin(target_p) || IsSetTransISO(target_p))) {
+	  text = translate(target_p, text);
+	}
+#endif
 
 	if(MyConnect(source_p) && (p_or_n != NOTICE) && target_p->user && target_p->user->away)
 		sendto_one(source_p, form_str(RPL_AWAY), me.name,
@@ -881,3 +990,63 @@
 	}
 	return (res);
 }
+
+#ifdef BGFREE
+/*
+ * finds color or ctcp depending on ctcpcolor
+ * 1 - color
+ * 0 - ctcp
+ *
+ * main procedure from UniBG's hyb6 IRCd 
+ */
+int find_color_ctcp(const char *msg, int ctcpcolor)
+{
+  const char *c = msg;
+
+  while (*c)
+  {
+	if ((ctcpcolor && (*c == '\003' || *c == '\033')) ||
+		(!ctcpcolor && (*c == '\001')))
+	  break;
+	else
+	  c++;
+  }
+
+  if (*c)
+	return 1;
+
+  return 0;
+}
+
+/* from somewhere else.. not mine.. FUIS i think - MasterBo */
+static int check_repeat(struct Client *source_p,
+                        struct Channel *chptr,
+                        const char *text)
+{
+  dlink_node *ptr;
+  struct Repeat *repeatptr;
+
+  for (ptr = source_p->user->repeat.head; ptr; ptr = ptr->next) {
+    repeatptr = ptr->data;
+	if (repeatptr->chptr == chptr)
+  	  if (!strcmp(repeatptr->text, text)) {
+    	return 1;
+  	  } else {
+    	MyFree(repeatptr->text);
+    	DupString(repeatptr->text, text);
+  	    repeatptr->lastphrase = CurrentTime;
+	    return 0;
+	  }
+    }
+
+  repeatptr = (struct Repeat *)MyMalloc(sizeof(struct Repeat));
+  repeatptr->chptr = chptr;
+  DupString(repeatptr->text, text);
+  repeatptr->lastphrase = CurrentTime;
+
+  ptr = make_dlink_node();
+  dlinkAdd(repeatptr, ptr, &source_p->user->repeat);
+
+  return 0;
+}
+#endif
\ No newline at end of file
diff -uNrd ircd-ratbox-1.3-1/modules/core/m_nick.c ircd-ratbox-bgfree-p1/modules/core/m_nick.c
--- ircd-ratbox-1.3-1/modules/core/m_nick.c	Thu Nov  6 19:00:42 2003
+++ ircd-ratbox-bgfree-p1/modules/core/m_nick.c	Fri Jan 16 11:44:46 2004
@@ -703,6 +703,17 @@
 	/* remove all accepts pointing to the client */
 	del_all_accepts(source_p);
 
+#ifdef BGFREE
+	if (IsNSId(source_p)) {
+    	    ClearNSId(source_p);
+    	    CurrentIdentUsers--;
+
+            if (CurrentIdentUsers < 0)
+                CurrentIdentUsers= 0;
+
+	}
+#endif
+
 	return 0;
 }
 
diff -uNrd ircd-ratbox-1.3-1/modules/core/m_part.c ircd-ratbox-bgfree-p1/modules/core/m_part.c
--- ircd-ratbox-1.3-1/modules/core/m_part.c	Thu Nov  6 19:00:42 2003
+++ ircd-ratbox-bgfree-p1/modules/core/m_part.c	Sat Jan 17 09:39:55 2004
@@ -165,5 +165,9 @@
 				     source_p->name,
 				     source_p->username, source_p->host, chptr->chname);
 	}
+#ifdef BGFREE
+	del_nokick_chan(source_p,name);
+#endif
+
 	remove_user_from_channel(msptr);
 }
diff -uNrd ircd-ratbox-1.3-1/modules/m_join.c ircd-ratbox-bgfree-p1/modules/m_join.c
--- ircd-ratbox-1.3-1/modules/m_join.c	Mon Nov  3 12:53:43 2003
+++ ircd-ratbox-bgfree-p1/modules/m_join.c	Thu Jan 15 14:47:49 2004
@@ -225,6 +225,14 @@
 		if(!IsOper(source_p) && !IsExemptSpambot(source_p))
 			check_spambot_warning(source_p, name);
 
+#ifdef BGFREE
+	    if ((chptr->mode.mode & MODE_JOINF) /* && ServicesOn */ && (!IsNSId(source_p)/* ||
+		    (source_p->ns_reg + ConfigFileEntry.how_old >= time(NULL))*/) && !IsOperRemote(source_p)) {
+		sendto_one(source_p, form_str(ERR_JOINF), me.name, source_p->name, chptr->chname);
+		return;
+	    }
+#endif
+
 		/* can_join checks for +i key, bans etc */
 		if((i = can_join(source_p, chptr, key)))
 		{
diff -uNrd ircd-ratbox-1.3-1/modules/m_svshint.c ircd-ratbox-bgfree-p1/modules/m_svshint.c
--- ircd-ratbox-1.3-1/modules/m_svshint.c	Wed Dec 31 19:00:00 1969
+++ ircd-ratbox-bgfree-p1/modules/m_svshint.c	Sat Jan 17 09:25:30 2004
@@ -0,0 +1,149 @@
+/************************************************************************
+ *   IRC - Internet Relay Chat, modules/m_version.c
+ *   Copyright (C) 1990 Jarkko Oikarinen and
+ *                      University of Oulu, Computing Center
+ *
+ *   See file AUTHORS in IRC package for additional names of
+ *   the programmers. 
+ *
+ *   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_svshint.c,v 1.3 2003/04/04 03:16:20 zer0c00l Exp $
+ */
+#include "stdinc.h"
+#include "handlers.h"
+#include "client.h"
+#include "common.h"     /* TRUE bleah */
+#include "irc_string.h"
+#include "ircd.h"
+#include "hash.h"
+#include "numeric.h"
+#include "send.h"
+#include "s_conf.h"
+#include "s_log.h"
+#include "s_serv.h"
+#include "msg.h"
+#include "parse.h"
+#include "modules.h"
+
+
+static void ms_svshint(struct Client*, struct Client*, int, char**);
+struct Message svshint_msgtab = {
+  "SVSHINT", 0, 1, 0, 0, 0, 0,
+  {m_unregistered, m_ignore, ms_svshint, m_ignore}
+};
+
+#ifndef STATIC_MODULES
+void
+_modinit(void)
+{
+  mod_add_cmd(&svshint_msgtab);
+}
+
+void
+_moddeinit(void)
+{
+  mod_del_cmd(&svshint_msgtab);
+}
+
+char *_version = "20031228_1";
+#endif
+/*
+ * ms_svshint - SVSHINT command handler
+ *      parv[0] = sender prefix
+ *      parv[1] = hint flags
+ *      parv[2] = nick
+ */
+static void ms_svshint(struct Client* client_p, struct Client* source_p,
+                      int parc, char* parv[])
+{
+  struct Client *victim;
+  unsigned int hint;
+
+if (parc < 4) return;
+
+victim = find_client(parv[2]);
+
+  if (!IsServer(source_p))
+        return;
+
+  if (!(victim)) 
+	return;
+
+  if (!strcasecmp(parv[1], "NSID")) {
+          
+		if (!strcasecmp(parv[3],"1"))
+		{
+				SetNSId(victim);
+                CurrentIdentUsers++;
+                
+				if (CurrentIdentUsers > MaxIdentUsers)
+                    MaxIdentUsers = CurrentIdentUsers;
+
+		} else {
+				ClearNSId(victim);
+                CurrentIdentUsers--;
+                
+				if (CurrentIdentUsers < 0)
+                    CurrentIdentUsers = 0;
+		}
+		
+	  sendto_server(client_p, NULL, NOCAPS, NOCAPS,
+                ":%s SVSHINT NSID %s %s", me.name, victim->name, parv[3]);
+	   		return;
+    }
+
+  if (!strcasecmp(parv[1], "OSID") && !IsOSId(victim)) {
+                SetOSId(victim);
+		CurrentOSidUsers++;
+
+                if (CurrentOSidUsers > MaxOSidUsers)
+                    MaxOSidUsers = CurrentOSidUsers;
+
+  sendto_server(client_p, NULL, NOCAPS, NOCAPS,
+                ":%s SVSHINT OSID %s 1", me.name, victim->name);
+                        return;
+        }
+
+  // Add nokick chan for user - MasterBo
+  if (!strcasecmp(parv[1], "NOKICK") && (parc == 5)) {
+	if (strcmp(parv[4],"1")==0)
+	    add_nokick_chan(victim,parv[3]);
+
+	else del_nokick_chan(victim,parv[3]);
+	
+	sendto_server(client_p, NULL, NOCAPS, NOCAPS,
+                  ":%s SVSHINT NOKICK %s %s %s", me.name, victim->name, parv[3], parv[4]);
+                    return;
+        }
+
+  // Gliner identified - MasterBo
+  if (!strcasecmp(parv[1],"NK"))
+  {  
+	  ilog(L_ALL,"Adding GLiner ID for %s",victim->name);
+	  SetGLId(victim);
+
+          CurrentGlinerUsers++;
+    
+   	  if (CurrentGlinerUsers > MaxGlinerUsers)
+                    MaxGlinerUsers = CurrentGlinerUsers;
+	
+	  sendto_server(client_p, NULL, NOCAPS, NOCAPS,
+                ":%s SVSHINT NK %s 1", me.name, victim->name);
+                        return;
+  }
+
+
+}
diff -uNrd ircd-ratbox-1.3-1/modules/m_svsjoin.c ircd-ratbox-bgfree-p1/modules/m_svsjoin.c
--- ircd-ratbox-1.3-1/modules/m_svsjoin.c	Wed Dec 31 19:00:00 1969
+++ ircd-ratbox-bgfree-p1/modules/m_svsjoin.c	Sat Jan 17 13:29:16 2004
@@ -0,0 +1,395 @@
+/*
+ *  ircd-ratbox: an advanced Internet Relay Chat Daemon(ircd).
+ *  m_svsjoin.c: Joins a channel via admin or service CMD.
+ *
+ *  Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
+ *  Copyright (C) 1996-2002 Hybrid Development Team
+ *  Copyright (C) 2002 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 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: m_svsjoin.c,v 1.2 2004/01/14 22:19:43 MasterBo Exp $
+ */
+
+#include "stdinc.h"
+#include "tools.h"
+#include "handlers.h"
+#include "channel.h"
+#include "channel_mode.h"
+#include "client.h"
+#include "common.h"
+#include "resv.h"
+#include "hash.h"
+#include "irc_string.h"
+#include "ircd.h"
+#include "numeric.h"
+#include "send.h"
+#include "s_serv.h"
+#include "s_conf.h"
+#include "msg.h"
+#include "parse.h"
+#include "modules.h"
+#include "sprintf_irc.h"
+#include "packet.h"
+
+static void m_svsjoin(struct Client *, struct Client *, int, char **);
+
+struct Message svsjoin_msgtab = {
+	"SVSJOIN", 0, 0, 3, 0, MFLG_SLOW, 0,
+	{m_unregistered, m_svsjoin, m_svsjoin, m_svsjoin}
+};
+
+#ifndef STATIC_MODULES
+
+void
+_modinit(void)
+{
+	mod_add_cmd(&svsjoin_msgtab);
+}
+
+void
+_moddeinit(void)
+{
+	mod_del_cmd(&svsjoin_msgtab);
+}
+const char *_version = "$Revision: 1.3 2004/01/17 $";
+
+#endif
+static void do_join_0(struct Client *client_p, struct Client *source_p);
+void check_spambot_warning(struct Client *source_p, const char *name);
+
+
+/*
+ * m_svsjoin
+ *      parv[0] = sender prefix
+ *      parv[1] = channel
+ *      parv[2] = channel password (key)
+ */
+static void
+m_svsjoin(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
+{
+	static char jbuf[BUFSIZE];
+	struct Channel *chptr = NULL;
+	struct Client * dest_p = NULL;
+	struct ResvEntry *resv;
+	char *name, *key = NULL;
+	int i, flags = 0;
+	char *p = NULL, *p2 = NULL;
+	int successful_join_count = 0;	/* Number of channels successfully joined */
+
+	if(EmptyString(parv[1]))
+	{
+		sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "SVSJOIN");
+		return;
+	}
+
+	if(EmptyString(parv[2]))
+	{
+		sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "SVSJOIN");
+		return;
+	}
+
+	if (!(dest_p=find_client(parv[1]))) {
+		sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, parv[0], parv[1]);
+		return;
+	
+	}
+
+	if (MyClient(dest_p)) {
+		sendto_realops_flags(UMODE_ALL, L_ADMIN, "Local SVSJOIN from %s for %s/%s", parv[0], parv[1], parv[2]);
+
+	*jbuf = '\0';
+
+	/* rebuild the list of channels theyre supposed to be joining.
+	 * this code has a side effect of losing keys, but..
+	 */
+	for(i = 0, name = strtoken(&p, parv[2], ","); name;
+	    name = strtoken(&p, (char *)NULL, ","))
+	{
+		/* check the length and name of channel is ok */
+		if(!check_channel_name(name) || (strlen(name) > CHANNELLEN))
+		{
+			sendto_one(source_p, form_str(ERR_BADCHANNAME),
+				   me.name, source_p->name, (unsigned char *) name);
+			continue;
+		}
+
+		if(*name == '0' && !atoi(name))
+		{
+			(void) strcpy(jbuf, "0");
+			continue;
+		}
+
+		/* check it begins with # or & */
+		else if(!IsChannelName(name) || 
+			(ConfigServerHide.disable_local_channels && (*name == '&')))
+		{
+			sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL),
+				   me.name, source_p->name, name);
+			continue;
+		}
+
+		/* see if its resv'd */
+		if(((resv = hash_find_resv(name)) != NULL) && (!IsOper(dest_p) || !ConfigChannel.no_oper_resvs))
+		{
+			sendto_one(source_p, form_str(ERR_BADCHANNAME),
+				   me.name, source_p->name, name);
+			sendto_realops_flags(UMODE_SPY, L_ALL,
+					     "User %s (%s@%s) was forced to join locally juped channel %s (%s)",
+					     dest_p->name, dest_p->username, dest_p->host,
+					     name, resv->reason);
+			continue;
+		}
+
+		if(splitmode && !IsOper(dest_p) && (*name != '&') &&
+		   ConfigChannel.no_join_on_split)
+		{
+			sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE),
+				   me.name, source_p->name, name);
+			continue;
+		}
+
+		if(*jbuf)
+			(void) strcat(jbuf, ",");
+		(void) strlcat(jbuf, name, sizeof(jbuf) - i - 1);
+		i += strlen(name)+1;
+	}
+
+	if(parc > 3)
+	{
+		key = strtoken(&p2, parv[3], ",");
+	}
+
+	for (name = strtoken(&p, jbuf, ","); name;
+	     key = (key) ? strtoken(&p2, NULL, ",") : NULL, name = strtoken(&p, NULL, ","))
+	{
+		/* JOIN 0 simply parts all channels the user is in */
+		if(*name == '0' && !atoi(name))
+		{
+	    	if (!IsServer(source_p)) {
+			  if(dest_p->user->channel.head == NULL)
+				continue;
+
+			  do_join_0(&me, dest_p);
+			}
+			else {
+		          sendto_wallops_flags(UMODE_WALLOP, &me,
+	    		    "SVSJOIN from %s for %s on channel %s REJECTED!", parv[0], parv[1], parv[2]);
+			}
+			continue;
+		}
+
+		/* look for the channel */
+		if((chptr = hash_find_channel(name)) != NULL)
+		{
+			if(IsMember(dest_p, chptr))
+				continue;
+
+			if(dlink_list_length(&chptr->members) == 0)
+				flags = CHFL_CHANOP;
+			else
+				flags = 0;
+		}
+		else
+		{
+			if(splitmode && !IsOper(dest_p) && (*name != '&') &&
+			   ConfigChannel.no_create_on_split)
+			{
+				sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE),
+					   me.name, source_p->name, name);
+				continue;
+			}
+
+			flags = CHFL_CHANOP;
+		}
+
+		if((dlink_list_length(&dest_p->user->channel) >= ConfigChannel.max_chans_per_user) &&
+		   (!IsOper(dest_p) || (dlink_list_length(&dest_p->user->channel) >=
+					  ConfigChannel.max_chans_per_user * 3)))
+		{
+			sendto_one(source_p, form_str(ERR_TOOMANYCHANNELS), me.name, parv[0], name);
+			if(successful_join_count)
+				dest_p->localClient->last_join_time = CurrentTime;
+			return;
+		}
+
+		if(flags == 0)	/* if channel doesn't exist, don't penalize */
+			successful_join_count++;
+
+		if(chptr == NULL)	/* If I already have a chptr, no point doing this */
+		{
+			chptr = get_or_create_channel(dest_p, name, NULL);
+
+			if(chptr == NULL)
+			{
+				sendto_one(source_p, form_str(ERR_UNAVAILRESOURCE), me.name, parv[0], name);
+				if(successful_join_count > 0)
+					successful_join_count--;
+				continue;
+			}
+		}
+
+
+		if(!IsOper(dest_p) && !IsExemptSpambot(dest_p))
+			check_spambot_warning(dest_p, name);
+
+		/* can_join checks for +i key, bans etc */
+		if((i = can_join(dest_p, chptr, key)))
+		{
+			sendto_one(source_p, form_str(i), me.name, parv[1], name);
+			if(successful_join_count > 0)
+				successful_join_count--;
+			continue;
+		}
+
+		/* add the user to the channel */
+		add_user_to_channel(chptr, dest_p, flags);
+
+		/* we send the user their join here, because we could have to
+		 * send a mode out next.
+		 */
+		sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s",
+				     dest_p->name,
+				     dest_p->username, dest_p->host, chptr->chname);
+
+		/* if theyre joining opped (ie, new chan or joining one thats
+		 * persisting) then set timestamp to current, set +nt and
+		 * broadcast the sjoin with its old modes, or +nt.
+		 */
+		if(flags & CHFL_CHANOP)
+		{
+			char mbuf[MODEBUFLEN];
+			char pbuf[MODEBUFLEN];
+
+			chptr->channelts = CurrentTime;
+			chptr->mode.mode |= MODE_TOPICLIMIT;
+			chptr->mode.mode |= MODE_NOPRIVMSGS;
+
+			sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +nt",
+					     me.name, chptr->chname);
+
+			if(*chptr->chname == '#')
+			{
+				channel_modes(chptr, dest_p, mbuf, pbuf);
+
+				strlcat(mbuf, " ", sizeof(mbuf));
+
+				if(pbuf[0] != '\0')
+					strlcat(mbuf, pbuf, sizeof(mbuf));
+
+				/* note: mbuf here will have a trailing space.  we add one above,
+				 * and channel_modes() will leave a trailing space on pbuf if
+				 * its used --fl
+				 */
+				sendto_server(client_p, chptr, NOCAPS, NOCAPS,
+					      ":%s SJOIN %lu %s %s:@%s",
+					      me.name, (unsigned long) chptr->channelts,
+					      chptr->chname, mbuf, parv[1]);
+			}
+
+			/* drop our +beI modes */
+			free_channel_list(&chptr->banlist);
+			free_channel_list(&chptr->exceptlist);
+			free_channel_list(&chptr->invexlist);
+
+			/* REMOVE THIS AND DIE --fl */
+			chptr->num_mask = 0;
+		}
+		else
+		{
+			sendto_server(client_p, chptr, NOCAPS, NOCAPS,
+				      ":%s SJOIN %lu %s + :%s",
+				      me.name, (unsigned long) chptr->channelts,
+				      chptr->chname, parv[1]);
+		}
+
+		del_invite(chptr, dest_p);
+
+		if(chptr->topic != NULL)
+		{
+			sendto_one(dest_p, form_str(RPL_TOPIC), me.name,
+				   parv[1], chptr->chname, chptr->topic);
+
+			if(!(chptr->mode.mode & MODE_HIDEOPS) || (flags & CHFL_CHANOP))
+			{
+				sendto_one(dest_p, form_str(RPL_TOPICWHOTIME),
+					   me.name, parv[1], chptr->chname,
+					   chptr->topic_info, chptr->topic_time);
+			}
+			else	/* Hide from nonops */
+			{
+				sendto_one(dest_p, form_str(RPL_TOPICWHOTIME),
+					   me.name, parv[1], chptr->chname,
+					   me.name, chptr->topic_time);
+			}
+		}
+
+		channel_member_names(chptr, dest_p, 1);
+
+		if(successful_join_count)
+			source_p->localClient->last_join_time = CurrentTime;
+	}
+	} else {
+	    sendto_realops_flags(UMODE_ALL, L_ADMIN,
+	     "Remote SVSJOIN from %s for %s/%s. Okay, forwarding message...", parv[0], parv[1],parv[2]);
+
+    if (parv[3] != NULL)
+	    sendto_one(dest_p->servptr,":%s SVSJOIN %s %s %s", me.name,
+	                                      parv[1], parv[2], parv[3]);
+    else sendto_one(dest_p->servptr,":%s SVSJOIN %s %s", me.name,
+	                                      parv[1], parv[2]);
+    }
+}
+
+/*
+ * do_join_0
+ *
+ * inputs	- pointer to client doing join 0
+ * output	- NONE
+ * side effects	- Use has decided to join 0. This is legacy
+ *		  from the days when channels were numbers not names. *sigh*
+ *		  There is a bunch of evilness necessary here due to
+ * 		  anti spambot code.
+ */
+
+static void
+do_join_0(struct Client *client_p, struct Client *source_p)
+{
+	struct Channel *chptr = NULL;
+	struct membership *msptr;
+	dlink_node *lp;
+
+	/* Finish the flood grace period... */
+	if(MyClient(source_p) && !IsFloodDone(source_p))
+		flood_endgrace(source_p);
+
+
+	sendto_server(client_p, NULL, NOCAPS, NOCAPS, ":%s JOIN 0", source_p->name);
+
+	if(source_p->user->channel.head && MyConnect(source_p) && 
+	   !IsOper(source_p) && !IsExemptSpambot(source_p))
+		check_spambot_warning(source_p, NULL);
+
+	while ((lp = source_p->user->channel.head))
+	{
+		msptr = lp->data;
+		chptr = msptr->chptr;
+		sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s PART %s",
+				     source_p->name,
+				     source_p->username, source_p->host, chptr->chname);
+		remove_user_from_channel(msptr);
+	}
+}
diff -uNrd ircd-ratbox-1.3-1/modules/m_svsnick.c ircd-ratbox-bgfree-p1/modules/m_svsnick.c
--- ircd-ratbox-1.3-1/modules/m_svsnick.c	Wed Dec 31 19:00:00 1969
+++ ircd-ratbox-bgfree-p1/modules/m_svsnick.c	Wed Jan 14 12:46:05 2004
@@ -0,0 +1,212 @@
+/*
+ *  ircd-ratbox: an advanced Internet Relay Chat Daemon(ircd).
+ *  m_svsnick.c: Sets a users nick to random one when the nickname is
+ *               registered and user did not identify within 30 seconds.
+ *
+ *  Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
+ *  Copyright (C) 1996-2002 Hybrid Development Team
+ *  Copyright (C) 2002 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 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: m_svsnick.c,v 1.107 2003/05/20 14:46:00 MasterBo Exp $
+ */
+
+#include "stdinc.h"
+#include "handlers.h"
+#include "client.h"
+#include "hash.h"
+#include "fdlist.h"
+#include "irc_string.h"
+#include "ircd.h"
+#include "numeric.h"
+#include "s_conf.h"
+#include "s_stats.h"
+#include "s_user.h"
+#include "hash.h"
+#include "whowas.h"
+#include "s_serv.h"
+#include "send.h"
+#include "channel.h"
+#include "s_log.h"
+#include "resv.h"
+#include "msg.h"
+#include "parse.h"
+#include "modules.h"
+#include "common.h"
+#include "packet.h"
+
+
+static void m_svsnick(struct Client *, struct Client *, int, char **);
+
+static int check_clean_nick(struct Client *, struct Client *, char *, char *, char *);
+static int clean_nick_name(char *);
+
+struct Message svsnick_msgtab = {
+	"SVSNICK", 0, 0, 3, 0, MFLG_SLOW, 0,
+	{m_ignore, m_svsnick, m_svsnick, m_svsnick}
+};
+
+#ifndef STATIC_MODULES
+void
+_modinit(void)
+{
+	mod_add_cmd(&svsnick_msgtab);
+}
+
+void
+_moddeinit(void)
+{
+	mod_del_cmd(&svsnick_msgtab);
+}
+
+const char *_version = "$Revision: 1.1 $";
+#endif
+
+/*
+ * m_svsnick()
+ *
+ *     parv[0] = sender prefix
+ *     parv[1] = target nickname
+ *     parv[2] = new nickname
+ */
+static void
+m_svsnick(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
+{
+	char nick[NICKLEN];
+	struct Client *target_p;
+	struct Client *dest_p;
+
+	if (!IsServer(source_p) && !IsAdmin(source_p)) {
+	    return;
+	}
+	
+	if(parc < 3 || BadPtr(parv[2]))
+	{
+  	  sendto_wallops_flags(UMODE_WALLOP, &me,
+	     "No nickname given via SVSNICK from %s for %s", parv[0], parv[1]);
+		return;
+	}
+
+	/* terminate nick to NICKLEN */
+	strlcpy(nick, parv[2], sizeof(nick));
+
+	/* check the nickname is ok */
+	if(!clean_nick_name(nick))
+	{
+  	  sendto_wallops_flags(UMODE_WALLOP, &me,
+	     "Bogus nickname via SVSNICK from %s for %s : %s", parv[0], parv[1], parv[2]);
+      return;
+	}
+
+	if(find_nick_resv(nick))
+	{
+  	  sendto_wallops_flags(UMODE_WALLOP, &me,
+	     "Unavailable nickname via SVSNICK from %s for %s : %s", parv[0], parv[1], parv[2]);
+		return;
+	}
+	
+	if(!(dest_p = find_client(parv[1]))) {
+  	  sendto_wallops_flags(UMODE_WALLOP, &me,
+	     "Nickname (%s) not found via SVSNICK",parv[1]);
+		return;
+	}
+	if (MyClient(dest_p)) {
+    	    ilog(L_ALL,"SVSNICK LOCAL %s %s",parv[1],parv[2]);	
+  	  sendto_wallops_flags(UMODE_WALLOP, &me,
+	     "SVSNICK [ %s ] -> [ %s ] by %s",parv[1],parv[2],parv[0]);
+
+	    change_local_nick(&me, dest_p, nick);
+	    }
+	else {
+    	    ilog(L_ALL,"SVSNICK REMOTE %s %s",parv[1],parv[2]);	
+  	  sendto_wallops_flags(UMODE_WALLOP, &me,
+	     "SVSNICK [ %s ] -> [ %s ] by %s",parv[1],parv[2],parv[0]);
+	    sendto_one(dest_p->servptr,":%s SVSNICK %s %s", me.name,
+	                                      parv[1], nick);
+	}
+}
+/* 
+ * check_clean_nick()
+ * 
+ * input	- pointer to source
+ *		- nickname
+ *		- truncated nickname
+ *		- origin of client
+ * output	- none
+ * side effects - if nickname is erroneous, or a different length to
+ *                truncated nickname, return 1
+ */
+static int
+check_clean_nick(struct Client *client_p, struct Client *source_p,
+		 char *nick, char *newnick, char *server)
+{
+	/* the old code did some wacky stuff here, if the nick is invalid, kill it
+	 * and dont bother messing at all
+	 */
+
+	/*
+	 * Zero length nicks are bad too..this shouldn't happen but..
+	 */
+
+	if(!clean_nick_name(nick) || strcmp(nick, newnick) || nick[0] == '\0')
+	{
+		ServerStats->is_kill++;
+		sendto_realops_flags(UMODE_DEBUG, L_ALL,
+				     "Bad Nick: %s From: %s(via %s)", nick, server, client_p->name);
+
+		sendto_one(client_p, ":%s KILL %s :%s (Bad Nickname)", me.name, newnick, me.name);
+
+		/* bad nick change */
+		if(source_p != client_p)
+		{
+			kill_client_serv_butone(client_p, source_p, "%s (Bad Nickname)", me.name);
+			source_p->flags |= FLAGS_KILLED;
+			exit_client(client_p, source_p, &me, "Bad Nickname");
+		}
+
+		return 1;
+	}
+
+	return 0;
+}
+
+/* clean_nick_name()
+ *
+ * input	- nickname
+ * output	- none
+ * side effects - walks through the nickname, returning 0 if erroneous
+ */
+static int
+clean_nick_name(char *nick)
+{
+	assert(nick);
+	if(nick == NULL)
+		return 0;
+
+	/* nicks cant start with a digit or -, and must have a length */
+	if(*nick == '-' || IsDigit(*nick) || !*nick)
+		return 0;
+
+	for (; *nick; nick++)
+	{
+		if(!IsNickChar(*nick))
+			return 0;
+	}
+
+	return 1;
+}
+
diff -uNrd ircd-ratbox-1.3-1/modules/m_svspart.c ircd-ratbox-bgfree-p1/modules/m_svspart.c
--- ircd-ratbox-1.3-1/modules/m_svspart.c	Wed Dec 31 19:00:00 1969
+++ ircd-ratbox-bgfree-p1/modules/m_svspart.c	Sat Jan 17 13:23:44 2004
@@ -0,0 +1,195 @@
+/*
+ *  ircd-ratbox: an advanced Internet Relay Chat Daemon(ircd).
+ *  m_part.c: Parts a user from a channel.
+ *
+ *  Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
+ *  Copyright (C) 1996-2002 Hybrid Development Team
+ *  Copyright (C) 2002 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 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: m_svspart.c,v 1.80.2.3 2004/01/17 15:44:42 MasterBo Exp $
+ */
+
+#include "stdinc.h"
+#include "tools.h"
+#include "handlers.h"
+#include "channel.h"
+#include "channel_mode.h"
+#include "client.h"
+#include "common.h"
+#include "hash.h"
+#include "irc_string.h"
+#include "ircd.h"
+#include "numeric.h"
+#include "send.h"
+#include "s_serv.h"
+#include "msg.h"
+#include "parse.h"
+#include "modules.h"
+#include "s_conf.h"
+#include "packet.h"
+
+static void m_svspart(struct Client *, struct Client *, int, char **);
+void check_spambot_warning(struct Client *source_p, const char *name);
+
+struct Message svspart_msgtab = {
+	"SVSPART", 0, 0, 3, 0, MFLG_SLOW, 0,
+	{m_unregistered, m_svspart, m_svspart, m_svspart}
+};
+
+#ifndef STATIC_MODULES
+void
+_modinit(void)
+{
+	mod_add_cmd(&svspart_msgtab);
+}
+
+void
+_moddeinit(void)
+{
+	mod_del_cmd(&svspart_msgtab);
+}
+const char *_version = "$Revision: 1.1.7 $";
+#endif
+
+static void part_one_client(struct Client *client_p,
+			    struct Client *source_p, char *name, char *reason);
+
+
+/*
+** m_svspart
+**      parv[0] = sender prefix
+**      parv[1] = channel
+**      parv[2] = reason
+*/
+static void
+m_svspart(struct Client *client_p, struct Client *source_p, int parc, char *parv[])
+{
+	char *p, *name;
+	char reason[TOPICLEN + 1];
+	struct Client * dest_p = NULL;
+
+	if(EmptyString(parv[1]) || EmptyString(parv[2]))
+	{
+		sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, parv[0], "SVSPART");
+		return;
+	}
+	if (!IsServer(source_p) && !IsAdmin(source_p))
+	{
+		sendto_realops_flags(UMODE_ALL, L_ADMIN,
+					     "DENIED ACCESS to SVSPART for %s !", source_p->name);
+		ilog(L_ALL,"DENIED ACCESS to SVSPART for %s !", source_p->name);
+		return;
+	}
+	if (!(dest_p = find_person(parv[1])))
+	{
+		sendto_one(source_p, form_str(ERR_NOSUCHNICK), me.name, parv[0], parv[1]);
+		return;
+	}
+
+	if (!MyClient(dest_p))
+	{
+		sendto_realops_flags(UMODE_ALL, L_ADMIN,"Forwarding SVSPART from %s for %s/%s",parv[0],parv[1],parv[2]);
+		ilog(L_ALL,"Forwarding SVSPART from %s for %s/%s",parv[0],parv[1],parv[2]);
+		sendto_one(dest_p->servptr,":%s SVSPART %s %s %s", parv[0],
+	                                      parv[1], parv[2], (parv[3]) ? parv[3] : NULL);
+		return;
+	} else {
+		sendto_realops_flags(UMODE_ALL, L_ADMIN,"Received SVSPART from %s for %s/%s",parv[0],parv[1],parv[2]);
+		ilog(L_ALL,"Received SVSPART from %s for %s/%s",parv[0],parv[1],parv[2]);
+	}
+
+	reason[0] = '\0';
+
+	if(parc > 3)
+		strlcpy(reason, parv[3], sizeof(reason));
+
+	name = strtoken(&p, parv[2], ",");
+
+	/* Finish the flood grace period... */
+	if(MyClient(dest_p) && !IsFloodDone(dest_p))
+		flood_endgrace(dest_p);
+
+	while (name)
+	{
+		part_one_client(client_p, dest_p, name, reason);
+		name = strtoken(&p, (char *) NULL, ",");
+	}
+	return;
+}
+
+/*
+ * part_one_client
+ *
+ * inputs	- pointer to server
+ * 		- pointer to source client to remove
+ *		- char pointer of name of channel to remove from
+ * output	- none
+ * side effects	- remove ONE client given the channel name 
+ */
+static void
+part_one_client(struct Client *client_p, struct Client *source_p, char *name, char *reason)
+{
+	struct Channel *chptr;
+	struct membership *msptr;
+
+	if((chptr = hash_find_channel(name)) == NULL)
+	{
+		sendto_one(source_p, form_str(ERR_NOSUCHCHANNEL), me.name, source_p->name, name);
+		return;
+	}
+
+	msptr = find_channel_membership(chptr, source_p);
+	if(msptr == NULL)
+	{
+		sendto_one(source_p, form_str(ERR_NOTONCHANNEL), me.name, source_p->name, name);
+		return;
+	}
+	if(MyConnect(source_p) && !IsOper(source_p) && 
+	   !IsExemptSpambot(source_p))
+		check_spambot_warning(source_p, NULL);
+
+	/*
+	 *  Remove user from the old channel (if any)
+	 *  only allow /part reasons in -m chans
+	 */
+	if(reason[0] && (is_chanop(msptr) || !MyConnect(source_p) ||
+			 ((can_send(chptr, source_p, msptr) > 0 &&
+			   (source_p->firsttime + ConfigFileEntry.anti_spam_exit_message_time)
+			   < CurrentTime))))
+	{
+		sendto_server(client_p, chptr, NOCAPS, NOCAPS,
+			      ":%s PART %s :%s", source_p->name, chptr->chname, reason);
+
+		sendto_channel_local(ALL_MEMBERS,
+				     chptr, ":%s!%s@%s PART %s :%s",
+				     source_p->name,
+				     source_p->username, source_p->host, chptr->chname, reason);
+	}
+	else
+	{
+		sendto_server(client_p, chptr, NOCAPS, NOCAPS,
+			      ":%s PART %s", source_p->name, chptr->chname);
+
+		sendto_channel_local(ALL_MEMBERS,
+				     chptr, ":%s!%s@%s PART %s",
+				     source_p->name,
+				     source_p->username, source_p->host, chptr->chname);
+	}
+	del_nokick_chan(source_p,name);
+	remove_user_from_channel(msptr);
+}
diff -uNrd ircd-ratbox-1.3-1/modules/m_whois.c ircd-ratbox-bgfree-p1/modules/m_whois.c
--- ircd-ratbox-1.3-1/modules/m_whois.c	Fri Nov 28 10:14:51 2003
+++ ircd-ratbox-bgfree-p1/modules/m_whois.c	Wed Jan 21 10:06:34 2004
@@ -282,6 +282,50 @@
 		   target_p->username, target_p->host, target_p->info);
 	server_name = (char *) target_p->user->server;
 
+#ifdef BGFREE
+	if (IsNSId(target_p)) {
+		sendto_one(source_p, form_str(RPL_WHOISSERVER),
+			   me.name, source_p->name, target_p->name,
+			   "NickServ","Nickname identified!");
+	}
+
+    if (IsOSId(target_p)) {
+		sendto_one(source_p, form_str(RPL_WHOISSERVER),
+ 	    me.name, source_p->name, target_p->name,
+			   "BGFree.Services","Identified as an Administrator!");
+	}
+
+    if (IsGLId(target_p)) {
+		sendto_one(source_p, form_str(RPL_WHOISSERVER),
+ 	    me.name, source_p->name, target_p->name,
+			   "GLiner","Identified as a NetKeeper!");
+	}
+
+	if (HasSilence(target_p)) {
+		sendto_one(source_p, form_str(RPL_WHOISSERVER),
+			   me.name, source_p->name, target_p->name,
+			   "Silcence","The User is in silence mode (only registered nicknames)!");
+	}
+	
+	if (target_p->umodes & UMODE_CALLERID) {
+		sendto_one(source_p, form_str(RPL_WHOISSERVER),
+ 	    me.name, source_p->name, target_p->name,
+			   "CallerID","The User is in caller id mode!");
+	}
+
+	if (s_check(target_p->name)) {
+		sendto_one(source_p, form_str(RPL_WHOISSERVER),
+			   me.name, source_p->name, target_p->name,
+			   "NickServ","Nickname identified!");
+/*	    sendto_one(source_p,form_str(RPL_WHOISCHANNELS), me.name, 
+		    source_p->name, target_p->name, "The Channel list is hidden"); */
+
+		ircsprintf(buf, form_str(RPL_WHOISCHANNELS), me.name, source_p->name, target_p->name);
+		sendto_one(source_p, "%s%s", buf, "The Channel list is hidden");
+
+	} else {
+#endif /* BGFREE */
+
 	cur_len = mlen = ircsprintf(buf, form_str(RPL_WHOISCHANNELS), me.name, source_p->name, target_p->name);
 	t = buf + mlen;
 
@@ -311,6 +355,9 @@
 
 	if(cur_len > mlen)
 		sendto_one(source_p, "%s", buf);
+#ifdef BGFREE
+    }
+#endif
 
 	if((IsOper(source_p) || !ConfigServerHide.hide_servers) || target_p == source_p)
 		sendto_one(source_p, form_str(RPL_WHOISSERVER),
diff -uNrd ircd-ratbox-1.3-1/src/channel.c ircd-ratbox-bgfree-p1/src/channel.c
--- ircd-ratbox-1.3-1/src/channel.c	Fri Sep  5 20:03:09 2003
+++ ircd-ratbox-bgfree-p1/src/channel.c	Tue Jan 13 14:46:41 2004
@@ -800,6 +800,26 @@
 	   dlink_list_length(&chptr->members) >= chptr->mode.limit)
 		return (ERR_CHANNELISFULL);
 
+#ifdef BGFREE
+	/* +A +O modes check - MasterBo */
+
+	if (chptr->mode.mode & MODE_ADMONLY)
+	{
+		if (!IsAdmin(source_p))
+		{
+			return (ERR_ADMINCHAN);
+		}
+	}
+
+	if (chptr->mode.mode & MODE_OPRONLY)
+	{
+		if (!IsOper(source_p))
+		{
+			return (ERR_OPERCHAN);
+		}
+	}
+#endif
+
 	return 0;
 }
 
diff -uNrd ircd-ratbox-1.3-1/src/channel_mode.c ircd-ratbox-bgfree-p1/src/channel_mode.c
--- ircd-ratbox-1.3-1/src/channel_mode.c	Thu Nov  6 19:00:44 2003
+++ ircd-ratbox-bgfree-p1/src/channel_mode.c	Tue Jan 13 15:03:44 2004
@@ -333,6 +333,29 @@
 	if(chptr->mode.mode & MODE_NOPRIVMSGS)
 		*mbuf++ = 'n';
 
+#ifdef BGFREE
+	if (chptr->mode.mode & MODE_NOCOLOR)
+    		*mbuf++ = 'c';
+        
+	// from ircd fuis
+	if (chptr->mode.mode & MODE_NOTALK)
+		*mbuf++ = 'M';
+	if (chptr->mode.mode & MODE_NOSPAM)
+		*mbuf++ = 'H';
+	if (chptr->mode.mode & MODE_NOREPEAT)
+		*mbuf++ = 'z';
+	if (chptr->mode.mode & MODE_NOCTCP)
+		*mbuf++ = 'C';
+	if (chptr->mode.mode & MODE_JOINF)
+		*mbuf++ = 'q';
+
+	// +A +O modes - MasterBo
+	if (chptr->mode.mode & MODE_ADMONLY)
+		*mbuf++ = 'A';
+	if (chptr->mode.mode & MODE_OPRONLY)
+		*mbuf++ = 'O';
+#endif /* BGFREE */
+
 	if(chptr->mode.limit)
 	{
 		*mbuf++ = 'l';
@@ -1043,6 +1066,16 @@
 		return;
 	}
 
+#ifdef BGFREE
+	/* added for protecting services' nicks -zer0c00l */
+	if ((dir == MODE_DEL) && s_check(opnick))
+	{
+        sendto_one(source_p, form_str(ERR_SERV_NICK),
+                 me.name, source_p->name, opnick);
+             return;
+	}
+#endif
+
 	if(MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
 		return;
 
@@ -1275,21 +1308,41 @@
 static struct ChannelMode ModeTable[255] =
 {
   {chm_nosuch, NULL},
+#ifdef BGFREE
+  {chm_simple, (void *) MODE_ADMONLY},            /* A */ // IRC Admins only - MasterBo
+#else
   {chm_nosuch, NULL},                             /* A */
+#endif
   {chm_nosuch, NULL},                             /* B */
+#ifdef BGFREE
+  {chm_simple, (void *) MODE_NOCTCP},             /* C */
+#else
   {chm_nosuch, NULL},                             /* C */
+#endif
   {chm_nosuch, NULL},                             /* D */
   {chm_nosuch, NULL},                             /* E */
   {chm_nosuch, NULL},                             /* F */
   {chm_nosuch, NULL},                             /* G */
+#ifdef BGFREE
+  {chm_simple, (void *) MODE_NOSPAM},             /* H */
+#else
   {chm_nosuch, NULL},                             /* H */
+#endif
   {chm_invex, NULL},                              /* I */
   {chm_nosuch, NULL},                             /* J */
   {chm_nosuch, NULL},                             /* K */
   {chm_nosuch, NULL},                             /* L */
+#ifdef BGFREE
+  {chm_simple, (void *) MODE_NOTALK},             /* M */
+#else
   {chm_nosuch, NULL},                             /* M */
+#endif
   {chm_nosuch, NULL},                             /* N */
+#ifdef BGFREE
+  {chm_simple, (void *) MODE_OPRONLY},            /* O */  // IRC Operators only - MasterBo
+#else
   {chm_nosuch, NULL},                             /* O */
+#endif
   {chm_nosuch, NULL},                             /* P */
   {chm_nosuch, NULL},                             /* Q */
   {chm_nosuch, NULL},                             /* R */
@@ -1309,7 +1362,11 @@
   {chm_nosuch, NULL},
   {chm_nosuch, NULL},				  /* a */
   {chm_ban, NULL},                                /* b */
+#ifdef BGFREE
+  {chm_simple, (void *) MODE_NOCOLOR},            /* c */
+#else
   {chm_nosuch, NULL},                             /* c */
+#endif
   {chm_nosuch, NULL},                             /* d */
   {chm_except, NULL},                             /* e */
   {chm_nosuch, NULL},                             /* f */
@@ -1323,7 +1380,11 @@
   {chm_simple, (void *) MODE_NOPRIVMSGS},         /* n */
   {chm_op, NULL},                                 /* o */
   {chm_simple, (void *) MODE_PRIVATE},            /* p */
+#ifdef BGFREE
+  {chm_simple, (void *) MODE_JOINF},              /* q */
+#else
   {chm_nosuch, NULL},                             /* q */
+#endif
   {chm_nosuch, NULL},                             /* r */
   {chm_simple, (void *) MODE_SECRET},             /* s */
   {chm_simple, (void *) MODE_TOPICLIMIT},         /* t */
@@ -1332,7 +1393,11 @@
   {chm_nosuch, NULL},                             /* w */
   {chm_nosuch, NULL},                             /* x */
   {chm_nosuch, NULL},                             /* y */
+#ifdef BGFREE
+  {chm_simple, (void *) MODE_NOREPEAT},           /* z */
+#else
   {chm_nosuch, NULL},                             /* z */
+#endif
 };
 /* *INDENT-ON* */
 
diff -uNrd ircd-ratbox-1.3-1/src/client.c ircd-ratbox-bgfree-p1/src/client.c
--- ircd-ratbox-1.3-1/src/client.c	Thu Nov 27 15:20:14 2003
+++ ircd-ratbox-bgfree-p1/src/client.c	Sat Jan 17 12:46:54 2004
@@ -57,6 +57,10 @@
 #include "balloc.h"
 #include "listener.h"
 
+#ifdef BGFREE
+#define SERVICESHOST	"BGFree.Services"
+#define GLINERHOST	"Gliner.BgFree.net"
+#endif
 
 static void check_pings_list(dlink_list * list);
 static void check_unknowns_list(dlink_list * list);
@@ -848,6 +852,30 @@
 			--Count.oper;
 		if(IsInvisible(client_p))
 			--Count.invisi;
+
+#ifdef BGFREE
+		if (IsNSId(client_p)) {
+		    CurrentIdentUsers--;
+			if (CurrentIdentUsers < 0) {
+				CurrentIdentUsers = 0;
+		    }
+		}
+
+		if (IsGLId(client_p)) {
+		    CurrentGlinerUsers--;
+			if (CurrentGlinerUsers < 0) {
+				CurrentGlinerUsers = 0;
+            }
+		}
+
+		if (IsOSId(client_p)) {
+		    CurrentOSidUsers--;
+			if (CurrentOSidUsers < 0) {
+				CurrentOSidUsers = 0;
+            }
+        }
+#endif
+
 	}
 
 	if(splitchecking && !splitmode)
@@ -1147,6 +1175,41 @@
 		   (source_p->flags & FLAGS_KILLED) == 0)
 			sendto_one(target_p, ":%s SQUIT %s :%s", from->name, source_p->name,
 				   comment);
+
+#ifdef BGFREE
+		if (!strcasecmp(GLINERHOST, source_p->name)) {
+			dlink_node *gptr;
+
+		    CurrentGlinerUsers = 0;
+			for (gptr = global_client_list.head; gptr; gptr = gptr->next) {
+				target_p = gptr->data;
+                if (IsServer(target_p) || IsMe(target_p))
+					    continue;
+				if (IsGLId(target_p)) {
+					   ClearGLId(target_p);
+			    }
+			}
+		}
+
+		if (!strcasecmp(SERVICESHOST, source_p->name)) {
+            dlink_node *ptr;
+	
+            CurrentIdentUsers = 0;
+            CurrentOSidUsers = 0;
+            for (ptr = global_client_list.head; ptr; ptr = ptr->next) {
+				target_p = ptr->data;
+                if (IsServer(target_p) || IsMe(target_p))
+					    continue;
+				if (IsNSId(target_p)) {
+                   ClearNSId(target_p);
+			    }
+                if (IsOSId(target_p)) {
+                   ClearOSId(target_p);
+			    }
+             } 
+        }
+#endif /* BGFREE */
+
 	}
 	else if(IsPerson(source_p))	/* ...just clean all others with QUIT... */
 	{
@@ -1854,6 +1917,15 @@
 
 	del_all_accepts(source_p);
 
+#ifdef BGFREE
+	if (IsNSId(source_p)) {
+        CurrentIdentUsers--;
+        if (CurrentIdentUsers < 0)
+                CurrentIdentUsers = 0;
+	    ClearNSId(source_p);
+	}
+#endif
+
 	/* fd_desc is long enough */
 	fd_note(client_p->localClient->fd, "Nick: %s", nick);
 
@@ -2078,3 +2150,78 @@
 		BlockHeapFree(user_heap, user);
 	}
 }
+
+#ifdef BGFREE
+/* from Bulgaria.Net ircd i think - MasterBo */
+
+static char cyr2lat[] = {
+  'A', 'B', 'V', 'G', 'D', 'E', 'Z', 'Z', 'I', 'J', 'K', 'L', 'M', 'N',
+  'O', 'P', 'R', 'S', 'T', 'U', 'F', 'H', 'C', '4', '6', '@', 'Y', '#',
+  'J', '#', 'U', 'Q',
+  'a', 'b', 'v', 'g', 'd', 'e', 'z', 'z', 'i', 'j', 'k', 'l', 'm', 'n',
+  'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'c', '4', '6', '@', 'y', '#',
+  'j', '#', 'u', 'q'
+};
+
+/*
+ * this will transpose cyrillic characters
+ * into their latin phonetic counterparts
+ *
+ *                                -demond
+ */
+char *translate(struct Client *client_p, char *buf)
+{
+  unsigned char *p = buf;
+  int offset;
+
+  if (IsSetTransWin(client_p))
+    offset = 192;
+  else if (IsSetTransISO(client_p))
+    offset = 176;
+  else
+    return buf;
+
+  while (*p)
+  {
+	if ((*p >= offset) && (*p < offset + 2*32))
+  	  *p = cyr2lat[*p - offset];
+    ++p;
+  }
+
+  return buf;
+}
+
+/* Add, del and clear channels form clients nokick list - MasterBo */
+void add_nokick_chan(struct Client * cptr, char * chan) {
+       dlink_node *nchptr;
+       struct Channel * chptr;
+	ilog(L_ALL,"Added %s to %s nokick",cptr->name,chan);
+       chptr = hash_find_channel(chan);
+       if (!chptr) return;
+       if ((nchptr = dlinkFind(&cptr->user->nokick, chptr)) == NULL)
+		dlinkAddAlloc(chptr, &cptr->user->nokick);
+
+}
+
+void del_nokick_chan(struct Client * cptr, char * chan) {
+       dlink_node *nchptr;
+       struct Channel * chptr;
+	ilog(L_ALL,"Deleted %s to %s nokick",cptr->name,chan);
+       chptr = hash_find_channel(chan);
+       if (!chptr) return;
+       if (nchptr = dlinkFind(&cptr->user->nokick, chptr))
+	    dlinkDestroy(nchptr, &cptr->user->nokick);
+
+}
+
+void clear_nokick_list(struct Client * cptr)  {
+       dlink_node *nchptr;
+       struct Channel * chptr;
+	
+		DLINK_FOREACH(nchptr,cptr->user->nokick.head)
+	    {
+			dlinkDestroy(nchptr, &cptr->user->nokick);
+		}
+		ilog(L_DEBUG,"Nokick list for %s cleared!",cptr->name);
+}
+#endif
diff -uNrd ircd-ratbox-1.3-1/src/messages.tab ircd-ratbox-bgfree-p1/src/messages.tab
--- ircd-ratbox-1.3-1/src/messages.tab	Thu Nov 20 14:44:39 2003
+++ ircd-ratbox-bgfree-p1/src/messages.tab	Wed Jan 21 10:39:16 2004
@@ -24,7 +24,11 @@
 /* 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",
+#ifdef BGFREE
+/* 004  RPL_MYINFO, */ ":%s 004 %s %s %s oiwszcerkfydnxbauglSTYZ biklmnopstveIqzCHMOA bkloveI",
+#else
 /* 004  RPL_MYINFO, */ ":%s 004 %s %s %s oiwszcerkfydnxbauglZ biklmnopstveI bkloveI",
+#endif
 /* 005  RPL_ISUPPORT, */ ":%s 005 %s %s :are supported by this server",
 /* 006 */       NULL,
 /* 007 */       NULL,
@@ -291,9 +295,15 @@
 /* 264 */       NULL,
 /* 265 RPL_LOCALUSERS, */       ":%s 265 %s :Current local  users: %d  Max: %d",
 /* 266 RPL_GLOBALUSERS, */      ":%s 266 %s :Current global users: %d  Max: %d",
+#ifdef BGFREE
+/* 267 RPL_IDENTUSERS, */       ":%s 267 %s :Current identified users: %d  Max: %d",
+/* 268 RPL_OSIDUSERS, */        ":%s 268 %s :Current services admins: %d  Max: %d",
+/* 269 RPL_GLIDUSERS, */        ":%s 269 %s :Current Gliner admins: %d  Max: %d",
+#else
 /* 267 */       NULL,
 /* 268 */       NULL,
 /* 269 */       NULL,
+#endif
 /* 270 */       NULL,
 /* 271 */       NULL,
 /* 272 */       NULL,
@@ -349,9 +359,15 @@
 /* 322 RPL_LIST, */             ":%s 322 %s %s %d :%s",
 /* 323 RPL_LISTEND, */          ":%s 323 %s :End of /LIST",
 /* 324 RPL_CHANNELMODEIS, */    ":%s 324 %s %s %s %s",
+#ifdef BGFREE
+/* 325 RPL_SILENCE */           ":%s 325 %s %s :is in silence mode (only registered nicknames)",
+/* 326 RPL_WHOISSVSHINT, */     ":%s 326 %s %s :has identified for: this nick",
+/* 327 RPL_OS_ID, */            ":%s 327 %s %s :is a Services Admin",
+#else
 /* 325 */       NULL,
 /* 326 */       NULL,
 /* 327 */       NULL,
+#endif
 /* 328 */       NULL,
 /* 329 RPL_CREATIONTIME, */      ":%s 329 %s %s %lu", 
 /* 330 */       NULL,
@@ -439,7 +455,11 @@
 /* 412 ERR_NOTEXTTOSEND, */     ":%s 412 %s :No text to send",
 /* 413 ERR_NOTOPLEVEL, */       ":%s 413 %s %s :No toplevel domain specified",
 /* 414 ERR_WILDTOPLEVEL, */     ":%s 414 %s %s :Wildcard in toplevel Domain",
+#ifdef BGFREE
+/* 415 ERR_SERV_NICK, */        ":%s 415 %s %s :- You can not kick/deop services",
+#else
 /* 415 */       NULL,
+#endif
 /* 416 ERR_TOOMANYMATCHES */    ":%s 416 %s %s :output too large, truncated",
 /* 417 */       NULL,
 /* 418 */       NULL,
@@ -477,7 +497,11 @@
 /* 449 */       NULL,
 /* 450 */       NULL,
 /* 451 ERR_NOTREGISTERED, */    ":%s 451 %s :You have not registered",
+#ifdef BGFREE
+/* 452 ERR_NOREPEATING, */      ":%s 452 %s %s :No repeating allowed (+z)",
+#else
 /* 452 */       NULL,
+#endif
 /* 453 */       NULL,
 /* 454 */       NULL,
 /* 455 */       NULL,
@@ -494,8 +518,13 @@
 /* 466 ERR_YOUWILLBEBANNED, */  NULL,
 /* 467 ERR_KEYSET, */           ":%s 467 %s %s :Channel key already set",
 /* 468 */       NULL,
+#ifdef BGFREE
+/* 469 */			":%s 469 %s %s :Cannot join channel (+A). IRC Server Admins only!",
+/* 470 */       		":%s 470 %s %s :Cannot join channel (+O). IRC Operators only!",
+#else
 /* 469 */       NULL,
 /* 470 */       NULL,
+#endif
 /* 471 ERR_CHANNELISFULL, */    ":%s 471 %s %s :Cannot join channel (+l)",
 /* 472 ERR_UNKNOWNMODE  , */    ":%s 472 %s %c :is unknown mode char to me",
 /* 473 ERR_INVITEONLYCHAN, */   ":%s 473 %s %s :Cannot join channel (+i)",
@@ -516,12 +545,23 @@
 /* 486 */       NULL,
 /* 487 */       NULL,
 /* 488 */       NULL,
+#ifdef BGFREE
+/* 489 ERR_NOCOLOR, */ ":%s 489 %s %s :Colors are forbidden on this channel!",
+/* 490 ERR_JOINF, */   ":%s 490 %s %s :Can't join the channel, because your nick is either not regged or too young!",
+#else
 /* 489 */       NULL,
 /* 490 */       NULL,
+#endif
 /* 491 ERR_NOOPERHOST, */       ":%s 491 %s :Only few of mere mortals may try to enter the twilight zone",
+#ifdef BGFREE
+/* 492 ERR_NOCTCP, */           ":%s 492 %s %s :CTCP messages from non +v/+o/+h are forbidden!",
+/* 493 ERR_NOTALK, */           ":%s 493 %s %s :You can't talk on this channel, while your nickname is not regged ot regged too recently!",
+/* 494 ERR_NOSPAM, */           ":%s 494 %s %s :You can't send this to the channel, while it contains a spam phrase, if you think it's not contact the admin (/ADMIN)",
+#else
 /* 492 */       NULL,
 /* 493 */       NULL,
 /* 494 */       NULL,
+#endif
 /* 495 */       NULL,
 /* 496 */       NULL,
 /* 497 */       NULL,
diff -uNrd ircd-ratbox-1.3-1/src/modules.c ircd-ratbox-bgfree-p1/src/modules.c
--- ircd-ratbox-1.3-1/src/modules.c	Thu Jun 26 10:03:16 2003
+++ ircd-ratbox-bgfree-p1/src/modules.c	Tue Jan 13 15:42:15 2004
@@ -590,6 +590,9 @@
 	mod_add_cmd(&squit_msgtab);
 	mod_add_cmd(&stats_msgtab);
 	mod_add_cmd(&svinfo_msgtab);
+#ifdef BGFREE
+	mod_add_cmd(&svshint_msgtab);
+#endif
 	mod_add_cmd(&testline_msgtab);
 	mod_add_cmd(&time_msgtab);
 	mod_add_cmd(&topic_msgtab);
diff -uNrd ircd-ratbox-1.3-1/src/newconf.c ircd-ratbox-bgfree-p1/src/newconf.c
--- ircd-ratbox-1.3-1/src/newconf.c	Fri Dec 19 12:33:03 2003
+++ ircd-ratbox-bgfree-p1/src/newconf.c	Tue Jan 13 15:45:16 2004
@@ -3069,6 +3069,11 @@
 	add_top_conf("exempt", conf_begin_exempt, conf_end_exempt);
 	add_conf_item("exempt", "ip", CF_QSTRING, conf_set_exempt_ip);
 
+#ifdef BGFREE
+	add_top_conf("spamcheck", NULL, NULL);
+	add_conf_item("spamcheck", "adv_text", CF_QSTRING, add_adv_text);
+#endif
+
 	add_top_conf("gecos", conf_begin_gecos, conf_end_gecos);
 	add_conf_item("gecos", "name", CF_QSTRING, conf_set_gecos_name);
 	add_conf_item("gecos", "reason", CF_QSTRING, conf_set_gecos_reason);
diff -uNrd ircd-ratbox-1.3-1/src/s_conf.c ircd-ratbox-bgfree-p1/src/s_conf.c
--- ircd-ratbox-1.3-1/src/s_conf.c	Fri Dec 19 12:33:03 2003
+++ ircd-ratbox-bgfree-p1/src/s_conf.c	Sat Jan 17 12:47:19 2004
@@ -117,6 +117,17 @@
 /* conf uline link list root */
 struct ConfItem *u_conf = ((struct ConfItem *) NULL);
 
+#ifdef BGFREE
+struct DCCForb {
+  char *fileext;
+  struct DCCForb *next;
+};
+
+// static struct DCCForb *dccforb = NULL;
+
+static struct DCCForb *quitcheck = NULL;
+#endif
+
 /*
  * conf_dns_callback
  * inputs	- pointer to struct ConfItem
@@ -2575,3 +2586,27 @@
 	return (0);
 }
 
+#ifdef BGFREE
+void add_adv_text(void *data)
+{
+  struct DCCForb *fileextf;
+  char * param = data;
+  if (!param[0]) return;
+
+  fileextf = (struct DCCForb*) MyMalloc(sizeof(struct DCCForb));
+  DupString(fileextf->fileext, param);
+  fileextf->next = quitcheck;
+  quitcheck = fileextf;
+}
+
+int IsAdvQuit(char *file)
+{
+  struct DCCForb *fileextf;
+
+  for (fileextf = quitcheck; fileextf; fileextf = fileextf->next)
+    if (match(fileextf->fileext, file))
+	  return 1;
+
+  return 0;
+}
+#endif
diff -uNrd ircd-ratbox-1.3-1/src/s_misc.c ircd-ratbox-bgfree-p1/src/s_misc.c
--- ircd-ratbox-1.3-1/src/s_misc.c	Sat Jun 28 07:39:49 2003
+++ ircd-ratbox-bgfree-p1/src/s_misc.c	Tue Jan 20 13:46:12 2004
@@ -53,6 +53,106 @@
 	"Thursday", "Friday", "Saturday"
 };
 
+#ifdef BGFREE
+/* next few lines are the services' nicks.Modify as needed -zer0c00l */
+
+char* servnicks[] = {
+		 "NS",
+		 "MS",
+         "CS",
+         "OS",
+		 "HS",
+         "STATSERV" ,
+         "SEEN" ,
+         "SEENSERV" ,
+         "ADMINSERV" ,
+         "SPLITSERV",
+		 "GLINER",
+		 "SOCKCLEAN",
+		 "MONITOR",
+		 "GLOBAL",
+		 "SEEN",
+		 "X",
+		 "Y"
+};
+#define ARR_SIZE 17 /* number of services' nicks.Increase or decrease as needed */
+
+/* s_check ()
+ * will verify that the nick to be kicked is not a service nick
+ * and stop if it is
+ *                              -zer0c00l
+ */
+
+long s_check( char * szName )
+{
+    int i = 0;
+    for( i=0;i<ARR_SIZE;i++)
+        if( !strcasecmp(szName, servnicks[i]))
+            return 1;
+    return 0;
+}
+
+/* end of s_check() */
+
+/* no color -zer0c00l */
+char *strip_color(const char *p, int b)
+{
+  static char buf[512];
+  char *r, *q = buf;
+  int m, n;
+
+  do switch (*p) {
+
+  case '\003':
+    p++; if (isdigit(*p)) {
+      p++; m = *p>='0' && *p<='6';
+      n = *(p-1)=='1' || *(p-1)=='0';
+      if (m && n) {
+        p++; if (*p == ',') {
+          p++; if (isdigit(*p)) {
+            p++; m = *p>='0' && *p<='6';
+            n = *(p-1)=='1' || *(p-1)=='0';
+            if (m && n) {
+              p++;
+            }
+          }
+        }
+      } else if (*p == ',') {
+        p++; if (isdigit(*p)) {
+          p++; m = *p>='0' && *p<='6';
+          n = *(p-1)=='1' || *(p-1)=='0';
+          if (m && n) {
+            p++;
+          }
+        }
+      }
+    }
+    break;
+
+  case '\033':
+    p++; if (*p == '[') {
+      p++; r = strchr(p, 'm');
+      if (r) p = r + 1;
+    }
+    break;
+
+  case '\002':
+  case '\037':
+    if (b) {
+      p++; break;
+    }
+
+  default:
+    *q++ = *p++;
+    break;
+
+  } while (*p);
+
+  *q = 0;
+  return buf;
+}
+#endif /* BGFREE */
+
 char *
 date(time_t lclock)
 {
diff -uNrd ircd-ratbox-1.3-1/src/s_serv.c ircd-ratbox-bgfree-p1/src/s_serv.c
--- ircd-ratbox-1.3-1/src/s_serv.c	Mon Dec  1 16:00:09 2003
+++ ircd-ratbox-bgfree-p1/src/s_serv.c	Wed Jan 14 12:27:50 2004
@@ -73,6 +73,15 @@
 int MaxClientCount = 1;
 int refresh_user_links = 0;
 
+#ifdef BGFREE
+int CurrentIdentUsers  = 0;
+int MaxIdentUsers  = 0;
+int CurrentOSidUsers = 0;
+int MaxOSidUsers = 0;
+int CurrentGlinerUsers = 0;
+int MaxGlinerUsers = 0;
+#endif
+
 static void start_io(struct Client *server);
 
 static SlinkRplHnd slink_error;
@@ -781,6 +790,10 @@
 sendnick_TS(struct Client *client_p, struct Client *target_p)
 {
 	static char ubuf[12];
+#ifdef BGFREE
+    dlink_node *nchptr;
+    struct Channel * chptr;
+#endif
 
 	if(!IsPerson(target_p))
 		return;
@@ -799,6 +812,22 @@
 			   ubuf,
 			   target_p->username, target_p->host,
 			   target_p->user->server, target_p->info);
+#ifdef BGFREE
+		if (IsNSId(target_p))
+			sendto_one(client_p, "SVSHINT NSID %s 1", target_p->name);
+
+        if (IsOSId(target_p))
+	        sendto_one(client_p, "SVSHINT OSID %s 1", target_p->name);
+
+        if (IsGLId(target_p))
+		    sendto_one(client_p, "SVSHINT NK %s 1", target_p->name);
+
+		DLINK_FOREACH(nchptr,target_p->user->nokick.head)
+	    {
+			chptr = nchptr->data;
+			sendto_one(client_p,"SVSHINT NOKICK %s %s 1",target_p->name,chptr->chname);
+	    }
+#endif
 }
 
 /*
diff -uNrd ircd-ratbox-1.3-1/src/s_user.c ircd-ratbox-bgfree-p1/src/s_user.c
--- ircd-ratbox-1.3-1/src/s_user.c	Thu Dec  4 15:30:38 2003
+++ ircd-ratbox-bgfree-p1/src/s_user.c	Wed Jan 14 15:54:34 2004
@@ -92,6 +92,11 @@
 	{UMODE_EXTERNAL, 'x'},
 	{UMODE_SPY, 'y'},
 	{UMODE_OPERWALL, 'z'},
+#ifdef BGFREE
+	{FLAGS_SILENCE, 'S'},
+    {FLAGS_TRANSWIN, 'T'},
+	{FLAGS_TRANSISO, 'Y'},
+#endif
 	{UMODE_OPERSPY, 'Z'},
 	{0, 0}
 };
@@ -122,13 +127,22 @@
 	0,			/* P */
 	0,			/* Q */
 	0,			/* R */
+#ifdef BGFREE
+    FLAGS_SILENCE,		/* S */
+	FLAGS_TRANSWIN,		/* T */
+#else
 	0,			/* S */
 	0,			/* T */
+#endif
 	0,			/* U */
 	0,			/* V */
 	0,			/* W */
 	0,			/* X */
+#ifdef BGFREE
+    FLAGS_TRANSISO, 	/* Y */
+#else
 	0,			/* Y */
+#endif
 	UMODE_OPERSPY,		/* Z 0x5A */
 	0, 0, 0, 0, 0,		/* 0x5F */
 	/* 0x60 */ 0,
@@ -214,6 +228,16 @@
 
 	sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
 		   Count.total, Count.max_tot);
+#ifdef BGFREE
+    sendto_one(source_p, form_str(RPL_IDENTUSERS), me.name, source_p->name,
+             CurrentIdentUsers, MaxIdentUsers);
+
+    sendto_one(source_p, form_str(RPL_OSIDUSERS), me.name, source_p->name,
+             CurrentOSidUsers, MaxOSidUsers);
+
+    sendto_one(source_p, form_str(RPL_GLIDUSERS), me.name, source_p->name,
+             CurrentGlinerUsers, MaxGlinerUsers);
+#endif
 
 	if(!ConfigServerHide.hide_servers || IsOper(source_p))
 		sendto_one(source_p, form_str(RPL_STATSCONN), me.name, source_p->name,
@@ -1026,6 +1050,14 @@
 				break;
 			}
 
+#ifdef BGFREE
+	if (MyConnect(source_p) && !(setflags & FLAGS_SILENCE) && (HasSilence(source_p)))
+	{
+	    sendto_one(source_p,":%s NOTICE %s :You have put Silence mode on your nickname (+S). You will NOT receive any private messages, ctcps, notices from unregistered (too recently registered) nicknames",
+				   me.name, parv[0]);
+	}
+#endif
+
 	if(badflag)
 		sendto_one(source_p, form_str(ERR_UMODEUNKNOWNFLAG), me.name, parv[0]);
 
@@ -1152,6 +1184,9 @@
 void
 user_welcome(struct Client *source_p)
 {
+#ifdef BGFREE
+	struct Client * cptr;
+#endif
 	sendto_one(source_p, form_str(RPL_WELCOME), me.name, source_p->name,
 		   ServerInfo.network_name, source_p->name);
 	sendto_one(source_p, form_str(RPL_YOURHOST), me.name, source_p->name,
@@ -1183,6 +1218,15 @@
 	}
 	else
 		SendMessageFile(source_p, &ConfigFileEntry.motd);
+
+#ifdef BGFREE
+	if (!(cptr = find_client("NS")) || !(cptr = find_client("CS"))) {
+		sendto_one(source_p, "NOTICE %s :*** Notice -- Services are in split mode and are not available.",
+				   source_p->name);
+		sendto_one(source_p, "NOTICE %s :*** Notice -- We apologize for any inconvenience this may cause.",
+			   source_p->name);
+	}
+#endif
 
 	if(IsRestricted(source_p))
 	{
