source: protocols/msn/soap.h @ 4452e69

Last change on this file since 4452e69 was 4452e69, checked in by Wilmer van der Gaast <wilmer@…>, at 2010-08-14T13:06:11Z

Allow changing the display_name, now permanently!

  • Property mode set to 100644
File size: 12.6 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       "</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
135#define SOAP_OIM_SEND_URL "https://ows.messenger.msn.com/OimWS/oim.asmx"
136#define SOAP_OIM_SEND_ACTION "http://messenger.live.com/ws/2006/09/oim/Store2"
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>" \
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\"/>" \
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>" \
152  "<Content xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">" \
153    "MIME-Version: 1.0\r\n" \
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" \
157    "X-OIM-Run-Id: {F9A6C9DD-0D94-4E85-9CC6-F9D118CC1CAF}\r\n" \
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 );
166int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq );
167
168
169#define SOAP_MEMLIST_URL "http://contacts.msn.com/abservice/SharingService.asmx"
170#define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership"
171
172#define SOAP_MEMLIST_PAYLOAD \
173"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
174"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
175  "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
176    "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
177      "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \
178      "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>" \
179      "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">Initial</PartnerScenario>" \
180    "</ABApplicationHeader>" \
181    "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
182      "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>" \
183      "<TicketToken>%s</TicketToken>" \
184    "</ABAuthHeader>" \
185  "</soap:Header>" \
186  "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
187    "<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>" \
188    "</FindMembership>" \
189  "</soap:Body>" \
190"</soap:Envelope>"
191
192int msn_soap_memlist_request( struct im_connection *ic );
193
194
195#define SOAP_ADDRESSBOOK_URL "http://contacts.msn.com/abservice/abservice.asmx"
196#define SOAP_ADDRESSBOOK_ACTION "http://www.msn.com/webservices/AddressBook/ABFindAll"
197
198#define SOAP_ADDRESSBOOK_PAYLOAD \
199"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
200"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">" \
201  "<soap:Header>" \
202    "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
203      "<ApplicationId>CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \
204      "<IsMigration>false</IsMigration>" \
205      "<PartnerScenario>Initial</PartnerScenario>" \
206    "</ABApplicationHeader>" \
207    "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
208      "<ManagedGroupRequest>false</ManagedGroupRequest>" \
209      "<TicketToken>%s</TicketToken>" \
210    "</ABAuthHeader>" \
211  "</soap:Header>" \
212  "<soap:Body>" \
213    "<ABFindAll xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
214      "<abId>00000000-0000-0000-0000-000000000000</abId>" \
215      "<abView>Full</abView>" \
216      "<deltasOnly>false</deltasOnly>" \
217      "<lastChange>0001-01-01T00:00:00.0000000-08:00</lastChange>" \
218    "</ABFindAll>" \
219  "</soap:Body>" \
220"</soap:Envelope>"
221
222#define SOAP_AB_NAMECHANGE_ACTION "http://www.msn.com/webservices/AddressBook/ABContactUpdate"
223
224#define SOAP_AB_NAMECHANGE_PAYLOAD \
225"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
226"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">" \
227  "<soap:Header>" \
228    "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
229      "<ApplicationId>CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \
230      "<IsMigration>false</IsMigration>" \
231      "<PartnerScenario>Initial</PartnerScenario>" \
232    "</ABApplicationHeader>" \
233    "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
234      "<ManagedGroupRequest>false</ManagedGroupRequest>" \
235      "<TicketToken>%s</TicketToken>" \
236    "</ABAuthHeader>" \
237  "</soap:Header>" \
238    "<soap:Body>" \
239        "<ABContactUpdate xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
240            "<abId>00000000-0000-0000-0000-000000000000</abId>" \
241            "<contacts>" \
242                "<Contact xmlns=\"http://www.msn.com/webservices/AddressBook\">" \
243                    "<contactInfo>" \
244                        "<contactType>Me</contactType>" \
245                        "<displayName>%s</displayName>" \
246                    "</contactInfo>" \
247                    "<propertiesChanged>DisplayName</propertiesChanged>" \
248                "</Contact>" \
249            "</contacts>" \
250        "</ABContactUpdate>" \
251    "</soap:Body>" \
252"</soap:Envelope>"
253
254int msn_soap_addressbook_request( struct im_connection *ic );
255int msn_soap_addressbook_set_display_name( struct im_connection *ic, const char *new );
256
257
258#endif /* __SOAP_H__ */
Note: See TracBrowser for help on using the repository browser.