comparison libpurple/protocols/msn/oim.h @ 20394:4a099e4d0d09

propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328) to branch 'im.pidgin.rlaager.merging.msnp13-and-pidgin' (head 4d82c29e56bd33cd6f94302e343dfeb5d68ab3eb)
author Richard Laager <rlaager@wiktel.com>
date Sun, 15 Apr 2007 03:43:17 +0000
parents
children 4ddc27c18781
comparison
equal deleted inserted replaced
20393:40a04930b233 20394:4a099e4d0d09
1 /**
2 * @file oim.h Header file for oim.c
3 * Author
4 * MaYuan<mayuan2006@gmail.com>
5 * gaim
6 *
7 * Gaim is the legal property of its developers, whose names are too numerous
8 * to list here. Please refer to the COPYRIGHT file distributed with this
9 * source distribution.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25 #ifndef _MSN_OIM_H_
26 #define _MSN_OIM_H_
27
28 /*OIM Retrieve SOAP Template*/
29 #define MSN_OIM_RETRIEVE_HOST "rsi.hotmail.com"
30 #define MSN_OIM_RETRIEVE_URL "/rsi/rsi.asmx"
31 #define MSN_OIM_GET_SOAP_ACTION "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/GetMessage"
32
33 #define MSN_OIM_GET_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
34 "<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/\">"\
35 "<soap:Header>"\
36 "<PassportCookie xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
37 "<t>%s</t>"\
38 "<p>%s</p>"\
39 "</PassportCookie>"\
40 "</soap:Header>"\
41 "<soap:Body>"\
42 "<GetMessage xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
43 "<messageId>%s</messageId>"\
44 "<alsoMarkAsRead>false</alsoMarkAsRead>"\
45 "</GetMessage>"\
46 "</soap:Body>"\
47 "</soap:Envelope>"
48
49 /*OIM Delete SOAP Template*/
50 #define MSN_OIM_DEL_SOAP_ACTION "http://www.hotmail.msn.com/ws/2004/09/oim/rsi/DeleteMessages"
51
52 #define MSN_OIM_DEL_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
53 "<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/\">"\
54 "<soap:Header>"\
55 "<PassportCookie xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
56 "<t>%s</t>"\
57 " <p>%s</p>"\
58 "</PassportCookie>"\
59 "</soap:Header>"\
60 "<soap:Body>"\
61 "<DeleteMessages xmlns=\"http://www.hotmail.msn.com/ws/2004/09/oim/rsi\">"\
62 "<messageIds>"\
63 "<messageId>%s</messageId>"\
64 "</messageIds>"\
65 "</DeleteMessages>"\
66 "</soap:Body>"\
67 "</soap:Envelope>"
68
69 /*OIM Send SOAP Template*/
70 #define MSN_OIM_MSG_TEMPLATE "MIME-Version: 1.0\n"\
71 "Content-Type: text/plain; charset=UTF-8\n"\
72 "Content-Transfer-Encoding: base64\n"\
73 "X-OIM-Message-Type: OfflineMessage\n"\
74 "X-OIM-Run-Id: {%s}\n"\
75 "X-OIM-Sequence-Num: %d\n\n"\
76 "%s"
77
78 #define MSN_OIM_SEND_HOST "ows.messenger.msn.com"
79 #define MSN_OIM_SEND_URL "/OimWS/oim.asmx"
80 #define MSN_OIM_SEND_SOAP_ACTION "http://messenger.msn.com/ws/2004/09/oim/Store"
81 #define MSN_OIM_SEND_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
82 "<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/\">"\
83 "<soap:Header>"\
84 "<From memberName=\"%s\" friendlyName=\"%s\" xml:lang=\"en-US\" proxy=\"MSNMSGR\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\" msnpVer=\"MSNP14\" buildVer=\"8.0.0792\"/>"\
85 "<To memberName=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>"\
86 "<Ticket passport=\"%s\" appid=\"%s\" lockkey=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>"\
87 "<Sequence xmlns=\"http://schemas.xmlsoap.org/ws/2003/03/rm\">"\
88 "<Identifier xmlns=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">http://messenger.msn.com</Identifier>"\
89 "<MessageNumber>%d</MessageNumber>"\
90 "</Sequence>"\
91 "</soap:Header>"\
92 "<soap:Body>"\
93 "<MessageType xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">text</MessageType>"\
94 "<Content xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">%s</Content>"\
95 "</soap:Body>"\
96 "</soap:Envelope>"
97
98 typedef struct _MsnOimSendReq MsnOimSendReq;
99
100 struct _MsnOimSendReq
101 {
102 char *from_member;
103 char *friendname;
104 char *to_member;
105 char *oim_msg;
106 gint send_seq;
107 };
108
109 typedef struct _MsnOim MsnOim;
110
111 struct _MsnOim
112 {
113 MsnSession *session;
114
115 MsnSoapConn *retrieveconn;
116 GList * oim_list;
117
118 MsnSoapConn *sendconn;
119 char *challenge;
120 char *run_id;
121 gint send_seq;
122 GQueue *send_queue;
123 };
124
125 /****************************************************
126 * function prototype
127 * **************************************************/
128 MsnOim * msn_oim_new(MsnSession *session);
129 void msn_oim_destroy(MsnOim *oim);
130 void msn_oim_connect(MsnOim *oim);
131
132 void msn_parse_oim_msg(MsnOim *oim,const char *xmlmsg);
133
134 /*Send OIM Message*/
135 void msn_oim_prep_send_msg_info(MsnOim *oim, const char *membername,
136 const char *friendname, const char *tomember,
137 const char * msg);
138
139 void msn_oim_send_msg(MsnOim *oim);
140
141 /*get the OIM message*/
142 void msn_oim_get_msg(MsnOim *oim);
143
144 /*report the oim message to the conversation*/
145 void msn_oim_report_user(MsnOim *oim,const char *passport,char *msg);
146
147 #endif/* _MSN_OIM_H_*/
148 /*endof oim.h*/