Mercurial > pidgin
annotate libpurple/protocols/msn/oim.c @ 23469:5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
returned.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 07 Jun 2008 06:12:44 +0000 |
parents | 1ac5faa72c8d |
children | 20da64b2e104 |
rev | line source |
---|---|
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1 /** |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22930
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 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
25 */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
26 #include "msn.h" |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
27 #include "soap2.h" |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
28 #include "oim.h" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
29 #include "msnutils.h" |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
30 |
20536
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
31 typedef struct _MsnOimSendReq { |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
32 char *from_member; |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
33 char *friendname; |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
34 char *to_member; |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
35 char *oim_msg; |
20536
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
36 } MsnOimSendReq; |
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
37 |
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
38 typedef struct { |
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
39 MsnOim *oim; |
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
40 char *msg_id; |
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
41 } MsnOimRecvData; |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
42 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
43 /*Local Function Prototype*/ |
23454
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
44 static void msn_parse_oim_xml(MsnOim *oim, xmlnode *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
|
45 static void msn_oim_post_single_get_msg(MsnOim *oim, char *msgid); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
46 static MsnOimSendReq *msn_oim_new_send_req(const char *from_member, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
47 const char *friendname, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
48 const char* to_member, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
49 const char *msg); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
50 static void msn_oim_free_send_req(MsnOimSendReq *req); |
20536
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
51 static void msn_oim_report_to_user(MsnOimRecvData *rdata, const char *msg_str); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
52 static char *msn_oim_msg_to_str(MsnOim *oim, const char *body); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
53 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
54 /*new a OIM object*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
55 MsnOim * |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
56 msn_oim_new(MsnSession *session) |
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 MsnOim *oim; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
59 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
60 oim = g_new0(MsnOim, 1); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
61 oim->session = session; |
22832
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22828
diff
changeset
|
62 oim->oim_list = NULL; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
63 oim->run_id = rand_guid(); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
64 oim->challenge = NULL; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
65 oim->send_queue = g_queue_new(); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
66 oim->send_seq = 1; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
67 return oim; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
68 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
69 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
70 /*destroy the oim object*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
71 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
72 msn_oim_destroy(MsnOim *oim) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
73 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
74 MsnOimSendReq *request; |
22832
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22828
diff
changeset
|
75 |
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22828
diff
changeset
|
76 purple_debug_info("OIM", "destroy the OIM %p\n", oim); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
77 g_free(oim->run_id); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
78 g_free(oim->challenge); |
22832
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22828
diff
changeset
|
79 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
80 while((request = g_queue_pop_head(oim->send_queue)) != NULL){ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
81 msn_oim_free_send_req(request); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
82 } |
22832
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22828
diff
changeset
|
83 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
84 g_queue_free(oim->send_queue); |
22832
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22828
diff
changeset
|
85 g_list_free(oim->oim_list); |
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22828
diff
changeset
|
86 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
87 g_free(oim); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
88 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
89 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
90 static MsnOimSendReq * |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
91 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
|
92 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
|
93 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
94 MsnOimSendReq *request; |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22930
diff
changeset
|
95 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
96 request = g_new0(MsnOimSendReq, 1); |
22832
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22828
diff
changeset
|
97 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
|
98 request->friendname = g_strdup(friendname); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
99 request->to_member = g_strdup(to_member); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
100 request->oim_msg = g_strdup(msg); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
101 return request; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
102 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
103 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
104 static void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
105 msn_oim_free_send_req(MsnOimSendReq *req) |
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_return_if_fail(req != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
108 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
109 g_free(req->from_member); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
110 g_free(req->friendname); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
111 g_free(req->to_member); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
112 g_free(req->oim_msg); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22930
diff
changeset
|
113 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
114 g_free(req); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
115 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
116 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
117 /**************************************** |
23469
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
118 * Manage OIM Tokens |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
119 ****************************************/ |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
120 typedef struct _MsnOimRequestData { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
121 MsnOim *oim; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
122 gboolean send; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
123 const char *action; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
124 const char *host; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
125 const char *url; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
126 xmlnode *body; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
127 MsnSoapCallback cb; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
128 gpointer cb_data; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
129 } MsnOimRequestData; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
130 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
131 static void 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:
23464
diff
changeset
|
132 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
133 static void |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
134 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:
23464
diff
changeset
|
135 gpointer req_data) |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
136 { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
137 MsnOimRequestData *data = (MsnOimRequestData *)req_data; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
138 xmlnode *xml; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
139 xmlnode *faultcode; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
140 gchar *faultcode_str; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
141 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
142 xml = response->xml; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
143 faultcode = xmlnode_get_child(xml, "Body/Fault/faultcode"); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
144 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
145 if (faultcode != NULL) { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
146 faultcode_str = xmlnode_get_data(faultcode); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
147 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
148 if (faultcode_str && g_str_equal(faultcode_str, "q0:BadContextToken")) { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
149 purple_debug_error("msnp15", "OIM Request Error, Updating token now."); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
150 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:
23464
diff
changeset
|
151 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:
23464
diff
changeset
|
152 (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:
23464
diff
changeset
|
153 g_free(faultcode_str); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
154 return; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
155 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
156 g_free(faultcode_str); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
157 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
158 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
159 if (data->cb) |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
160 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:
23464
diff
changeset
|
161 xmlnode_free(data->body); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
162 g_free(data); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
163 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
164 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
165 static void |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
166 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:
23464
diff
changeset
|
167 { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
168 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:
23464
diff
changeset
|
169 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
170 if (data->send) { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
171 /* 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:
23464
diff
changeset
|
172 xmlnode *ticket; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
173 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:
23464
diff
changeset
|
174 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:
23464
diff
changeset
|
175 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:
23464
diff
changeset
|
176 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
177 else |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
178 { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
179 xmlnode *passport; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
180 xmlnode *xml_t; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
181 xmlnode *xml_p; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
182 GHashTable *token; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
183 const char *msn_t; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
184 const char *msn_p; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
185 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
186 token = msn_nexus_get_token(session->nexus, MSN_AUTH_MESSENGER_WEB); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
187 g_return_if_fail(token != NULL); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
188 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
189 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:
23464
diff
changeset
|
190 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:
23464
diff
changeset
|
191 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
192 g_return_if_fail(msn_t != NULL); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
193 g_return_if_fail(msn_p != NULL); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
194 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
195 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:
23464
diff
changeset
|
196 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:
23464
diff
changeset
|
197 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:
23464
diff
changeset
|
198 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
199 /* 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:
23464
diff
changeset
|
200 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:
23464
diff
changeset
|
201 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:
23464
diff
changeset
|
202 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
203 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:
23464
diff
changeset
|
204 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:
23464
diff
changeset
|
205 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
206 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
207 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:
23464
diff
changeset
|
208 msn_soap_message_new(data->action, xmlnode_copy(data->body)), |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
209 data->host, data->url, msn_oim_request_cb, data); |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
210 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
211 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
212 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
213 static void |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
214 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:
23464
diff
changeset
|
215 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:
23464
diff
changeset
|
216 gpointer cb_data) |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
217 { |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
218 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:
23464
diff
changeset
|
219 data->oim = oim; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
220 data->send = send; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
221 data->action = action; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
222 data->host = host; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
223 data->url = url; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
224 data->body = body; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
225 data->cb = cb; |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
226 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:
23464
diff
changeset
|
227 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
228 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:
23464
diff
changeset
|
229 } |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
230 |
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
231 /**************************************** |
23454
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
232 * OIM GetMetadata request |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
233 * **************************************/ |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
234 static void |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
235 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:
23453
diff
changeset
|
236 gpointer data) |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
237 { |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
238 MsnOim *oim = data; |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
239 |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
240 if (response) { |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
241 msn_parse_oim_xml(oim, |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
242 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:
23453
diff
changeset
|
243 } |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
244 } |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
245 |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
246 /* Post to get the OIM Metadata */ |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
247 static void |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
248 msn_oim_get_metadata(MsnOim *oim) |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
249 { |
23469
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
250 msn_oim_make_request(oim, FALSE, MSN_OIM_GET_METADATA_ACTION, |
23454
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
251 MSN_OIM_RETRIEVE_HOST, MSN_OIM_RETRIEVE_URL, |
23469
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
252 xmlnode_from_str(MSN_OIM_GET_METADATA_TEMPLATE, -1), |
23454
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
253 msn_oim_get_metadata_cb, oim); |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
254 } |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
255 |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
256 /**************************************** |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
257 * OIM send SOAP request |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
258 * **************************************/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
259 /*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
|
260 static gchar * |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
261 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
|
262 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
263 char *oim_body,*oim_base64; |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22930
diff
changeset
|
264 |
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22930
diff
changeset
|
265 purple_debug_info("MSN OIM","encode OIM Message...\n"); |
20401
4ddc27c18781
Fix up some gaim -> purple issues.
Richard Laager <rlaager@wiktel.com>
parents:
20394
diff
changeset
|
266 oim_base64 = purple_base64_encode((const guchar *)body, strlen(body)); |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22930
diff
changeset
|
267 purple_debug_info("MSN OIM","encoded base64 body:{%s}\n",oim_base64); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
268 oim_body = g_strdup_printf(MSN_OIM_MSG_TEMPLATE, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
269 oim->run_id,oim->send_seq,oim_base64); |
20989
2097b1664fa3
Fix some leaks and prevent some unnecessary allocations and frees.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20858
diff
changeset
|
270 g_free(oim_base64); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
271 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
272 return oim_body; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
273 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
274 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
275 /* |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
276 * Process the send return SOAP string |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
277 * 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
|
278 */ |
20430 | 279 static void |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
280 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
|
281 gpointer data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
282 { |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
283 MsnOim *oim = data; |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
284 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
|
285 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
286 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
|
287 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
288 if (response == NULL) { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
289 purple_debug_info("MSNP14", "cannot send OIM: %s\n", msg->oim_msg); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
290 } else { |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23452
diff
changeset
|
291 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
|
292 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
293 if (faultNode == NULL) { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
294 /*Send OK! return*/ |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
295 purple_debug_info("MSNP14", "sent OIM: %s\n", msg->oim_msg); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
296 } 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
|
297 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
|
298 |
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
|
299 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
|
300 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
|
301 |
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
|
302 if (g_str_equal(faultcode_str, "q0:AuthenticationFailed")) { |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23452
diff
changeset
|
303 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
|
304 "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
|
305 |
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
|
306 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
|
307 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
|
308 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
|
309 oim->challenge = NULL; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
310 |
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
|
311 purple_debug_info("msnoim","resending OIM: %s\n", |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20536
diff
changeset
|
312 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
|
313 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
|
314 msn_oim_send_msg(oim); |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20536
diff
changeset
|
315 } 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
|
316 purple_debug_info("msnoim", |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20536
diff
changeset
|
317 "can't find lock key for OIM: %s\n", |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20536
diff
changeset
|
318 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
|
319 } |
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
|
320 } 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
|
321 char buf[33]; |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
322 |
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
|
323 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
|
324 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
|
325 |
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
|
326 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
|
327 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
|
328 g_free(challenge); |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20536
diff
changeset
|
329 purple_debug_info("MSNP14","lockkey:{%s}\n",oim->challenge); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
330 |
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
|
331 /*repost the send*/ |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20536
diff
changeset
|
332 purple_debug_info("MSNP14","resending OIM: %s\n", msg->oim_msg); |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20536
diff
changeset
|
333 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
|
334 msn_oim_send_msg(oim); |
90fd0826c6ce
finish converting the rest of stuff to the new soap api, signing on, getting
Ka-Hing Cheung <khc@hxbc.us>
parents:
20536
diff
changeset
|
335 } |
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
|
336 } |
22828
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
|
337 |
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
|
338 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
|
339 } |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
340 } |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
341 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
342 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
343 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
344 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
345 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
|
346 const char* friendname, const char *tomember, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
347 const char * msg) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
348 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
349 g_return_if_fail(oim != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
350 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
351 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
|
352 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
|
353 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
354 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
355 /*post send single message request to oim server*/ |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22930
diff
changeset
|
356 void |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
357 msn_oim_send_msg(MsnOim *oim) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
358 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
359 MsnOimSendReq *oim_request; |
23447
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23443
diff
changeset
|
360 char *soap_body; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
361 char *msg_body; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
362 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
363 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
|
364 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
|
365 g_return_if_fail(oim_request != NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
366 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
367 purple_debug_info("MSNP14","sending OIM: %s\n", oim_request->oim_msg); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
368 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
369 /* 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
|
370 * 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
|
371 */ |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
372 if(oim->challenge == NULL){ |
23447
72aa2ccad28d
fix sending offline message in p15 by sending the correct token. In msnp14,
Ka-Hing Cheung <khc@hxbc.us>
parents:
23443
diff
changeset
|
373 purple_debug_info("MSNP14","no lock key challenge, wait for SOAP Fault and Resend\n"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
374 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
375 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
376 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
|
377 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
|
378 oim_request->from_member, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
379 oim_request->friendname, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
380 oim_request->to_member, |
23443
75be80ddeca5
Patch 1 from Qulogic, this one mostly updates the version sent by pidgin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
21767
diff
changeset
|
381 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
|
382 oim->challenge ? oim->challenge : "", |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
383 oim->send_seq, |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
384 msg_body); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
385 |
23469
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
386 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:
23464
diff
changeset
|
387 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:
23464
diff
changeset
|
388 oim); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
389 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
390 /*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
|
391 if (oim->challenge != NULL) { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
392 oim->send_seq++; |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
393 } |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
394 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
395 g_free(msg_body); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
396 g_free(soap_body); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
397 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
398 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
399 /**************************************** |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
400 * OIM delete SOAP request |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
401 * **************************************/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
402 static void |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
403 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
|
404 gpointer data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
405 { |
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
|
406 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
|
407 |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23452
diff
changeset
|
408 if (response && xmlnode_get_child(response->xml, "Body/Fault") == NULL) { |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
409 purple_debug_info("msnoim", "delete OIM success\n"); |
20536
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
410 rdata->oim->oim_list = g_list_remove(rdata->oim->oim_list, |
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
411 rdata->msg_id); |
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
412 g_free(rdata->msg_id); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
413 } else { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
414 purple_debug_info("msnoim", "delete OIM failed\n"); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
415 } |
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
|
416 |
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
|
417 g_free(rdata); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
418 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
419 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
420 /*Post to get the Offline Instant Message*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
421 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
|
422 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
|
423 { |
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
|
424 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
|
425 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
|
426 char *soap_body; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
427 |
20471
530a92d50c5e
Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents:
20444
diff
changeset
|
428 purple_debug_info("MSNP14","Delete single OIM Message {%s}\n",msgid); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
429 |
23469
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
430 soap_body = g_strdup_printf(MSN_OIM_DEL_TEMPLATE, msgid); |
23452
b268fc2c9121
References #4382, fixes getting offline messages in p15
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23450
diff
changeset
|
431 |
23469
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
432 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:
23464
diff
changeset
|
433 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
|
434 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
435 g_free(soap_body); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
436 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
437 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
438 /**************************************** |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
439 * OIM get SOAP request |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
440 * **************************************/ |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
441 /* 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
|
442 * 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
|
443 static time_t |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
444 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
|
445 { |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
446 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
|
447 char *tz_ptr = tz_str; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
448 static const char *months[] = { |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
449 "Jan", "Feb", "Mar", "Apr", "May", "Jun", |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
450 "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
|
451 }; |
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
|
452 time_t tval = 0; |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
453 struct tm t; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
454 memset(&t, 0, sizeof(t)); |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
455 |
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
|
456 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
|
457 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
|
458 |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
459 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
|
460 &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
|
461 &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
|
462 gboolean offset_positive = TRUE; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
463 int tzhrs; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
464 int tzmins; |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22930
diff
changeset
|
465 |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
466 for (t.tm_mon = 0; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
467 months[t.tm_mon] != NULL && |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
468 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
|
469 if (months[t.tm_mon] != NULL) { |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
470 if (*tz_str == '-') { |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
471 offset_positive = FALSE; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
472 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
|
473 } 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
|
474 tz_ptr++; |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
475 } |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
476 |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
477 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
|
478 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
|
479 #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
|
480 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
|
481 #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
|
482 |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
483 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
|
484 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
|
485 |
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
|
486 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
|
487 |
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
|
488 #ifdef _WIN32 |
20503
905891855710
3rd time the charm? Fixes #2990, maybe
Ka-Hing Cheung <khc@hxbc.us>
parents:
20501
diff
changeset
|
489 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
|
490 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
|
491 #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
|
492 #ifdef HAVE_TM_GMTOFF |
20535
a9ee3fbabf81
fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents:
20534
diff
changeset
|
493 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
|
494 #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
|
495 # 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
|
496 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
|
497 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
|
498 # endif |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
499 #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
|
500 #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
|
501 |
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
|
502 return mktime(&t) + tzoff; |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
503 } |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
504 } |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
505 } |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
506 |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
507 purple_debug_info("MSNP14:OIM", "Can't parse timestamp %s\n", timestamp); |
20535
a9ee3fbabf81
fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents:
20534
diff
changeset
|
508 return tval; |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
509 } |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
510 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
511 /*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
|
512 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
|
513 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
|
514 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
515 MsnMessage *message; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
516 char *date,*from,*decode_msg; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
517 gsize body_len; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
518 char **tokens; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
519 char *start,*end; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
520 int has_nick = 0; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
521 char *passport_str, *passport; |
20435
f0bc92602072
Parse the message timestamp using purple_str_to_time. I haven't been able
Stu Tomlinson <stu@nosnilmot.com>
parents:
20433
diff
changeset
|
522 time_t stamp; |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
523 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
524 message = msn_message_new(MSN_MSG_UNKNOWN); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
525 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
526 msn_message_parse_payload(message, msg_str, strlen(msg_str), |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
527 MSG_OIM_LINE_DEM, MSG_OIM_BODY_DEM); |
20471
530a92d50c5e
Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents:
20444
diff
changeset
|
528 purple_debug_info("MSNP14","oim body:{%s}\n",message->body); |
20430 | 529 decode_msg = (char *)purple_base64_decode(message->body,&body_len); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
530 date = (char *)g_hash_table_lookup(message->attr_table, "Date"); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
531 from = (char *)g_hash_table_lookup(message->attr_table, "From"); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
532 if(strstr(from," ")){ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
533 has_nick = 1; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
534 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
535 if(has_nick){ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
536 tokens = g_strsplit(from , " " , 2); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
537 passport_str = g_strdup(tokens[1]); |
20471
530a92d50c5e
Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents:
20444
diff
changeset
|
538 purple_debug_info("MSNP14","oim Date:{%s},nickname:{%s},tokens[1]:{%s} passport{%s}\n", |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
539 date,tokens[0],tokens[1],passport_str); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
540 g_strfreev(tokens); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
541 }else{ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
542 passport_str = g_strdup(from); |
20471
530a92d50c5e
Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents:
20444
diff
changeset
|
543 purple_debug_info("MSNP14","oim Date:{%s},passport{%s}\n", |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
544 date,passport_str); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
545 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
546 start = strstr(passport_str,"<"); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
547 start += 1; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
548 end = strstr(passport_str,">"); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
549 passport = g_strndup(start,end - start); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
550 g_free(passport_str); |
20539
2c8c6d77f12c
Make use of the GQueue in MsnSoapConn to manage the SOAP requests, allowing them to work perfectly even when dispatching multiple requests at once.
Carlos Silva <typ0@pidgin.im>
parents:
20503
diff
changeset
|
551 purple_debug_info("MSN OIM","oim Date:{%s},passport{%s}\n",date,passport); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
552 |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
553 stamp = msn_oim_parse_timestamp(date); |
20435
f0bc92602072
Parse the message timestamp using purple_str_to_time. I haven't been able
Stu Tomlinson <stu@nosnilmot.com>
parents:
20433
diff
changeset
|
554 |
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
|
555 serv_got_im(rdata->oim->session->account->gc, passport, decode_msg, 0, |
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
556 stamp); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
557 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
558 /*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
|
559 * 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
|
560 */ |
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
|
561 msn_oim_post_delete_msg(rdata); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
562 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
563 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
|
564 g_free(decode_msg); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
565 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
566 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
567 /* Parse the XML data, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
568 * prepare to report the OIM to user |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
569 */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
570 static void |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
571 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
|
572 gpointer data) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
573 { |
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
|
574 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
|
575 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
576 if (response != NULL) { |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23452
diff
changeset
|
577 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
|
578 "Body/GetMessageResponse/GetMessageResult"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
579 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
580 if (msg_node) { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
581 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
|
582 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
|
583 g_free(msg_str); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
584 } else { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
585 char *str = xmlnode_to_str(response->xml, NULL); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
586 purple_debug_info("msnoim", "Unknown response: %s\n", str); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
587 g_free(str); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
588 } |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
589 } else { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
590 purple_debug_info("msnoim", "Failed to get OIM\n"); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
591 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
592 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
593 |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22930
diff
changeset
|
594 /* parse the oim XML data |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
595 * 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
|
596 * */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
597 void |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
598 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
|
599 { |
23454
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
600 xmlnode *node; |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
601 |
22832
f62a4a7fe365
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22828
diff
changeset
|
602 purple_debug_info("MSNP14:OIM", "%s\n", xmlmsg); |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
603 |
23454
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
604 if (!strcmp(xmlmsg, "too-large")) { |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
605 /* 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:
23453
diff
changeset
|
606 msn_oim_get_metadata(oim); |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
607 } else { |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
608 node = xmlnode_from_str(xmlmsg, -1); |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
609 msn_parse_oim_xml(oim, node); |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
610 xmlnode_free(node); |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
611 } |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
612 } |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
613 |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
614 static void |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
615 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:
23453
diff
changeset
|
616 { |
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
617 xmlnode *mNode; |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
618 xmlnode *iu_node; |
20444
a0d104281002
Compile fix, whoops! Thanks Masca/salinasv.
Stu Tomlinson <stu@nosnilmot.com>
parents:
20443
diff
changeset
|
619 MsnSession *session = oim->session; |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
620 |
23454
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
621 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
|
622 |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
623 if (strcmp(node->name, "MD") != 0) { |
23454
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
624 char *xmlmsg = xmlnode_to_str(node, NULL); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
625 purple_debug_info("msnoim", "WTF is this? %s\n", xmlmsg); |
23454
7b03d95902d4
References #4382, fixes receiving too many offline messages
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23453
diff
changeset
|
626 g_free(xmlmsg); |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
627 return; |
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
628 } |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
629 |
23453
bca58b00afab
References #4382, replaces usage of msn_soap_xml_get with xmlnode_get_child
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23452
diff
changeset
|
630 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
|
631 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
632 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
|
633 { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
634 char *unread = xmlnode_get_data(iu_node); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
635 const char *passport = msn_user_get_passport(session->user); |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
636 const char *url = session->passport_info.file; |
21767
7ac87187bbec
Don't show a 'you ain't got no new mail' notification.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21103
diff
changeset
|
637 int count = atoi(unread); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
638 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
639 /* 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
|
640 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
|
641 purple_notify_emails(session->account->gc, count, FALSE, NULL, |
7ac87187bbec
Don't show a 'you ain't got no new mail' notification.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21103
diff
changeset
|
642 NULL, &passport, &url, NULL, NULL); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
643 g_free(unread); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
644 } |
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
645 |
20490
2d8999540239
mostly fixed offline messaging, still 2 bugs:
Ka-Hing Cheung <khc@hxbc.us>
parents:
20481
diff
changeset
|
646 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
|
647 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
|
648 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
|
649 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
|
650 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
651 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
|
652 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
|
653 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
654 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
|
655 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
|
656 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
657 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
|
658 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
|
659 |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
660 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
|
661 if (rt_node != NULL) { |
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
662 rtime = xmlnode_get_data(rt_node); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
663 } |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
664 /* purple_debug_info("msnoim","E:{%s},I:{%s},rTime:{%s}\n",passport,msgid,rTime); */ |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
665 |
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
|
666 if (!g_list_find_custom(oim->oim_list, msgid, (GCompareFunc)strcmp)) { |
20535
a9ee3fbabf81
fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents:
20534
diff
changeset
|
667 oim->oim_list = g_list_append(oim->oim_list, msgid); |
a9ee3fbabf81
fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents:
20534
diff
changeset
|
668 msn_oim_post_single_get_msg(oim, msgid); |
a9ee3fbabf81
fixes oim timestamp for me, non HAVE_TM_GMTOFF people probably want to test
Ka-Hing Cheung <khc@hxbc.us>
parents:
20534
diff
changeset
|
669 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
|
670 } |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
671 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
672 g_free(passport); |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20435
diff
changeset
|
673 g_free(msgid); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
674 g_free(rtime); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
675 g_free(nickname); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
676 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
677 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
678 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
679 /*Post to get the Offline Instant Message*/ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
680 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
|
681 msn_oim_post_single_get_msg(MsnOim *oim, char *msgid) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
682 { |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
683 char *soap_body; |
20536
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
684 MsnOimRecvData *data = g_new0(MsnOimRecvData, 1); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
685 |
20471
530a92d50c5e
Misc cleanups, better error handling, and print the Address Book received from the server in a human readable way.
Carlos Silva <typ0@pidgin.im>
parents:
20444
diff
changeset
|
686 purple_debug_info("MSNP14","Get single OIM Message\n"); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
687 |
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
|
688 data->oim = oim; |
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
689 data->msg_id = msgid; |
d52d299cfde3
seems to fix duplicate oim messages for real. The problem was that MSN tells
Ka-Hing Cheung <khc@hxbc.us>
parents:
20535
diff
changeset
|
690 |
23469
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
691 soap_body = g_strdup_printf(MSN_OIM_GET_TEMPLATE, msgid); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
692 |
23469
5f9e6f8b2aea
Correctly update MSN OIM tokens when an invalid token error is
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
693 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:
23464
diff
changeset
|
694 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:
23464
diff
changeset
|
695 data); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
696 |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20503
diff
changeset
|
697 g_free(soap_body); |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
698 } |