source: protocols/msn/soap.h @ 9b1d2d6

Last change on this file since 9b1d2d6 was 80175a1, checked in by Wilmer van der Gaast <wilmer@…>, at 2010-08-18T19:21:44Z

Fetch the user's profile to see if there's a display name set there. If
there is, the one in the address book should be ignored. No support for
changing the profile yet though.

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