diff options
-rw-r--r-- | protocols/msn/ns.c | 4 | ||||
-rw-r--r-- | protocols/msn/soap.c | 56 | ||||
-rw-r--r-- | protocols/msn/soap.h | 29 |
3 files changed, 84 insertions, 5 deletions
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 897650a6..8236b731 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -28,6 +28,7 @@ #include "msn.h" #include "passport.h" #include "md5.h" +#include "soap.h" static gboolean msn_ns_callback( gpointer data, gint source, b_input_condition cond ); static int msn_ns_command( gpointer data, char **cmd, int num_parts ); @@ -238,8 +239,7 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) 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 { diff --git a/protocols/msn/soap.c b/protocols/msn/soap.c index 4d623a9d..252bddeb 100644 --- a/protocols/msn/soap.c +++ b/protocols/msn/soap.c @@ -82,14 +82,22 @@ static void msn_soap_handle_response( struct http_request *http_req ); 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, http_req, msn_soap_handle_response, soap_req ); @@ -151,7 +159,7 @@ static int msn_soap_oim_build_request( struct msn_soap_req_data *soap_req ) display_name_b64 = tobase64( ic->displayname ); 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, MSNP11_PROD_ID, md->lock_key ? md->lock_key : "", @@ -255,3 +263,47 @@ int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq ) *msgq = g_slist_remove( *msgq, m ); } } + + +/* 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 ); +} diff --git a/protocols/msn/soap.h b/protocols/msn/soap.h index 307ac1bc..78808fdf 100644 --- a/protocols/msn/soap.h +++ b/protocols/msn/soap.h @@ -45,6 +45,7 @@ "SOAPAction: \"%s\"\r\n" \ "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" \ "\r\n" \ @@ -52,7 +53,7 @@ #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 \ "<?xml version=\"1.0\" encoding=\"utf-8\"?>" \ @@ -84,4 +85,30 @@ int msn_soap_oim_send( struct im_connection *ic, const char *to, const char *msg ); 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__ */ |