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

Last change on this file since 4e1be76 was 4e1be76, checked in by Wilmer van der Gaast <wilmer@…>, at 2010-09-04T17:23:46Z

Clean up any stuff stuck in the soap queue at disconnect time.

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