source: protocols/msn/soap.h @ cfeadc3

Last change on this file since cfeadc3 was afbad28, checked in by dequis <dx@…>, at 2015-03-10T07:46:38Z

msn: Update FindMembership payload to fix incorrect pending requests

It was requesting memberships for the following services:

Messenger, Invitation, SocialNetwork, Space, Profile

Now it only requests the same services as WLM 2012:

Messenger, IMAvailability

Fixes trac ticket 1191.

I'm going to apply this to the master branch just for the sake of
marking it as fixed, but I can't log in at all with that branch at the
moment. Yes this is silly.

  • Property mode set to 100644
File size: 13.5 KB
Line 
1/********************************************************************\
2  * BitlBee -- An IRC to other IM-networks gateway                     *
3  *                                                                    *
4  * Copyright 2002-2012 Wilmer van der Gaast and others                *
5  \********************************************************************/
6
7/* MSN module - All the SOAPy XML stuff.
8   Some manager at Microsoft apparently thought MSNP wasn't XMLy enough so
9   someone stepped up and changed that. This is the result. Kilobytes and
10   more kilobytes of XML vomit to transfer tiny bits of informaiton. */
11
12/*
13  This program is free software; you can redistribute it and/or modify
14  it under the terms of the GNU General Public License as published by
15  the Free Software Foundation; either version 2 of the License, or
16  (at your option) any later version.
17
18  This program is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  GNU General Public License for more details.
22
23  You should have received a copy of the GNU General Public License with
24  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
25  if not, write to the Free Software Foundation, Inc., 51 Franklin St.,
26  Fifth Floor, Boston, MA  02110-1301  USA
27*/
28
29/* Thanks to http://msnpiki.msnfanatic.com/ for lots of info on this! */
30
31#ifndef __SOAP_H__
32#define __SOAP_H__
33
34#include <stdio.h>
35#include <stdlib.h>
36#include <string.h>
37#include <sys/types.h>
38#include <sys/socket.h>
39#include <netinet/in.h>
40#include <arpa/inet.h>
41#include <unistd.h>
42#include "nogaim.h"
43
44
45int msn_soapq_flush(struct im_connection *ic, gboolean resend);
46
47
48#define SOAP_HTTP_REQUEST \
49        "POST %s HTTP/1.0\r\n" \
50        "Host: %s\r\n" \
51        "Accept: */*\r\n" \
52        "User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \
53        "Content-Type: text/xml; charset=utf-8\r\n" \
54        "%s" \
55        "Content-Length: %zd\r\n" \
56        "Cache-Control: no-cache\r\n" \
57        "\r\n" \
58        "%s"
59
60
61#define SOAP_PASSPORT_SSO_URL "https://login.live.com/RST.srf"
62#define SOAP_PASSPORT_SSO_URL_MSN "https://msnia.login.live.com/pp900/RST.srf"
63#define MAX_PASSPORT_PWLEN 16
64
65#define SOAP_PASSPORT_SSO_PAYLOAD \
66        "<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\" " \
67        "xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" " \
68        "xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" " \
69        "xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2002/12/policy\" " \
70        "xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" " \
71        "xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/03/addressing\" " \
72        "xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2004/04/sc\" " \
73        "xmlns:wst=\"http://schemas.xmlsoap.org/ws/2004/04/trust\">" \
74        "<Header>" \
75        "<ps:AuthInfo " \
76        "xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" " \
77        "Id=\"PPAuthInfo\">" \
78        "<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>" \
79        "<ps:BinaryVersion>4</ps:BinaryVersion>" \
80        "<ps:UIVersion>1</ps:UIVersion>" \
81        "<ps:Cookies></ps:Cookies>" \
82        "<ps:RequestParams>AQAAAAIAAABsYwQAAAAxMDMz</ps:RequestParams>" \
83        "</ps:AuthInfo>" \
84        "<wsse:Security>" \
85        "<wsse:UsernameToken Id=\"user\">" \
86        "<wsse:Username>%s</wsse:Username>" \
87        "<wsse:Password>%s</wsse:Password>" \
88        "</wsse:UsernameToken>" \
89        "</wsse:Security>" \
90        "</Header>" \
91        "<Body>" \
92        "<ps:RequestMultipleSecurityTokens " \
93        "xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" " \
94        "Id=\"RSTS\">" \
95        "<wst:RequestSecurityToken Id=\"RST0\">" \
96        "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
97        "<wsp:AppliesTo>" \
98        "<wsa:EndpointReference>" \
99        "<wsa:Address>http://Passport.NET/tb</wsa:Address>" \
100        "</wsa:EndpointReference>" \
101        "</wsp:AppliesTo>" \
102        "</wst:RequestSecurityToken>" \
103        "<wst:RequestSecurityToken Id=\"RST1\">" \
104        "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
105        "<wsp:AppliesTo>" \
106        "<wsa:EndpointReference>" \
107        "<wsa:Address>messengerclear.live.com</wsa:Address>" \
108        "</wsa:EndpointReference>" \
109        "</wsp:AppliesTo>" \
110        "<wsse:PolicyReference URI=\"%s\"></wsse:PolicyReference>" \
111        "</wst:RequestSecurityToken>" \
112        "<wst:RequestSecurityToken Id=\"RST2\">" \
113        "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
114        "<wsp:AppliesTo>" \
115        "<wsa:EndpointReference>" \
116        "<wsa:Address>contacts.msn.com</wsa:Address>" \
117        "</wsa:EndpointReference>" \
118        "</wsp:AppliesTo>" \
119        "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI\"></wsse:PolicyReference>" \
120        "</wst:RequestSecurityToken>" \
121        "<wst:RequestSecurityToken Id=\"RST3\">" \
122        "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
123        "<wsp:AppliesTo>" \
124        "<wsa:EndpointReference>" \
125        "<wsa:Address>messengersecure.live.com</wsa:Address>" \
126        "</wsa:EndpointReference>" \
127        "</wsp:AppliesTo>" \
128        "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI_SSL\"></wsse:PolicyReference>" \
129        "</wst:RequestSecurityToken>" \
130        "<wst:RequestSecurityToken Id=\"RST4\">" \
131        "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
132        "<wsp:AppliesTo>" \
133        "<wsa:EndpointReference>" \
134        "<wsa:Address>storage.msn.com</wsa:Address>" \
135        "</wsa:EndpointReference>" \
136        "</wsp:AppliesTo>" \
137        "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI_SSL\"></wsse:PolicyReference>" \
138        "</wst:RequestSecurityToken>" \
139        "</ps:RequestMultipleSecurityTokens>" \
140        "</Body>" \
141        "</Envelope>"
142
143int msn_soap_passport_sso_request(struct im_connection *ic, const char *nonce);
144
145
146#define SOAP_ABSERVICE_PAYLOAD \
147        "<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
148        "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
149        "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
150        "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
151        "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">F6D2794D-501F-443A-ADBE-8F1490FF30FD</ApplicationId>" \
152        "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>" \
153        "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">%s</PartnerScenario>" \
154        "</ABApplicationHeader>" \
155        "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
156        "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>" \
157        "<TicketToken>%s</TicketToken>" \
158        "</ABAuthHeader>" \
159        "</soap:Header>" \
160        "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
161        "%%s" \
162        "</soap:Body>" \
163        "</soap:Envelope>"
164
165#define SOAP_MEMLIST_URL "http://contacts.msn.com/abservice/SharingService.asmx"
166#define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership"
167
168#define SOAP_MEMLIST_PAYLOAD \
169        "<FindMembership xmlns=\"http://www.msn.com/webservices/AddressBook\"><serviceFilter><Types><ServiceType>Messenger</ServiceType><ServiceType>IMAvailability</ServiceType></Types></serviceFilter><expandMembership>true</expandMembership>" \
170        "</FindMembership>"
171
172#define SOAP_MEMLIST_ADD_ACTION "http://www.msn.com/webservices/AddressBook/AddMember"
173#define SOAP_MEMLIST_DEL_ACTION "http://www.msn.com/webservices/AddressBook/DeleteMember"
174
175#define SOAP_MEMLIST_EDIT_PAYLOAD \
176        "<%sMember xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
177        "<serviceHandle>" \
178        "<Id>0</Id>" \
179        "<Type>Messenger</Type>" \
180        "<ForeignId></ForeignId>" \
181        "</serviceHandle>" \
182        "<memberships>" \
183        "<Membership>" \
184        "<MemberRole>%s</MemberRole>" \
185        "<Members>" \
186        "<Member xsi:type=\"PassportMember\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" \
187        "<Type>Passport</Type>" \
188        "<State>Accepted</State>" \
189        "<PassportName>%s</PassportName>" \
190        "</Member>" \
191        "</Members>" \
192        "</Membership>" \
193        "</memberships>" \
194        "</%sMember>"
195
196int msn_soap_memlist_request(struct im_connection *ic);
197int msn_soap_memlist_edit(struct im_connection *ic, const char *handle, gboolean add, int list);
198
199
200#define SOAP_ADDRESSBOOK_URL "http://contacts.msn.com/abservice/abservice.asmx"
201#define SOAP_ADDRESSBOOK_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll"
202
203#define SOAP_ADDRESSBOOK_PAYLOAD \
204        "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
205        "<abId>00000000-0000-0000-0000-000000000000</abId>" \
206        "<abView>Full</abView>" \
207        "<deltasOnly>false</deltasOnly>" \
208        "<lastChange>0001-01-01T00:00:00.0000000-08:00</lastChange>" \
209        "</ABFindAll>"
210
211#define SOAP_AB_NAMECHANGE_ACTION "http://www.msn.com/webservices/AddressBook/ABContactUpdate"
212
213#define SOAP_AB_NAMECHANGE_PAYLOAD \
214        "<ABContactUpdate xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
215        "<abId>00000000-0000-0000-0000-000000000000</abId>" \
216        "<contacts>" \
217        "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
218        "<contactInfo>" \
219        "<contactType>Me</contactType>" \
220        "<displayName>%s</displayName>" \
221        "</contactInfo>" \
222        "<propertiesChanged>DisplayName</propertiesChanged>" \
223        "</Contact>" \
224        "</contacts>" \
225        "</ABContactUpdate>"
226
227#define SOAP_AB_CONTACT_ADD_ACTION "http://www.msn.com/webservices/AddressBook/ABContactAdd"
228
229#define SOAP_AB_CONTACT_ADD_PAYLOAD \
230        "<ABContactAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
231        "<abId>00000000-0000-0000-0000-000000000000</abId>" \
232        "<contacts>" \
233        "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
234        "<contactInfo>" \
235        "<contactType>LivePending</contactType>" \
236        "<passportName>%s</passportName>" \
237        "<isMessengerUser>true</isMessengerUser>" \
238        "<MessengerMemberInfo>" \
239        "<DisplayName>%s</DisplayName>" \
240        "</MessengerMemberInfo>" \
241        "</contactInfo>" \
242        "</Contact>" \
243        "</contacts>" \
244        "<options>" \
245        "<EnableAllowListManagement>true</EnableAllowListManagement>" \
246        "</options>" \
247        "</ABContactAdd>"
248
249#define SOAP_AB_CONTACT_DEL_ACTION "http://www.msn.com/webservices/AddressBook/ABContactDelete"
250
251#define SOAP_AB_CONTACT_DEL_PAYLOAD \
252        "<ABContactDelete xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
253        "<abId>00000000-0000-0000-0000-000000000000</abId>" \
254        "<contacts>" \
255        "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
256        "<contactId>%s</contactId>" \
257        "</Contact>" \
258        "</contacts>" \
259        "</ABContactDelete>"
260
261int msn_soap_addressbook_request(struct im_connection *ic);
262int msn_soap_addressbook_set_display_name(struct im_connection *ic, const char *new);
263int msn_soap_ab_contact_add(struct im_connection *ic, bee_user_t *bu);
264int msn_soap_ab_contact_del(struct im_connection *ic, bee_user_t *bu);
265
266
267#define SOAP_STORAGE_URL "https://storage.msn.com/storageservice/SchematizedStore.asmx"
268#define SOAP_PROFILE_GET_ACTION "http://www.msn.com/webservices/storage/w10/GetProfile"
269#define SOAP_PROFILE_SET_DN_ACTION "http://www.msn.com/webservices/storage/w10/UpdateProfile"
270
271#define SOAP_PROFILE_GET_PAYLOAD \
272        "<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
273        "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
274        "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
275        "<StorageApplicationHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
276        "<ApplicationID>Messenger Client 9.0</ApplicationID>" \
277        "<Scenario>Initial</Scenario>" \
278        "</StorageApplicationHeader>" \
279        "<StorageUserHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
280        "<Puid>0</Puid>" \
281        "<TicketToken>%s</TicketToken>" \
282        "</StorageUserHeader>" \
283        "</soap:Header>" \
284        "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
285        "<GetProfile xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
286        "<profileHandle>" \
287        "<Alias>" \
288        "<Name>%s</Name>" \
289        "<NameSpace>MyCidStuff</NameSpace>" \
290        "</Alias>" \
291        "<RelationshipName>MyProfile</RelationshipName>" \
292        "</profileHandle>" \
293        "<profileAttributes>" \
294        "<ResourceID>true</ResourceID>" \
295        "<DateModified>true</DateModified>" \
296        "<ExpressionProfileAttributes>" \
297        "<ResourceID>true</ResourceID>" \
298        "<DateModified>true</DateModified>" \
299        "<DisplayName>true</DisplayName>" \
300        "<DisplayNameLastModified>true</DisplayNameLastModified>" \
301        "<PersonalStatus>true</PersonalStatus>" \
302        "<PersonalStatusLastModified>true</PersonalStatusLastModified>" \
303        "<StaticUserTilePublicURL>true</StaticUserTilePublicURL>" \
304        "<Photo>true</Photo>" \
305        "<Flags>true</Flags>" \
306        "</ExpressionProfileAttributes>" \
307        "</profileAttributes>" \
308        "</GetProfile>" \
309        "</soap:Body>" \
310        "</soap:Envelope>"
311
312#define SOAP_PROFILE_SET_DN_PAYLOAD \
313        "<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
314        "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
315        "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
316        "<StorageApplicationHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
317        "<ApplicationID>Messenger Client 9.0</ApplicationID>" \
318        "<Scenario>Initial</Scenario>" \
319        "</StorageApplicationHeader>" \
320        "<StorageUserHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
321        "<Puid>0</Puid>" \
322        "<TicketToken>%s</TicketToken>" \
323        "</StorageUserHeader>" \
324        "</soap:Header>" \
325        "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
326        "<UpdateProfile xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
327        "<profile>" \
328        "<ResourceID>%s</ResourceID>" \
329        "<ExpressionProfile>" \
330        "<FreeText>Update</FreeText>" \
331        "<DisplayName>%s</DisplayName>" \
332        "<Flags>0</Flags>" \
333        "</ExpressionProfile>" \
334        "</profile>" \
335        "</UpdateProfile>" \
336        "</soap:Body>" \
337        "</soap:Envelope>"
338
339int msn_soap_profile_get(struct im_connection *ic, const char *cid);
340int msn_soap_profile_set_dn(struct im_connection *ic, const char *dn);
341
342#endif /* __SOAP_H__ */
Note: See TracBrowser for help on using the repository browser.