[e5a8118] | 1 | /* soap.h |
---|
| 2 | * |
---|
| 3 | * SOAP-related functions. Some manager at Microsoft apparently thought |
---|
| 4 | * MSNP wasn't XMLy enough so someone stepped up and changed that. This |
---|
| 5 | * is the result. |
---|
| 6 | * |
---|
| 7 | * Copyright (C) 2010 Wilmer van der Gaast <wilmer@gaast.net> |
---|
| 8 | * |
---|
| 9 | * This program is free software; you can redistribute it and/or modify |
---|
| 10 | * it under the terms of the GNU General Public License version 2 |
---|
| 11 | * as published by the Free Software Foundation |
---|
| 12 | * |
---|
| 13 | * This program is distributed in the hope that is will be useful, |
---|
| 14 | * bit WITHOU ANY WARRANTY; without even the implied warranty of |
---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 16 | * GNU General Public License for more details. |
---|
| 17 | * |
---|
| 18 | * You should have received a copy of the GNU General Public License |
---|
| 19 | * along with this program; if not, write to the Free Software |
---|
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | /* Thanks to http://msnpiki.msnfanatic.com/ for lots of info on this! */ |
---|
| 24 | |
---|
| 25 | #ifndef __SOAP_H__ |
---|
| 26 | #define __SOAP_H__ |
---|
| 27 | |
---|
| 28 | #include <stdio.h> |
---|
| 29 | #include <stdlib.h> |
---|
| 30 | #include <string.h> |
---|
| 31 | #include <sys/types.h> |
---|
| 32 | #ifndef _WIN32 |
---|
| 33 | #include <sys/socket.h> |
---|
| 34 | #include <netinet/in.h> |
---|
| 35 | #include <arpa/inet.h> |
---|
| 36 | #include <unistd.h> |
---|
| 37 | #endif |
---|
| 38 | #include "nogaim.h" |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | #define SOAP_HTTP_REQUEST \ |
---|
| 42 | "POST %s HTTP/1.0\r\n" \ |
---|
| 43 | "Host: %s\r\n" \ |
---|
| 44 | "Accept: */*\r\n" \ |
---|
| 45 | "SOAPAction: \"%s\"\r\n" \ |
---|
| 46 | "User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \ |
---|
| 47 | "Content-Type: text/xml; charset=utf-8\r\n" \ |
---|
[7db65b7] | 48 | "Cookie: MSPAuth=%s\r\n" \ |
---|
[e5a8118] | 49 | "Content-Length: %d\r\n" \ |
---|
| 50 | "Cache-Control: no-cache\r\n" \ |
---|
| 51 | "\r\n" \ |
---|
| 52 | "%s" |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | #define SOAP_OIM_SEND_URL "https://ows.messenger.msn.com/OimWS/oim.asmx" |
---|
[7db65b7] | 56 | #define SOAP_OIM_SEND_ACTION "http://messenger.msn.com/ws/2004/09/oim/Store" |
---|
[e5a8118] | 57 | |
---|
| 58 | #define SOAP_OIM_SEND_PAYLOAD \ |
---|
| 59 | "<?xml version=\"1.0\" encoding=\"utf-8\"?>" \ |
---|
| 60 | "<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/\">" \ |
---|
| 61 | "<soap:Header>" \ |
---|
| 62 | "<From memberName=\"%s\" friendlyName=\"=?utf-8?B?%s?=\" xml:lang=\"nl-nl\" proxy=\"MSNMSGR\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\" msnpVer=\"MSNP13\" buildVer=\"8.0.0328\"/>" \ |
---|
| 63 | "<To memberName=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \ |
---|
| 64 | "<Ticket passport=\"%s\" appid=\"%s\" lockkey=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \ |
---|
| 65 | "<Sequence xmlns=\"http://schemas.xmlsoap.org/ws/2003/03/rm\">" \ |
---|
| 66 | "<Identifier xmlns=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">http://messenger.msn.com</Identifier>" \ |
---|
| 67 | "<MessageNumber>%d</MessageNumber>" \ |
---|
| 68 | "</Sequence>" \ |
---|
| 69 | "</soap:Header>" \ |
---|
| 70 | "<soap:Body>" \ |
---|
| 71 | "<MessageType xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">text</MessageType>" \ |
---|
[ffb6dea] | 72 | "<Content xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">" \ |
---|
| 73 | "MIME-Version: 1.0\r\n" \ |
---|
[e5a8118] | 74 | "Content-Type: text/plain; charset=UTF-8\r\n" \ |
---|
| 75 | "Content-Transfer-Encoding: base64\r\n" \ |
---|
| 76 | "X-OIM-Message-Type: OfflineMessage\r\n" \ |
---|
[5fecede] | 77 | "X-OIM-Run-Id: {F9A6C9DD-0D94-4E85-9CC6-F9D118CC1CAF}\r\n" \ |
---|
[e5a8118] | 78 | "X-OIM-Sequence-Num: %d\r\n" \ |
---|
| 79 | "\r\n" \ |
---|
| 80 | "%s" \ |
---|
| 81 | "</Content>" \ |
---|
| 82 | "</soap:Body>" \ |
---|
| 83 | "</soap:Envelope>" |
---|
| 84 | |
---|
| 85 | int msn_soap_oim_send( struct im_connection *ic, const char *to, const char *msg ); |
---|
[bc090f0] | 86 | int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq ); |
---|
[e5a8118] | 87 | |
---|
[7db65b7] | 88 | |
---|
| 89 | #define SOAP_MEMLIST_URL "https://byrdr.omega.contacts.msn.com/abservice/SharingService.asmx" |
---|
| 90 | #define SOAP_MEMLIST_ACTION "http://www.msn.com/webservices/AddressBook/FindMembership" |
---|
| 91 | |
---|
| 92 | #define SOAP_MEMLIST_PAYLOAD \ |
---|
| 93 | "<?xml version=\"1.0\" encoding=\"utf-8\"?>" \ |
---|
| 94 | "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \ |
---|
| 95 | "<soap:Header xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \ |
---|
| 96 | "<ABApplicationHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \ |
---|
| 97 | "<ApplicationId xmlns=\"http://www.msn.com/webservices/AddressBook\">CFE80F9D-180F-4399-82AB-413F33A1FA11</ApplicationId>" \ |
---|
| 98 | "<IsMigration xmlns=\"http://www.msn.com/webservices/AddressBook\">false</IsMigration>" \ |
---|
| 99 | "<PartnerScenario xmlns=\"http://www.msn.com/webservices/AddressBook\">Initial</PartnerScenario>" \ |
---|
| 100 | "</ABApplicationHeader>" \ |
---|
| 101 | "<ABAuthHeader xmlns=\"http://www.msn.com/webservices/AddressBook\">" \ |
---|
| 102 | "<ManagedGroupRequest xmlns=\"http://www.msn.com/webservices/AddressBook\">false</ManagedGroupRequest>" \ |
---|
| 103 | "</ABAuthHeader>" \ |
---|
| 104 | "</soap:Header>" \ |
---|
| 105 | "<soap:Body xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \ |
---|
| 106 | "<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>" \ |
---|
| 107 | "</FindMembership>" \ |
---|
| 108 | "</soap:Body>" \ |
---|
| 109 | "</soap:Envelope>" |
---|
| 110 | |
---|
| 111 | int msn_soap_memlist_request( struct im_connection *ic ); |
---|
| 112 | |
---|
| 113 | |
---|
[e5a8118] | 114 | #endif /* __SOAP_H__ */ |
---|