Index: protocols/msn/ns.c
===================================================================
--- protocols/msn/ns.c	(revision 21d48d977b35d35d0ad86b3ccd051dae0d1fe055)
+++ protocols/msn/ns.c	(revision d84e2a93feae8db909dfbe63b55066cb4e8160dc)
@@ -229,24 +229,17 @@
 			}
 		}
-		else if( num_parts >= 7 && strcmp( cmd[2], "OK" ) == 0 )
+		else if( num_parts == 7 && strcmp( cmd[2], "OK" ) == 0 )
 		{
 			set_t *s;
 			
-			if( num_parts == 7 )
-			{
-				http_decode( cmd[4] );
-				
-				strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) );
-				ic->displayname[sizeof(ic->displayname)-1] = 0;
-				
-				if( ( s = set_find( &ic->acc->set, "display_name" ) ) )
-				{
-					g_free( s->value );
-					s->value = g_strdup( cmd[4] );
-				}
-			}
-			else
-			{
-				imcb_log( ic, "Warning: Friendly name in server response was corrupted" );
+			http_decode( cmd[4] );
+			
+			strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) );
+			ic->displayname[sizeof(ic->displayname)-1] = 0;
+			
+			if( ( s = set_find( &ic->acc->set, "display_name" ) ) )
+			{
+				g_free( s->value );
+				s->value = g_strdup( cmd[4] );
 			}
 			
@@ -427,10 +420,9 @@
 		{
 			/* FIXME: Warn/Bomb about unknown away state? */
-			st = msn_away_state_list + 1;
-		}
-		
-		imcb_buddy_status( ic, cmd[3], OPT_LOGGED_IN | 
-		                   ( st != msn_away_state_list ? OPT_AWAY : 0 ),
-		                   st->name, NULL );
+			st = msn_away_state_list;
+		}
+		
+		imcb_buddy_status( ic, cmd[3], OPT_LOGGED_IN |
+		                   ( st->number ? OPT_AWAY : 0 ), st->name, NULL );
 	}
 	else if( strcmp( cmd[0], "FLN" ) == 0 )
@@ -457,10 +449,9 @@
 		{
 			/* FIXME: Warn/Bomb about unknown away state? */
-			st = msn_away_state_list + 1;
-		}
-		
-		imcb_buddy_status( ic, cmd[2], OPT_LOGGED_IN | 
-		                   ( st != msn_away_state_list ? OPT_AWAY : 0 ),
-		                   st->name, NULL );
+			st = msn_away_state_list;
+		}
+		
+		imcb_buddy_status( ic, cmd[2], OPT_LOGGED_IN |
+		                   ( st->number ? OPT_AWAY : 0 ), st->name, NULL );
 	}
 	else if( strcmp( cmd[0], "RNG" ) == 0 )
@@ -672,6 +663,6 @@
 				}
 				
-				g_free( arg1 );
-				g_free( mtype );
+				if( arg1 ) g_free( arg1 );
+				if( mtype ) g_free( mtype );
 			}
 			else if( g_strncasecmp( ct, "text/x-msmsgsprofile", 20 ) == 0 )
@@ -681,28 +672,23 @@
 			else if( g_strncasecmp( ct, "text/x-msmsgsinitialemailnotification", 37 ) == 0 )
 			{
-				if( set_getbool( &ic->acc->set, "mail_notifications" ) )
+				char *inbox = msn_findheader( body, "Inbox-Unread:", blen );
+				char *folders = msn_findheader( body, "Folders-Unread:", blen );
+				
+				if( inbox && folders && set_getbool( &ic->acc->set, "mail_notifications" ) )
 				{
-					char *inbox = msn_findheader( body, "Inbox-Unread:", blen );
-					char *folders = msn_findheader( body, "Folders-Unread:", blen );
-
-					if( inbox && folders )
-						imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
-					
-					g_free( inbox );
-					g_free( folders );
+					imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders );
 				}
+				
+				g_free( inbox );
+				g_free( folders );
 			}
 			else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 )
 			{
-				if( set_getbool( &ic->acc->set, "mail_notifications" ) )
+				char *from = msn_findheader( body, "From-Addr:", blen );
+				char *fromname = msn_findheader( body, "From:", blen );
+				
+				if( from && fromname && set_getbool( &ic->acc->set, "mail_notifications" ) )
 				{
-					char *from = msn_findheader( body, "From-Addr:", blen );
-					char *fromname = msn_findheader( body, "From:", blen );
-					
-					if( from && fromname )
-						imcb_log( ic, "Received an e-mail message from %s <%s>.", fromname, from );
-
-					g_free( from );
-					g_free( fromname );
+					imcb_log( ic, "Received an e-mail message from %s <%s>.", fromname, from );
 				}
 			}
