Mercurial > pidgin.yaz
annotate libpurple/protocols/msn/oim.c @ 31421:2a9327053398
Suppress the "View Locations..." protocol action on MSN if we are not
actually using MSNP16 or newer
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Mon, 29 Nov 2010 01:12:51 +0000 |
parents | b4285ea42b6e |
children | 84c5575d08de |
rev | line source |
---|---|
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1 /** |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22932
diff
changeset
|
2 * @file oim.c |
20394
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 |
28420
7921a53b94b3
Oops, Elliott correctly pointed out this was wrong...
Paul Aurich <paul@darkrain42.org>
parents:
28399
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
25 */ |
31180
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
31132
diff
changeset
|
26 |
31196
230caecf5435
Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents:
31180
diff
changeset
|
27 #include "internal.h" |
31180
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
31132
diff
changeset
|
28 #include "debug.h" |
a99b6dcdb60d
Remove unnecesary includes from msn.h.
masca@cpw.pidgin.im
parents:
31132
diff
changeset
|
29 |
23552
711773577380
Clean up some MSN SOAP stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23537
diff
changeset
|
30 #include "soap.h" |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
31 #include "oim.h" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
32 #include "msnutils.h" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
33 |
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
|
34 typedef struct _MsnOimSendReq { |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
35 char *from_member; |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
36 char *friendname; |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
37 char *to_member; |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
38 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
|
39 } 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
|
40 |
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 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
|
42 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
|
43 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
|
44 } MsnOimRecvData; |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
45 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
46 /*Local Function Prototype*/ |
23499
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
47 static void msn_parse_oim_xml(MsnOim *oim, xmlnode *node); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
48 static void msn_oim_free_send_req(MsnOimSendReq *req); |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
49 static void msn_oim_recv_data_free(MsnOimRecvData *data); |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
50 static void msn_oim_post_single_get_msg(MsnOim *oim, MsnOimRecvData *data); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
51 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
52 /*new a OIM object*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
53 MsnOim * |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
54 msn_oim_new(MsnSession *session) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
55 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
56 MsnOim *oim; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
57 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
58 oim = g_new0(MsnOim, 1); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
59 oim->session = session; |
22808
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22804
diff
changeset
|
60 oim->oim_list = NULL; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
61 oim->run_id = rand_guid(); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
62 oim->challenge = NULL; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
63 oim->send_queue = g_queue_new(); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
64 oim->send_seq = 1; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
65 return oim; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
66 } |
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 /*destroy the oim object*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
69 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
70 msn_oim_destroy(MsnOim *oim) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
71 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
72 MsnOimSendReq *request; |
22808
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22804
diff
changeset
|
73 |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
74 purple_debug_info("msn", "destroy the OIM %p\n", oim); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
75 g_free(oim->run_id); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
76 g_free(oim->challenge); |
22808
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22804
diff
changeset
|
77 |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
78 while ((request = g_queue_pop_head(oim->send_queue)) != NULL) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
79 msn_oim_free_send_req(request); |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
80 g_queue_free(oim->send_queue); |
22808
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22804
diff
changeset
|
81 |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
82 while (oim->oim_list != NULL) |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
83 msn_oim_recv_data_free((MsnOimRecvData *)oim->oim_list->data); |
22808
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22804
diff
changeset
|
84 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
85 g_free(oim); |
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 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
88 static MsnOimSendReq * |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
89 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
|
90 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
|
91 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
92 MsnOimSendReq *request; |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22932
diff
changeset
|
93 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
94 request = g_new0(MsnOimSendReq, 1); |
22808
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22804
diff
changeset
|
95 request->from_member = g_strdup(from_member); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
96 request->friendname = g_strdup(friendname); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
97 request->to_member = g_strdup(to_member); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
98 request->oim_msg = g_strdup(msg); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
99 return request; |
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 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
102 static void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
103 msn_oim_free_send_req(MsnOimSendReq *req) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
104 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
105 g_return_if_fail(req != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
106 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
107 g_free(req->from_member); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
108 g_free(req->friendname); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
109 g_free(req->to_member); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
110 g_free(req->oim_msg); |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22932
diff
changeset
|
111 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
112 g_free(req); |
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 |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
115 static MsnOimRecvData * |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
116 msn_oim_recv_data_new(MsnOim *oim, char *msg_id) |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
117 { |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
118 MsnOimRecvData *data; |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
119 |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
120 data = g_new0(MsnOimRecvData, 1); |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
121 data->oim = oim; |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
122 data->msg_id = msg_id; |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
123 |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
124 oim->oim_list = g_list_append(oim->oim_list, data); |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
125 |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
126 return data; |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
127 } |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
128 |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
129 /* Probably only good for g_list_find_custom */ |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
130 static gint |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
131 msn_recv_data_equal(MsnOimRecvData *a, const char *msg_id) |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
132 { |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
133 return strcmp(a->msg_id, msg_id); |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
134 } |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
135 |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
136 static void |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
137 msn_oim_recv_data_free(MsnOimRecvData *data) |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
138 { |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
139 data->oim->oim_list = g_list_remove(data->oim->oim_list, data); |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
140 g_free(data->msg_id); |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
141 |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
142 g_free(data); |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
143 } |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
144 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
145 /**************************************** |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
146 * Manage OIM Tokens |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
147 ****************************************/ |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
148 typedef struct _MsnOimRequestData { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
149 MsnOim *oim; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
150 gboolean send; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
151 const char *action; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
152 const char *host; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
153 const char *url; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
154 xmlnode *body; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
155 MsnSoapCallback cb; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
156 gpointer cb_data; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
157 } MsnOimRequestData; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
158 |
28794
44cbfcaf9e3a
Fix a crash when sending OIMs on MSN. The callback function used after
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28719
diff
changeset
|
159 static gboolean msn_oim_request_helper(MsnOimRequestData *data); |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
160 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
161 static void |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
162 msn_oim_request_cb(MsnSoapMessage *request, MsnSoapMessage *response, |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
163 gpointer req_data) |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
164 { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
165 MsnOimRequestData *data = (MsnOimRequestData *)req_data; |
23537
8fd6a97b9c67
Apparently, when the token expires, OIM requests get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23535
diff
changeset
|
166 xmlnode *fault = NULL; |
8fd6a97b9c67
Apparently, when the token expires, OIM requests get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23535
diff
changeset
|
167 xmlnode *faultcode = NULL; |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
168 |
23598
2a4341e3d2da
Avoid a crash in OIM processing if the request was cancelled outside of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23596
diff
changeset
|
169 if (response == NULL) |
2a4341e3d2da
Avoid a crash in OIM processing if the request was cancelled outside of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23596
diff
changeset
|
170 return; |
2a4341e3d2da
Avoid a crash in OIM processing if the request was cancelled outside of
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23596
diff
changeset
|
171 |
23537
8fd6a97b9c67
Apparently, when the token expires, OIM requests get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23535
diff
changeset
|
172 fault = xmlnode_get_child(response->xml, "Body/Fault"); |
8fd6a97b9c67
Apparently, when the token expires, OIM requests get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23535
diff
changeset
|
173 if (fault) |
8fd6a97b9c67
Apparently, when the token expires, OIM requests get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23535
diff
changeset
|
174 faultcode = xmlnode_get_child(fault, "faultcode"); |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
175 |
23537
8fd6a97b9c67
Apparently, when the token expires, OIM requests get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23535
diff
changeset
|
176 if (faultcode) { |
8fd6a97b9c67
Apparently, when the token expires, OIM requests get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23535
diff
changeset
|
177 gchar *faultcode_str = xmlnode_get_data(faultcode); |
28625
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
178 gboolean need_token_update = FALSE; |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
179 |
28625
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
180 if (faultcode_str) { |
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
181 if (g_str_equal(faultcode_str, "q0:BadContextToken") || |
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
182 g_str_equal(faultcode_str, "AuthenticationFailed")) |
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
183 need_token_update = TRUE; |
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
184 else if (g_str_equal(faultcode_str, "q0:AuthenticationFailed") && |
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
185 xmlnode_get_child(fault, "detail/RequiredAuthPolicy") != NULL) |
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
186 need_token_update = TRUE; |
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
187 } |
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
188 |
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
189 if (need_token_update) { |
26278
399776a9ad98
Add some missing newlines in debug messages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24921
diff
changeset
|
190 purple_debug_warning("msn", "OIM Request Error, Updating token now.\n"); |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
191 msn_nexus_update_token(data->oim->session->nexus, |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
192 data->send ? MSN_AUTH_LIVE_SECURE : MSN_AUTH_MESSENGER_WEB, |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
193 (GSourceFunc)msn_oim_request_helper, data); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
194 g_free(faultcode_str); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
195 return; |
23537
8fd6a97b9c67
Apparently, when the token expires, OIM requests get a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23535
diff
changeset
|
196 |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
197 } |
28625
ca0d55a8943f
Dimmuxx noticed that retrieving OIM didn't work for him until he
Ka-Hing Cheung <khc@hxbc.us>
parents:
28420
diff
changeset
|
198 |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
199 g_free(faultcode_str); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
200 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
201 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
202 if (data->cb) |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
203 data->cb(request, response, data->cb_data); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
204 xmlnode_free(data->body); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
205 g_free(data); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
206 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
207 |
28794
44cbfcaf9e3a
Fix a crash when sending OIMs on MSN. The callback function used after
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28719
diff
changeset
|
208 static gboolean |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
209 msn_oim_request_helper(MsnOimRequestData *data) |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
210 { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
211 MsnSession *session = data->oim->session; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
212 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
213 if (data->send) { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
214 /* The Sending of OIM's uses a different token for some reason. */ |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
215 xmlnode *ticket; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
216 ticket = xmlnode_get_child(data->body, "Header/Ticket"); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
217 xmlnode_set_attrib(ticket, "passport", |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
218 msn_nexus_get_token_str(session->nexus, MSN_AUTH_LIVE_SECURE)); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
219 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
220 else |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
221 { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
222 xmlnode *passport; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
223 xmlnode *xml_t; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
224 xmlnode *xml_p; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
225 GHashTable *token; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
226 const char *msn_t; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
227 const char *msn_p; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
228 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
229 token = msn_nexus_get_token(session->nexus, MSN_AUTH_MESSENGER_WEB); |
28794
44cbfcaf9e3a
Fix a crash when sending OIMs on MSN. The callback function used after
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28719
diff
changeset
|
230 g_return_val_if_fail(token != NULL, FALSE); |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
231 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
232 msn_t = g_hash_table_lookup(token, "t"); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
233 msn_p = g_hash_table_lookup(token, "p"); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
234 |
28794
44cbfcaf9e3a
Fix a crash when sending OIMs on MSN. The callback function used after
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28719
diff
changeset
|
235 g_return_val_if_fail(msn_t != NULL, FALSE); |
44cbfcaf9e3a
Fix a crash when sending OIMs on MSN. The callback function used after
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28719
diff
changeset
|
236 g_return_val_if_fail(msn_p != NULL, FALSE); |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
237 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
238 passport = xmlnode_get_child(data->body, "Header/PassportCookie"); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
239 xml_t = xmlnode_get_child(passport, "t"); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
240 xml_p = xmlnode_get_child(passport, "p"); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
241 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
242 /* frees old token text, or the 'EMPTY' text if first time */ |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
243 xmlnode_free(xml_t->child); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
244 xmlnode_free(xml_p->child); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
245 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
246 xmlnode_insert_data(xml_t, msn_t, -1); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
247 xmlnode_insert_data(xml_p, msn_p, -1); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
248 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
249 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
250 msn_soap_message_send(session, |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
251 msn_soap_message_new(data->action, xmlnode_copy(data->body)), |
23658
860e5e210fc9
Don't print SOAP messages to debug log for "secure" requests. This is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23657
diff
changeset
|
252 data->host, data->url, FALSE, |
860e5e210fc9
Don't print SOAP messages to debug log for "secure" requests. This is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23657
diff
changeset
|
253 msn_oim_request_cb, data); |
28794
44cbfcaf9e3a
Fix a crash when sending OIMs on MSN. The callback function used after
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28719
diff
changeset
|
254 |
44cbfcaf9e3a
Fix a crash when sending OIMs on MSN. The callback function used after
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
28719
diff
changeset
|
255 return FALSE; |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
256 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
257 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
258 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
259 static void |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
260 msn_oim_make_request(MsnOim *oim, gboolean send, const char *action, |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
261 const char *host, const char *url, xmlnode *body, MsnSoapCallback cb, |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
262 gpointer cb_data) |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
263 { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
264 MsnOimRequestData *data = g_new0(MsnOimRequestData, 1); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
265 data->oim = oim; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
266 data->send = send; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
267 data->action = action; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
268 data->host = host; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
269 data->url = url; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
270 data->body = body; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
271 data->cb = cb; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
272 data->cb_data = cb_data; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
273 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
274 msn_oim_request_helper(data); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
275 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
276 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
277 /**************************************** |
23499
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
278 * OIM GetMetadata request |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
279 * **************************************/ |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
280 static void |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
281 msn_oim_get_metadata_cb(MsnSoapMessage *request, MsnSoapMessage *response, |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
282 gpointer data) |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
283 { |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
284 MsnOim *oim = data; |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
285 |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
286 if (response) { |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
287 msn_parse_oim_xml(oim, |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
288 xmlnode_get_child(response->xml, "Body/GetMetadataResponse/MD")); |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
289 } |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
290 } |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
291 |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
292 /* Post to get the OIM Metadata */ |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
293 static void |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
294 msn_oim_get_metadata(MsnOim *oim) |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
295 { |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
296 msn_oim_make_request(oim, FALSE, MSN_OIM_GET_METADATA_ACTION, |
23499
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
297 MSN_OIM_RETRIEVE_HOST, MSN_OIM_RETRIEVE_URL, |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
298 xmlnode_from_str(MSN_OIM_GET_METADATA_TEMPLATE, -1), |
23499
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
299 msn_oim_get_metadata_cb, oim); |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
300 } |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
301 |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
302 /**************************************** |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
303 * OIM send SOAP request |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
304 * **************************************/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
305 /*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
|
306 static gchar * |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
307 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
|
308 { |
23592
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
309 GString *oim_body; |
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
310 char *oim_base64; |
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
311 char *c; |
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
312 int len; |
23595
fe2e20ff3345
fixes a crash and probably more correct and definitely easier to understand
Ka-Hing Cheung <khc@hxbc.us>
parents:
23592
diff
changeset
|
313 size_t base64_len; |
23592
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
314 |
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
315 purple_debug_info("msn", "Encoding OIM Message...\n"); |
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
316 len = strlen(body); |
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
317 c = oim_base64 = purple_base64_encode((const guchar *)body, len); |
23595
fe2e20ff3345
fixes a crash and probably more correct and definitely easier to understand
Ka-Hing Cheung <khc@hxbc.us>
parents:
23592
diff
changeset
|
318 base64_len = strlen(oim_base64); |
23592
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
319 purple_debug_info("msn", "Encoded base64 body:{%s}\n", oim_base64); |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22932
diff
changeset
|
320 |
23592
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
321 oim_body = g_string_new(NULL); |
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
322 g_string_printf(oim_body, MSN_OIM_MSG_TEMPLATE, |
23596
73f61c445827
Commit the changes to oim.h that I forgot last time. Fixes #6343,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23595
diff
changeset
|
323 oim->run_id, oim->send_seq); |
23592
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
324 |
23595
fe2e20ff3345
fixes a crash and probably more correct and definitely easier to understand
Ka-Hing Cheung <khc@hxbc.us>
parents:
23592
diff
changeset
|
325 #define OIM_LINE_LEN 76 |
fe2e20ff3345
fixes a crash and probably more correct and definitely easier to understand
Ka-Hing Cheung <khc@hxbc.us>
parents:
23592
diff
changeset
|
326 while (base64_len > OIM_LINE_LEN) { |
fe2e20ff3345
fixes a crash and probably more correct and definitely easier to understand
Ka-Hing Cheung <khc@hxbc.us>
parents:
23592
diff
changeset
|
327 g_string_append_len(oim_body, c, OIM_LINE_LEN); |
23592
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
328 g_string_append_c(oim_body, '\n'); |
23595
fe2e20ff3345
fixes a crash and probably more correct and definitely easier to understand
Ka-Hing Cheung <khc@hxbc.us>
parents:
23592
diff
changeset
|
329 c += OIM_LINE_LEN; |
fe2e20ff3345
fixes a crash and probably more correct and definitely easier to understand
Ka-Hing Cheung <khc@hxbc.us>
parents:
23592
diff
changeset
|
330 base64_len -= OIM_LINE_LEN; |
23592
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
331 } |
23595
fe2e20ff3345
fixes a crash and probably more correct and definitely easier to understand
Ka-Hing Cheung <khc@hxbc.us>
parents:
23592
diff
changeset
|
332 #undef OIM_LINE_LEN |
fe2e20ff3345
fixes a crash and probably more correct and definitely easier to understand
Ka-Hing Cheung <khc@hxbc.us>
parents:
23592
diff
changeset
|
333 |
23592
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
334 g_string_append(oim_body, c); |
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
335 |
20989
2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20858
diff
changeset
|
336 g_free(oim_base64); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
337 |
23592
3249c367577b
When sending MSN OIM's, wrap Base64'd text at 76 characters. Because
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23564
diff
changeset
|
338 return g_string_free(oim_body, FALSE); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
339 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
340 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
341 /* |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
342 * Process the send return SOAP string |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
343 * 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
|
344 */ |
20430 | 345 static void |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
346 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
|
347 gpointer data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
348 { |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
349 MsnOim *oim = data; |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
350 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
|
351 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
352 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
|
353 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
354 if (response == NULL) { |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
355 purple_debug_info("msn", "cannot send OIM: %s\n", msg->oim_msg); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
356 } else { |
23498
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23497
diff
changeset
|
357 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
|
358 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
359 if (faultNode == NULL) { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
360 /*Send OK! return*/ |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
361 purple_debug_info("msn", "sent OIM: %s\n", msg->oim_msg); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
362 } 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
|
363 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
|
364 |
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
|
365 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
|
366 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
|
367 |
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
|
368 if (g_str_equal(faultcode_str, "q0:AuthenticationFailed")) { |
23498
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23497
diff
changeset
|
369 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
|
370 "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
|
371 |
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
|
372 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
|
373 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
|
374 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
|
375 oim->challenge = NULL; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
376 |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
377 purple_debug_info("msn", "Resending OIM: %s\n", |
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
|
378 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
|
379 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
|
380 msn_oim_send_msg(oim); |
28719
3061a0c72b26
Fix an incorrect leak-fix. Thanks Elliott!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28716
diff
changeset
|
381 msg = NULL; |
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
|
382 } else { |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
383 purple_debug_info("msn", |
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
384 "Can't find lock key for OIM: %s\n", |
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
|
385 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
|
386 } |
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
|
387 } 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
|
388 char buf[33]; |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
389 |
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
|
390 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
|
391 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
|
392 |
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
|
393 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
|
394 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
|
395 g_free(challenge); |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
396 purple_debug_info("msn", "Found lockkey:{%s}\n", oim->challenge); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
397 |
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
|
398 /*repost the send*/ |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
399 purple_debug_info("msn", "Resending OIM: %s\n", msg->oim_msg); |
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
|
400 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
|
401 msn_oim_send_msg(oim); |
28719
3061a0c72b26
Fix an incorrect leak-fix. Thanks Elliott!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28716
diff
changeset
|
402 msg = NULL; |
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
|
403 } |
23535
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
404 } else { |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
405 /* Report the error */ |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
406 const char *str_reason; |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
407 |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
408 if (g_str_equal(faultcode_str, "q0:SystemUnavailable")) { |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
409 str_reason = _("Message was not sent because the system is " |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
410 "unavailable. This normally happens when the " |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
411 "user is blocked or does not exist."); |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
412 |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
413 } else if (g_str_equal(faultcode_str, "q0:SenderThrottleLimitExceeded")) { |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
414 str_reason = _("Message was not sent because messages " |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
415 "are being sent too quickly."); |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
416 |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
417 } else if (g_str_equal(faultcode_str, "q0:InvalidContent")) { |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
418 str_reason = _("Message was not sent because an unknown " |
23614
a97c1628c803
Fix up some spelling mistakes in MSN oim.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23598
diff
changeset
|
419 "encoding error occurred."); |
23535
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
420 |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
421 } else { |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
422 str_reason = _("Message was not sent because an unknown " |
23614
a97c1628c803
Fix up some spelling mistakes in MSN oim.c.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23598
diff
changeset
|
423 "error occurred."); |
23535
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
424 } |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
425 |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
426 msn_session_report_user(oim->session, msg->to_member, |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
427 str_reason, PURPLE_MESSAGE_ERROR); |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
428 msn_session_report_user(oim->session, msg->to_member, |
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23534
diff
changeset
|
429 msg->oim_msg, PURPLE_MESSAGE_RAW); |
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
|
430 } |
22804
7d3b2c023ad8
This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21767
diff
changeset
|
431 |
7d3b2c023ad8
This is the way we plug the leaks, plug the leaks, plug the leaks...
Daniel Atallah <daniel.atallah@gmail.com>
parents:
21767
diff
changeset
|
432 g_free(faultcode_str); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
433 } |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
434 } |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
435 } |
28719
3061a0c72b26
Fix an incorrect leak-fix. Thanks Elliott!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28716
diff
changeset
|
436 |
3061a0c72b26
Fix an incorrect leak-fix. Thanks Elliott!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28716
diff
changeset
|
437 if (msg) |
3061a0c72b26
Fix an incorrect leak-fix. Thanks Elliott!
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28716
diff
changeset
|
438 msn_oim_free_send_req(msg); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
439 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
440 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
441 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
442 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
|
443 const char* friendname, const char *tomember, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
444 const char * msg) |
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 g_return_if_fail(oim != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
447 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
448 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
|
449 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
|
450 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
451 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
452 /*post send single message request to oim server*/ |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22932
diff
changeset
|
453 void |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
454 msn_oim_send_msg(MsnOim *oim) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
455 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
456 MsnOimSendReq *oim_request; |
23492
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23488
diff
changeset
|
457 char *soap_body; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
458 char *msg_body; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
459 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
460 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
|
461 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
|
462 g_return_if_fail(oim_request != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
463 |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
464 purple_debug_info("msn", "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
|
465 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
466 /* 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
|
467 * 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
|
468 */ |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
469 if (oim->challenge == NULL){ |
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
470 purple_debug_info("msn", "No lock key challenge, waiting for SOAP Fault and Resend\n"); |
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 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
|
474 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
|
475 oim_request->from_member, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
476 oim_request->friendname, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
477 oim_request->to_member, |
23488
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
|
478 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
|
479 oim->challenge ? oim->challenge : "", |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
480 oim->send_seq, |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
481 msg_body); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
482 |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
483 msn_oim_make_request(oim, TRUE, MSN_OIM_SEND_SOAP_ACTION, MSN_OIM_SEND_HOST, |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
484 MSN_OIM_SEND_URL, xmlnode_from_str(soap_body, -1), msn_oim_send_read_cb, |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
485 oim); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
486 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
487 /*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
|
488 if (oim->challenge != NULL) { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
489 oim->send_seq++; |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
490 } |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
491 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
492 g_free(msg_body); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
493 g_free(soap_body); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
494 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
495 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
496 /**************************************** |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
497 * OIM delete SOAP request |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
498 * **************************************/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
499 static void |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
500 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
|
501 gpointer data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
502 { |
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
|
503 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
|
504 |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
505 if (response && xmlnode_get_child(response->xml, "Body/Fault") == NULL) |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
506 purple_debug_info("msn", "Delete OIM success\n"); |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
507 else |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
508 purple_debug_info("msn", "Delete OIM failed\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
|
509 |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
510 msn_oim_recv_data_free(rdata); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
511 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
512 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
513 /*Post to get the Offline Instant Message*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
514 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
|
515 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
|
516 { |
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
|
517 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
|
518 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
|
519 char *soap_body; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
520 |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
521 purple_debug_info("msn", "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
|
522 |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
523 soap_body = g_strdup_printf(MSN_OIM_DEL_TEMPLATE, msgid); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
524 |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
525 msn_oim_make_request(oim, FALSE, MSN_OIM_DEL_SOAP_ACTION, MSN_OIM_RETRIEVE_HOST, |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
526 MSN_OIM_RETRIEVE_URL, xmlnode_from_str(soap_body, -1), 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
|
527 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
528 g_free(soap_body); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
529 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
530 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
531 /**************************************** |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
532 * OIM get SOAP request |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
533 * **************************************/ |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
534 /* 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
|
535 * 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
|
536 static time_t |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
537 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
|
538 { |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
539 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
|
540 char *tz_ptr = tz_str; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
541 static const char *months[] = { |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
542 "Jan", "Feb", "Mar", "Apr", "May", "Jun", |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
543 "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
|
544 }; |
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
|
545 time_t tval = 0; |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
546 struct tm t; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
547 memset(&t, 0, sizeof(t)); |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
548 |
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
|
549 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
|
550 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
|
551 |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
552 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
|
553 &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
|
554 &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
|
555 gboolean offset_positive = TRUE; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
556 int tzhrs; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
557 int tzmins; |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22932
diff
changeset
|
558 |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
559 for (t.tm_mon = 0; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
560 months[t.tm_mon] != NULL && |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
561 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
|
562 if (months[t.tm_mon] != NULL) { |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
563 if (*tz_str == '-') { |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
564 offset_positive = FALSE; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
565 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
|
566 } 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
|
567 tz_ptr++; |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
568 } |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
569 |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
570 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
|
571 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
|
572 #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
|
573 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
|
574 #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
|
575 |
23534
20da64b2e104
Change msn_oim_parse_timestamp to match purple_str_to_time more
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23514
diff
changeset
|
576 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
|
577 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
|
578 |
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
|
579 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
|
580 |
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
|
581 #ifdef _WIN32 |
20503
905891855710
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
582 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
|
583 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
|
584 #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
|
585 #ifdef HAVE_TM_GMTOFF |
23534
20da64b2e104
Change msn_oim_parse_timestamp to match purple_str_to_time more
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23514
diff
changeset
|
586 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
|
587 #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
|
588 # 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
|
589 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
|
590 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
|
591 # endif |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
592 #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
|
593 #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
|
594 |
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
|
595 return mktime(&t) + tzoff; |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
596 } |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
597 } |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
598 } |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
599 |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
600 purple_debug_info("msn", "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
|
601 return tval; |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
602 } |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
603 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
604 /*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
|
605 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
|
606 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
|
607 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
608 MsnMessage *message; |
24680
1385d79ef68f
Clean up msn_oim_report_to_user to avoid extra g_strdup's and call strchr
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23728
diff
changeset
|
609 const char *date; |
1385d79ef68f
Clean up msn_oim_report_to_user to avoid extra g_strdup's and call strchr
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23728
diff
changeset
|
610 const char *from; |
24837
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
611 const char *boundary; |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
612 char *decode_msg = NULL; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
613 gsize body_len; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
614 char **tokens; |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
615 char *passport = NULL; |
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
|
616 time_t stamp; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
617 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
618 message = msn_message_new(MSN_MSG_UNKNOWN); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
619 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
620 msn_message_parse_payload(message, msg_str, strlen(msg_str), |
24680
1385d79ef68f
Clean up msn_oim_report_to_user to avoid extra g_strdup's and call strchr
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23728
diff
changeset
|
621 MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM); |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
622 purple_debug_info("msn", "oim body:{%s}\n", message->body); |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
623 |
31132
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
28794
diff
changeset
|
624 boundary = msn_message_get_header_value(message, "boundary"); |
24837
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
625 |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
626 if (boundary != NULL) { |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
627 char *bounds; |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
628 char **part; |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
629 |
24837
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
630 bounds = g_strdup_printf("--%s" MSG_OIM_LINE_DEM, boundary); |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
631 tokens = g_strsplit(message->body, bounds, 0); |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
632 |
24692
fbd1a82247ba
For processing mobile OIM's, fix a crash when searching through each part
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24691
diff
changeset
|
633 /* tokens+1 to skip the "This is a multipart message..." text */ |
fbd1a82247ba
For processing mobile OIM's, fix a crash when searching through each part
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24691
diff
changeset
|
634 for (part = tokens+1; *part != NULL; part++) { |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
635 MsnMessage *multipart; |
24692
fbd1a82247ba
For processing mobile OIM's, fix a crash when searching through each part
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24691
diff
changeset
|
636 const char *type; |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
637 multipart = msn_message_new(MSN_MSG_UNKNOWN); |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
638 msn_message_parse_payload(multipart, *part, strlen(*part), |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
639 MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM); |
24680
1385d79ef68f
Clean up msn_oim_report_to_user to avoid extra g_strdup's and call strchr
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23728
diff
changeset
|
640 |
24692
fbd1a82247ba
For processing mobile OIM's, fix a crash when searching through each part
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24691
diff
changeset
|
641 type = msn_message_get_content_type(multipart); |
fbd1a82247ba
For processing mobile OIM's, fix a crash when searching through each part
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24691
diff
changeset
|
642 if (type && !strcmp(type, "text/plain")) { |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
643 decode_msg = (char *)purple_base64_decode(multipart->body, &body_len); |
31393
b4285ea42b6e
msn_message_destroy() calls msn_message_unref() if refcount>0. This is
Mark Doliner <mark@kingant.net>
parents:
31196
diff
changeset
|
644 msn_message_unref(multipart); |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
645 break; |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
646 } |
31393
b4285ea42b6e
msn_message_destroy() calls msn_message_unref() if refcount>0. This is
Mark Doliner <mark@kingant.net>
parents:
31196
diff
changeset
|
647 msn_message_unref(multipart); |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
648 } |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
649 |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
650 g_strfreev(tokens); |
24837
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
651 g_free(bounds); |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
652 |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
653 if (decode_msg == NULL) { |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
654 purple_debug_error("msn", "Couldn't find text/plain OIM message.\n"); |
31393
b4285ea42b6e
msn_message_destroy() calls msn_message_unref() if refcount>0. This is
Mark Doliner <mark@kingant.net>
parents:
31196
diff
changeset
|
655 msn_message_unref(message); |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
656 return; |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
657 } |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
658 } else { |
24837
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
659 decode_msg = (char *)purple_base64_decode(message->body, &body_len); |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
660 } |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
661 |
31132
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
28794
diff
changeset
|
662 from = msn_message_get_header_value(message, "X-OIM-originatingSource"); |
24837
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
663 |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
664 /* Match number to user's mobile number, FROM is a phone number |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
665 if the other side pages you using your phone number */ |
24921
2aa4b88bdcf8
I have no idea if this check is needed, but it looked a bit risky without it
Stu Tomlinson <stu@nosnilmot.com>
parents:
24837
diff
changeset
|
666 if (from && !strncmp(from, "tel:+", 5)) { |
24837
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
667 MsnUser *user = msn_userlist_find_user_with_mobile_phone( |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
668 rdata->oim->session->userlist, from + 4); |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
669 |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
670 if (user && user->passport) |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
671 passport = g_strdup(user->passport); |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
672 } |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
673 |
955bfda56492
Apparently X-OIM-Proxy was not a good way to decide that we received a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24692
diff
changeset
|
674 if (passport == NULL) { |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
675 char *start, *end; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
676 |
31132
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
28794
diff
changeset
|
677 from = msn_message_get_header_value(message, "From"); |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
678 |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
679 tokens = g_strsplit(from, " ", 2); |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
680 if (tokens[1] != NULL) |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
681 from = (const char *)tokens[1]; |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
682 |
25843
d8ce4de7137f
Prevent a NUL ptr deref when the passport is malformed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24921
diff
changeset
|
683 start = strchr(from, '<'); |
d8ce4de7137f
Prevent a NUL ptr deref when the passport is malformed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24921
diff
changeset
|
684 if (start != NULL) { |
d8ce4de7137f
Prevent a NUL ptr deref when the passport is malformed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24921
diff
changeset
|
685 start++; |
d8ce4de7137f
Prevent a NUL ptr deref when the passport is malformed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24921
diff
changeset
|
686 end = strchr(from, '>'); |
d8ce4de7137f
Prevent a NUL ptr deref when the passport is malformed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24921
diff
changeset
|
687 if (end != NULL) |
d8ce4de7137f
Prevent a NUL ptr deref when the passport is malformed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24921
diff
changeset
|
688 passport = g_strndup(start, end - start); |
d8ce4de7137f
Prevent a NUL ptr deref when the passport is malformed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24921
diff
changeset
|
689 } |
d8ce4de7137f
Prevent a NUL ptr deref when the passport is malformed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24921
diff
changeset
|
690 if (passport == NULL) |
d8ce4de7137f
Prevent a NUL ptr deref when the passport is malformed.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24921
diff
changeset
|
691 passport = g_strdup(_("Unknown")); |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
692 |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
693 g_strfreev(tokens); |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
694 } |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
695 |
31132
33b4ae796648
Rename "attribute" to "header" in a bunch of places. The SLP protocol
Mark Doliner <mark@kingant.net>
parents:
28794
diff
changeset
|
696 date = msn_message_get_header_value(message, "Date"); |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
697 stamp = msn_oim_parse_timestamp(date); |
24681
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
698 purple_debug_info("msn", "oim Date:{%s},passport{%s}\n", |
34258af32335
Add support for receiving MSN offline messages that were sent from a mobile
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24680
diff
changeset
|
699 date, 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
|
700 |
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
|
701 serv_got_im(rdata->oim->session->account->gc, passport, decode_msg, 0, |
24680
1385d79ef68f
Clean up msn_oim_report_to_user to avoid extra g_strdup's and call strchr
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23728
diff
changeset
|
702 stamp); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
703 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
704 /*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
|
705 * 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
|
706 */ |
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
|
707 msn_oim_post_delete_msg(rdata); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
708 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
709 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
|
710 g_free(decode_msg); |
31393
b4285ea42b6e
msn_message_destroy() calls msn_message_unref() if refcount>0. This is
Mark Doliner <mark@kingant.net>
parents:
31196
diff
changeset
|
711 msn_message_unref(message); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
712 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
713 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
714 /* Parse the XML data, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
715 * prepare to report the OIM to user |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
716 */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
717 static void |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
718 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
|
719 gpointer data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
720 { |
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
|
721 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
|
722 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
723 if (response != NULL) { |
23498
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23497
diff
changeset
|
724 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
|
725 "Body/GetMessageResponse/GetMessageResult"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
726 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
727 if (msg_node) { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
728 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
|
729 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
|
730 g_free(msg_str); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
731 } else { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
732 char *str = xmlnode_to_str(response->xml, NULL); |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
733 purple_debug_info("msn", "Unknown OIM response: %s\n", str); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
734 g_free(str); |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
735 msn_oim_recv_data_free(rdata); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
736 } |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
737 } else { |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
738 purple_debug_info("msn", "Failed to get OIM\n"); |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
739 msn_oim_recv_data_free(rdata); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
740 } |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
741 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
742 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
743 |
23300
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22932
diff
changeset
|
744 /* parse the oim XML data |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
745 * 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
|
746 * */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
747 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
748 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
|
749 { |
23499
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
750 xmlnode *node; |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
751 |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
752 purple_debug_info("msn", "%s\n", xmlmsg); |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
753 |
23499
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
754 if (!strcmp(xmlmsg, "too-large")) { |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
755 /* Too many OIM's to send via NS, so we need to request them via SOAP. */ |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
756 msn_oim_get_metadata(oim); |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
757 } else { |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
758 node = xmlnode_from_str(xmlmsg, -1); |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
759 msn_parse_oim_xml(oim, node); |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
760 xmlnode_free(node); |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
761 } |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
762 } |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
763 |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
764 static void |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
765 msn_parse_oim_xml(MsnOim *oim, xmlnode *node) |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
766 { |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
767 xmlnode *mNode; |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
768 xmlnode *iu_node; |
20444
a0d104281002
Compile fix, whoops! Thanks Masca/salinasv.
Stu Tomlinson <stu@nosnilmot.com>
parents:
20443
diff
changeset
|
769 MsnSession *session = oim->session; |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
770 |
23499
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
771 g_return_if_fail(node != NULL); |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
772 |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
773 if (strcmp(node->name, "MD") != 0) { |
23499
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
774 char *xmlmsg = xmlnode_to_str(node, NULL); |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
775 purple_debug_info("msn", "WTF is this? %s\n", xmlmsg); |
23499
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23498
diff
changeset
|
776 g_free(xmlmsg); |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
777 return; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
778 } |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
779 |
23498
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23497
diff
changeset
|
780 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
|
781 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
782 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
|
783 { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
784 char *unread = xmlnode_get_data(iu_node); |
25891
2260e5b0ca91
*** Plucked rev f9080d0b (khc@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
24921
diff
changeset
|
785 const char *passports[2] = { msn_user_get_passport(session->user) }; |
2260e5b0ca91
*** Plucked rev f9080d0b (khc@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
24921
diff
changeset
|
786 const char *urls[2] = { session->passport_info.mail_url }; |
21767
7ac87187bbec
Don't show a 'you ain't got no new mail' notification.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21103
diff
changeset
|
787 int count = atoi(unread); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
788 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
789 /* 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
|
790 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
|
791 purple_notify_emails(session->account->gc, count, FALSE, NULL, |
25891
2260e5b0ca91
*** Plucked rev f9080d0b (khc@pidgin.im):
Paul Aurich <paul@darkrain42.org>
parents:
24921
diff
changeset
|
792 NULL, passports, urls, NULL, NULL); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
793 g_free(unread); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
794 } |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
795 |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
796 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
|
797 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
|
798 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
|
799 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
|
800 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
801 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
|
802 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
|
803 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
804 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
|
805 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
|
806 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
807 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
|
808 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
|
809 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
810 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
|
811 if (rt_node != NULL) { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
812 rtime = xmlnode_get_data(rt_node); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
813 } |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
814 /* purple_debug_info("msn", "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
|
815 |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
816 if (!g_list_find_custom(oim->oim_list, msgid, (GCompareFunc)msn_recv_data_equal)) { |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
817 MsnOimRecvData *data = msn_oim_recv_data_new(oim, msgid); |
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
818 msn_oim_post_single_get_msg(oim, data); |
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
|
819 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
|
820 } |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
821 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
822 g_free(passport); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
823 g_free(msgid); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
824 g_free(rtime); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
825 g_free(nickname); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
826 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
827 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
828 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
829 /*Post to get the Offline Instant Message*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
830 static void |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
831 msn_oim_post_single_get_msg(MsnOim *oim, MsnOimRecvData *data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
832 { |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
833 char *soap_body; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
834 |
23564
7bceac816e19
The great MSN debug message cleanup! Threw in a few whitespace fixes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23555
diff
changeset
|
835 purple_debug_info("msn", "Get single OIM Message\n"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
836 |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
837 soap_body = g_strdup_printf(MSN_OIM_GET_TEMPLATE, data->msg_id); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
838 |
23514
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
839 msn_oim_make_request(oim, FALSE, MSN_OIM_GET_SOAP_ACTION, MSN_OIM_RETRIEVE_HOST, |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
840 MSN_OIM_RETRIEVE_URL, xmlnode_from_str(soap_body, -1), msn_oim_get_read_cb, |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23509
diff
changeset
|
841 data); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
842 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
843 g_free(soap_body); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
844 } |
23728
3c0e7b05714e
Fix a leak when requesting OIM's. Also removed some unnecessary
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23658
diff
changeset
|
845 |