Index: protocols/msn/msn.h
===================================================================
--- protocols/msn/msn.h	(revision 9f958f794a1710f17eaae79c64f90f1f66134094)
+++ protocols/msn/msn.h	(revision 164352ef9d3e8b4b2eea8ec64c3b4590b2388b18)
@@ -234,5 +234,4 @@
 int msn_buddy_list_remove( struct im_connection *ic, msn_buddy_flags_t list, const char *who, const char *group );
 void msn_buddy_ask( bee_user_t *bu );
-char *msn_findheader( char *text, char *header, int len );
 char **msn_linesplit( char *line );
 int msn_handler( struct msn_handler_data *h );
Index: protocols/msn/msn_util.c
===================================================================
--- protocols/msn/msn_util.c	(revision 9f958f794a1710f17eaae79c64f90f1f66134094)
+++ protocols/msn/msn_util.c	(revision 164352ef9d3e8b4b2eea8ec64c3b4590b2388b18)
@@ -226,56 +226,4 @@
 	            bu->handle, bu->fullname );
 	imcb_ask( bu->ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );
-}
-
-char *msn_findheader( char *text, char *header, int len )
-{
-	int hlen = strlen( header ), i;
-	char *ret;
-	
-	if( len == 0 )
-		len = strlen( text );
-	
-	i = 0;
-	while( ( i + hlen ) < len )
-	{
-		/* Maybe this is a bit over-commented, but I just hate this part... */
-		if( g_strncasecmp( text + i, header, hlen ) == 0 )
-		{
-			/* Skip to the (probable) end of the header */
-			i += hlen;
-			
-			/* Find the first non-[: \t] character */
-			while( i < len && ( text[i] == ':' || text[i] == ' ' || text[i] == '\t' ) ) i ++;
-			
-			/* Make sure we're still inside the string */
-			if( i >= len ) return( NULL );
-			
-			/* Save the position */
-			ret = text + i;
-			
-			/* Search for the end of this line */
-			while( i < len && text[i] != '\r' && text[i] != '\n' ) i ++;
-			
-			/* Make sure we're still inside the string */
-			if( i >= len ) return( NULL );
-			
-			/* Copy the found data */
-			return( g_strndup( ret, text + i - ret ) );
-		}
-		
-		/* This wasn't the header we were looking for, skip to the next line. */
-		while( i < len && ( text[i] != '\r' && text[i] != '\n' ) ) i ++;
-		while( i < len && ( text[i] == '\r' || text[i] == '\n' ) ) i ++;
-		
-		/* End of headers? */
-		if( ( i >= 4 && strncmp( text + i - 4, "\r\n\r\n", 4 ) == 0 ) ||
-		    ( i >= 2 && ( strncmp( text + i - 2, "\n\n", 2 ) == 0 ||   
-		                  strncmp( text + i - 2, "\r\r", 2 ) == 0 ) ) )
-		{
-			break;
-		}
-	}
-	
-	return( NULL );
 }
 
Index: protocols/msn/ns.c
===================================================================
--- protocols/msn/ns.c	(revision 9f958f794a1710f17eaae79c64f90f1f66134094)
+++ protocols/msn/ns.c	(revision 164352ef9d3e8b4b2eea8ec64c3b4590b2388b18)
@@ -609,5 +609,5 @@
 		if( g_strcasecmp( cmd[1], "Hotmail" ) == 0 )
 		{
-			char *ct = msn_findheader( msg, "Content-Type:", msglen );
+			char *ct = get_rfc822_header( msg, "Content-Type:", msglen );
 			
 			if( !ct )
@@ -622,6 +622,6 @@
 					return( 1 );
 				
-				mtype = msn_findheader( body, "Type:", blen );
-				arg1 = msn_findheader( body, "Arg1:", blen );
+				mtype = get_rfc822_header( body, "Type:", blen );
+				arg1 = get_rfc822_header( body, "Arg1:", blen );
 				
 				if( mtype && strcmp( mtype, "1" ) == 0 )
@@ -642,6 +642,6 @@
 				if( set_getbool( &ic->acc->set, "mail_notifications" ) )
 				{
-					char *inbox = msn_findheader( body, "Inbox-Unread:", blen );
-					char *folders = msn_findheader( body, "Folders-Unread:", blen );
+					char *inbox = get_rfc822_header( body, "Inbox-Unread:", blen );
+					char *folders = get_rfc822_header( body, "Folders-Unread:", blen );
 
 					if( inbox && folders )
@@ -656,6 +656,6 @@
 				if( set_getbool( &ic->acc->set, "mail_notifications" ) )
 				{
-					char *from = msn_findheader( body, "From-Addr:", blen );
-					char *fromname = msn_findheader( body, "From:", blen );
+					char *from = get_rfc822_header( body, "From-Addr:", blen );
+					char *fromname = get_rfc822_header( body, "From:", blen );
 					
 					if( from && fromname )
Index: protocols/msn/sb.c
===================================================================
--- protocols/msn/sb.c	(revision 9f958f794a1710f17eaae79c64f90f1f66134094)
+++ protocols/msn/sb.c	(revision 164352ef9d3e8b4b2eea8ec64c3b4590b2388b18)
@@ -682,5 +682,5 @@
 	if( strcmp( cmd[0], "MSG" ) == 0 )
 	{
-		char *ct = msn_findheader( msg, "Content-Type:", msglen );
+		char *ct = get_rfc822_header( msg, "Content-Type:", msglen );
 		
 		if( !ct )
@@ -711,6 +711,6 @@
 		else if( g_strncasecmp( ct, "text/x-msmsgsinvite", 19 ) == 0 )
 		{
-			char *command = msn_findheader( body, "Invitation-Command:", blen );
-			char *cookie = msn_findheader( body, "Invitation-Cookie:", blen );
+			char *command = get_rfc822_header( body, "Invitation-Command:", blen );
+			char *cookie = get_rfc822_header( body, "Invitation-Cookie:", blen );
 			unsigned int icookie;
 			
@@ -750,5 +750,5 @@
 		else if( g_strncasecmp( ct, "text/x-msmsgscontrol", 20 ) == 0 )
 		{
-			char *who = msn_findheader( msg, "TypingUser:", msglen );
+			char *who = get_rfc822_header( msg, "TypingUser:", msglen );
 			
 			if( who )
