source: protocols/msn/soap.h @ 660cb00

Last change on this file since 660cb00 was 4fc95c5, checked in by Wilmer van der Gaast <wilmer@…>, at 2010-08-14T21:33:33Z

Add/Remove support.

  • Property mode set to 100644
File size: 13.5 KB
RevLine 
[d93c0eb9]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*/
[e5a8118]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" \
[523fb23]53"%s" \
54"Content-Length: %zd\r\n" \
[e5a8118]55"Cache-Control: no-cache\r\n" \
56"\r\n" \
57"%s"
58
59
[523fb23]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>" \
[91d6e91]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>" \
[523fb23]128       "</ps:RequestMultipleSecurityTokens>" \
129   "</Body>" \
130"</Envelope>"
131
132int msn_soap_passport_sso_request( struct im_connection *ic, const char *policy, const char *nonce );
133
134
[e5a8118]135#define SOAP_OIM_SEND_URL "https://ows.messenger.msn.com/OimWS/oim.asmx"
[91d6e91]136#define SOAP_OIM_SEND_ACTION "http://messenger.live.com/ws/2006/09/oim/Store2"
[e5a8118]137
138#define SOAP_OIM_SEND_PAYLOAD \
139"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
140"<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/\">" \
141"<soap:Header>" \
[91d6e91]142  "<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\"/>" \
[e5a8118]143  "<To memberName=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \
144  "<Ticket passport=\"%s\" appid=\"%s\" lockkey=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \
145  "<Sequence xmlns=\"http://schemas.xmlsoap.org/ws/2003/03/rm\">" \
146    "<Identifier xmlns=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">http://messenger.msn.com</Identifier>" \
147    "<MessageNumber>%d</MessageNumber>" \
148  "</Sequence>" \
149"</soap:Header>" \
150"<soap:Body>" \
151  "<MessageType xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">text</MessageType>" \
[ffb6dea]152  "<Content xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">" \
153    "MIME-Version: 1.0\r\n" \
[e5a8118]154    "Content-Type: text/plain; charset=UTF-8\r\n" \
155    "Content-Transfer-Encoding: base64\r\n" \
156    "X-OIM-Message-Type: OfflineMessage\r\n" \
[5fecede]157    "X-OIM-Run-Id: {F9A6C9DD-0D94-4E85-9CC6-F9D118CC1CAF}\r\n" \
[e5a8118]158    "X-OIM-Sequence-Num: %d\r\n" \
159    "\r\n" \
160    "%s" \
161  "</Content>" \
162"</soap:Body>" \
163"</soap:Envelope>"
164
165int msn_soap_oim_send( struct im_connection *ic, const char *to, const char *msg );
[bc090f0]166int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq );
[e5a8118]167
[7db65b7]168
[6ddb223]169#define SOAP_ABSERVICE_PAYLOAD \
[7db65b7]170"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
171"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
172  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
173    "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
174      "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \
175      "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>" \
[6ddb223]176      "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">%s</PartnerScenario>" \
[7db65b7]177    "</ABApplicationHeader>" \
178    "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
179      "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>" \
[7f34ce2]180      "<TicketToken>%s</TicketToken>" \
[7db65b7]181    "</ABAuthHeader>" \
182  "</soap:Header>" \
183  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
[6ddb223]184    "%%s" \
[7db65b7]185  "</soap:Body>" \
186"</soap:Envelope>"
187
[6ddb223]188#define SOAP_MEMLIST_URL "http://contacts.msn.com/abservice/SharingService.asmx"
189#define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership"
190
191#define SOAP_MEMLIST_PAYLOAD \
192    "<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>" \
193    "</FindMembership>"
194
[193dc74]195#define SOAP_MEMLIST_ADD_ACTION "http://www.msn.com/webservices/AddressBook/AddMember"
196#define SOAP_MEMLIST_DEL_ACTION "http://www.msn.com/webservices/AddressBook/DeleteMember"
197
198#define SOAP_MEMLIST_EDIT_PAYLOAD \
199  "<%sMember xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
200   "<serviceHandle>" \
201    "<Id>0</Id>" \
202    "<Type>Messenger</Type>" \
203    "<ForeignId></ForeignId>" \
204   "</serviceHandle>" \
205   "<memberships>" \
206    "<Membership>" \
207     "<MemberRole>%s</MemberRole>" \
208     "<Members>" \
209      "<Member xsi:type=\"PassportMember\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" \
210       "<Type>Passport</Type>" \
211       "<State>Accepted</State>" \
212       "<PassportName>%s</PassportName>" \
213      "</Member>" \
214     "</Members>" \
215    "</Membership>" \
216   "</memberships>" \
[6ddb223]217  "</%sMember>"
[193dc74]218
[7db65b7]219int msn_soap_memlist_request( struct im_connection *ic );
[193dc74]220int msn_soap_memlist_edit( struct im_connection *ic, const char *handle, gboolean add, int list );
[7db65b7]221
222
[7f34ce2]223#define SOAP_ADDRESSBOOK_URL "http://contacts.msn.com/abservice/abservice.asmx"
224#define SOAP_ADDRESSBOOK_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll"
225
226#define SOAP_ADDRESSBOOK_PAYLOAD \
227    "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
228      "<abId>00000000-0000-0000-0000-000000000000</abId>" \
229      "<abView>Full</abView>" \
230      "<deltasOnly>false</deltasOnly>" \
231      "<lastChange>0001-01-01T00:00:00.0000000-08:00</lastChange>" \
[6ddb223]232    "</ABFindAll>"
[7f34ce2]233
[4452e69]234#define SOAP_AB_NAMECHANGE_ACTION "http://www.msn.com/webservices/AddressBook/ABContactUpdate"
235
236#define SOAP_AB_NAMECHANGE_PAYLOAD \
237        "<ABContactUpdate xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
238            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
239            "<contacts>" \
240                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
241                    "<contactInfo>" \
242                        "<contactType>Me</contactType>" \
243                        "<displayName>%s</displayName>" \
244                    "</contactInfo>" \
245                    "<propertiesChanged>DisplayName</propertiesChanged>" \
246                "</Contact>" \
247            "</contacts>" \
[6ddb223]248        "</ABContactUpdate>"
[4452e69]249
[4fc95c5]250#define SOAP_AB_CONTACT_ADD_ACTION "http://www.msn.com/webservices/AddressBook/ABContactAdd"
251
252#define SOAP_AB_CONTACT_ADD_PAYLOAD \
253        "<ABContactAdd xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
254            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
255            "<contacts>" \
256                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
257                    "<contactInfo>" \
258                        "<contactType>LivePending</contactType>" \
259                        "<passportName>%s</passportName>" \
260                        "<isMessengerUser>true</isMessengerUser>" \
261                        "<MessengerMemberInfo>" \
262                            "<DisplayName>%s</DisplayName>" \
263                        "</MessengerMemberInfo>" \
264                    "</contactInfo>" \
265                "</Contact>" \
266            "</contacts>" \
267            "<options>" \
268                "<EnableAllowListManagement>true</EnableAllowListManagement>" \
269            "</options>" \
270        "</ABContactAdd>"
271
272#define SOAP_AB_CONTACT_DEL_ACTION "http://www.msn.com/webservices/AddressBook/ABContactDelete"
273
274#define SOAP_AB_CONTACT_DEL_PAYLOAD \
275        "<ABContactDelete xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
276            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
277            "<contacts>" \
278                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
279                    "<contactId>%s</contactId>" \
280                "</Contact>" \
281            "</contacts>" \
282        "</ABContactDelete>"
283
[7f34ce2]284int msn_soap_addressbook_request( struct im_connection *ic );
[4452e69]285int msn_soap_addressbook_set_display_name( struct im_connection *ic, const char *new );
[4fc95c5]286int msn_soap_ab_contact_add( struct im_connection *ic, bee_user_t *bu );
287int msn_soap_ab_contact_del( struct im_connection *ic, bee_user_t *bu );
[7f34ce2]288
[e5a8118]289#endif /* __SOAP_H__ */
Note: See TracBrowser for help on using the repository browser.