Index: protocols/msn/msn.h
===================================================================
--- protocols/msn/msn.h	(revision 080c43a862bca535e51682423afc9d0f75ea1d02)
+++ protocols/msn/msn.h	(revision 79bb7e412d28e8afe734762e8bd3e4c488a53562)
@@ -2,5 +2,5 @@
   * BitlBee -- An IRC to other IM-networks gateway                     *
   *                                                                    *
-  * Copyright 2002-2010 Wilmer van der Gaast and others                *
+  * Copyright 2002-2012 Wilmer van der Gaast and others                *
   \********************************************************************/
 
@@ -253,4 +253,5 @@
 struct msn_group *msn_group_by_id( struct im_connection *ic, const char *id );
 int msn_ns_set_display_name( struct im_connection *ic, const char *value );
+const char *msn_normalize_handle( const char *handle );
 
 /* tables.c */
@@ -263,5 +264,5 @@
 int msn_sb_write( struct msn_switchboard *sb, const char *fmt, ... ) G_GNUC_PRINTF( 2, 3 );;
 struct msn_switchboard *msn_sb_create( struct im_connection *ic, char *host, int port, char *key, int session );
-struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle );
+struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, const char *handle );
 struct msn_switchboard *msn_sb_by_chat( struct groupchat *c );
 struct msn_switchboard *msn_sb_spare( struct im_connection *ic );
Index: protocols/msn/msn_util.c
===================================================================
--- protocols/msn/msn_util.c	(revision 080c43a862bca535e51682423afc9d0f75ea1d02)
+++ protocols/msn/msn_util.c	(revision 79bb7e412d28e8afe734762e8bd3e4c488a53562)
@@ -2,5 +2,5 @@
   * BitlBee -- An IRC to other IM-networks gateway                     *
   *                                                                    *
-  * Copyright 2002-2010 Wilmer van der Gaast and others                *
+  * Copyright 2002-2012 Wilmer van der Gaast and others                *
   \********************************************************************/
 
@@ -537,2 +537,10 @@
 	return msn_ns_write( ic, -1, "PRP %d MFN %s\r\n", ++md->trId, fn );
 }
+
+const char *msn_normalize_handle( const char *handle )
+{
+	if( strncmp( handle, "1:", 2 ) == 0 )
+		return handle + 2;
+	else
+		return handle;
+}
Index: protocols/msn/ns.c
===================================================================
--- protocols/msn/ns.c	(revision 080c43a862bca535e51682423afc9d0f75ea1d02)
+++ protocols/msn/ns.c	(revision 79bb7e412d28e8afe734762e8bd3e4c488a53562)
@@ -372,7 +372,9 @@
 		return st;
 	}
-	else if( strcmp( cmd[0], "ILN" ) == 0 )
+	else if( strcmp( cmd[0], "ILN" ) == 0 || strcmp( cmd[0], "NLN" ) == 0 )
 	{
 		const struct msn_away_state *st;
+		const char *handle;
+		int cap = 0;
 		
 		if( num_parts < 6 )
@@ -382,9 +384,20 @@
 			return( 0 );
 		}
-		
-		http_decode( cmd[5] );
-		imcb_rename_buddy( ic, cmd[3], cmd[5] );
-		
-		st = msn_away_state_by_code( cmd[2] );
+		/* ILN and NLN are more or less the same, except ILN has a trId
+		   at the start, and NLN has a capability field at the end. 
+		   Does ILN still exist BTW? */
+		if( cmd[0][1] == 'I' )
+			cmd ++;
+		else
+			cap = atoi( cmd[4] );
+
+		handle = msn_normalize_handle( cmd[2] );
+		if( strcmp( handle, ic->acc->user ) == 0 )
+			return 1; /* That's me! */
+		
+		http_decode( cmd[3] );
+		imcb_rename_buddy( ic, handle, cmd[3] );
+		
+		st = msn_away_state_by_code( cmd[1] );
 		if( !st )
 		{
@@ -393,46 +406,21 @@
 		}
 		
-		imcb_buddy_status( ic, cmd[3], OPT_LOGGED_IN | 
-		                   ( st != msn_away_state_list ? OPT_AWAY : 0 ),
-		                   st->name, NULL );
-	}
-	else if( strcmp( cmd[0], "FLN" ) == 0 )
-	{
-		if( cmd[1] == NULL )
-			return 1;
-		
-		imcb_buddy_status( ic, cmd[1], 0, NULL, NULL );
-		
-		msn_sb_start_keepalives( msn_sb_by_handle( ic, cmd[1] ), TRUE );
-	}
-	else if( strcmp( cmd[0], "NLN" ) == 0 )
-	{
-		const struct msn_away_state *st;
-		int cap;
-		
-		if( num_parts < 6 )
-		{
-			imcb_error( ic, "Syntax error" );
-			imc_logout( ic, TRUE );
-			return( 0 );
-		}
-		
-		http_decode( cmd[4] );
-		cap = atoi( cmd[5] );
-		imcb_rename_buddy( ic, cmd[2], cmd[4] );
-		
-		st = msn_away_state_by_code( cmd[1] );
-		if( !st )
-		{
-			/* FIXME: Warn/Bomb about unknown away state? */
-			st = msn_away_state_list + 1;
-		}
-		
-		imcb_buddy_status( ic, cmd[2], OPT_LOGGED_IN | 
+		imcb_buddy_status( ic, handle, OPT_LOGGED_IN | 
 		                   ( st != msn_away_state_list ? OPT_AWAY : 0 ) |
 		                   ( cap & 1 ? OPT_MOBILE : 0 ),
 		                   st->name, NULL );
 		
-		msn_sb_stop_keepalives( msn_sb_by_handle( ic, cmd[2] ) );
+		msn_sb_stop_keepalives( msn_sb_by_handle( ic, handle ) );
+	}
+	else if( strcmp( cmd[0], "FLN" ) == 0 )
+	{
+		const char *handle;
+		
+		if( cmd[1] == NULL )
+			return 1;
+		
+		handle = msn_normalize_handle( cmd[1] );
+		imcb_buddy_status( ic, handle, 0, NULL, NULL );
+		msn_sb_start_keepalives( msn_sb_by_handle( ic, handle ), TRUE );
 	}
 	else if( strcmp( cmd[0], "RNG" ) == 0 )
@@ -481,5 +469,5 @@
 		else
 		{
-			sb->who = g_strdup( cmd[5] );
+			sb->who = g_strdup( msn_normalize_handle( cmd[5] ) );
 		}
 	}
@@ -707,5 +695,5 @@
 			psm_text = psm->text;
 		
-		imcb_buddy_status_msg( ic, cmd[1], psm_text );
+		imcb_buddy_status_msg( ic, msn_normalize_handle( cmd[1] ), psm_text );
 		xt_free_node( ubx );
 	}
Index: protocols/msn/sb.c
===================================================================
--- protocols/msn/sb.c	(revision 080c43a862bca535e51682423afc9d0f75ea1d02)
+++ protocols/msn/sb.c	(revision 79bb7e412d28e8afe734762e8bd3e4c488a53562)
@@ -2,5 +2,5 @@
   * BitlBee -- An IRC to other IM-networks gateway                     *
   *                                                                    *
-  * Copyright 2002-2010 Wilmer van der Gaast and others                *
+  * Copyright 2002-2012 Wilmer van der Gaast and others                *
   \********************************************************************/
 
@@ -122,5 +122,5 @@
 }
 
-struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, char *handle )
+struct msn_switchboard *msn_sb_by_handle( struct im_connection *ic, const char *handle )
 {
 	struct msn_data *md = ic->proto_data;
