Index: protocols/msn/ns.c
===================================================================
--- protocols/msn/ns.c	(revision 5fecede7db56a41cf9d6ecb2b821f5a833ce0f59)
+++ protocols/msn/ns.c	(revision 7db65b7df08a3c7cab28e065b2ffa3d9941ceccb)
@@ -29,4 +29,5 @@
 #include "passport.h"
 #include "md5.h"
+#include "soap.h"
 
 static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond );
@@ -239,6 +240,5 @@
 			imcb_log( ic, "Authenticated, getting buddy list" );
 			
-			g_snprintf( buf, sizeof( buf ), "SYN %d 0\r\n", ++md->trId );
-			return( msn_write( ic, buf, strlen( buf ) ) );
+			msn_soap_memlist_request( ic );
 		}
 		else
Index: protocols/msn/soap.c
===================================================================
--- protocols/msn/soap.c	(revision 5fecede7db56a41cf9d6ecb2b821f5a833ce0f59)
+++ protocols/msn/soap.c	(revision 7db65b7df08a3c7cab28e065b2ffa3d9941ceccb)
@@ -83,12 +83,20 @@
 static int msn_soap_send_request( struct msn_soap_req_data *soap_req )
 {
+	struct msn_data *md = soap_req->ic->proto_data;
 	char *http_req;
+	char *pom, *s;
 	url_t url;
 	
 	soap_req->build_request( soap_req );
+	
+	pom = g_new0( char, strlen( md->passport_token ) * 3 );
+	strcpy( pom, md->passport_token + 2 );
+	if( ( s = strchr( pom, '&' ) ) )
+		*s = '\0';
 	
 	url_set( &url, soap_req->url );
 	http_req = g_strdup_printf( SOAP_HTTP_REQUEST, url.file, url.host,
-		soap_req->action, strlen( soap_req->payload ), soap_req->payload );
+		soap_req->action, pom,
+		strlen( soap_req->payload ), soap_req->payload );
 	
 	soap_req->http_req = http_dorequest( url.host, url.port, url.proto == PROTO_HTTPS,
@@ -152,5 +160,5 @@
 	
 	soap_req->url = g_strdup( SOAP_OIM_SEND_URL );
-	soap_req->action = g_strdup( SOAP_OIM_ACTION_URL );
+	soap_req->action = g_strdup( SOAP_OIM_SEND_ACTION );
 	soap_req->payload = g_markup_printf_escaped( SOAP_OIM_SEND_PAYLOAD,
 		ic->acc->user, display_name_b64, oim->to, md->passport_token,
@@ -256,2 +264,46 @@
 	}
 }
+
+
+/* memlist: Fetching the membership list (NOT address book) */
+
+#if 0
+struct msn_soap_oim_send_data
+{
+	char *to;
+	char *msg;
+	int number;
+	int need_retry;
+};
+#endif
+
+static int msn_soap_memlist_build_request( struct msn_soap_req_data *soap_req )
+{
+	soap_req->url = g_strdup( SOAP_MEMLIST_URL );
+	soap_req->action = g_strdup( SOAP_MEMLIST_ACTION );
+	soap_req->payload = g_strdup( SOAP_MEMLIST_PAYLOAD );
+	
+	return 1;
+}
+
+static const struct xt_handler_entry msn_soap_memlist_parser[] = {
+	{ NULL,               NULL,     NULL                        }
+};
+
+static int msn_soap_memlist_handle_response( struct msn_soap_req_data *soap_req )
+{
+	return 0;
+}
+
+static int msn_soap_memlist_free_data( struct msn_soap_req_data *soap_req )
+{
+	return 0;
+}
+
+int msn_soap_memlist_request( struct im_connection *ic )
+{
+	return msn_soap_start( ic, NULL, msn_soap_memlist_build_request,
+	                                 msn_soap_memlist_parser,
+	                                 msn_soap_memlist_handle_response,
+	                                 msn_soap_memlist_free_data );
+}
Index: protocols/msn/soap.h
===================================================================
--- protocols/msn/soap.h	(revision 5fecede7db56a41cf9d6ecb2b821f5a833ce0f59)
+++ protocols/msn/soap.h	(revision 7db65b7df08a3c7cab28e065b2ffa3d9941ceccb)
@@ -46,4 +46,5 @@
 "User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \
 "Content-Type: text/xml; charset=utf-8\r\n" \
+"Cookie: MSPAuth=%s\r\n" \
 "Content-Length: %d\r\n" \
 "Cache-Control: no-cache\r\n" \
@@ -53,5 +54,5 @@
 
 #define SOAP_OIM_SEND_URL "https://ows.messenger.msn.com/OimWS/oim.asmx"
-#define SOAP_OIM_ACTION_URL "http://messenger.msn.com/ws/2004/09/oim/Store"
+#define SOAP_OIM_SEND_ACTION "http://messenger.msn.com/ws/2004/09/oim/Store"
 
 #define SOAP_OIM_SEND_PAYLOAD \
@@ -85,3 +86,29 @@
 int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq );
 
+
+#define SOAP_MEMLIST_URL "https://byrdr.omega.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>" \
+    "</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>"
+
+int msn_soap_memlist_request( struct im_connection *ic );
+
+
 #endif /* __SOAP_H__ */
