Index: .bzrignore
===================================================================
--- .bzrignore	(revision b135438c4c6aeb5a7cd3403f0cf37e741d589cd3)
+++ .bzrignore	(revision c998255d6aa501281c6266a5f1dce69d4c3afab4)
@@ -3,2 +3,3 @@
 bitlbee
 debian
+tags
Index: protocols/jabber/jabber.c
===================================================================
--- protocols/jabber/jabber.c	(revision b135438c4c6aeb5a7cd3403f0cf37e741d589cd3)
+++ protocols/jabber/jabber.c	(revision c998255d6aa501281c6266a5f1dce69d4c3afab4)
@@ -2436,4 +2436,5 @@
 	ret->alias_buddy = jabber_roster_update;
 	ret->group_buddy = jabber_group_change;
+	ret->cmp_buddynames = g_strcasecmp;
 
 	register_protocol (ret);
Index: protocols/msn/msn.c
===================================================================
--- protocols/msn/msn.c	(revision b135438c4c6aeb5a7cd3403f0cf37e741d589cd3)
+++ protocols/msn/msn.c	(revision c998255d6aa501281c6266a5f1dce69d4c3afab4)
@@ -397,4 +397,5 @@
 	ret->rem_deny = msn_rem_deny;
 	ret->send_typing = msn_send_typing;
+	ret->cmp_buddynames = g_strcasecmp;
 
 	register_protocol(ret);
Index: protocols/nogaim.c
===================================================================
--- protocols/nogaim.c	(revision b135438c4c6aeb5a7cd3403f0cf37e741d589cd3)
+++ protocols/nogaim.c	(revision c998255d6aa501281c6266a5f1dce69d4c3afab4)
@@ -224,42 +224,4 @@
 	return( NULL );
 }
-
-/* Compare two handles for a specific protocol. For most protocols,
-   g_strcasecmp is okay, but for AIM, for example, it's not. This really
-   should be a compare function inside the PRPL module, but I do it this
-   way for now because I don't want to touch the Gaim code too much since
-   it's not going to be here for too long anymore. */
-int handle_cmp( char *a, char *b, struct prpl *protocol )
-{
-	if( !strcmp(protocol->name, "oscar") )
-	{
-		/* AIM, being teh evil, thinks it's cool that users can put
-		   random spaces in screennames. But "A B" and "AB" are
-		   equal. Hrmm, okay. */
-		while( 1 )
-		{
-			while( *a == ' ' ) a ++;
-			while( *b == ' ' ) b ++;
-			
-			if( *a && *b )
-			{
-				if( tolower( *a ) != tolower( *b ) )
-					return( 1 );
-			}
-			else if( *a || *b )
-				return( 1 );
-			else
-				return( 0 );
-			
-			a ++;
-			b ++;
-		}
-	}
-	else
-	{
-		return( g_strcasecmp( a, b ) );
-	}
-}
-
 
 /* multi.c */
@@ -897,5 +859,5 @@
 	
 	/* It might be yourself! */
-	if( handle_cmp ( handle, b->gc->user->username, b->gc->prpl ) == 0 )
+	if( b->gc->prpl->cmp_buddynames( handle, b->gc->user->username ) == 0 )
 	{
 		u = user_find( b->gc->irc, b->gc->irc->nick );
Index: protocols/nogaim.h
===================================================================
--- protocols/nogaim.h	(revision b135438c4c6aeb5a7cd3403f0cf37e741d589cd3)
+++ protocols/nogaim.h	(revision c998255d6aa501281c6266a5f1dce69d4c3afab4)
@@ -242,4 +242,6 @@
 
 	char *(* get_status_string) (struct gaim_connection *gc, int stat);
+
+	int (* cmp_buddynames) (const char *who1, const char *who2);
 };
 
@@ -266,5 +268,4 @@
 int proto_away( struct gaim_connection *gc, char *away );
 char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value );
-int handle_cmp( char *a, char *b, struct prpl *protocol );
 
 gboolean auto_reconnect( gpointer data );
Index: protocols/oscar/auth.c
===================================================================
--- protocols/oscar/auth.c	(revision b135438c4c6aeb5a7cd3403f0cf37e741d589cd3)
+++ protocols/oscar/auth.c	(revision c998255d6aa501281c6266a5f1dce69d4c3afab4)
@@ -352,15 +352,9 @@
 {
 	guint8 encoding_table[] = {
-#if 0 /* old v1 table */
-		0xf3, 0xb3, 0x6c, 0x99,
-		0x95, 0x3f, 0xac, 0xb6,
-		0xc5, 0xfa, 0x6b, 0x63,
-		0x69, 0x6c, 0xc3, 0x9f
-#else /* v2.1 table, also works for ICQ */
+	/* v2.1 table, also works for ICQ */
 		0xf3, 0x26, 0x81, 0xc4,
 		0x39, 0x86, 0xdb, 0x92,
 		0x71, 0xa3, 0xb9, 0xe6,
 		0x53, 0x7a, 0x95, 0x7c
-#endif
 	};
 	int i;
Index: protocols/oscar/oscar.c
===================================================================
--- protocols/oscar/oscar.c	(revision b135438c4c6aeb5a7cd3403f0cf37e741d589cd3)
+++ protocols/oscar/oscar.c	(revision c998255d6aa501281c6266a5f1dce69d4c3afab4)
@@ -1208,9 +1208,5 @@
 	return 1;
 }
-/*
-int handle_cmp_aim(const char * a, const char * b) {
-	return handle_cmp(a, b, PROTO_TOC);
-}
-*/
+
 static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) {
 	int channel, ret = 0;
@@ -2484,4 +2480,5 @@
 	ret->set_permit_deny = oscar_set_permit_deny;
 	ret->keepalive = oscar_keepalive;
+	ret->cmp_buddynames = aim_sncmp;
 	ret->get_status_string = oscar_get_status_string;
 
Index: protocols/oscar/oscar_util.c
===================================================================
--- protocols/oscar/oscar_util.c	(revision b135438c4c6aeb5a7cd3403f0cf37e741d589cd3)
+++ protocols/oscar/oscar_util.c	(revision c998255d6aa501281c6266a5f1dce69d4c3afab4)
@@ -1,8 +1,2 @@
-/*
- *
- *
- *
- */
-
 #include <aim.h>
 #include <ctype.h>
Index: protocols/oscar/tlv.c
===================================================================
--- protocols/oscar/tlv.c	(revision b135438c4c6aeb5a7cd3403f0cf37e741d589cd3)
+++ protocols/oscar/tlv.c	(revision c998255d6aa501281c6266a5f1dce69d4c3afab4)
@@ -1,12 +1,6 @@
 #include <aim.h>
 
-static aim_tlv_t *createtlv(void)
-{
-	return g_new0(aim_tlv_t, 1);
-}
-
 static void freetlv(aim_tlv_t **oldtlv)
 {
-
 	if (!oldtlv || !*oldtlv)
 		return;
@@ -15,6 +9,4 @@
 	g_free(*oldtlv);
 	*oldtlv = NULL;
-
-	return;
 }
 
@@ -46,31 +38,13 @@
 		length = aimbs_get16(bs);
 
-#if 0 /* temporarily disabled until I know if they're still doing it or not */
-		/*
-		 * Okay, so now AOL has decided that any TLV of
-		 * type 0x0013 can only be two bytes, despite
-		 * what the actual given length is.  So here 
-		 * we dump any invalid TLVs of that sort.  Hopefully
-		 * theres no special cases to this special case.
-		 *   - mid (30jun2000)
-		 */
-		if ((type == 0x0013) && (length != 0x0002))
-			length = 0x0002;
-#else
-		if (0)
-			;
-#endif
-		else {
-
-			cur = g_new0(aim_tlvlist_t, 1);
-
-			cur->tlv = createtlv();	
-			cur->tlv->type = type;
-			if ((cur->tlv->length = length))
-			       cur->tlv->value = aimbs_getraw(bs, length);	
-
-			cur->next = list;
-			list = cur;
-		}
+		cur = g_new0(aim_tlvlist_t, 1);
+
+		cur->tlv = g_new0(aim_tlv_t, 1);
+		cur->tlv->type = type;
+		if ((cur->tlv->length = length))
+			cur->tlv->value = aimbs_getraw(bs, length);	
+
+		cur->next = list;
+		list = cur;
 	}
 
@@ -173,5 +147,5 @@
 		return 0;
 
-	if (!(newtlv->tlv = createtlv())) {
+	if (!(newtlv->tlv = g_new0(aim_tlv_t, 1))) {
 		g_free(newtlv);
 		return 0;
Index: protocols/yahoo/yahoo.c
===================================================================
--- protocols/yahoo/yahoo.c	(revision b135438c4c6aeb5a7cd3403f0cf37e741d589cd3)
+++ protocols/yahoo/yahoo.c	(revision c998255d6aa501281c6266a5f1dce69d4c3afab4)
@@ -411,4 +411,5 @@
 	ret->chat_leave = byahoo_chat_leave;
 	ret->chat_open = byahoo_chat_open;
+	ret->cmp_buddynames = g_strcasecmp;
 	
 	register_protocol(ret);
Index: user.c
===================================================================
--- user.c	(revision b135438c4c6aeb5a7cd3403f0cf37e741d589cd3)
+++ user.c	(revision c998255d6aa501281c6266a5f1dce69d4c3afab4)
@@ -146,5 +146,5 @@
 	while( u )
 	{
-		if( u->gc == gc && u->handle && handle_cmp( u->handle, handle, gc->prpl) == 0 )
+		if( u->gc == gc && u->handle && gc->prpl->cmp_buddynames ( u->handle, handle ) == 0 )
 			break;
 		u = u->next;
