source: protocols/msn/soap.h @ e222c36

Last change on this file since e222c36 was dcf155d, checked in by Wilmer van der Gaast <wilmer@…>, at 2012-02-11T17:26:41Z

Drop dead support for MSN offline messages (that SOAP server isn't even in
DNS anymore). Bug #874 for adding support for the new (much simpler, for a
change) way.

  • Property mode set to 100644
File size: 15.7 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_ABSERVICE_PAYLOAD \
149"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
150"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
151  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
152    "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
153      "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \
154      "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>" \
155      "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">%s</PartnerScenario>" \
156    "</ABApplicationHeader>" \
157    "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
158      "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>" \
159      "<TicketToken>%s</TicketToken>" \
160    "</ABAuthHeader>" \
161  "</soap:Header>" \
162  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
163    "%%s" \
164  "</soap:Body>" \
165"</soap:Envelope>"
166
167#define SOAP_MEMLIST_URL "http://contacts.msn.com/abservice/SharingService.asmx"
168#define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership"
169
170#define SOAP_MEMLIST_PAYLOAD \
171    "<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>" \
172    "</FindMembership>"
173
174#define SOAP_MEMLIST_ADD_ACTION "http://www.msn.com/webservices/AddressBook/AddMember"
175#define SOAP_MEMLIST_DEL_ACTION "http://www.msn.com/webservices/AddressBook/DeleteMember"
176
177#define SOAP_MEMLIST_EDIT_PAYLOAD \
178  "<%sMember xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
179   "<serviceHandle>" \
180    "<Id>0</Id>" \
181    "<Type>Messenger</Type>" \
182    "<ForeignId></ForeignId>" \
183   "</serviceHandle>" \
184   "<memberships>" \
185    "<Membership>" \
186     "<MemberRole>%s</MemberRole>" \
187     "<Members>" \
188      "<Member xsi:type=\"PassportMember\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" \
189       "<Type>Passport</Type>" \
190       "<State>Accepted</State>" \
191       "<PassportName>%s</PassportName>" \
192      "</Member>" \
193     "</Members>" \
194    "</Membership>" \
195   "</memberships>" \
196  "</%sMember>"
197
198int msn_soap_memlist_request( struct im_connection *ic );
199int msn_soap_memlist_edit( struct im_connection *ic, const char *handle, gboolean add, int list );
200
201
202#define SOAP_ADDRESSBOOK_URL "http://contacts.msn.com/abservice/abservice.asmx"
203#define SOAP_ADDRESSBOOK_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll"
204
205#define SOAP_ADDRESSBOOK_PAYLOAD \
206    "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
207      "<abId>00000000-0000-0000-0000-000000000000</abId>" \
208      "<abView>Full</abView>" \
209      "<deltasOnly>false</deltasOnly>" \
210      "<lastChange>0001-01-01T00:00:00.0000000-08:00</lastChange>" \
211    "</ABFindAll>"
212
213#define SOAP_AB_NAMECHANGE_ACTION "http://www.msn.com/webservices/AddressBook/ABContactUpdate"
214
215#define SOAP_AB_NAMECHANGE_PAYLOAD \
216        "<ABContactUpdate xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
217            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
218            "<contacts>" \
219                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
220                    "<contactInfo>" \
221                        "<contactType>Me</contactType>" \
222                        "<displayName>%s</displayName>" \
223                    "</contactInfo>" \
224                    "<propertiesChanged>DisplayName</propertiesChanged>" \
225                "</Contact>" \
226            "</contacts>" \
227        "</ABContactUpdate>"
228
229#define SOAP_AB_CONTACT_ADD_ACTION "http://www.msn.com/webservices/AddressBook/ABContactAdd"
230
231#define SOAP_AB_CONTACT_ADD_PAYLOAD \
232        "<ABContactAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
233            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
234            "<contacts>" \
235                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
236                    "<contactInfo>" \
237                        "<contactType>LivePending</contactType>" \
238                        "<passportName>%s</passportName>" \
239                        "<isMessengerUser>true</isMessengerUser>" \
240                        "<MessengerMemberInfo>" \
241                            "<DisplayName>%s</DisplayName>" \
242                        "</MessengerMemberInfo>" \
243                    "</contactInfo>" \
244                "</Contact>" \
245            "</contacts>" \
246            "<options>" \
247                "<EnableAllowListManagement>true</EnableAllowListManagement>" \
248            "</options>" \
249        "</ABContactAdd>"
250
251#define SOAP_AB_CONTACT_DEL_ACTION "http://www.msn.com/webservices/AddressBook/ABContactDelete"
252
253#define SOAP_AB_CONTACT_DEL_PAYLOAD \
254        "<ABContactDelete xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
255            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
256            "<contacts>" \
257                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
258                    "<contactId>%s</contactId>" \
259                "</Contact>" \
260            "</contacts>" \
261        "</ABContactDelete>"
262
263int msn_soap_addressbook_request( struct im_connection *ic );
264int msn_soap_addressbook_set_display_name( struct im_connection *ic, const char *new );
265int msn_soap_ab_contact_add( struct im_connection *ic, bee_user_t *bu );
266int msn_soap_ab_contact_del( struct im_connection *ic, bee_user_t *bu );
267
268
269#define SOAP_STORAGE_URL "https://storage.msn.com/storageservice/SchematizedStore.asmx"
270#define SOAP_PROFILE_GET_ACTION "http://www.msn.com/webservices/storage/w10/GetProfile"
271#define SOAP_PROFILE_SET_DN_ACTION "http://www.msn.com/webservices/storage/w10/UpdateProfile"
272
273#define SOAP_PROFILE_GET_PAYLOAD \
274"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
275"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
276  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
277    "<StorageApplicationHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
278      "<ApplicationID>Messenger Client 9.0</ApplicationID>" \
279      "<Scenario>Initial</Scenario>" \
280    "</StorageApplicationHeader>" \
281    "<StorageUserHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
282      "<Puid>0</Puid>" \
283      "<TicketToken>%s</TicketToken>" \
284    "</StorageUserHeader>" \
285  "</soap:Header>" \
286  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
287    "<GetProfile xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
288      "<profileHandle>" \
289        "<Alias>" \
290          "<Name>%s</Name>" \
291          "<NameSpace>MyCidStuff</NameSpace>" \
292        "</Alias>" \
293        "<RelationshipName>MyProfile</RelationshipName>" \
294      "</profileHandle>" \
295      "<profileAttributes>" \
296        "<ResourceID>true</ResourceID>" \
297        "<DateModified>true</DateModified>" \
298        "<ExpressionProfileAttributes>" \
299          "<ResourceID>true</ResourceID>" \
300          "<DateModified>true</DateModified>" \
301          "<DisplayName>true</DisplayName>" \
302          "<DisplayNameLastModified>true</DisplayNameLastModified>" \
303          "<PersonalStatus>true</PersonalStatus>" \
304          "<PersonalStatusLastModified>true</PersonalStatusLastModified>" \
305          "<StaticUserTilePublicURL>true</StaticUserTilePublicURL>" \
306          "<Photo>true</Photo>" \
307          "<Flags>true</Flags>" \
308        "</ExpressionProfileAttributes>" \
309      "</profileAttributes>" \
310    "</GetProfile>" \
311  "</soap:Body>" \
312"</soap:Envelope>"
313
314#define SOAP_PROFILE_SET_DN_PAYLOAD \
315"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
316"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
317  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
318    "<StorageApplicationHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
319      "<ApplicationID>Messenger Client 9.0</ApplicationID>" \
320      "<Scenario>Initial</Scenario>" \
321    "</StorageApplicationHeader>" \
322    "<StorageUserHeader xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
323      "<Puid>0</Puid>" \
324      "<TicketToken>%s</TicketToken>" \
325    "</StorageUserHeader>" \
326  "</soap:Header>" \
327  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
328    "<UpdateProfile xmlns=\"http://www.msn.com/webservices/storage/w10\">" \
329      "<profile>" \
330        "<ResourceID>%s</ResourceID>" \
331        "<ExpressionProfile>" \
332          "<FreeText>Update</FreeText>" \
333          "<DisplayName>%s</DisplayName>" \
334          "<Flags>0</Flags>" \
335        "</ExpressionProfile>" \
336      "</profile>" \
337    "</UpdateProfile>" \
338  "</soap:Body>" \
339"</soap:Envelope>"
340
341int msn_soap_profile_get( struct im_connection *ic, const char *cid );
342int msn_soap_profile_set_dn( struct im_connection *ic, const char *dn );
343
344#endif /* __SOAP_H__ */
Note: See TracBrowser for help on using the repository browser.