muddy/
muddy/CVS/
muddy/area/
muddy/area/CVS/
muddy/clans/CVS/
muddy/classes/CVS/
muddy/doc/
muddy/doc/CVS/
muddy/etc/CVS/
muddy/etc/i3/
muddy/etc/i3/CVS/
muddy/imc/CVS/
muddy/lang/CVS/
muddy/licenses/CVS/
muddy/msgdb/CVS/
muddy/new/CVS/
muddy/notes/
muddy/player/
muddy/races/CVS/
muddy/religions/CVS/
muddy/src/CVS/
muddy/src/comm/CVS/
muddy/src/db/CVS/
muddy/src/intermud/
muddy/src/intermud/CVS/
muddy/src/irc/CVS/
muddy/src/olc/CVS/
/* $Id: comm_irc.patch,v 1.666 2004/09/20 10:50:27 shrike Exp $ */
diff -U 3 ../old_src/Makefile ./Makefile
--- ../old_src/Makefile	Tue Apr 23 03:30:22 2002
+++ ./Makefile	Tue Apr 23 04:21:43 2002
@@ -43,7 +43,7 @@
           mapout.o misc.o mpxset.o mud_comm.o mud_prog.o player.o polymorph.o \
           requests.o reset.o save.o shops.o skills.o special.o tables.o \
           track.o update.o grub.o stat_obj.o ban.o services.o planes.o \
-          imm_host.o $(IMC_OFILES) colorize.o 
+          imm_host.o $(IMC_OFILES) colorize.o comm_irc.o
 
 C_FILES = act_comm.c act_info.c act_move.c act_obj.c act_wiz.c boards.c \
           build.c clans.c comm.c comments.c const.c db.c deity.c fight.c \
@@ -51,7 +51,7 @@
           mapout.c misc.c mpxset.c mud_comm.c mud_prog.c player.c polymorph.c \
           requests.c reset.c save.c shops.c skills.c special.c tables.c \
           track.c update.c grub.c stat_obj.c ban.c services.c planes.c \
-          imm_host.c $(IMC_CFILES) colorize.c 
+          imm_host.c $(IMC_CFILES) colorize.c comm_irc.c
 
 H_FILES = mud.h bet.h imc-config.h imc-mercbase.h imc-mercdefs.h imc.h \
           ice.h icec.h icec-mercbase.h
diff -U 3 ../old_src/act_comm.c ./act_comm.c
--- ../old_src/act_comm.c	Tue Apr 23 03:30:22 2002
+++ ./act_comm.c	Tue Apr 23 03:30:52 2002
@@ -2150,56 +2150,12 @@
     send_page_to_char(ch, victim->pIndexData, arg2[0]);   
 }
 
-
+/* Moved the functionality do_rip and do_ansi to a new do_color command
+   in comm_irc.c    --Cronel
 void do_rip( CHAR_DATA *ch, char *argument )
-{
-    char arg[MAX_INPUT_LENGTH];
-
-    one_argument( argument, arg );
-
-    if ( arg[0] == '\0' )
-    {
-	send_to_char( "Rip ON or OFF?\n\r", ch );
-	return;
-    }
-    if ( (strcmp(arg,"on")==0) || (strcmp(arg,"ON") == 0) ) {
-	send_rip_screen(ch);
-	xSET_BIT(ch->act,PLR_RIP);
-	xSET_BIT(ch->act,PLR_ANSI);
-	return;
-    }
-
-    if ( (strcmp(arg,"off")==0) || (strcmp(arg,"OFF") == 0) ) {
-	xREMOVE_BIT(ch->act,PLR_RIP);
-	send_to_char( "!|*\n\rRIP now off...\n\r", ch );
-	return;
-    }
-}
-
 void do_ansi( CHAR_DATA *ch, char *argument )
-{
-    char arg[MAX_INPUT_LENGTH];
-
-    one_argument( argument, arg );
-
-    if ( arg[0] == '\0' )
-    {
-	send_to_char( "ANSI ON or OFF?\n\r", ch );
-	return;
-    }
-    if ( (strcmp(arg,"on")==0) || (strcmp(arg,"ON") == 0) ) {
-	xSET_BIT(ch->act,PLR_ANSI);
-	set_char_color( AT_WHITE + AT_BLINK, ch);
-	send_to_char( "ANSI ON!!!\n\r", ch);
-	return;
-    }
+*/
 
-    if ( (strcmp(arg,"off")==0) || (strcmp(arg,"OFF") == 0) ) {
-	xREMOVE_BIT(ch->act,PLR_ANSI);
-	send_to_char( "Okay... ANSI support is now off\n\r", ch );
-	return;
-    }
-}
 
 void do_save( CHAR_DATA *ch, char *argument )
 {
diff -U 3 ../old_src/act_info.c ./act_info.c
--- ../old_src/act_info.c	Tue Apr 23 03:30:22 2002
+++ ./act_info.c	Tue Apr 23 03:30:52 2002
@@ -3849,7 +3849,7 @@
       set_char_color( AT_DGREEN, ch );
       send_to_char( "Display:   ", ch );
       set_char_color( AT_GREY, ch );
-      ch_printf( ch, "%-12s   %-12s   %-12s   %-12s\n\r           %-12s   %-12s   %-12s   %-12s",
+      ch_printf( ch, "%-12s   %-12s   %-12s   %-12s\n\r           %-12s   %-12s   %-12s",
         IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) 	? "[+] PAGER"
                                                     	: "[-] pager",
         IS_SET( ch->pcdata->flags, PCFLAG_GAG )     	? "[+] GAG"
@@ -3862,10 +3862,8 @@
                                                     	: "[-] blank",
         xIS_SET(ch->act, PLR_PROMPT )               	? "[+] PROMPT"
                                                     	: "[-] prompt",
-        xIS_SET(ch->act, PLR_ANSI )                 	? "[+] ANSI"
-                                                    	: "[-] ansi",
-        xIS_SET(ch->act, PLR_RIP )                  	? "[+] RIP"
-                                                    	: "[-] rip" );
+	xIS_SET(ch->act, PLR_PRIVMSG)			? "[+] MSG" /* Cronel, IRC */
+							: "[-] msg" );
       set_char_color( AT_DGREEN, ch );
       send_to_char( "\n\r\n\rAuto:      ", ch );
       set_char_color( AT_GREY, ch );
@@ -3964,8 +3962,8 @@
 	else if ( !str_prefix( arg+1, "combine"  ) ) bit = PLR_COMBINE;
 	else if ( !str_prefix( arg+1, "prompt"   ) ) bit = PLR_PROMPT;
 	else if ( !str_prefix( arg+1, "telnetga" ) ) bit = PLR_TELNET_GA;
-	else if ( !str_prefix( arg+1, "ansi"     ) ) bit = PLR_ANSI;
-	else if ( !str_prefix( arg+1, "rip"      ) ) bit = PLR_RIP;
+	/* removed ansi & rip, added privmsg */
+	else if ( !str_prefix( arg+1, "msg"      ) ) bit = PLR_PRIVMSG;
 /*	else if ( !str_prefix( arg+1, "flee"     ) ) bit = PLR_FLEE; */
 	else if ( !str_prefix( arg+1, "nice"     ) ) bit = PLR_NICE;
 	else if ( !str_prefix( arg+1, "drag"     ) ) bit = PLR_SHOVEDRAG;
@@ -4472,14 +4470,33 @@
       strcat(buf2, ".\n\r");
       send_to_pager(buf2, ch);
     }
-  if ( victim->desc && victim->desc->host[0]!='\0' )   /* added by Gorog */
-     {
+    if ( victim->desc && victim->desc->host[0]!='\0' )   /* added by Gorog */
+    {
      sprintf (buf2, "%s's IP info: %s ", victim->name, victim->desc->host);
      if (get_trust(ch) >= LEVEL_GOD)
         strcat (buf2, victim->desc->user);
      strcat (buf2, "\n\r");
      send_to_pager(buf2, ch);
-     }
+    }
+    if ( victim->desc ) /* added by Cronel, IRC */
+    {
+	sprintf(buf2, "%s is playing via %s.\n\r",
+		victim->name, 
+		IS_IRC_DESC(victim->desc) ? "IRC" : 
+		IS_DCC_DESC(victim->desc) ? "DCC" : 
+		IS_TELNET_DESC(victim->desc) ? "Telnet" : "Unknown" );
+	if( victim->desc->nick_data )
+	{
+		sh_int login_mode = victim->desc->nick_data->login_mode; 
+		sprintf(buf2 + strlen(buf2), "%s's nick: %s, login mode: %s. ",
+			victim->name, victim->desc->nick_data->nick,
+			login_mode == MODE_LOGIN ? "login" :
+			(login_mode == MODE_SLOGIN ? "slogin" :
+			(login_mode == MODE_DCC ? "DCC" : "Unknown")) );
+		strcat( buf2, "\n\r" );
+	}
+	send_to_pager( buf2, ch );
+    } /* if (victim->desc ) */
   }
 }
 
diff -U 3 ../old_src/act_wiz.c ./act_wiz.c
--- ../old_src/act_wiz.c	Tue Apr 23 03:30:22 2002
+++ ./act_wiz.c	Tue Apr 23 03:30:52 2002
@@ -42,7 +42,7 @@
 int generate_itemlevel  args ( ( AREA_DATA *pArea, OBJ_INDEX_DATA *pObjIndex ));
 
 /* from comm.c */
-bool	write_to_descriptor	args( ( int desc, char *txt, int length ) );
+bool    write_low_level args( (DESCRIPTOR_DATA *d, char *txt, int len, bool use_privmsg ) );
 bool     check_parse_name        args( ( char *name, bool newchar ) );
 
 /* from boards.c */
@@ -1040,7 +1040,10 @@
     desc = atoi( arg );
     for ( d = first_descriptor; d; d = d->next )
     {
-	if ( d->descriptor == desc )
+	/* Modified by Cronel to allow for "disconnect <nick>" for irc
+	   logged-in players (who dont have an actual descriptor */
+	if ( (!IS_IRC_DESC(d) && d->descriptor == desc) 
+	||   (IS_IRC_DESC(d) && !str_prefix(arg, d->nick_data->nick)) )
 	{
 	    if ( d->character && get_trust(d->character) >= get_trust(ch) )
 	    {
@@ -1142,6 +1145,12 @@
 	    send_to_char( "\n\r",   d->character );
 	}
     }
+    /* Added msging it to the mud channel if connected to irc --Cronel */
+    {
+	char buf[ MAX_STRING_LENGTH ];
+    	sprintf( buf, "%s\r", argument );
+    	write_to_channel( buf, FALSE );
+    }
     return;
 }
 
@@ -2714,7 +2723,7 @@
 /*  Snoop notification for higher imms, if desired, uncomment this */
 #ifdef TOOSNOOPY
     if ( get_trust(victim) > LEVEL_GOD && get_trust(ch) < LEVEL_SUPREME )
-      write_to_descriptor( victim->desc->descriptor, "\n\rYou feel like someone is watching your every move...\n\r", 0 );
+      write_low_level( victim->desc, "\n\rYou feel like someone is watching your every move...\n\r", 0, FALSE );
 #endif
     victim->desc->snoop_by = ch->desc;
     send_to_char( "Ok.\n\r", ch );
@@ -4345,6 +4354,7 @@
     return;
 }
 
+/* Modified by Cronel to show login type and nick of irc players */
 void do_users( CHAR_DATA *ch, char *argument )
 {
     char buf[MAX_STRING_LENGTH];
@@ -4358,11 +4368,11 @@
     count	= 0;
     buf[0]	= '\0';
 
-    sprintf(buf, "\n\rDesc|Con|Idle| Port | Player      @HostIP           ");
+    sprintf(buf, "\n\rType|Desc| Port |Con|Idle| Player      @HostIP           ");
     if ( get_trust(ch) >= LEVEL_GOD)
      strcat(buf, "| Username");
     strcat(buf, "\n\r");
-    strcat(buf, "----+---+----+------+-------------------------------");
+    strcat(buf, "----+----+------+---+----+-------------------------------");
     if ( get_trust(ch) >= LEVEL_GOD)
       strcat(buf, "+---------");
     strcat(buf, "\n\r");
@@ -4376,12 +4386,20 @@
 	||   (d->character && can_see( ch, d->character )) )
 	{
 	    count++;
-	    sprintf( buf,
-	     " %3d| %2d|%4d|%6d| %-12s@%-16s ",
-		d->descriptor,
+	    sprintf( buf, "%-4s",
+		IS_IRC_DESC(d) ? "IRC" : 
+		(IS_DCC_DESC(d) ? "DCC" :
+		(IS_TELNET_DESC(d) ? "TELN" : "?")) );
+	    if( IS_IRC_DESC(d) )
+		sprintf( buf + strlen(buf), "| %-10s",
+			d->nick_data->nick );
+	    else
+		sprintf( buf + strlen(buf), "| %3d|%6d",
+			d->descriptor,
+			d->port );
+	    sprintf( buf + strlen(buf), "| %2d|%4d| %-12s@%-16s ",
 		d->connected,
 		d->idle / 4,
-		d->port,
 		d->original  ? d->original->name  :
 		d->character ? d->character->name : "(none)",
 		d->host);
@@ -4399,12 +4417,21 @@
 	||   ( d->character && !str_prefix( arg, d->character->name ) ) ) )
 	{
 	    count++;
+	    pager_printf( ch, "%-4s",
+		IS_IRC_DESC(d) ? "IRC" : 
+		(IS_DCC_DESC(d) ? "DCC" :
+		(IS_TELNET_DESC(d) ? "TELN" : "?")) );
+	    if( IS_IRC_DESC(d) )
+		pager_printf( ch, "| %-10s",
+			d->nick_data->nick );
+	    else
+		pager_printf( ch, "| %3d|%6d",
+			d->descriptor,
+			d->port );
 	    pager_printf( ch,
-	     " %3d| %2d|%4d|%6d| %-12s@%-16s ",
-		d->descriptor,
+	     "| %2d|%4d| %-12s@%-16s ",
 		d->connected,
 		d->idle / 4,
-		d->port,
 		d->original  ? d->original->name  :
 		d->character ? d->character->name : "(none)",
 		d->host
diff -U 3 ../old_src/comm.c ./comm.c
--- ../old_src/comm.c	Tue Apr 23 03:30:22 2002
+++ ./comm.c	Tue Apr 23 04:00:19 2002
@@ -120,7 +120,7 @@
  */
 void	game_loop		args( ( ) );
 int	init_socket		args( ( int port ) );
-void	new_descriptor		args( ( int new_desc ) );
+DESCRIPTOR_DATA *new_descriptor		args( ( int new_desc ) );
 bool	read_from_descriptor	args( ( DESCRIPTOR_DATA *d ) );
 bool	write_to_descriptor	args( ( int desc, char *txt, int length ) );
 
@@ -151,6 +151,37 @@
 
 int port;
 
+
+
+/* 
+ * Functions in comm_irc.c
+ * --Cronel
+ */
+void	connect_to_irc		args( ( void ) );
+void	disconnect_from_irc	args( ( char *txt ) );
+void	irc_game_loop		args( ( void ) );
+bool	write_low_level		args( ( DESCRIPTOR_DATA *d, char *txt, 
+					int len, bool use_privmsg ) );
+void	free_irc_desc		args( ( DESCRIPTOR_DATA *d ) );
+void	free_dcc_desc		args( ( DESCRIPTOR_DATA *d ) );
+bool	create_color_code	args( ( sh_int col, CHAR_DATA *ch, char *buf ) );
+bool	create_special_code	args( ( char code, CHAR_DATA *ch, char *buf ) );
+sh_int	atype_to_color		args( ( sh_int AType, CHAR_DATA *ch ) );
+void	check_restrictions	args( ( DESCRIPTOR_DATA *d ) );
+void	ircstart		args( ( void ) );
+bool	is_auth_nickserv	args( ( DESCRIPTOR_DATA *d ) );
+void	send_greeting		args( ( DESCRIPTOR_DATA *d ) );
+/* 
+ * This should calculate the length in characters of a 
+ * color sequence. Made to allow two-character color
+ * sequences ("&SC"). --Cronel
+ */
+#define COLOR_SEQ_LEN(colstr) /* length of a color sequence */ \
+	((colstr)[1] != 'S' ? 2 : 3)
+
+
+
+
 #ifdef WIN32
   int mainthread( int argc, char **argv )
 #else
@@ -270,12 +301,16 @@
 
     log_string("Booting Database");
     boot_db( );
+
+    ircstart(); 	/* <- this one MUST go */
+    connect_to_irc( );	/* <- BEFORE this one */
+
     log_string("Initializing socket");
     control  = init_socket( port   );
     control2 = init_socket( port+1 );
     conclient= init_socket( port+10);
     conjava  = init_socket( port+20);
-    
+
 #ifdef OLD_IMC
     /* Be sure to change RoD to your mud's name! */
     if(port == 4000)
@@ -315,6 +350,8 @@
     closesocket( conclient);
     closesocket( conjava  );
 
+    disconnect_from_irc( "Shutdown" );
+
 #ifdef WIN32
     if (service_shut_down)
     {
@@ -490,7 +527,7 @@
 }
 
 
-void accept_new( int ctrl )
+DESCRIPTOR_DATA *accept_new( int ctrl )
 {
 	static struct timeval null_time;
 	DESCRIPTOR_DATA *d;
@@ -512,6 +549,8 @@
 	newdesc = 0;
 	for ( d = first_descriptor; d; d = d->next )
 	{
+	    if( IS_IRC_DESC(d) )
+		continue;
 	    maxdesc = UMAX( maxdesc, d->descriptor );
 	    FD_SET( d->descriptor, &in_set  );
 	    FD_SET( d->descriptor, &out_set );
@@ -541,8 +580,9 @@
 	if ( FD_ISSET( ctrl, &in_set ) )
 	{
 	    newdesc = ctrl;
-	    new_descriptor( newdesc );
+	    return new_descriptor( newdesc );
 	}
+	return NULL;
 }
 
 void game_loop( )
@@ -570,7 +610,10 @@
 	accept_new( conjava  );
 	
 	auth_check(&in_set, &out_set, &exc_set);
-	
+
+	/* irc */
+	irc_game_loop( );
+
 	/*
 	 * Kick out descriptors with raised exceptions
 	 * or have been idle, then check for input.
@@ -585,7 +628,7 @@
  	    d_next = d->next;   
 
 	    d->idle++;	/* make it so a descriptor can idle out */
-	    if ( FD_ISSET( d->descriptor, &exc_set ) )
+	    if ( !IS_IRC_DESC(d) && FD_ISSET( d->descriptor, &exc_set ) )
 	    {
 		FD_CLR( d->descriptor, &in_set  );
 		FD_CLR( d->descriptor, &out_set );
@@ -597,13 +640,13 @@
 		close_socket( d, TRUE );
 		continue;
 	    }
-	    else 
+	    else
 	    if ( (!d->character && d->idle > 360)		  /* 2 mins */
             ||   ( d->connected != CON_PLAYING && d->idle > 1200) /* 5 mins */
 	    ||     d->idle > 28800 )				  /* 2 hrs  */
 	    {
-		write_to_descriptor( d->descriptor,
-		 "Idle timeout... disconnecting.\n\r", 0 );
+		write_low_level( d,
+		 "Idle timeout... disconnecting.\n\r", 0, FALSE );
 		d->outtop	= 0;
 		close_socket( d, TRUE );
 		continue;
@@ -612,7 +655,7 @@
 	    {
 		d->fcommand	= FALSE;
 
-		if ( FD_ISSET( d->descriptor, &in_set ) )
+		if ( !IS_IRC_DESC(d) && FD_ISSET( d->descriptor, &in_set ) )
 		{
 			d->idle = 0;
 			if ( d->character )
@@ -644,7 +687,7 @@
 
 			strcpy( cmdline, d->incomm );
 			d->incomm[0] = '\0';
-			
+
 			if ( d->character )
 			  set_cur_char( d->character );
 
@@ -692,7 +735,7 @@
 	    d_next = d->next;   
 
 	    if ( ( d->fcommand || d->outtop > 0 )
-	    &&   FD_ISSET(d->descriptor, &out_set) )
+	    &&   (IS_IRC_DESC(d) || FD_ISSET(d->descriptor, &out_set)) )
 	    {
 	        if ( d->pagepoint )
 	        {
@@ -785,7 +828,7 @@
 }
 
 
-void new_descriptor( int new_desc )
+DESCRIPTOR_DATA *new_descriptor( int new_desc )
 {
     char buf[MAX_STRING_LENGTH];
     DESCRIPTOR_DATA *dnew;
@@ -802,7 +845,7 @@
     if ( check_bad_desc( new_desc ) )
     {
       set_alarm( 0 );
-      return;
+      return NULL;
     }
     set_alarm( 20 );
     alarm_section = "new_descriptor::accept";
@@ -812,12 +855,12 @@
 	sprintf(bugbuf, "[*****] BUG: New_descriptor: accept");
 	log_string_plus( bugbuf, LOG_COMM, sysdata.log_level );
 	set_alarm( 0 );
-	return;
+	return NULL;
     }
     if ( check_bad_desc( new_desc ) )
     {
       set_alarm( 0 );
-      return;
+      return NULL;
     }
 #if !defined(FNDELAY)
 #define FNDELAY O_NDELAY
@@ -834,10 +877,10 @@
     {
 	perror( "New_descriptor: fcntl: FNDELAY" );
 	set_alarm( 0 );
-	return;
+	return NULL;
     }
     if ( check_bad_desc( new_desc ) )
-      return;
+      return NULL;
 
     CREATE( dnew, DESCRIPTOR_DATA, 1 );
     dnew->next		= NULL;
@@ -873,7 +916,7 @@
                          "Your site has been banned from this Mud.\n\r", 0);
           free_desc (dnew);
           set_alarm (0);
-          return;
+          return NULL;
      }
 
     /*
@@ -895,13 +938,7 @@
     /*
      * Send the greeting.
      */
-    {
-	extern char * help_greeting;
-	if ( help_greeting[0] == '.' )
-	    write_to_buffer( dnew, help_greeting+1, 0 );
-	else
-	    write_to_buffer( dnew, help_greeting  , 0 );
-    }
+    send_greeting( dnew ); /* Cronel, IRC */
 
     alarm_section = "new_descriptor: set_auth";
     set_auth(dnew);
@@ -922,7 +959,7 @@
 	save_sysdata( sysdata );
     }
     set_alarm(0);
-    return;
+    return dnew;
 }
 
 void free_desc( DESCRIPTOR_DATA *d )
@@ -1061,7 +1098,12 @@
     if ( dclose->descriptor == maxdesc )
       --maxdesc;
 
-    free_desc( dclose );
+    if( IS_IRC_DESC( dclose ) )
+	free_irc_desc( dclose );
+    else if( IS_DCC_DESC( dclose) )
+	free_dcc_desc( dclose );
+    else
+    	free_desc( dclose );
     --num_descriptors;
     return;
 }
@@ -1082,7 +1124,7 @@
 	sprintf( log_buf, "%s input overflow!", d->host );
 	log_string( log_buf );
 	write_to_descriptor( d->descriptor,
-	    "\n\r*** PUT A LID ON IT!!! ***\n\rYou cannot enter the same command more than 20 consecutive times!\n\r", 0 );
+	    "\n\r*** PUT A LID ON IT!!! ***\n\rYou cannot enter the same command more than 20 consecutive times!\n\r", 0);
 	return FALSE;
     }
 
@@ -1153,7 +1195,7 @@
     {
 	if ( k >= 254 )
 	{
-	    write_to_descriptor( d->descriptor, "Line too long.\n\r", 0 );
+	    write_low_level( d, "Line too long.\n\r", 0, FALSE );
 
 	    /* skip the rest of the line */
 	    /*
@@ -1197,8 +1239,8 @@
 /*		sprintf( log_buf, "%s input spamming!", d->host );
 		log_string( log_buf );
 */
-		write_to_descriptor( d->descriptor,
-		    "\n\r*** PUT A LID ON IT!!! ***\n\rYou cannot enter the same command more than 20 consecutive times!\n\r", 0 );
+		write_low_level( d,
+		    "\n\r*** PUT A LID ON IT!!! ***\n\rYou cannot enter the same command more than 20 consecutive times!\n\r", 0, FALSE );
 		strcpy( d->incomm, "quit" );
 	    }
 	}
@@ -1231,32 +1273,61 @@
 {
     char buf[MAX_INPUT_LENGTH];
     extern bool mud_down;
+    sh_int spit_len;
+    char *p;
 
     /*
      * If buffer has more than 4K inside, spit out .5K at a time   -Thoric
      */
     if ( !mud_down && d->outtop > 4096 )
     {
-	memcpy( buf, d->outbuf, 512 );
-	d->outtop -= 512;
-	memmove( d->outbuf, d->outbuf + 512, d->outtop );
+ 	spit_len = 512;
+ 	/*
+ 	 * Unless its an IRC or DCC descriptor. For these descriptors, new
+ 	 * lines are inserted if not present because of how IRC works. So
+ 	 * if we just cut on 512 bytes it won't look good, lines will be
+ 	 * broken. So we look for the last new line in these 512 bytes
+ 	 * instead, and send that. --Cronel
+ 	 */
+ 	if( !IS_TELNET_DESC(d) )
+ 	{
+ 		p = d->outbuf + spit_len;
+ 		while( *p != '\n' && *p != '\r' && p > d->outbuf )
+ 			p--;
+ 		if( p == d->outbuf )
+ 			spit_len = 512;
+ 		else
+ 		{
+ 			spit_len = p - d->outbuf;
+ 			if( (p[0] == '\n' && p[1] == '\r')
+ 			||  (p[0] == '\r' && p[1] == '\n') )
+ 				spit_len += 2;
+ 			else
+ 				spit_len ++;
+ 		}
+ 	}
+
+         memcpy( buf, d->outbuf, spit_len );
+         memmove( d->outbuf, d->outbuf + spit_len, d->outtop - spit_len );
+         d->outtop -= spit_len;
+
 	if ( d->snoop_by )
 	{
 	    char snoopbuf[MAX_INPUT_LENGTH];
 
-	    buf[512] = '\0';
+	    buf[spit_len] = '\0';
 	    if ( d->character && d->character->name )
 	    {
 		if (d->original && d->original->name)
 		    sprintf( snoopbuf, "%s (%s)", d->character->name, d->original->name );
-		else          
+		else
 		    sprintf( snoopbuf, "%s", d->character->name);
 		write_to_buffer( d->snoop_by, snoopbuf, 0);
 	    }
 	    write_to_buffer( d->snoop_by, "% ", 2 );
 	    write_to_buffer( d->snoop_by, buf, 0 );
 	}
-        if ( !write_to_descriptor( d->descriptor, buf, 512 ) )
+        if ( !write_low_level( d, buf, spit_len, FALSE ) )
         {
 	    d->outtop = 0;
 	    return FALSE;
@@ -1279,7 +1350,7 @@
 	    
 	if ( xIS_SET(ch->act, PLR_PROMPT) )
 	    display_prompt(d);
-	if ( xIS_SET(ch->act, PLR_TELNET_GA) )
+	if ( IS_TELNET_DESC(d) && xIS_SET(ch->act, PLR_TELNET_GA) )
 	    write_to_buffer( d, go_ahead_str, 0 );
     }
 
@@ -1311,7 +1382,7 @@
     /*
      * OS-dependent output.
      */
-    if ( !write_to_descriptor( d->descriptor, d->outbuf, d->outtop ) )
+    if ( !write_low_level( d, d->outbuf, d->outtop, FALSE ) )
     {
 	d->outtop = 0;
 	return FALSE;
@@ -1392,7 +1463,6 @@
     return;
 }
 
-
 /*
  * Lowest level output function.
  * Write a block of text to the file descriptor.
@@ -1428,10 +1498,10 @@
 
     if ( !IS_SET( ch->pcdata->flags, PCFLAG_NOINTRO ) )
     {
-	if (xIS_SET(ch->act, PLR_RIP))
+	if( WANT_RIP_COLOR(ch) )
 	  send_rip_title(ch);
 	else
-	if (xIS_SET(ch->act, PLR_ANSI))
+	if( WANT_ANSI_COLOR(ch) )
 	  send_ansi_title(ch);
 	else
 	  send_ascii_title(ch);
@@ -1626,8 +1696,18 @@
 	      return;
 	    }
 	    /* Old player */
+	    /* This is for the nickserv->password transition --Cronel */
+	    if( ch->pcdata->pwd == NULL || ch->pcdata->pwd[0] == '\0' ) 
+	    {
+		d->connected = CON_GET_OLD_PASSWORD;
+		/* so that nanny gets called again immediately
+		 * kludgy but seems better than a recursive call --Cronel */
+		strcpy( d->inbuf, "\n\r" ); 
+		return;
+	    }
 	    write_to_buffer( d, "Password: ", 0 );
-	    write_to_buffer( d, echo_off_str, 0 );
+	    if( IS_TELNET_DESC(d) )
+		write_to_buffer( d, echo_off_str, 0 );
 	    d->connected = CON_GET_OLD_PASSWORD;
 	    return;
 	}
@@ -1660,7 +1740,15 @@
     case CON_GET_OLD_PASSWORD:
 	write_to_buffer( d, "\n\r", 2 );
 
-	if ( strcmp( crypt( argument, ch->pcdata->pwd ), ch->pcdata->pwd ) )
+	/* This is for the nickserv->pwd transition --Cronel */
+	if( (ch->pcdata->pwd == NULL || ch->pcdata->pwd[0] == '\0')
+	&&  !is_auth_nickserv(d) )
+		return;
+
+	/* if is_auth_nickserv let them pass it means they are
+	 * authenticated to nickserv --Cronel */
+	if ( (ch->pcdata->pwd != NULL && ch->pcdata->pwd[0] != '\0')
+	&&  strcmp( crypt( argument, ch->pcdata->pwd ), ch->pcdata->pwd ) )
 	{
 	    write_to_buffer( d, "Wrong password.\n\r", 0 );
 	    /* clear descriptor pointer to get rid of bug message in log */
@@ -1669,7 +1757,8 @@
 	    return;
 	}
 
-	write_to_buffer( d, echo_on_str, 0 );
+	if( IS_TELNET_DESC(d ) )
+		write_to_buffer( d, echo_on_str, 0 );
 
 	if ( check_playing( d, ch->pcdata->filename, TRUE ) )
 	    return;
@@ -1716,7 +1805,7 @@
 	case 'y': case 'Y':
 	    sprintf( buf, "\n\rMake sure to use a password that won't be easily guessed by someone else."
 	    		  "\n\rPick a good password for %s: %s",
-		ch->name, echo_off_str );
+		ch->name, (IS_TELNET_DESC(d) ? echo_off_str : "") );
 	    write_to_buffer( d, buf, 0 );
 	    d->connected = CON_GET_NEW_PASSWORD;
 	    break;
@@ -1776,7 +1865,8 @@
 	    return;
 	}
 
-	write_to_buffer( d, echo_on_str, 0 );
+	if( IS_TELNET_DESC(d) )
+		write_to_buffer( d, echo_on_str, 0 );
 	write_to_buffer( d, "\n\rWhat is your sex (M/F/N)? ", 0 );
 	d->connected = CON_GET_NEW_SEX;
 	break;
@@ -1952,21 +2042,20 @@
           return;
         }
 
-	write_to_buffer( d, "\n\rWould you like RIP, ANSI or no graphic/color support, (R/A/N)? ", 0 );
+	write_to_buffer( d, "\n\rWould you like RIP, ANSI, MIRCW, MIRCB, or no graphic/color support, (R/A/W/B/N)? ", 0 );
 	d->connected = CON_GET_WANT_RIPANSI;
         break;
 
     case CON_GET_WANT_RIPANSI:
 	switch ( argument[0] )
 	{
-	case 'r': case 'R':
-	    xSET_BIT(ch->act,PLR_RIP);
-	    xSET_BIT(ch->act,PLR_ANSI);
-	    break;
-	case 'a': case 'A': xSET_BIT(ch->act,PLR_ANSI);  break;
+	case 'r': case 'R': ch->color = COLOR_RIP; break;
+	case 'a': case 'A': ch->color = COLOR_ANSI; break;
+	case 'W': case 'w': ch->color = COLOR_MIRCW; break;
+	case 'B': case 'b': ch->color = COLOR_MIRCB; break;
 	case 'n': case 'N': break;
 	default:
-	    write_to_buffer( d, "Invalid selection.\n\rRIP, ANSI or NONE? ", 0 );
+	    write_to_buffer( d, "Invalid selection.\n\rRIP, ANSI, MIRCW, MIRCB or NONE? ", 0 );
 	    return;
 	}
 	sprintf( log_buf, "%s@%s new %s %s.", ch->name, d->host,
@@ -1993,12 +2082,13 @@
 		ch->position = POS_STANDING;
 
 	set_pager_color( AT_PLAIN, ch );
-	if ( xIS_SET(ch->act, PLR_RIP) )
+	if( WANT_RIP_COLOR(ch) )
 	  send_rip_screen(ch);
-	if ( xIS_SET(ch->act, PLR_ANSI) )
-	  send_to_pager( "\033[2J", ch );
+	if( WANT_ANSI_COLOR(ch) )
+	  send_to_pager( "\033[2J\033[0;37;40m", ch ); /* Cronel, IRC, 1.3 fix */
 	else
 	  send_to_pager( "\014", ch );
+	set_pager_color( AT_LBLUE, ch ); /* Stock color bug fix --Cronel */
 	if ( IS_IMMORTAL(ch) )
 	  do_help( ch, "imotd" );
 	if ( ch->level == 50)
@@ -2180,6 +2270,8 @@
     else if ( !ch->was_in_room )
     	ch->was_in_room = ch->in_room;
 
+    check_restrictions( d );
+
     break;
 
     }
@@ -2303,6 +2395,8 @@
 		d->character = ch;
 		ch->desc	 = d;
 		ch->timer	 = 0;
+		if( WANT_ANSI_COLOR( ch ) )
+			send_to_char( "\033[0;37;40m", ch ); /* Cronel, IRC, 1.3 fix */
 		send_to_char( "Reconnecting.\n\r", ch );
 		do_look( ch, "auto" );
 		act( AT_ACTION, "$n has reconnected.", ch, NULL, NULL, TO_CANSEE );
@@ -2314,6 +2408,9 @@
 		  to_channel( log_buf, CHANNEL_MONITOR, "Monitor", ch->level );
 */
 		d->connected = CON_PLAYING;
+
+		check_restrictions( d );
+
 	    }
 	    return TRUE;
 	}
@@ -2355,6 +2452,8 @@
 	    }
 	    if ( !kick )
 	      return TRUE;
+	    if( WANT_ANSI_COLOR(ch) ) /* Cronel IRC, 1.3 fix */
+		write_to_buffer( d, "\033[0;37;40m", 0 );
 	    write_to_buffer( d, "Already playing... Kicking off old connection.\n\r", 0 );
 	    write_to_buffer( dold, "Kicking off old connection... bye!\n\r", 0 );
 	    close_socket( dold, FALSE );
@@ -2379,6 +2478,8 @@
 	      to_channel( log_buf, CHANNEL_MONITOR, "Monitor", ch->level );
 */
 	    d->connected = cstate;
+
+	    check_restrictions( d );
 	    return TRUE;
 	}
     }
@@ -2475,7 +2576,7 @@
     }
     else if ( ln > 0 )
       write_to_buffer(d, colbuf, ln);
-    prevstr = colstr+2;
+    prevstr = colstr+COLOR_SEQ_LEN(colstr);
   }
   if ( *prevstr )
     write_to_buffer(d, prevstr, 0);
@@ -2587,7 +2688,7 @@
     }
     else if ( ln > 0 )
       write_to_pager(d, colbuf, ln);
-    prevstr = colstr+2;
+    prevstr = colstr+COLOR_SEQ_LEN(colstr);
   }
   if ( *prevstr )
     write_to_pager(d, prevstr, 0);
@@ -2617,19 +2718,16 @@
 {
     char buf[16];
     CHAR_DATA *och;
-    
+    sh_int color;
+
     if ( !ch || !ch->desc )
       return;
-    
+
     och = (ch->desc->original ? ch->desc->original : ch);
-    if ( !IS_NPC(och) && xIS_SET(och->act, PLR_ANSI) )
+    AType = figure_color(AType, och);
+    color = atype_to_color( AType, och );
+    if( create_color_code( color, och, buf ) )
     {
-	AType = figure_color(AType, och);
-	if ( AType == 7 )
-	  strcpy( buf, "\033[m" );
-	else
-	  sprintf(buf, "\033[0;%d;%s%dm", (AType & 8) == 8,
-	        (AType > 15 ? "5;" : ""), (AType & 7)+30);
 	write_to_buffer( ch->desc, buf, strlen(buf) );
     }
     return;
@@ -2639,21 +2737,18 @@
 {
     char buf[16];
     CHAR_DATA *och;
-    
+    sh_int color;
+
     if ( !ch || !ch->desc )
       return;
-    
+
     och = (ch->desc->original ? ch->desc->original : ch);
-    if ( !IS_NPC(och) && xIS_SET(och->act, PLR_ANSI) )
+    AType = figure_color(AType, ch);
+    color = atype_to_color( AType, och );
+    if( create_color_code( color, och, buf ) )
     {
-	AType = figure_color(AType, ch);
-	if ( AType == 7 )
-	  strcpy( buf, "\033[m" );
-	else
-	  sprintf(buf, "\033[0;%d;%s%dm", (AType & 8) == 8,
-	        (AType > 15 ? "5;" : ""), (AType & 7)+30);
 	send_to_pager( buf, ch );
-	ch->desc->pagecolor = AType;
+	ch->desc->pagecolor = color;
     }
     return;
 }
@@ -3122,7 +3217,6 @@
   CHAR_DATA *ch = d->character;
   CHAR_DATA *och = (d->original ? d->original : d->character);
   CHAR_DATA *victim;
-  bool ansi = (!IS_NPC(och) && xIS_SET(och->act, PLR_ANSI));
   const char *prompt;
   const char *helpstart = "<Type HELP START>";
   char buf[MAX_STRING_LENGTH];
@@ -3152,11 +3246,9 @@
   }
   else
     prompt = ch->pcdata->prompt;
-  if ( ansi )
+  if( create_color_code( 0x07, (d->original ? d->original : d->character), pbuf ) )
   {
-    strcpy(pbuf, "\033[m");
-    d->prevcolor = 0x07;
-    pbuf += 3;
+	pbuf += strlen(pbuf);
   }
   /* Clear out old color stuff */
 /*  make_color_sequence(NULL, NULL, NULL);*/
@@ -3192,7 +3284,10 @@
       if ( stat < 0 )
         --prompt;
       else if ( stat > 0 )
+      {
         pbuf += stat;
+	prompt += COLOR_SEQ_LEN(prompt-1) - 2;
+      }
       break;
     case '%':
       *pbuf = '\0';
@@ -3427,10 +3522,8 @@
   const char *ctype = col;
   unsigned char cl;
   CHAR_DATA *och;
-  bool ansi;
   
   och = (d->original ? d->original : d->character);
-  ansi = (!IS_NPC(och) && xIS_SET(och->act, PLR_ANSI));
   col++;
   if ( !*col )
     ln = -1;
@@ -3445,11 +3538,9 @@
     buf[1] = '\0';
     ln = 1;
   }
-  else if ( !ansi )
-    ln = 0;
   else
   {
-    cl = d->prevcolor;
+    cl = 0x7;
     switch(*ctype)
     {
     default:
@@ -3467,7 +3558,16 @@
     case '^':
       {
         int newcol;
-        
+
+	/* Special escape codes for mIRC (Bold, underline..) */
+	if ( *col == 'S' )
+	{
+		if( create_special_code( col[1], och, buf ) )
+			ln = strlen( buf );
+		else
+			ln = 0;
+		break;
+	}
         if ( (newcol = getcolor(*col)) < 0 )
         {
           ln = 0;
@@ -3478,42 +3578,10 @@
         else
           cl = (cl & 0x0F) | (newcol << 4);
       }
-      if ( cl == d->prevcolor )
-      {
-        ln = 0;
-        break;
-      }
-      strcpy(buf, "\033[");
-      if ( (cl & 0x88) != (d->prevcolor & 0x88) )
-      {
-        strcat(buf, "m\033[");
-        if ( (cl & 0x08) )
-          strcat(buf, "1;");
-        if ( (cl & 0x80) )
-          strcat(buf, "5;");
-        d->prevcolor = 0x07 | (cl & 0x88);
-        ln = strlen(buf);
-      }
-      else
-        ln = 2;
-      if ( (cl & 0x07) != (d->prevcolor & 0x07) )
-      {
-        sprintf(buf+ln, "3%d;", cl & 0x07);
-        ln += 3;
-      }
-      if ( (cl & 0x70) != (d->prevcolor & 0x70) )
-      {
-        sprintf(buf+ln, "4%d;", (cl & 0x70) >> 4);
-        ln += 3;
-      }
-      if ( buf[ln-1] == ';' )
-        buf[ln-1] = 'm';
+      if( create_color_code( cl, och, buf ))
+	ln = strlen( buf );
       else
-      {
-        buf[ln++] = 'm';
-        buf[ln] = '\0';
-      }
-      d->prevcolor = cl;
+	ln = 0; 
     }
   }
   if ( ln <= 0 )
@@ -3536,6 +3604,7 @@
   int pclines;
   register int lines;
   bool ret;
+  char buf[32];
 
   if ( !d || !d->pagepoint || d->pagecmd == -1 )
     return TRUE;
@@ -3580,8 +3649,8 @@
     ++last;
   if ( last != d->pagepoint )
   {
-    if ( !write_to_descriptor(d->descriptor, d->pagepoint,
-          (last-d->pagepoint)) )
+    if ( !write_low_level(d, d->pagepoint,
+          (last-d->pagepoint), FALSE) )
       return FALSE;
     d->pagepoint = last;
   }
@@ -3597,23 +3666,20 @@
     return TRUE;
   }
   d->pagecmd = -1;
-  if ( xIS_SET( ch->act, PLR_ANSI ) )
-      if ( write_to_descriptor(d->descriptor, "\033[1;36m", 7) == FALSE )
-	return FALSE;
-  if ( (ret=write_to_descriptor(d->descriptor,
-	"(C)ontinue, (N)on-stop, (R)efresh, (B)ack, (Q)uit: [C] ", 0)) == FALSE )
-	return FALSE;
-  if ( xIS_SET( ch->act, PLR_ANSI ) )
-  {
-      char buf[32];
 
-      if ( d->pagecolor == 7 )
-	strcpy( buf, "\033[m" );
-      else
-	sprintf(buf, "\033[0;%d;%s%dm", (d->pagecolor & 8) == 8,
-		(d->pagecolor > 15 ? "5;" : ""), (d->pagecolor & 7)+30);
-      ret = write_to_descriptor( d->descriptor, buf, 0 );
-  }
+   if( create_color_code( (0x8|0x6), ch, buf ) )
+    {
+	if( write_low_level( d, buf, strlen(buf), FALSE ) == FALSE )
+		return FALSE;
+   }
+   if ( (ret=write_low_level(d,
+	"(C)ontinue, (R)efresh, (B)ack, (Q)uit: [C] ", 0, FALSE)) == FALSE )
+	return FALSE;
+   if( d->pagecolor == 0 ) d->pagecolor = 0xF;
+   if( create_color_code( d->pagecolor, (d->original ? d->original : d->character), buf ) )
+   {
+       ret = write_low_level( d, buf, 0, FALSE );
+   }
   return ret;
 }
 
Only in .: comm_irc.c
Only in .: comm_irc.patch
diff -U 3 ../old_src/interp.c ./interp.c
--- ../old_src/interp.c	Tue Apr 23 03:30:22 2002
+++ ./interp.c	Tue Apr 23 03:30:52 2002
@@ -743,6 +743,7 @@
     tmptime = UMIN(time_used.tv_sec,19) * 1000000 + time_used.tv_usec;
 
     /* laggy command notice: command took longer than 1.5 seconds */
+#ifdef 0
     if ( tmptime > 1500000 )
     {
 #ifdef TIMEFORMAT
@@ -759,7 +760,7 @@
 	log_string_plus(log_buf, LOG_NORMAL, get_trust(ch));
 	cmd->lag_count++;	/* count the lag flags */
     }
-
+#endif 0 /* REMOVEME */
     tail_chain( );
 }
 
diff -U 3 ../old_src/mapout.c ./mapout.c
--- ../old_src/mapout.c	Tue Apr 23 03:30:22 2002
+++ ./mapout.c	Tue Apr 23 03:30:52 2002
@@ -250,7 +250,7 @@
 	    {
 	       if(map_index->map_of_vnums[y][x]==ch->in_room->vnum)
 	       {
-		  if ( xIS_SET(ch->act, PLR_ANSI) ){
+		  if( WANT_ANSI_COLOR(ch) ) {
 	             text_map[i] = (char) '\x1B';    /* Bold */
 		     i++;
 	             text_map[i] = (char) '[';
diff -U 3 ../old_src/mud.h ./mud.h
--- ../old_src/mud.h	Tue Apr 23 03:30:22 2002
+++ ./mud.h	Tue Apr 23 03:30:52 2002
********************************************************************************************VVV**
@@ -154,6 +154,9 @@
 typedef	struct	lcnv_data		LCNV_DATA;
 typedef	struct	lang_data		LANG_DATA;
 
+typedef struct ircdata			IRCDATA; /* Cronel, IRC */
+typedef struct nick_data		NICK_DATA; /* Cronel, IRC */
+
 ********************************************************************************************^^^**
 
 /*
@@ -704,6 +707,89 @@
   SUB_TIMER_DO_ABORT = 128, SUB_TIMER_CANT_ABORT
 } char_substates;
 ********************************************************************************************VVV**
+
+
+/* 
+ * IRC related structures and #defines
+ * --Cronel
+ */
+/* Login modes for IRC and DCC descriptors */
+typedef enum 
+{
+  MODE_NONE, MODE_LOGIN, MODE_SLOGIN, MODE_DCC
+} login_modes;
+
+/* Nickserv substates */
+typedef enum
+{
+  NICKSERV_NONE, NICKSERV_START, NICKSERV_UNREG, NICKSERV_UNREC, NICKSERV_REC
+} nickserv_states;
+
+/* Mud connetion modes to IRC */
+typedef enum 
+{
+  MODE_CLIENT, MODE_SERVER
+} mud_con;
+
+/* IRC nickname info */
+struct nick_data
+{
+	char	*		nick;
+	char	*		user;
+	char	*		host;
+
+	DESCRIPTOR_DATA *	desc;
+	sh_int			login_mode;
+
+	struct nick_data *	next;
+	struct nick_data *	prev;
+
+	sh_int			nickserv;
+};
+
+#define IS_TELNET_DESC(d)	((d) && (d)->nick_data == NULL )
+#define IS_IRC_DESC( d )	((d) && (d)->nick_data != NULL && (d)->nick_data->login_mode != MODE_DCC )
+#define IS_DCC_DESC( d )	((d) && (d)->nick_data != NULL && (d)->nick_data->login_mode == MODE_DCC )
+#define CAN_TELNET( ch )	((ch) && !IS_NPC(ch) && (IS_IMMORTAL(ch) || NOT_AUTHED(ch) || IS_WAITING_FOR_AUTH(ch)) )
+
+/* Struc for the IRC commands table */
+struct irc_cmd
+{
+	char	*	cmd_name;
+	char	*	cmd_letter;
+	void		(*cmd_proc)(char *, char*);
+};
+
+/* Configuration data for mud IRC connection */
+struct ircdata
+{
+	sh_int		mode;
+
+	char	*	sserver;
+	int		sport;
+	char	*	spwd;
+
+	char	*	cserver;
+	int		cport;
+	char	*	cpwd;
+
+	sh_int		resp_timeout;
+	bool		reconnect;
+
+	char	*	mud_nick;
+	char	*	mud_channel;
+
+	char	*	mud_pseudo_host;
+	char	*	mud_server;
+
+	int		dcc_port;
+	sh_int		dcc_timeout;
+
+	char	*	mud_desc;
+} ;
+void write_to_channel( char *msg, bool use_privmsg );
+void send_mirc_sound( CHAR_DATA *ch, char *sound_file );
+

********************************************************************************************^^^**
 /*
  * Descriptor (channel) structure.
  */
@@ -738,6 +824,10 @@
     char *		user;
     int			newstate;
     unsigned char	prevcolor;
+
+    NICK_DATA *		nick_data;
+    bool		must_bleed;
+    char 		bleeding[ 16 ];
 };
 
 
@@ -929,7 +1019,7 @@
 #define AT_IMMORT	   AT_YELLOW
 #define AT_HURT		   AT_RED
 #define AT_FALLING	   AT_WHITE + AT_BLINK
-#define AT_DANGER	   AT_RED + AT_BLINK
+#define AT_DANGER	   AT_BLUE + AT_BLINK
 #define AT_MAGIC	   AT_BLUE
 #define AT_CONSIDER	   AT_GREY
 #define AT_REPORT	   AT_GREY
@@ -2016,6 +2106,15 @@
   STYLE_EVASIVE,
 } styles;
 
+/* Color settings --Cronel */
+typedef enum 
+{ 
+   COLOR_NONE, COLOR_ANSI, COLOR_RIP, COLOR_MIRCB, COLOR_MIRCW
+} color_sets;
+#define WANT_MIRC_COLOR(ch) ((ch)->color == COLOR_MIRCB || (ch)->color == COLOR_MIRCW)
+#define WANT_ANSI_COLOR(ch) ((ch)->color == COLOR_ANSI || (ch)->color == COLOR_RIP)
+#define WANT_RIP_COLOR(ch)  ((ch)->color == COLOR_RIP)
+
 /*
  * ACT bits for players.
  */
@@ -2025,9 +2124,12 @@
   PLR_AUTOSAC, PLR_BLANK, PLR_OUTCAST, PLR_BRIEF, PLR_COMBINE, PLR_PROMPT, 
   PLR_TELNET_GA, PLR_HOLYLIGHT, PLR_WIZINVIS, PLR_ROOMVNUM, PLR_SILENCE, 
   PLR_NO_EMOTE, PLR_ATTACKER, PLR_NO_TELL, PLR_LOG, PLR_DENY, PLR_FREEZE, 
-  PLR_THIEF, PLR_KILLER, PLR_LITTERBUG, PLR_ANSI, PLR_RIP, PLR_NICE, PLR_FLEE, 
+  PLR_THIEF, PLR_KILLER, PLR_LITTERBUG, PLR_PRIVMSG, PLR_UNUSED, PLR_NICE, PLR_FLEE,
   PLR_AUTOGOLD, PLR_AUTOMAP, PLR_AFK, PLR_INVISPROMPT
 } player_flags;
+  /* Moved colors to its own field, added PLR_PRIVMSG. Left PLR_UNUSED 
+   * cause we dont want all the ones after it moving up.. It would
+   * screw up existing pfiles and mobs.. --Cronel */
 
 /* Bits for pc_data->flags. */
 #define PCFLAG_R1                  BV00
@@ -2344,6 +2446,8 @@
     int			retran;
     int			regoto;
     sh_int		mobinvis;	/* Mobinvis level SB */
+
+    sh_int		color; /* Color setting for the player --Cronel */
 };
 
 
@@ -3701,7 +3805,6 @@
 DECLARE_DO_FUN( do_afk          );
 DECLARE_DO_FUN(	do_aid		);
 DECLARE_DO_FUN(	do_allow	);
-DECLARE_DO_FUN( do_ansi		);
 DECLARE_DO_FUN(	do_answer	);
 DECLARE_DO_FUN( do_apply	);
 DECLARE_DO_FUN(	do_appraise	);
@@ -3753,6 +3856,7 @@
 DECLARE_DO_FUN(	do_close	);
 DECLARE_DO_FUN(	do_cmdtable	);
 DECLARE_DO_FUN(	do_cmenu	);
+DECLARE_DO_FUN( do_color	); /* Cronel, IRC */
 DECLARE_DO_FUN( do_colorize	); /* Alty */
 DECLARE_DO_FUN(	do_commands	);
 DECLARE_DO_FUN(	do_comment	);
@@ -3852,6 +3956,10 @@
 DECLARE_DO_FUN(	do_inventory	);
 DECLARE_DO_FUN(	do_invis	);
 DECLARE_DO_FUN( do_ipcompare    );
+DECLARE_DO_FUN( do_ircconnect	); /* Cronel, IRC */
+DECLARE_DO_FUN( do_ircdisconnect); /* Cronel, IRC */
+DECLARE_DO_FUN( do_ircset	); /* Cronel, IRC */
+DECLARE_DO_FUN( do_irclink	); /* Cronel, IRC */
 DECLARE_DO_FUN( do_khistory	);
 DECLARE_DO_FUN(	do_kick		);
 DECLARE_DO_FUN(	do_kill		);
@@ -3998,7 +4106,6 @@
 DECLARE_DO_FUN(	do_return	);
 DECLARE_DO_FUN(	do_revert	);
 DECLARE_DO_FUN( do_rgrub	);
-DECLARE_DO_FUN( do_rip		);
 DECLARE_DO_FUN( do_rlist	);
 DECLARE_DO_FUN( do_rolldie	);
 DECLARE_DO_FUN( do_rpfind	);
diff -U 3 ../old_src/save.c ./save.c
--- ../old_src/save.c	Tue Apr 23 03:30:23 2002
+++ ./save.c	Tue Apr 23 03:30:52 2002
@@ -300,6 +300,7 @@
     fprintf( fp, "Exp          %d\n",	ch->exp			);
     fprintf( fp, "Height          %d\n",	ch->height	);
     fprintf( fp, "Weight          %d\n",	ch->weight	);
+    fprintf( fp, "Color        %d\n", ch->color ); 
     if ( !xIS_EMPTY(ch->act) )
       fprintf( fp, "Act          %s\n", print_bitvector(&ch->act) );
     if ( !xIS_EMPTY(ch->affected_by) )
@@ -1156,6 +1157,7 @@
 	    }
 
 	    KEY( "Class",	ch->class,		fread_number( fp ) );
+	    KEY( "Color",	ch->color,		fread_number( fp ) );
 
 	    if ( !str_cmp( word, "Color" ) )
 	    {
Only in .: shutdown.txt
diff -U 3 ../old_src/tables.c ./tables.c
--- ../old_src/tables.c	Tue Apr 23 03:30:23 2002
+++ ./tables.c	Tue Apr 23 03:30:52 2002
@@ -173,7 +173,6 @@
 	if ( !str_cmp( name, "do_afk" ))		return do_afk;
 	if ( !str_cmp( name, "do_aid" ))		return do_aid;
 	if ( !str_cmp( name, "do_allow" ))		return do_allow;
-	if ( !str_cmp( name, "do_ansi" ))		return do_ansi;
 	if ( !str_cmp( name, "do_answer" ))		return do_answer;
 	if ( !str_cmp( name, "do_apply" ))		return do_apply;
 	if ( !str_cmp( name, "do_appraise" ))		return do_appraise;
@@ -228,6 +227,7 @@
 	if ( !str_cmp( name, "do_close" ))		return do_close;
 	if ( !str_cmp( name, "do_cmdtable" ))		return do_cmdtable;
 	if ( !str_cmp( name, "do_cmenu" ))		return do_cmenu;
+	if ( !str_cmp( name, "do_color" ))		return do_color; /* Cronel, IRC */
 	if ( !str_cmp( name, "do_colorize" ))		return do_colorize;
 	if ( !str_cmp( name, "do_commands" ))		return do_commands;
 	if ( !str_cmp( name, "do_comment" ))		return do_comment;
@@ -340,6 +340,10 @@
 	if ( !str_cmp( name, "do_immortalize" ))	return do_immortalize;
 	if ( !str_cmp( name, "do_immtalk" ))		return do_immtalk;
 	if ( !str_cmp( name, "do_imm_morph" ))		return do_imm_morph;
+	if ( !str_cmp( name, "do_ircconnect" ))		return do_ircconnect; /* Cronel, IRC */
+	if ( !str_cmp( name, "do_ircdisconnect" ))	return do_ircdisconnect; /* Cronel, IRC */
+	if ( !str_cmp( name, "do_ircset" ))		return do_ircset; /* Cronel, IRC */
+	if ( !str_cmp( name, "do_irclink" ))		return do_irclink; /* Cronel, IRC */
 	if ( !str_cmp( name, "do_imm_unmorph" ))	return do_imm_unmorph;
 	if ( !str_cmp( name, "do_induct" ))		return do_induct;
 	if ( !str_cmp( name, "do_installarea" ))	return do_installarea;
@@ -592,7 +596,6 @@
 	if ( !str_cmp( name, "do_rignore" ))		return do_rignore;
 	if ( !str_cmp( name, "do_rinfo" ))		return do_rinfo;
 #endif
-	if ( !str_cmp( name, "do_rip" ))		return do_rip;
 	if ( !str_cmp( name, "do_rlist" ))		return do_rlist;
 	if ( !str_cmp( name, "do_rmenu" ))		return do_rmenu;
  	if ( !str_cmp( name, "do_rolldie" ))		return do_rolldie;
@@ -851,7 +854,6 @@
     if ( skill == do_afk )		return "do_afk";
     if ( skill == do_aid )		return "do_aid";
     if ( skill == do_allow )		return "do_allow";
-    if ( skill == do_ansi )		return "do_ansi";
     if ( skill == do_answer )		return "do_answer";
     if ( skill == do_apply )		return "do_apply";
     if ( skill == do_appraise )		return "do_appraise";
@@ -902,6 +904,7 @@
     if ( skill == do_close )		return "do_close";
     if ( skill == do_cmdtable )		return "do_cmdtable";
     if ( skill == do_cmenu )		return "do_cmenu";
+    if ( skill == do_color )		return "do_color";
     if ( skill == do_colorize )		return "do_colorize";
     if ( skill == do_commands )		return "do_commands";
     if ( skill == do_comment )		return "do_comment";
@@ -1000,6 +1003,10 @@
     if ( skill == do_imm_morph)         return "do_imm_morph";
     if ( skill == do_imm_unmorph)       return "do_imm_unmorph";
     if ( skill == do_induct )		return "do_induct";
+    if ( skill == do_ircconnect )	return "do_ircconnect"; /* Cronel, IRC */
+    if ( skill == do_ircdisconnect )	return "do_ircdisconnect"; /* Cronel, IRC */
+    if ( skill == do_ircset )		return "do_ircset"; /* Cronel, IRC */
+    if ( skill == do_irclink )		return "do_irclink"; /* Cronel, IRC */
     if ( skill == do_installarea )	return "do_installarea";
     if ( skill == do_instaroom )	return "do_instaroom";
     if ( skill == do_instazone )	return "do_instazone";
@@ -1232,7 +1239,6 @@
     if ( skill == do_rignore )		return "do_rignore";
     if ( skill == do_rinfo )		return "do_rinfo";
 #endif
-    if ( skill == do_rip )		return "do_rip";
     if ( skill == do_rlist )		return "do_rlist";
     if ( skill == do_rmenu )		return "do_rmenu";
     if ( skill == do_rolldie )		return "do_rolldie";