Index: ipc.c
===================================================================
--- ipc.c	(revision dd95ce431b5c85eb6d74e501a7796e8a6016ec70)
+++ ipc.c	(revision e277e80022e9cad3f7a3dbadbc25a6a2da9bf40d)
@@ -152,5 +152,5 @@
 		old = l->data;
 		if( child != old &&
-		    old->nick && nick_cmp( old->nick, child->nick ) == 0 &&
+		    old->nick && nick_cmp( NULL, old->nick, child->nick ) == 0 &&
 		    old->password && strcmp( old->password, child->password ) == 0 )
 			break;
@@ -298,5 +298,5 @@
 		return;
 	
-	if( nick_cmp( cmd[1], irc->user->nick ) != 0 )
+	if( nick_cmp( NULL, cmd[1], irc->user->nick ) != 0 )
 		return;		/* It's not for us. */
 	
Index: irc_commands.c
===================================================================
--- irc_commands.c	(revision dd95ce431b5c85eb6d74e501a7796e8a6016ec70)
+++ irc_commands.c	(revision e277e80022e9cad3f7a3dbadbc25a6a2da9bf40d)
@@ -80,5 +80,5 @@
 		irc_send_num( irc, 433, "%s :This nick is already in use", cmd[1] );
 	}
-	else if( !nick_ok( cmd[1] ) )
+	else if( !nick_ok( NULL, cmd[1] ) )
 	{
 		/* [SH] Invalid characters. */
@@ -291,5 +291,5 @@
 	else
 	{
-		if( nick_cmp( cmd[1], irc->user->nick ) == 0 )
+		if( nick_cmp( NULL, cmd[1], irc->user->nick ) == 0 )
 		{
 			if( cmd[2] )
@@ -392,5 +392,5 @@
 	/* At least for now just echo. IIRC some IRC clients use self-notices
 	   for lag checks, so try to support that. */
-	if( nick_cmp( cmd[1], irc->user->nick ) == 0 )
+	if( nick_cmp( NULL, cmd[1], irc->user->nick ) == 0 )
 		irc_send_msg( irc->user, "NOTICE", irc->user->nick, cmd[2], NULL );
 	else if( ( iu = irc_user_by_name( irc, cmd[1] ) ) )
@@ -593,5 +593,5 @@
 		
 		nick = g_strdup( cmd[i] + 1 );
-		nick_lc( nick );
+		nick_lc( irc, nick );
 		
 		iu = irc_user_by_name( irc, nick );
Index: irc_im.c
===================================================================
--- irc_im.c	(revision dd95ce431b5c85eb6d74e501a7796e8a6016ec70)
+++ irc_im.c	(revision e277e80022e9cad3f7a3dbadbc25a6a2da9bf40d)
@@ -697,5 +697,5 @@
 	irc_channel_name_strip( stripped );
 	if( set_getbool( &bee->set, "lcnicks" ) )
-		nick_lc( stripped );
+		nick_lc( irc, stripped );
 	
 	if( stripped[0] == '\0' )
Index: irc_user.c
===================================================================
--- irc_user.c	(revision dd95ce431b5c85eb6d74e501a7796e8a6016ec70)
+++ irc_user.c	(revision e277e80022e9cad3f7a3dbadbc25a6a2da9bf40d)
@@ -36,5 +36,5 @@
 	
 	iu->key = g_strdup( nick );
-	nick_lc( iu->key );
+	nick_lc( irc, iu->key );
 	/* Using the hash table for speed and irc->users for easy iteration
 	   through the list (since the GLib API doesn't have anything sane
@@ -107,5 +107,5 @@
 	
 	strcpy( key, nick );
-	if( nick_lc( key ) )
+	if( nick_lc( irc, key ) )
 		return g_hash_table_lookup( irc->nick_user_hash, key );
 	else
@@ -121,5 +121,5 @@
 	
 	strcpy( key, new );
-	if( iu == NULL || !nick_lc( key ) ||
+	if( iu == NULL || !nick_lc( irc, key ) ||
 	    ( ( new_iu = irc_user_by_name( irc, new ) ) && new_iu != iu ) )
 		return 0;
Index: nick.c
===================================================================
--- nick.c	(revision dd95ce431b5c85eb6d74e501a7796e8a6016ec70)
+++ nick.c	(revision e277e80022e9cad3f7a3dbadbc25a6a2da9bf40d)
@@ -51,9 +51,10 @@
 {
 	char *store_handle, *store_nick = g_malloc( MAX_NICK_LENGTH + 1 );
+	irc_t *irc = (irc_t *) acc->bee->ui_data;
 	
 	store_handle = clean_handle( handle );
 	store_nick[MAX_NICK_LENGTH] = '\0';
 	strncpy( store_nick, nick, MAX_NICK_LENGTH );
-	nick_strip( store_nick );
+	nick_strip( irc, store_nick );
 	
 	g_hash_table_replace( acc->nicks, store_handle, store_nick );
@@ -69,4 +70,5 @@
 	static char nick[MAX_NICK_LENGTH+1];
 	char *store_handle, *found_nick;
+	irc_t *irc = (irc_t *) bu->bee->ui_data;
 	
 	memset( nick, 0, MAX_NICK_LENGTH + 1 );
@@ -94,7 +96,7 @@
 				*(s++) = 0;
 		
-		nick_strip( nick );
+		nick_strip( irc, nick );
 		if( set_getbool( &bu->bee->set, "lcnicks" ) )
-			nick_lc( nick );
+			nick_lc( irc, nick );
 	}
 	g_free( store_handle );
@@ -230,5 +232,5 @@
 	/* Now, find out if the nick is already in use at the moment, and make
 	   subtle changes to make it unique. */
-	while( !nick_ok( nick ) ||
+	while( !nick_ok( irc, nick ) ||
 	       ( ( iu = irc_user_by_name( irc, nick ) ) && iu->bu != bu ) )
 	{
@@ -287,5 +289,5 @@
 
 
-void nick_strip( char *nick )
+void nick_strip( irc_t *irc, char *nick )
 {
 	int i, j;
@@ -313,5 +315,5 @@
 }
 
-int nick_ok( const char *nick )
+int nick_ok( irc_t *irc, const char *nick )
 {
 	const char *s;
@@ -328,5 +330,5 @@
 }
 
-int nick_lc( char *nick )
+int nick_lc( irc_t *irc, char *nick )
 {
 	static char tab[128] = { 0 };
@@ -351,5 +353,5 @@
 }
 
-int nick_uc( char *nick )
+int nick_uc( irc_t *irc, char *nick )
 {
 	static char tab[128] = { 0 };
@@ -374,5 +376,5 @@
 }
 
-int nick_cmp( const char *a, const char *b )
+int nick_cmp( irc_t *irc, const char *a, const char *b )
 {
 	char aa[1024] = "", bb[1024] = "";
@@ -380,5 +382,5 @@
 	strncpy( aa, a, sizeof( aa ) - 1 );
 	strncpy( bb, b, sizeof( bb ) - 1 );
-	if( nick_lc( aa ) && nick_lc( bb ) )
+	if( nick_lc( irc, aa ) && nick_lc( irc, bb ) )
 	{
 		return( strcmp( aa, bb ) );
@@ -389,7 +391,2 @@
 	}
 }
-
-char *nick_dup( const char *nick )
-{
-	return g_strndup( nick, MAX_NICK_LENGTH );
-}
Index: nick.h
===================================================================
--- nick.h	(revision dd95ce431b5c85eb6d74e501a7796e8a6016ec70)
+++ nick.h	(revision e277e80022e9cad3f7a3dbadbc25a6a2da9bf40d)
@@ -31,9 +31,9 @@
 int nick_saved( bee_user_t *bu );
 void nick_del( bee_user_t *bu );
-void nick_strip( char *nick );
 
-int nick_ok( const char *nick );
-int nick_lc( char *nick );
-int nick_uc( char *nick );
-int nick_cmp( const char *a, const char *b );
+void nick_strip( irc_t *irc, char *nick );
+int nick_ok( irc_t *irc, const char *nick );
+int nick_lc( irc_t *irc, char *nick );
+int nick_uc( irc_t *irc, char *nick );
+int nick_cmp( irc_t *irc, const char *a, const char *b );
 char *nick_dup( const char *nick );
Index: root_commands.c
===================================================================
--- root_commands.c	(revision dd95ce431b5c85eb6d74e501a7796e8a6016ec70)
+++ root_commands.c	(revision e277e80022e9cad3f7a3dbadbc25a6a2da9bf40d)
@@ -702,5 +702,5 @@
 	if( cmd[3] )
 	{
-		if( !nick_ok( cmd[3] ) )
+		if( !nick_ok( irc, cmd[3] ) )
 		{
 			irc_rootmsg( irc, "The requested nick `%s' is invalid", cmd[3] );
@@ -844,5 +844,5 @@
 		irc_rootmsg( irc, "Use /nick to change your own nickname" );
 	}
-	else if( !nick_ok( cmd[2] ) )
+	else if( !nick_ok( irc, cmd[2] ) )
 	{
 		irc_rootmsg( irc, "Nick `%s' is invalid", cmd[2] );
Index: storage_xml.c
===================================================================
--- storage_xml.c	(revision dd95ce431b5c85eb6d74e501a7796e8a6016ec70)
+++ storage_xml.c	(revision e277e80022e9cad3f7a3dbadbc25a6a2da9bf40d)
@@ -181,5 +181,5 @@
 	strncpy( xd->given_nick, my_nick, MAX_NICK_LENGTH );
 	xd->given_nick[MAX_NICK_LENGTH] = '\0';
-	nick_lc( xd->given_nick );
+	nick_lc( NULL, xd->given_nick );
 	xd->given_pass = (char*) password;
 	
@@ -368,5 +368,5 @@
 	
 	path2 = g_strdup( irc->user->nick );
-	nick_lc( path2 );
+	nick_lc( NULL, path2 );
 	g_snprintf( path, sizeof( path ) - 20, "%s%s%s", global.conf->configdir, path2, ".xml" );
 	g_free( path2 );
@@ -424,5 +424,5 @@
 
 	lc = g_strdup( nick );
-	nick_lc( lc );
+	nick_lc( NULL, lc );
 	g_snprintf( s, 511, "%s%s%s", global.conf->configdir, lc, ".xml" );
 	g_free( lc );
