Index: protocols/msn/msn_util.c
===================================================================
--- protocols/msn/msn_util.c	(revision 193dc742d357bb604fff8921417c74ddf9e8729c)
+++ protocols/msn/msn_util.c	(revision 6ddb2236943384d45cacd08e02cb4ef9ed03bba3)
@@ -147,4 +147,6 @@
 		return msn_write( ic, buf, strlen( buf ) );
 	}
+	
+	return 1;
 }
 
@@ -188,5 +190,5 @@
 	}
 	
-	return( 0 );
+	return 1;
 }
 
Index: protocols/msn/soap.c
===================================================================
--- protocols/msn/soap.c	(revision 193dc742d357bb604fff8921417c74ddf9e8729c)
+++ protocols/msn/soap.c	(revision 6ddb2236943384d45cacd08e02cb4ef9ed03bba3)
@@ -145,4 +145,22 @@
 		g_free( soap_req );
 	}
+}
+
+static char *msn_soap_abservice_build( const char *body_fmt, const char *scenario, const char *ticket, ... )
+{
+	va_list params;
+	char *ret, *format, *body;
+	
+	format = g_markup_printf_escaped( SOAP_ABSERVICE_PAYLOAD, scenario, ticket );
+	
+	va_start( params, ticket );
+	body = g_strdup_vprintf( body_fmt, params );
+	va_end( params );
+	
+	ret = g_strdup_printf( format, body );
+	g_free( body );
+	g_free( format );
+	
+	return ret;
 }
 
@@ -445,5 +463,5 @@
 	soap_req->url = g_strdup( SOAP_MEMLIST_URL );
 	soap_req->action = g_strdup( SOAP_MEMLIST_ACTION );
-	soap_req->payload = g_markup_printf_escaped( SOAP_MEMLIST_PAYLOAD, md->tokens[1] );
+	soap_req->payload = msn_soap_abservice_build( SOAP_MEMLIST_PAYLOAD, "Initial", md->tokens[1] );
 	
 	return 1;
@@ -562,5 +580,5 @@
 		break;
 	}
-	soap_req->payload = g_markup_printf_escaped( SOAP_MEMLIST_EDIT_PAYLOAD,
+	soap_req->payload = msn_soap_abservice_build( SOAP_MEMLIST_EDIT_PAYLOAD,
 		scenario, md->tokens[1], add, list, med->handle, add );
 	
@@ -607,5 +625,5 @@
 	soap_req->url = g_strdup( SOAP_ADDRESSBOOK_URL );
 	soap_req->action = g_strdup( SOAP_ADDRESSBOOK_ACTION );
-	soap_req->payload = g_markup_printf_escaped( SOAP_ADDRESSBOOK_PAYLOAD, md->tokens[1] );
+	soap_req->payload = msn_soap_abservice_build( SOAP_ADDRESSBOOK_PAYLOAD, "Initial", md->tokens[1] );
 	
 	return 1;
@@ -706,6 +724,6 @@
 	soap_req->url = g_strdup( SOAP_ADDRESSBOOK_URL );
 	soap_req->action = g_strdup( SOAP_AB_NAMECHANGE_ACTION );
-	soap_req->payload = g_markup_printf_escaped( SOAP_AB_NAMECHANGE_PAYLOAD,
-		md->tokens[1], (char *) soap_req->data );
+	soap_req->payload = msn_soap_abservice_build( SOAP_AB_NAMECHANGE_PAYLOAD,
+		"Initial", md->tokens[1], (char *) soap_req->data );
 	
 	return 1;
Index: protocols/msn/soap.h
===================================================================
--- protocols/msn/soap.h	(revision 193dc742d357bb604fff8921417c74ddf9e8729c)
+++ protocols/msn/soap.h	(revision 6ddb2236943384d45cacd08e02cb4ef9ed03bba3)
@@ -167,31 +167,5 @@
 
 
-#define SOAP_MEMLIST_URL "http://contacts.msn.com/abservice/SharingService.asmx"
-#define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership"
-
-#define SOAP_MEMLIST_PAYLOAD \
-"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
-"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
-  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
-    "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
-      "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \
-      "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>" \
-      "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">Initial</PartnerScenario>" \
-    "</ABApplicationHeader>" \
-    "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
-      "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>" \
-      "<TicketToken>%s</TicketToken>" \
-    "</ABAuthHeader>" \
-  "</soap:Header>" \
-  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
-    "<FindMembership xmlns=\"http://www.msn.com/webservices/AddressBook\"><serviceFilter xmlns=\"http://www.msn.com/webservices/AddressBook\"><Types xmlns=\"http://www.msn.com/webservices/AddressBook\"><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Messenger</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Invitation</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">SocialNetwork</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Space</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Profile</ServiceType></Types></serviceFilter>" \
-    "</FindMembership>" \
-  "</soap:Body>" \
-"</soap:Envelope>"
-
-#define SOAP_MEMLIST_ADD_ACTION "http://www.msn.com/webservices/AddressBook/AddMember"
-#define SOAP_MEMLIST_DEL_ACTION "http://www.msn.com/webservices/AddressBook/DeleteMember"
-
-#define SOAP_MEMLIST_EDIT_PAYLOAD \
+#define SOAP_ABSERVICE_PAYLOAD \
 "<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
 "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
@@ -208,4 +182,19 @@
   "</soap:Header>" \
   "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
+    "%%s" \
+  "</soap:Body>" \
+"</soap:Envelope>"
+
+#define SOAP_MEMLIST_URL "http://contacts.msn.com/abservice/SharingService.asmx"
+#define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership"
+
+#define SOAP_MEMLIST_PAYLOAD \
+    "<FindMembership xmlns=\"http://www.msn.com/webservices/AddressBook\"><serviceFilter xmlns=\"http://www.msn.com/webservices/AddressBook\"><Types xmlns=\"http://www.msn.com/webservices/AddressBook\"><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Messenger</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Invitation</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">SocialNetwork</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Space</ServiceType><ServiceType xmlns=\"http://www.msn.com/webservices/AddressBook\">Profile</ServiceType></Types></serviceFilter>" \
+    "</FindMembership>"
+
+#define SOAP_MEMLIST_ADD_ACTION "http://www.msn.com/webservices/AddressBook/AddMember"
+#define SOAP_MEMLIST_DEL_ACTION "http://www.msn.com/webservices/AddressBook/DeleteMember"
+
+#define SOAP_MEMLIST_EDIT_PAYLOAD \
   "<%sMember xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
    "<serviceHandle>" \
@@ -226,7 +215,5 @@
     "</Membership>" \
    "</memberships>" \
-  "</%sMember>" \
-  "</soap:Body>" \
-"</soap:Envelope>"
+  "</%sMember>"
 
 int msn_soap_memlist_request( struct im_connection *ic );
@@ -238,18 +225,4 @@
 
 #define SOAP_ADDRESSBOOK_PAYLOAD \
-"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
-"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">" \
-  "<soap:Header>" \
-    "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
-      "<ApplicationId>CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \
-      "<IsMigration>false</IsMigration>" \
-      "<PartnerScenario>Initial</PartnerScenario>" \
-    "</ABApplicationHeader>" \
-    "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
-      "<ManagedGroupRequest>false</ManagedGroupRequest>" \
-      "<TicketToken>%s</TicketToken>" \
-    "</ABAuthHeader>" \
-  "</soap:Header>" \
-  "<soap:Body>" \
     "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
       "<abId>00000000-0000-0000-0000-000000000000</abId>" \
@@ -257,25 +230,9 @@
       "<deltasOnly>false</deltasOnly>" \
       "<lastChange>0001-01-01T00:00:00.0000000-08:00</lastChange>" \
-    "</ABFindAll>" \
-  "</soap:Body>" \
-"</soap:Envelope>"
+    "</ABFindAll>"
 
 #define SOAP_AB_NAMECHANGE_ACTION "http://www.msn.com/webservices/AddressBook/ABContactUpdate"
 
 #define SOAP_AB_NAMECHANGE_PAYLOAD \
-"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
-"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">" \
-  "<soap:Header>" \
-    "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
-      "<ApplicationId>CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \
-      "<IsMigration>false</IsMigration>" \
-      "<PartnerScenario>Initial</PartnerScenario>" \
-    "</ABApplicationHeader>" \
-    "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
-      "<ManagedGroupRequest>false</ManagedGroupRequest>" \
-      "<TicketToken>%s</TicketToken>" \
-    "</ABAuthHeader>" \
-  "</soap:Header>" \
-    "<soap:Body>" \
         "<ABContactUpdate xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
             "<abId>00000000-0000-0000-0000-000000000000</abId>" \
@@ -289,7 +246,5 @@
                 "</Contact>" \
             "</contacts>" \
-        "</ABContactUpdate>" \
-    "</soap:Body>" \
-"</soap:Envelope>"
+        "</ABContactUpdate>"
 
 int msn_soap_addressbook_request( struct im_connection *ic );
