source: protocols/msn/soap.h @ 4be0e34

Last change on this file since 4be0e34 was 5282ffd, checked in by Wilmer van der Gaast <wilmer@…>, at 2011-01-22T17:29:55Z

MSN changed the @msn.com login server URL and/or broke the old one. :-(

  • Property mode set to 100644
File size: 17.4 KB
Line 
1  /********************************************************************\
2  * BitlBee -- An IRC to other IM-networks gateway                     *
3  *                                                                    *
4  * Copyright 2002-2010 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., 59 Temple Place,
26  Suite 330, Boston, MA  02111-1307  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#ifndef _WIN32
39#include <sys/socket.h>
40#include <netinet/in.h>
41#include <arpa/inet.h>
42#include <unistd.h>
43#endif
44#include "nogaim.h"
45
46
47int msn_soapq_flush( struct im_connection *ic, gboolean resend );
48
49
50#define SOAP_HTTP_REQUEST \
51"POST %s HTTP/1.0\r\n" \
52"Host: %s\r\n" \
53"Accept: */*\r\n" \
54"User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \
55"Content-Type: text/xml; charset=utf-8\r\n" \
56"%s" \
57"Content-Length: %zd\r\n" \
58"Cache-Control: no-cache\r\n" \
59"\r\n" \
60"%s"
61
62
63#define SOAP_PASSPORT_SSO_URL "https://login.live.com/RST.srf"
64#define SOAP_PASSPORT_SSO_URL_MSN "https://msnia.login.live.com/pp900/RST.srf"
65#define MAX_PASSPORT_PWLEN 16
66
67#define SOAP_PASSPORT_SSO_PAYLOAD \
68"<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\" " \
69   "xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" " \
70   "xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" " \
71   "xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2002/12/policy\" " \
72   "xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" " \
73   "xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/03/addressing\" " \
74   "xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2004/04/sc\" " \
75   "xmlns:wst=\"http://schemas.xmlsoap.org/ws/2004/04/trust\">" \
76   "<Header>" \
77       "<ps:AuthInfo " \
78           "xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" " \
79           "Id=\"PPAuthInfo\">" \
80           "<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>" \
81           "<ps:BinaryVersion>4</ps:BinaryVersion>" \
82           "<ps:UIVersion>1</ps:UIVersion>" \
83           "<ps:Cookies></ps:Cookies>" \
84           "<ps:RequestParams>AQAAAAIAAABsYwQAAAAxMDMz</ps:RequestParams>" \
85       "</ps:AuthInfo>" \
86       "<wsse:Security>" \
87           "<wsse:UsernameToken Id=\"user\">" \
88               "<wsse:Username>%s</wsse:Username>" \
89               "<wsse:Password>%s</wsse:Password>" \
90           "</wsse:UsernameToken>" \
91       "</wsse:Security>" \
92   "</Header>" \
93   "<Body>" \
94       "<ps:RequestMultipleSecurityTokens " \
95           "xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" " \
96           "Id=\"RSTS\">" \
97           "<wst:RequestSecurityToken Id=\"RST0\">" \
98               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
99               "<wsp:AppliesTo>" \
100                   "<wsa:EndpointReference>" \
101                       "<wsa:Address>http://Passport.NET/tb</wsa:Address>" \
102                   "</wsa:EndpointReference>" \
103               "</wsp:AppliesTo>" \
104           "</wst:RequestSecurityToken>" \
105           "<wst:RequestSecurityToken Id=\"RST1\">" \
106               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
107               "<wsp:AppliesTo>" \
108                   "<wsa:EndpointReference>" \
109                       "<wsa:Address>messengerclear.live.com</wsa:Address>" \
110                   "</wsa:EndpointReference>" \
111               "</wsp:AppliesTo>" \
112               "<wsse:PolicyReference URI=\"%s\"></wsse:PolicyReference>" \
113           "</wst:RequestSecurityToken>" \
114           "<wst:RequestSecurityToken Id=\"RST2\">" \
115               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
116               "<wsp:AppliesTo>" \
117                   "<wsa:EndpointReference>" \
118                       "<wsa:Address>contacts.msn.com</wsa:Address>" \
119                   "</wsa:EndpointReference>" \
120               "</wsp:AppliesTo>" \
121               "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI\"></wsse:PolicyReference>" \
122           "</wst:RequestSecurityToken>" \
123           "<wst:RequestSecurityToken Id=\"RST3\">" \
124               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
125               "<wsp:AppliesTo>" \
126                   "<wsa:EndpointReference>" \
127                       "<wsa:Address>messengersecure.live.com</wsa:Address>" \
128                   "</wsa:EndpointReference>" \
129               "</wsp:AppliesTo>" \
130               "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI_SSL\"></wsse:PolicyReference>" \
131           "</wst:RequestSecurityToken>" \
132           "<wst:RequestSecurityToken Id=\"RST4\">" \
133               "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
134               "<wsp:AppliesTo>" \
135                   "<wsa:EndpointReference>" \
136                       "<wsa:Address>storage.msn.com</wsa:Address>" \
137                   "</wsa:EndpointReference>" \
138               "</wsp:AppliesTo>" \
139               "<wsse:PolicyReference xmlns=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" URI=\"MBI_SSL\"></wsse:PolicyReference>" \
140           "</wst:RequestSecurityToken>" \
141       "</ps:RequestMultipleSecurityTokens>" \
142   "</Body>" \
143"</Envelope>"
144
145int msn_soap_passport_sso_request( struct im_connection *ic, const char *nonce );
146
147
148#define SOAP_OIM_SEND_URL "https://ows.messenger.msn.com/OimWS/oim.asmx"
149#define SOAP_OIM_SEND_ACTION "http://messenger.live.com/ws/2006/09/oim/Store2"
150
151#define SOAP_OIM_SEND_PAYLOAD \
152"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
153"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
154"<soap:Header>" \
155  "<From memberName=\"%s\" friendlyName=\"=?utf-8?B?%s?=\" xml:lang=\"nl-nl\" proxy=\"MSNMSGR\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\" msnpVer=\"%s\" buildVer=\"%s\"/>" \
156  "<To memberName=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \
157  "<Ticket passport=\"%s\" appid=\"%s\" lockkey=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \
158  "<Sequence xmlns=\"http://schemas.xmlsoap.org/ws/2003/03/rm\">" \
159    "<Identifier xmlns=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">http://messenger.msn.com</Identifier>" \
160    "<MessageNumber>%d</MessageNumber>" \
161  "</Sequence>" \
162"</soap:Header>" \
163"<soap:Body>" \
164  "<MessageType xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">text</MessageType>" \
165  "<Content xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">" \
166    "MIME-Version: 1.0\r\n" \
167    "Content-Type: text/plain; charset=UTF-8\r\n" \
168    "Content-Transfer-Encoding: base64\r\n" \
169    "X-OIM-Message-Type: OfflineMessage\r\n" \
170    "X-OIM-Run-Id: {F9A6C9DD-0D94-4E85-9CC6-F9D118CC1CAF}\r\n" \
171    "X-OIM-Sequence-Num: %d\r\n" \
172    "\r\n" \
173    "%s" \
174  "</Content>" \
175"</soap:Body>" \
176"</soap:Envelope>"
177
178int msn_soap_oim_send( struct im_connection *ic, const char *to, const char *msg );
179int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq );
180
181
182#define SOAP_ABSERVICE_PAYLOAD \
183"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
184"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
185  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
186    "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
187      "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \
188      "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>" \
189      "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">%s</PartnerScenario>" \
190    "</ABApplicationHeader>" \
191    "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
192      "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>" \
193      "<TicketToken>%s</TicketToken>" \
194    "</ABAuthHeader>" \
195  "</soap:Header>" \
196  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
197    "%%s" \
198  "</soap:Body>" \
199"</soap:Envelope>"
200
201#define SOAP_MEMLIST_URL "http://contacts.msn.com/abservice/SharingService.asmx"
202#define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership"
203
204#define SOAP_MEMLIST_PAYLOAD \
205    "<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>" \
206    "</FindMembership>"
207
208#define SOAP_MEMLIST_ADD_ACTION "http://www.msn.com/webservices/AddressBook/AddMember"
209#define SOAP_MEMLIST_DEL_ACTION "http://www.msn.com/webservices/AddressBook/DeleteMember"
210
211#define SOAP_MEMLIST_EDIT_PAYLOAD \
212  "<%sMember xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
213   "<serviceHandle>" \
214    "<Id>0</Id>" \
215    "<Type>Messenger</Type>" \
216    "<ForeignId></ForeignId>" \
217   "</serviceHandle>" \
218   "<memberships>" \
219    "<Membership>" \
220     "<MemberRole>%s</MemberRole>" \
221     "<Members>" \
222      "<Member xsi:type=\"PassportMember\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" \
223       "<Type>Passport</Type>" \
224       "<State>Accepted</State>" \
225       "<PassportName>%s</PassportName>" \
226      "</Member>" \
227     "</Members>" \
228    "</Membership>" \
229   "</memberships>" \
230  "</%sMember>"
231
232int msn_soap_memlist_request( struct im_connection *ic );
233int msn_soap_memlist_edit( struct im_connection *ic, const char *handle, gboolean add, int list );
234
235
236#define SOAP_ADDRESSBOOK_URL "http://contacts.msn.com/abservice/abservice.asmx"
237#define SOAP_ADDRESSBOOK_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll"
238
239#define SOAP_ADDRESSBOOK_PAYLOAD \
240    "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
241      "<abId>00000000-0000-0000-0000-000000000000</abId>" \
242      "<abView>Full</abView>" \
243      "<deltasOnly>false</deltasOnly>" \
244      "<lastChange>0001-01-01T00:00:00.0000000-08:00</lastChange>" \
245    "</ABFindAll>"
246
247#define SOAP_AB_NAMECHANGE_ACTION "http://www.msn.com/webservices/AddressBook/ABContactUpdate"
248
249#define SOAP_AB_NAMECHANGE_PAYLOAD \
250        "<ABContactUpdate xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
251            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
252            "<contacts>" \
253                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
254                    "<contactInfo>" \
255                        "<contactType>Me</contactType>" \
256                        "<displayName>%s</displayName>" \
257                    "</contactInfo>" \
258                    "<propertiesChanged>DisplayName</propertiesChanged>" \
259                "</Contact>" \
260            "</contacts>" \
261        "</ABContactUpdate>"
262
263#define SOAP_AB_CONTACT_ADD_ACTION "http://www.msn.com/webservices/AddressBook/ABContactAdd"
264
265#define SOAP_AB_CONTACT_ADD_PAYLOAD \
266        "<ABContactAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
267            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
268            "<contacts>" \
269                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
270                    "<contactInfo>" \
271                        "<contactType>LivePending</contactType>" \
272                        "<passportName>%s</passportName>" \
273                        "<isMessengerUser>true</isMessengerUser>" \
274                        "<MessengerMemberInfo>" \
275                            "<DisplayName>%s</DisplayName>" \
276                        "</MessengerMemberInfo>" \
277                    "</contactInfo>" \
278                "</Contact>" \
279            "</contacts>" \
280            "<options>" \
281                "<EnableAllowListManagement>true</EnableAllowListManagement>" \
282            "</options>" \
283        "</ABContactAdd>"
284
285#define SOAP_AB_CONTACT_DEL_ACTION "http://www.msn.com/webservices/AddressBook/ABContactDelete"
286
287#define SOAP_AB_CONTACT_DEL_PAYLOAD \
288        "<ABContactDelete xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
289            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
290            "<contacts>" \
291                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
292                    "<contactId>%s</contactId>" \
293                "</Contact>" \
294            "</contacts>" \
295        "</ABContactDelete>"
296
297int msn_soap_addressbook_request( struct im_connection *ic );
298int msn_soap_addressbook_set_display_name( struct im_connection *ic, const char *new );
299int msn_soap_ab_contact_add( struct im_connection *ic, bee_user_t *bu );
300int msn_soap_ab_contact_del( struct im_connection *ic, bee_user_t *bu );
301
302
303#define SOAP_STORAGE_URL "https://storage.msn.com/storageservice/SchematizedStore.asmx"
304#define SOAP_PROFILE_GET_ACTION "http://www.msn.com/webservices/storage/w10/GetProfile"
305#define SOAP_PROFILE_SET_DN_ACTION "http://www.msn.com/webservices/storage/w10/UpdateProfile"
306
307#define SOAP_PROFILE_GET_PAYLOAD \
308"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
309"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
310  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
311    "<StorageApplicationHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
312      "<ApplicationID>Messenger Client 9.0</ApplicationID>" \
313      "<Scenario>Initial</Scenario>" \
314    "</StorageApplicationHeader>" \
315    "<StorageUserHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
316      "<Puid>0</Puid>" \
317      "<TicketToken>%s</TicketToken>" \
318    "</StorageUserHeader>" \
319  "</soap:Header>" \
320  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
321    "<GetProfile xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
322      "<profileHandle>" \
323        "<Alias>" \
324          "<Name>%s</Name>" \
325          "<NameSpace>MyCidStuff</NameSpace>" \
326        "</Alias>" \
327        "<RelationshipName>MyProfile</RelationshipName>" \
328      "</profileHandle>" \
329      "<profileAttributes>" \
330        "<ResourceID>true</ResourceID>" \
331        "<DateModified>true</DateModified>" \
332        "<ExpressionProfileAttributes>" \
333          "<ResourceID>true</ResourceID>" \
334          "<DateModified>true</DateModified>" \
335          "<DisplayName>true</DisplayName>" \
336          "<DisplayNameLastModified>true</DisplayNameLastModified>" \
337          "<PersonalStatus>true</PersonalStatus>" \
338          "<PersonalStatusLastModified>true</PersonalStatusLastModified>" \
339          "<StaticUserTilePublicURL>true</StaticUserTilePublicURL>" \
340          "<Photo>true</Photo>" \
341          "<Flags>true</Flags>" \
342        "</ExpressionProfileAttributes>" \
343      "</profileAttributes>" \
344    "</GetProfile>" \
345  "</soap:Body>" \
346"</soap:Envelope>"
347
348#define SOAP_PROFILE_SET_DN_PAYLOAD \
349"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
350"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
351  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
352    "<StorageApplicationHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
353      "<ApplicationID>Messenger Client 9.0</ApplicationID>" \
354      "<Scenario>Initial</Scenario>" \
355    "</StorageApplicationHeader>" \
356    "<StorageUserHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
357      "<Puid>0</Puid>" \
358      "<TicketToken>%s</TicketToken>" \
359    "</StorageUserHeader>" \
360  "</soap:Header>" \
361  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
362    "<UpdateProfile xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
363      "<profile>" \
364        "<ResourceID>%s</ResourceID>" \
365        "<ExpressionProfile>" \
366          "<FreeText>Update</FreeText>" \
367          "<DisplayName>%s</DisplayName>" \
368          "<Flags>0</Flags>" \
369        "</ExpressionProfile>" \
370      "</profile>" \
371    "</UpdateProfile>" \
372  "</soap:Body>" \
373"</soap:Envelope>"
374
375int msn_soap_profile_get( struct im_connection *ic, const char *cid );
376int msn_soap_profile_set_dn( struct im_connection *ic, const char *dn );
377
378#endif /* __SOAP_H__ */
Note: See TracBrowser for help on using the repository browser.