annotate libpurple/protocols/msn/oim.c @ 23453:bca58b00afab

References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child committer: Ka-Hing Cheung <khc@hxbc.us>
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 12 Jan 2008 23:26:29 +0000
parents b268fc2c9121
children 7b03d95902d4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
1 /**
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
2 * @file oim.c
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
3 * get and send MSN offline Instant Message via SOAP request
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
4 * Author
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
5 * MaYuan<mayuan2006@gmail.com>
20401
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
6 * purple
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
7 *
20401
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
10 * source distribution.
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
11 *
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
15 * (at your option) any later version.
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
16 *
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
20 * GNU General Public License for more details.
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
21 *
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
25 */
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
26 #include "msn.h"
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
27 #include "soap2.h"
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
28 #include "oim.h"
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
29 #include "msnutils.h"
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
30
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
31 typedef struct _MsnOimSendReq {
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
32 char *from_member;
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
33 char *friendname;
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
34 char *to_member;
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
35 char *oim_msg;
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
36 } MsnOimSendReq;
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
37
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
38 typedef struct {
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
39 MsnOim *oim;
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
40 char *msg_id;
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
41 } MsnOimRecvData;
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
42
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
43 /*Local Function Prototype*/
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
44 static void msn_oim_post_single_get_msg(MsnOim *oim, char *msgid);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
45 static MsnOimSendReq *msn_oim_new_send_req(const char *from_member,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
46 const char *friendname,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
47 const char* to_member,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
48 const char *msg);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
49 static void msn_oim_free_send_req(MsnOimSendReq *req);
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
50 static void msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
51 static char *msn_oim_msg_to_str(MsnOim *oim, const char *body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
52
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
53 /*new a OIM object*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
54 MsnOim *
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
55 msn_oim_new(MsnSession *session)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
56 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
57 MsnOim *oim;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
58
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
59 oim = g_new0(MsnOim, 1);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
60 oim->session = session;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
61 oim->oim_list = NULL;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
62 oim->run_id = rand_guid();
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
63 oim->challenge = NULL;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
64 oim->send_queue = g_queue_new();
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
65 oim->send_seq = 1;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
66 return oim;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
67 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
68
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
69 /*destroy the oim object*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
70 void
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
71 msn_oim_destroy(MsnOim *oim)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
72 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
73 MsnOimSendReq *request;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
74
20401
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
75 purple_debug_info("OIM","destroy the OIM \n");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
76 g_free(oim->run_id);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
77 g_free(oim->challenge);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
78
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
79 while((request = g_queue_pop_head(oim->send_queue)) != NULL){
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
80 msn_oim_free_send_req(request);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
81 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
82 g_queue_free(oim->send_queue);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
83
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
84 g_free(oim);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
85 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
86
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
87 static MsnOimSendReq *
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
88 msn_oim_new_send_req(const char *from_member, const char*friendname,
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
89 const char* to_member, const char *msg)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
90 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
91 MsnOimSendReq *request;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
92
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
93 request = g_new0(MsnOimSendReq, 1);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
94 request->from_member =g_strdup(from_member);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
95 request->friendname = g_strdup(friendname);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
96 request->to_member = g_strdup(to_member);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
97 request->oim_msg = g_strdup(msg);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
98 return request;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
99 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
100
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
101 static void
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
102 msn_oim_free_send_req(MsnOimSendReq *req)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
103 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
104 g_return_if_fail(req != NULL);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
105
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
106 g_free(req->from_member);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
107 g_free(req->friendname);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
108 g_free(req->to_member);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
109 g_free(req->oim_msg);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
110
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
111 g_free(req);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
112 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
113
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
114 /****************************************
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
115 * OIM send SOAP request
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
116 * **************************************/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
117 /*encode the message to OIM Message Format*/
20989
2097b1664fa3 Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20858
diff changeset
118 static gchar *
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
119 msn_oim_msg_to_str(MsnOim *oim, const char *body)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
120 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
121 char *oim_body,*oim_base64;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
122
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20503
diff changeset
123 purple_debug_info("MSN OIM","encode OIM Message...\n");
20401
4ddc27c18781 Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents: 20394
diff changeset
124 oim_base64 = purple_base64_encode((const guchar *)body, strlen(body));
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20503
diff changeset
125 purple_debug_info("MSN OIM","encoded base64 body:{%s}\n",oim_base64);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
126 oim_body = g_strdup_printf(MSN_OIM_MSG_TEMPLATE,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
127 oim->run_id,oim->send_seq,oim_base64);
20989
2097b1664fa3 Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 20858
diff changeset
128 g_free(oim_base64);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
129
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
130 return oim_body;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
131 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
132
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
133 /*
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
134 * Process the send return SOAP string
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
135 * If got SOAP Fault,get the lock key,and resend it.
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
136 */
20430
abfb0b366109 Compile warning fixes
Stu Tomlinson <stu@nosnilmot.com>
parents: 20401
diff changeset
137 static void
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
138 msn_oim_send_read_cb(MsnSoapMessage *request, MsnSoapMessage *response,
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
139 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
140 {
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
141 MsnOim *oim = data;
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
142 MsnOimSendReq *msg = g_queue_pop_head(oim->send_queue);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
143
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
144 g_return_if_fail(msg != NULL);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
145
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
146 if (response == NULL) {
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
147 purple_debug_info("MSNP14", "cannot send OIM: %s\n", msg->oim_msg);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
148 } else {
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23452
diff changeset
149 xmlnode *faultNode = xmlnode_get_child(response->xml, "Body/Fault");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
150
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
151 if (faultNode == NULL) {
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
152 /*Send OK! return*/
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
153 purple_debug_info("MSNP14", "sent OIM: %s\n", msg->oim_msg);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
154 } else {
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
155 xmlnode *faultcode = xmlnode_get_child(faultNode, "faultcode");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
156
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
157 if (faultcode) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
158 char *faultcode_str = xmlnode_get_data(faultcode);
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
159
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
160 if (g_str_equal(faultcode_str, "q0:AuthenticationFailed")) {
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23452
diff changeset
161 xmlnode *challengeNode = xmlnode_get_child(faultNode,
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
162 "detail/LockKeyChallenge");
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
163
23450
b82a17934604 fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@hxbc.us>
parents: 23447
diff changeset
164 g_free(faultcode_str);
b82a17934604 fixed a memleak or 3, or maybe 4, or 5. Some of these applies to the p14
Ka-Hing Cheung <khc@hxbc.us>
parents: 23447
diff changeset
165
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
166 if (challengeNode == NULL) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
167 if (oim->challenge) {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
168 g_free(oim->challenge);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
169 oim->challenge = NULL;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
170
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
171 purple_debug_info("msnoim","resending OIM: %s\n",
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
172 msg->oim_msg);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
173 g_queue_push_head(oim->send_queue, msg);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
174 msn_oim_send_msg(oim);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
175 return;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
176 } else {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
177 purple_debug_info("msnoim",
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
178 "can't find lock key for OIM: %s\n",
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
179 msg->oim_msg);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
180 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
181 } else {
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
182 char buf[33];
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
183
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
184 char *challenge = xmlnode_get_data(challengeNode);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
185 msn_handle_chl(challenge, buf);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
186
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
187 g_free(oim->challenge);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
188 oim->challenge = g_strndup(buf, sizeof(buf));
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
189 g_free(challenge);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
190 purple_debug_info("MSNP14","lockkey:{%s}\n",oim->challenge);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
191
20538
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
192 /*repost the send*/
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
193 purple_debug_info("MSNP14","resending OIM: %s\n", msg->oim_msg);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
194 g_queue_push_head(oim->send_queue, msg);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
195 msn_oim_send_msg(oim);
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
196 return;
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
197 }
90fd0826c6ce finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents: 20536
diff changeset
198 }
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
199 }
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
200 }
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20435
diff changeset
201 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
202
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
203 msn_oim_free_send_req(msg);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
204 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
205
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
206 void
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
207 msn_oim_prep_send_msg_info(MsnOim *oim, const char *membername,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
208 const char* friendname, const char *tomember,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
209 const char * msg)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
210 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
211 g_return_if_fail(oim != NULL);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
212
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
213 g_queue_push_tail(oim->send_queue,
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
214 msn_oim_new_send_req(membername, friendname, tomember, msg));
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
215 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
216
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
217 /*post send single message request to oim server*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
218 void
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
219 msn_oim_send_msg(MsnOim *oim)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
220 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
221 MsnOimSendReq *oim_request;
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23443
diff changeset
222 char *soap_body;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
223 char *msg_body;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
224
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
225 g_return_if_fail(oim != NULL);
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
226 oim_request = g_queue_peek_head(oim->send_queue);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
227 g_return_if_fail(oim_request != NULL);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
228
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
229 purple_debug_info("MSNP14","sending OIM: %s\n", oim_request->oim_msg);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
230
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
231 /* if we got the challenge lock key, we compute it
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
232 * else we go for the SOAP fault and resend it.
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
233 */
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
234 if(oim->challenge == NULL){
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23443
diff changeset
235 purple_debug_info("MSNP14","no lock key challenge, wait for SOAP Fault and Resend\n");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
236 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
237
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
238 msg_body = msn_oim_msg_to_str(oim, oim_request->oim_msg);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
239 soap_body = g_strdup_printf(MSN_OIM_SEND_TEMPLATE,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
240 oim_request->from_member,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
241 oim_request->friendname,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
242 oim_request->to_member,
23447
72aa2ccad28d fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents: 23443
diff changeset
243 msn_nexus_get_token_str(oim->session->nexus, MSN_AUTH_LIVE_SECURE),
23443
75be80ddeca5 Patch 1 from Qulogic, this one mostly updates the version sent by pidgin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21767
diff changeset
244 MSNP15_WLM_PRODUCT_ID,
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
245 oim->challenge ? oim->challenge : "",
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
246 oim->send_seq,
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
247 msg_body);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
248
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
249 msn_soap_message_send(oim->session,
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
250 msn_soap_message_new(MSN_OIM_SEND_SOAP_ACTION,
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
251 xmlnode_from_str(soap_body, -1)),
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
252 MSN_OIM_SEND_HOST, MSN_OIM_SEND_URL, msn_oim_send_read_cb, oim);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
253
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
254 /*increase the offline Sequence control*/
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
255 if (oim->challenge != NULL) {
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
256 oim->send_seq++;
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
257 }
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
258
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
259 g_free(msg_body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
260 g_free(soap_body);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
261 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
262
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
263 /****************************************
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
264 * OIM delete SOAP request
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
265 * **************************************/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
266 static void
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
267 msn_oim_delete_read_cb(MsnSoapMessage *request, MsnSoapMessage *response,
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
268 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
269 {
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
270 MsnOimRecvData *rdata = data;
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
271
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23452
diff changeset
272 if (response && xmlnode_get_child(response->xml, "Body/Fault") == NULL) {
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
273 purple_debug_info("msnoim", "delete OIM success\n");
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
274 rdata->oim->oim_list = g_list_remove(rdata->oim->oim_list,
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
275 rdata->msg_id);
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
276 g_free(rdata->msg_id);
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
277 } else {
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
278 purple_debug_info("msnoim", "delete OIM failed\n");
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
279 }
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
280
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
281 g_free(rdata);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
282 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
283
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
284 /*Post to get the Offline Instant Message*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
285 static void
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
286 msn_oim_post_delete_msg(MsnOimRecvData *rdata)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
287 {
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
288 MsnOim *oim = rdata->oim;
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
289 char *msgid = rdata->msg_id;
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
290 char *soap_body;
23452
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
291 GHashTable *token;
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
292 const char *msn_t;
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
293 const char *msn_p;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
294
20471
530a92d50c5e Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20444
diff changeset
295 purple_debug_info("MSNP14","Delete single OIM Message {%s}\n",msgid);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
296
23452
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
297 token = msn_nexus_get_token(oim->session->nexus, MSN_AUTH_MESSENGER_WEB);
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
298 g_return_if_fail(token != NULL);
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
299
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
300 msn_t = g_hash_table_lookup(token, "t");
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
301 msn_p = g_hash_table_lookup(token, "p");
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
302
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
303 g_return_if_fail(msn_t != NULL);
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
304 g_return_if_fail(msn_p != NULL);
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
305
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
306 soap_body = g_strdup_printf(MSN_OIM_DEL_TEMPLATE, msn_t, msn_p, msgid);
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
307
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
308 msn_soap_message_send(oim->session,
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
309 msn_soap_message_new(MSN_OIM_DEL_SOAP_ACTION,
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
310 xmlnode_from_str(soap_body, -1)),
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
311 MSN_OIM_RETRIEVE_HOST, MSN_OIM_RETRIEVE_URL,
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
312 msn_oim_delete_read_cb, rdata);
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
313
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
314 g_free(soap_body);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
315 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
316
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
317 /****************************************
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
318 * OIM get SOAP request
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
319 * **************************************/
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
320 /* like purple_str_to_time, but different. The format of the timestamp
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
321 * is like this: 5 Sep 2007 21:42:12 -0700 */
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
322 static time_t
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
323 msn_oim_parse_timestamp(const char *timestamp)
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
324 {
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
325 char month_str[4], tz_str[6];
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
326 char *tz_ptr = tz_str;
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
327 static const char *months[] = {
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
328 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
329 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
330 };
20535
a9ee3fbabf81 fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents: 20534
diff changeset
331 time_t tval = 0;
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
332 struct tm t;
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
333 memset(&t, 0, sizeof(t));
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
334
20535
a9ee3fbabf81 fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents: 20534
diff changeset
335 time(&tval);
a9ee3fbabf81 fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents: 20534
diff changeset
336 localtime_r(&tval, &t);
a9ee3fbabf81 fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents: 20534
diff changeset
337
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
338 if (sscanf(timestamp, "%02d %03s %04d %02d:%02d:%02d %05s",
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
339 &t.tm_mday, month_str, &t.tm_year,
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
340 &t.tm_hour, &t.tm_min, &t.tm_sec, tz_str) == 7) {
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
341 gboolean offset_positive = TRUE;
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
342 int tzhrs;
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
343 int tzmins;
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
344
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
345 for (t.tm_mon = 0;
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
346 months[t.tm_mon] != NULL &&
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
347 strcmp(months[t.tm_mon], month_str) != 0; t.tm_mon++);
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
348 if (months[t.tm_mon] != NULL) {
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
349 if (*tz_str == '-') {
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
350 offset_positive = FALSE;
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
351 tz_ptr++;
20496
c32fbef16656 Fixes #2990, apparently I used the wrong #define. Also fix + timezone
Ka-Hing Cheung <khc@hxbc.us>
parents: 20490
diff changeset
352 } else if (*tz_str == '+') {
c32fbef16656 Fixes #2990, apparently I used the wrong #define. Also fix + timezone
Ka-Hing Cheung <khc@hxbc.us>
parents: 20490
diff changeset
353 tz_ptr++;
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
354 }
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
355
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
356 if (sscanf(tz_ptr, "%02d%02d", &tzhrs, &tzmins) == 2) {
20498
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
357 time_t tzoff = tzhrs * 60 * 60 + tzmins * 60;
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
358 #ifdef _WIN32
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
359 long sys_tzoff;
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
360 #endif
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
361
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
362 if (!offset_positive)
20498
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
363 tzoff *= -1;
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
364
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
365 t.tm_year -= 1900;
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
366
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
367 #ifdef _WIN32
20503
905891855710 3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@hxbc.us>
parents: 20501
diff changeset
368 if ((sys_tzoff = wpurple_get_tz_offset()) != -1)
20498
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
369 tzoff += sys_tzoff;
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
370 #else
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
371 #ifdef HAVE_TM_GMTOFF
20535
a9ee3fbabf81 fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents: 20534
diff changeset
372 tzoff -= t.tm_gmtoff;
20498
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
373 #else
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
374 # ifdef HAVE_TIMEZONE
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
375 tzset(); /* making sure */
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
376 tzoff -= timezone;
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
377 # endif
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
378 #endif
20498
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
379 #endif /* _WIN32 */
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
380
6ef43e723595 I think this is the right way to fix timezone. People on Win32 _and_
Ka-Hing Cheung <khc@hxbc.us>
parents: 20496
diff changeset
381 return mktime(&t) + tzoff;
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
382 }
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
383 }
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
384 }
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
385
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
386 purple_debug_info("MSNP14:OIM", "Can't parse timestamp %s\n", timestamp);
20535
a9ee3fbabf81 fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents: 20534
diff changeset
387 return tval;
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
388 }
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
389
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
390 /*Post the Offline Instant Message to User Conversation*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
391 static void
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
392 msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
393 {
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
394 MsnMessage *message;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
395 char *date,*from,*decode_msg;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
396 gsize body_len;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
397 char **tokens;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
398 char *start,*end;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
399 int has_nick = 0;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
400 char *passport_str, *passport;
20435
f0bc92602072 Parse the message timestamp using purple_str_to_time. I haven't been able
Stu Tomlinson <stu@nosnilmot.com>
parents: 20433
diff changeset
401 time_t stamp;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
402
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
403 message = msn_message_new(MSN_MSG_UNKNOWN);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
404
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
405 msn_message_parse_payload(message, msg_str, strlen(msg_str),
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
406 MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM);
20471
530a92d50c5e Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20444
diff changeset
407 purple_debug_info("MSNP14","oim body:{%s}\n",message->body);
20430
abfb0b366109 Compile warning fixes
Stu Tomlinson <stu@nosnilmot.com>
parents: 20401
diff changeset
408 decode_msg = (char *)purple_base64_decode(message->body,&body_len);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
409 date = (char *)g_hash_table_lookup(message->attr_table, "Date");
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
410 from = (char *)g_hash_table_lookup(message->attr_table, "From");
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
411 if(strstr(from," ")){
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
412 has_nick = 1;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
413 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
414 if(has_nick){
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
415 tokens = g_strsplit(from , " " , 2);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
416 passport_str = g_strdup(tokens[1]);
20471
530a92d50c5e Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20444
diff changeset
417 purple_debug_info("MSNP14","oim Date:{%s},nickname:{%s},tokens[1]:{%s} passport{%s}\n",
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
418 date,tokens[0],tokens[1],passport_str);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
419 g_strfreev(tokens);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
420 }else{
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
421 passport_str = g_strdup(from);
20471
530a92d50c5e Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20444
diff changeset
422 purple_debug_info("MSNP14","oim Date:{%s},passport{%s}\n",
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
423 date,passport_str);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
424 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
425 start = strstr(passport_str,"<");
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
426 start += 1;
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
427 end = strstr(passport_str,">");
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
428 passport = g_strndup(start,end - start);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
429 g_free(passport_str);
20539
2c8c6d77f12c Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents: 20503
diff changeset
430 purple_debug_info("MSN OIM","oim Date:{%s},passport{%s}\n",date,passport);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
431
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
432 stamp = msn_oim_parse_timestamp(date);
20435
f0bc92602072 Parse the message timestamp using purple_str_to_time. I haven't been able
Stu Tomlinson <stu@nosnilmot.com>
parents: 20433
diff changeset
433
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
434 serv_got_im(rdata->oim->session->account->gc, passport, decode_msg, 0,
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
435 stamp);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
436
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
437 /*Now get the oim message ID from the oim_list.
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
438 * and append to read list to prepare for deleting the Offline Message when sign out
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
439 */
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
440 msn_oim_post_delete_msg(rdata);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
441
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
442 g_free(passport);
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
443 g_free(decode_msg);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
444 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
445
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
446 /* Parse the XML data,
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
447 * prepare to report the OIM to user
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
448 */
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
449 static void
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
450 msn_oim_get_read_cb(MsnSoapMessage *request, MsnSoapMessage *response,
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
451 gpointer data)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
452 {
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
453 MsnOimRecvData *rdata = data;
20501
f6dff814d95f cleans up ownership of soap callback data, this soap stuff is perfect
Ka-Hing Cheung <khc@hxbc.us>
parents: 20500
diff changeset
454
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
455 if (response != NULL) {
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23452
diff changeset
456 xmlnode *msg_node = xmlnode_get_child(response->xml,
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
457 "Body/GetMessageResponse/GetMessageResult");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
458
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
459 if (msg_node) {
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
460 char *msg_str = xmlnode_get_data(msg_node);
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
461 msn_oim_report_to_user(rdata, msg_str);
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
462 g_free(msg_str);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
463 } else {
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
464 char *str = xmlnode_to_str(response->xml, NULL);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
465 purple_debug_info("msnoim", "Unknown response: %s\n", str);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
466 g_free(str);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
467 }
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
468 } else {
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
469 purple_debug_info("msnoim", "Failed to get OIM\n");
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
470 }
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
471 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
472
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
473 /* parse the oim XML data
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
474 * and post it to the soap server to get the Offline Message
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
475 * */
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
476 void
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
477 msn_parse_oim_msg(MsnOim *oim,const char *xmlmsg)
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
478 {
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
479 xmlnode *node, *mNode;
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
480 xmlnode *iu_node;
20444
a0d104281002 Compile fix, whoops! Thanks Masca/salinasv.
Stu Tomlinson <stu@nosnilmot.com>
parents: 20443
diff changeset
481 MsnSession *session = oim->session;
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20435
diff changeset
482
23443
75be80ddeca5 Patch 1 from Qulogic, this one mostly updates the version sent by pidgin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 21767
diff changeset
483 purple_debug_info("MSNP14:OIM", "%s\n", xmlmsg);
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
484
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
485 node = xmlnode_from_str(xmlmsg, -1);
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
486 if (strcmp(node->name, "MD") != 0) {
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
487 purple_debug_info("msnoim", "WTF is this? %s\n", xmlmsg);
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
488 xmlnode_free(node);
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
489 return;
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
490 }
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20435
diff changeset
491
23453
bca58b00afab References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23452
diff changeset
492 iu_node = xmlnode_get_child(node, "E/IU");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
493
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
494 if (iu_node != NULL && purple_account_get_check_mail(session->account))
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
495 {
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
496 char *unread = xmlnode_get_data(iu_node);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
497 const char *passport = msn_user_get_passport(session->user);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
498 const char *url = session->passport_info.file;
21767
7ac87187bbec Don't show a 'you ain't got no new mail' notification.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21103
diff changeset
499 int count = atoi(unread);
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20435
diff changeset
500
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
501 /* XXX/khc: pretty sure this is wrong */
21767
7ac87187bbec Don't show a 'you ain't got no new mail' notification.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21103
diff changeset
502 if (count > 0)
7ac87187bbec Don't show a 'you ain't got no new mail' notification.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21103
diff changeset
503 purple_notify_emails(session->account->gc, count, FALSE, NULL,
7ac87187bbec Don't show a 'you ain't got no new mail' notification.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 21103
diff changeset
504 NULL, &passport, &url, NULL, NULL);
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
505 g_free(unread);
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20435
diff changeset
506 }
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20435
diff changeset
507
20490
2d8999540239 mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents: 20481
diff changeset
508 for(mNode = xmlnode_get_child(node, "M"); mNode;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
509 mNode = xmlnode_get_next_twin(mNode)){
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
510 char *passport, *msgid, *nickname, *rtime = NULL;
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
511 xmlnode *e_node, *i_node, *n_node, *rt_node;
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
512
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
513 e_node = xmlnode_get_child(mNode, "E");
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
514 passport = xmlnode_get_data(e_node);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
515
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
516 i_node = xmlnode_get_child(mNode, "I");
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
517 msgid = xmlnode_get_data(i_node);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
518
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
519 n_node = xmlnode_get_child(mNode, "N");
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
520 nickname = xmlnode_get_data(n_node);
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
521
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
522 rt_node = xmlnode_get_child(mNode, "RT");
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
523 if (rt_node != NULL) {
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
524 rtime = xmlnode_get_data(rt_node);
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20435
diff changeset
525 }
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
526 /* purple_debug_info("msnoim","E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime); */
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
527
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
528 if (!g_list_find_custom(oim->oim_list, msgid, (GCompareFunc)strcmp)) {
20535
a9ee3fbabf81 fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents: 20534
diff changeset
529 oim->oim_list = g_list_append(oim->oim_list, msgid);
a9ee3fbabf81 fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents: 20534
diff changeset
530 msn_oim_post_single_get_msg(oim, msgid);
a9ee3fbabf81 fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents: 20534
diff changeset
531 msgid = NULL;
a9ee3fbabf81 fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents: 20534
diff changeset
532 }
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
533
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
534 g_free(passport);
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20435
diff changeset
535 g_free(msgid);
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
536 g_free(rtime);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
537 g_free(nickname);
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
538 }
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
539
20439
bee467c81570 A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents: 20435
diff changeset
540 xmlnode_free(node);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
541 }
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
542
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
543 /*Post to get the Offline Instant Message*/
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
544 static void
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
545 msn_oim_post_single_get_msg(MsnOim *oim, char *msgid)
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
546 {
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
547 char *soap_body;
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
548 MsnOimRecvData *data = g_new0(MsnOimRecvData, 1);
23452
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
549 GHashTable *token;
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
550 const char *msn_t;
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
551 const char *msn_p;
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
552
20471
530a92d50c5e Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents: 20444
diff changeset
553 purple_debug_info("MSNP14","Get single OIM Message\n");
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
554
23452
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
555 token = msn_nexus_get_token(oim->session->nexus, MSN_AUTH_MESSENGER_WEB);
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
556 g_return_if_fail(token != NULL);
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
557
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
558 msn_t = g_hash_table_lookup(token, "t");
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
559 msn_p = g_hash_table_lookup(token, "p");
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
560 g_return_if_fail(msn_t != NULL);
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
561 g_return_if_fail(msn_p != NULL);
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
562
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
563 data->oim = oim;
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
564 data->msg_id = msgid;
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
565
23452
b268fc2c9121 References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23450
diff changeset
566 soap_body = g_strdup_printf(MSN_OIM_GET_TEMPLATE, msn_t, msn_p, msgid);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
567
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
568 msn_soap_message_send(oim->session,
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
569 msn_soap_message_new(MSN_OIM_GET_SOAP_ACTION,
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
570 xmlnode_from_str(soap_body, -1)),
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
571 MSN_OIM_RETRIEVE_HOST, MSN_OIM_RETRIEVE_URL,
20536
d52d299cfde3 seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents: 20535
diff changeset
572 msn_oim_get_read_cb, data);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
573
20534
7e69275a4eef oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents: 20503
diff changeset
574 g_free(soap_body);
20394
4a099e4d0d09 propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff changeset
575 }