Fri, 19 Jun 2009 20:57:03 +0000
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
updates the yahoo prpl to use the new URL fetching function.
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
1 | /* |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
2 | * purple |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
3 | * |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
6 | * source distribution. |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
7 | * |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
8 | * This program is free software; you can redistribute it and/or modify |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
9 | * it under the terms of the GNU General Public License as published by |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
10 | * the Free Software Foundation; either version 2 of the License, or |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
11 | * (at your option) any later version. |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
12 | * |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
13 | * This program is distributed in the hope that it will be useful, |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
16 | * GNU General Public License for more details. |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
17 | * |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
18 | * You should have received a copy of the GNU General Public License |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
19 | * along with this program; if not, write to the Free Software |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
21 | * |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
22 | */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
23 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
24 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
25 | #include "internal.h" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
26 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
27 | #include "account.h" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
28 | #include "accountopt.h" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
29 | #include "blist.h" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
30 | #include "debug.h" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
31 | #include "util.h" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
32 | #include "version.h" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
33 | #include "yahoo.h" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
34 | #include "yahoo_aliases.h" |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
35 | #include "yahoo_friend.h" |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
36 | #include "yahoo_packet.h" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
37 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
38 | /* I hate hardcoding this stuff, but Yahoo never sends us anything to use. Someone in the know may be able to tweak this URL */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
39 | #define YAHOO_ALIAS_FETCH_URL "http://address.yahoo.com/yab/us?v=XM&prog=ymsgr&.intl=us&diffs=1&t=0&tags=short&rt=0&prog-ver=8.1.0.249&useutf8=1&legenc=codepage-1252" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
40 | #define YAHOO_ALIAS_UPDATE_URL "http://address.yahoo.com/yab/us?v=XM&prog=ymsgr&.intl=us&sync=1&tags=short&noclear=1&useutf8=1&legenc=codepage-1252" |
|
22242
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
41 | #define YAHOOJP_ALIAS_FETCH_URL "http://address.yahoo.co.jp/yab/jp?v=XM&prog=ymsgr&.intl=jp&diffs=1&t=0&tags=short&rt=0&prog-ver=7.0.0.7" |
|
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
42 | #define YAHOOJP_ALIAS_UPDATE_URL "http://address.yahoo.co.jp/yab/jp?v=XM&prog=ymsgr&.intl=jp&sync=1&tags=short&noclear=1" |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
43 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
44 | void yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
45 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
46 | /** |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
47 | * Stuff we want passed to the callback function |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
48 | */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
49 | struct callback_data { |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
50 | PurpleConnection *gc; |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
51 | gchar *id; |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
52 | gchar *who; |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
53 | }; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
54 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
55 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
56 | /************************************************************************** |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
57 | * Alias Fetch Functions |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
58 | **************************************************************************/ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
59 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
60 | static void |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
61 | yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
62 | { |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
63 | struct callback_data *cb = user_data; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
64 | PurpleConnection *gc = cb->gc; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
65 | struct yahoo_data *yd = gc->proto_data; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
66 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
67 | yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
68 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
69 | if (len == 0) { |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
70 | purple_debug_info("yahoo", "No Aliases to process.%s%s\n", |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
71 | error_message ? " Error:" : "", error_message ? error_message : ""); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
72 | } else { |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
73 | gchar *full_name, *nick_name; |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
74 | const char *yid, *id, *fn, *ln, *nn, *alias; |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
75 | YahooFriend *f; |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
76 | PurpleBuddy *b; |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
77 | xmlnode *item, *contacts; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
78 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
79 | /* Put our web response into a xmlnode for easy management */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
80 | contacts = xmlnode_from_str(url_text, -1); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
81 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
82 | if (contacts == NULL) { |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
83 | purple_debug_error("yahoo", "Badly formed Alias XML\n"); |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
84 | g_free(cb->who); |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
85 | g_free(cb->id); |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
86 | g_free(cb); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
87 | return; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
88 | } |
|
22622
1ecb840b5101
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <markdoliner@pidgin.im>
parents:
22462
diff
changeset
|
89 | purple_debug_info("yahoo", "Fetched %" G_GSIZE_FORMAT |
|
1ecb840b5101
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <markdoliner@pidgin.im>
parents:
22462
diff
changeset
|
90 | " bytes of alias data\n", len); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
91 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
92 | /* Loop around and around and around until we have gone through all the received aliases */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
93 | for(item = xmlnode_get_child(contacts, "ct"); item; item = xmlnode_get_next_twin(item)) { |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
94 | /* Yahoo replies with two types of contact (ct) record, we are only interested in the alias ones */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
95 | if ((yid = xmlnode_get_attrib(item, "yi"))) { |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
96 | /* Grab all the bits of information we can */ |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
97 | fn = xmlnode_get_attrib(item, "fn"); |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
98 | ln = xmlnode_get_attrib(item, "ln"); |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
99 | nn = xmlnode_get_attrib(item, "nn"); |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
100 | id = xmlnode_get_attrib(item, "id"); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
101 | |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
102 | full_name = nick_name = NULL; |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
103 | alias = NULL; |
| 22966 | 104 | |
| 105 | /* Yahoo stores first and last names separately, lets put them together into a full name */ | |
|
22242
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
106 | if (yd->jp) |
|
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
107 | full_name = g_strstrip(g_strdup_printf("%s %s", (ln != NULL ? ln : "") , (fn != NULL ? fn : ""))); |
|
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
108 | else |
|
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
109 | full_name = g_strstrip(g_strdup_printf("%s %s", (fn != NULL ? fn : "") , (ln != NULL ? ln : ""))); |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
110 | nick_name = (nn != NULL ? g_strstrip(g_strdup(nn)) : NULL); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
111 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
112 | if (nick_name != NULL) |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
113 | alias = nick_name; /* If we have a nickname from Yahoo, let's use it */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
114 | else if (strlen(full_name) != 0) |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
115 | alias = full_name; /* If no Yahoo nickname, we can use the full_name created above */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
116 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
117 | /* Find the local buddy that matches */ |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
118 | f = yahoo_friend_find(cb->gc, yid); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
119 | b = purple_find_buddy(cb->gc->account, yid); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
120 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
121 | /* If we don't find a matching buddy, ignore the alias !! */ |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
122 | if (f != NULL && b != NULL) { |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
123 | const char *buddy_alias = purple_buddy_get_alias(b); |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
124 | yahoo_friend_set_alias_id(f, id); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
125 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
126 | /* Finally, if we received an alias, we better update the buddy list */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
127 | if (alias != NULL) { |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
128 | serv_got_alias(cb->gc, yid, alias); |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
129 | purple_debug_info("yahoo", "Fetched alias '%s' (%s)\n", alias, id); |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
130 | } else if (buddy_alias != NULL && strcmp(buddy_alias, "") != 0) { |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
131 | /* Or if we have an alias that Yahoo doesn't, send it up */ |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
132 | yahoo_update_alias(cb->gc, yid, buddy_alias); |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
133 | purple_debug_info("yahoo", "Sent updated alias '%s'\n", buddy_alias); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
134 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
135 | } |
| 22966 | 136 | |
| 137 | g_free(full_name); | |
| 138 | g_free(nick_name); | |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
139 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
140 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
141 | xmlnode_free(contacts); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
142 | } |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
143 | |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
144 | g_free(cb->who); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
145 | g_free(cb->id); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
146 | g_free(cb); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
147 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
148 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
149 | void |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
150 | yahoo_fetch_aliases(PurpleConnection *gc) |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
151 | { |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
152 | struct yahoo_data *yd = gc->proto_data; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
153 | struct callback_data *cb; |
|
22242
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
154 | const char *url; |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
155 | gchar *request, *webpage, *webaddress; |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
156 | PurpleUtilFetchUrlData *url_data; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
157 | |
|
22145
458640401515
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
158 | /* use whole URL if using HTTP Proxy */ |
|
24181
e028e31dcc67
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <datallah@pidgin.im>
parents:
23159
diff
changeset
|
159 | gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
|
22145
458640401515
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
160 | |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
161 | /* Using callback_data so I have access to gc in the callback function */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
162 | cb = g_new0(struct callback_data, 1); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
163 | cb->gc = gc; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
164 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
165 | /* Build all the info to make the web request */ |
|
22242
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
166 | url = yd->jp ? YAHOOJP_ALIAS_FETCH_URL : YAHOO_ALIAS_FETCH_URL; |
|
21092
d6fb00bf6524
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@pidgin.im>
parents:
20277
diff
changeset
|
167 | purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL); |
|
22145
458640401515
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
168 | request = g_strdup_printf("GET %s%s/%s HTTP/1.1\r\n" |
|
25762
0c1a4287c70c
Backport the parts of b859960a4a19f57f20db0536c1815a6d79e08e36 that apply to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25091
diff
changeset
|
169 | "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
170 | "Cookie: T=%s; Y=%s\r\n" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
171 | "Host: %s\r\n" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
172 | "Cache-Control: no-cache\r\n\r\n", |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
173 | use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
174 | yd->cookie_t, yd->cookie_y, |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
175 | webaddress); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
176 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
177 | /* We have a URL and some header information, let's connect and get some aliases */ |
|
25766
712ab1636372
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25762
diff
changeset
|
178 | url_data = purple_util_fetch_url_request_len_with_account(purple_connection_get_account(gc), |
|
712ab1636372
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25762
diff
changeset
|
179 | url, use_whole_url, NULL, TRUE, request, FALSE, -1, |
|
712ab1636372
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25762
diff
changeset
|
180 | yahoo_fetch_aliases_cb, cb); |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
181 | if (url_data != NULL) |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
182 | yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
183 | |
|
21092
d6fb00bf6524
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@pidgin.im>
parents:
20277
diff
changeset
|
184 | g_free(webaddress); |
|
d6fb00bf6524
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@pidgin.im>
parents:
20277
diff
changeset
|
185 | g_free(webpage); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
186 | g_free(request); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
187 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
188 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
189 | /************************************************************************** |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
190 | * Alias Update Functions |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
191 | **************************************************************************/ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
192 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
193 | static void |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
194 | yahoo_update_alias_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
195 | { |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
196 | xmlnode *node, *result; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
197 | struct callback_data *cb = user_data; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
198 | PurpleConnection *gc = cb->gc; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
199 | struct yahoo_data *yd; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
200 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
201 | yd = gc->proto_data; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
202 | yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
203 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
204 | if (len == 0 || error_message != NULL) { |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
205 | purple_debug_info("yahoo", "Error updating alias for %s: %s\n", |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
206 | cb->who, |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
207 | error_message ? error_message : ""); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
208 | g_free(cb->who); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
209 | g_free(cb->id); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
210 | g_free(cb); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
211 | return; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
212 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
213 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
214 | result = xmlnode_from_str(url_text, -1); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
215 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
216 | if (result == NULL) { |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
217 | purple_debug_error("yahoo", "Alias update for %s failed: Badly formed response\n", |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
218 | cb->who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
219 | g_free(cb->who); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
220 | g_free(cb->id); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
221 | g_free(cb); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
222 | return; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
223 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
224 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
225 | if ((node = xmlnode_get_child(result, "ct"))) { |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
226 | if (cb->id == NULL) { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
227 | const char *new_id = xmlnode_get_attrib(node, "id"); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
228 | if (new_id != NULL) { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
229 | /* We now have an addressbook id for the friend; we should save it */ |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
230 | YahooFriend *f = yahoo_friend_find(cb->gc, cb->who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
231 | |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
232 | purple_debug_info("yahoo", "Alias creation for %s succeeded\n", cb->who); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
233 | |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
234 | if (f) |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
235 | yahoo_friend_set_alias_id(f, new_id); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
236 | else |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
237 | purple_debug_error("yahoo", "Missing YahooFriend. Unable to store new addressbook id.\n"); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
238 | } else |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
239 | purple_debug_error("yahoo", "Missing new addressbook id in add response for %s (weird).\n", |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
240 | cb->who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
241 | } else { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
242 | if (g_ascii_strncasecmp(xmlnode_get_attrib(node, "id"), cb->id, strlen(cb->id))==0) |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
243 | purple_debug_info("yahoo", "Alias update for %s succeeded\n", cb->who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
244 | else |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
245 | purple_debug_error("yahoo", "Alias update for %s failed (Contact record return mismatch)\n", |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
246 | cb->who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
247 | } |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
248 | } else |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
249 | purple_debug_info("yahoo", "Alias update for %s failed (No contact record returned)\n", cb->who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
250 | |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
251 | g_free(cb->who); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
252 | g_free(cb->id); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
253 | g_free(cb); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
254 | xmlnode_free(result); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
255 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
256 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
257 | void |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
258 | yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
259 | { |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
260 | struct yahoo_data *yd; |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
261 | const char *url; |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
262 | gchar *content, *request, *webpage, *webaddress; |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
263 | struct callback_data *cb; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
264 | PurpleUtilFetchUrlData *url_data; |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
265 | YahooFriend *f; |
|
22145
458640401515
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
266 | /* use whole URL if using HTTP Proxy */ |
|
24181
e028e31dcc67
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <datallah@pidgin.im>
parents:
23159
diff
changeset
|
267 | gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
268 | |
|
22242
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
269 | g_return_if_fail(who != NULL); |
|
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
270 | g_return_if_fail(gc != NULL); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
271 | |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
272 | if (alias == NULL) |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
273 | alias = ""; |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
274 | |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
275 | f = yahoo_friend_find(gc, who); |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
276 | if (f == NULL) { |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
277 | purple_debug_error("yahoo", "Missing YahooFriend. Unable to set server alias.\n"); |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
278 | return; |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
279 | } |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
280 | |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
281 | yd = gc->proto_data; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
282 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
283 | /* Using callback_data so I have access to gc in the callback function */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
284 | cb = g_new0(struct callback_data, 1); |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
285 | cb->who = g_strdup(who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
286 | cb->id = g_strdup(yahoo_friend_get_alias_id(f)); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
287 | cb->gc = gc; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
288 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
289 | /* Build all the info to make the web request */ |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
290 | url = yd->jp ? YAHOOJP_ALIAS_UPDATE_URL: YAHOO_ALIAS_UPDATE_URL; |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
291 | purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
292 | |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
293 | if (cb->id == NULL) { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
294 | /* No id for this buddy, so create an address book entry */ |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
295 | purple_debug_info("yahoo", "Creating '%s' as new alias for user '%s'\n", alias, who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
296 | |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
297 | if (yd->jp) { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
298 | gchar *alias_jp = g_convert(alias, -1, "EUC-JP", "UTF-8", NULL, NULL, NULL); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
299 | gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
300 | content = g_strdup_printf("<ab k=\"%s\" cc=\"9\">\n" |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
301 | "<ct a=\"1\" yi='%s' nn='%s' />\n</ab>\r\n", |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
302 | purple_account_get_username(gc->account), |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
303 | who, converted_alias_jp); |
|
25091
40dc2fccf9aa
Use g_free instead of free here too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24181
diff
changeset
|
304 | g_free(converted_alias_jp); |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
305 | g_free(alias_jp); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
306 | } else { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
307 | gchar *escaped_alias = g_markup_escape_text(alias, -1); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
308 | content = g_strdup_printf("<?xml version=\"1.0\" encoding=\"utf-8\"?><ab k=\"%s\" cc=\"9\">\n" |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
309 | "<ct a=\"1\" yi='%s' nn='%s' />\n</ab>\r\n", |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
310 | purple_account_get_username(gc->account), |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
311 | who, escaped_alias); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
312 | g_free(escaped_alias); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
313 | } |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
314 | } else { |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
315 | purple_debug_info("yahoo", "Updating '%s' as new alias for user '%s'\n", alias, who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
316 | |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
317 | if (yd->jp) { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
318 | gchar *alias_jp = g_convert(alias, -1, "EUC-JP", "UTF-8", NULL, NULL, NULL); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
319 | gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
320 | content = g_strdup_printf("<ab k=\"%s\" cc=\"1\">\n" |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
321 | "<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n", |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
322 | purple_account_get_username(gc->account), |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
323 | who, cb->id, converted_alias_jp); |
|
25091
40dc2fccf9aa
Use g_free instead of free here too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24181
diff
changeset
|
324 | g_free(converted_alias_jp); |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
325 | g_free(alias_jp); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
326 | } else { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
327 | gchar *escaped_alias = g_markup_escape_text(alias, -1); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
328 | content = g_strdup_printf("<?xml version=\"1.0\" encoding=\"utf-8\"?><ab k=\"%s\" cc=\"1\">\n" |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
329 | "<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n", |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
330 | purple_account_get_username(gc->account), |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
331 | who, cb->id, escaped_alias); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
332 | g_free(escaped_alias); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
333 | } |
|
22242
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
334 | } |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
335 | |
|
22145
458640401515
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
336 | request = g_strdup_printf("POST %s%s/%s HTTP/1.1\r\n" |
|
25762
0c1a4287c70c
Backport the parts of b859960a4a19f57f20db0536c1815a6d79e08e36 that apply to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25091
diff
changeset
|
337 | "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
338 | "Cookie: T=%s; Y=%s\r\n" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
339 | "Host: %s\r\n" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
340 | "Content-Length: %" G_GSIZE_FORMAT "\r\n" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
341 | "Cache-Control: no-cache\r\n\r\n" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
342 | "%s", |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
343 | use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
344 | yd->cookie_t, yd->cookie_y, |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
345 | webaddress, |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
346 | strlen(content), |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
347 | content); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
348 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
349 | /* We have a URL and some header information, let's connect and update the alias */ |
|
25766
712ab1636372
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25762
diff
changeset
|
350 | url_data = purple_util_fetch_url_request_len_with_account( |
|
712ab1636372
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25762
diff
changeset
|
351 | purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, |
|
712ab1636372
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25762
diff
changeset
|
352 | request, FALSE, -1, yahoo_update_alias_cb, cb); |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
353 | if (url_data != NULL) |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
354 | yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
355 | |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
356 | g_free(webpage); |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
357 | g_free(webaddress); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
358 | g_free(content); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
359 | g_free(request); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
360 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
361 |