Mon, 26 Aug 2013 17:21:22 +0200
Extend prpl with max message length callback
|
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" |
|
34219
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33602
diff
changeset
|
31 | #include "http.h" |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
32 | #include "util.h" |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
33 | #include "request.h" |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
34 | #include "version.h" |
|
27555
afb7cb5c350c
Update for file renames.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25766
diff
changeset
|
35 | #include "libymsg.h" |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
36 | #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
|
37 | #include "yahoo_friend.h" |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
38 | #include "yahoo_packet.h" |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
39 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
40 | /* I hate hardcoding this stuff, but Yahoo never sends us anything to use. Someone in the know may be able to tweak this URL */ |
|
27957
41f124b67117
Update these URL's to use the correct version of the Yahoo Messenger client
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27792
diff
changeset
|
41 | #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=" YAHOO_CLIENT_VERSION "&useutf8=1&legenc=codepage-1252" |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
42 | #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" |
|
27957
41f124b67117
Update these URL's to use the correct version of the Yahoo Messenger client
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27792
diff
changeset
|
43 | #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=" YAHOOJP_CLIENT_VERSION |
|
22242
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
44 | #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
|
45 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
46 | 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
|
47 | |
|
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 | * Stuff we want passed to the callback function |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
50 | */ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
51 | struct callback_data { |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
52 | PurpleConnection *gc; |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
53 | gchar *id; |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
54 | gchar *who; |
|
20277
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 | |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
57 | void yahoo_personal_details_reset(YahooPersonalDetails *ypd, gboolean all) |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
58 | { |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
59 | if (all) |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
60 | g_free(ypd->id); |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
61 | g_free(ypd->names.first); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
62 | g_free(ypd->names.last); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
63 | g_free(ypd->names.middle); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
64 | g_free(ypd->names.nick); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
65 | g_free(ypd->phone.work); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
66 | g_free(ypd->phone.home); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
67 | g_free(ypd->phone.mobile); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
68 | } |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
69 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
70 | /************************************************************************** |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
71 | * Alias Fetch Functions |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
72 | **************************************************************************/ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
73 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
74 | static void |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
75 | yahoo_fetch_aliases_cb(PurpleHttpConnection *http_conn, |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
76 | PurpleHttpResponse *response, gpointer _unused) |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
77 | { |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
78 | PurpleConnection *gc = |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
79 | purple_http_conn_get_purple_connection(http_conn); |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
32147
diff
changeset
|
80 | YahooData *yd = purple_connection_get_protocol_data(gc); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
81 | |
|
34287
6cd0c77b1f6a
HTTP: successful is spelled with one l
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34269
diff
changeset
|
82 | if (!purple_http_response_is_successful(response)) { |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
83 | purple_debug_info("yahoo", "yahoo_fetch_aliases_cb error: %s\n", |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
84 | purple_http_response_get_error(response)); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
85 | } else { |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
86 | gchar *full_name, *nick_name; |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
87 | const gchar *xml_raw; |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
88 | const char *yid, *id, *fn, *ln, *nn, *alias, *mn; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
89 | const char *hp, *wp, *mo; |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
90 | YahooFriend *f; |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
91 | PurpleBuddy *b; |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
92 | xmlnode *item, *contacts; |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
93 | PurpleAccount *account; |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
94 | size_t len; |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
95 | |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
96 | account = purple_connection_get_account(gc); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
97 | /* Put our web response into a xmlnode for easy management */ |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
98 | xml_raw = purple_http_response_get_data(response, &len); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
99 | contacts = xmlnode_from_str(xml_raw, -1); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
100 | |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
101 | if (purple_debug_is_verbose()) { |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
102 | purple_debug_misc("yahoo", |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
103 | "yahoo_fetch_aliases_cb xml:[%s]\n", xml_raw); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
104 | } |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
105 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
106 | if (contacts == NULL) { |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
107 | purple_debug_error("yahoo", "Badly formed Alias XML\n"); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
108 | return; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
109 | } |
|
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
|
110 | 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
|
111 | " bytes of alias data\n", len); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
112 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
113 | /* 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
|
114 | 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
|
115 | /* 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
|
116 | if ((yid = xmlnode_get_attrib(item, "yi"))) { |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
117 | YahooPersonalDetails *ypd = NULL; |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
118 | /* Grab all the bits of information we can */ |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
119 | fn = xmlnode_get_attrib(item, "fn"); |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
120 | ln = xmlnode_get_attrib(item, "ln"); |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
121 | nn = xmlnode_get_attrib(item, "nn"); |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
122 | mn = xmlnode_get_attrib(item, "mn"); |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
123 | id = xmlnode_get_attrib(item, "id"); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
124 | |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
125 | hp = xmlnode_get_attrib(item, "hp"); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
126 | wp = xmlnode_get_attrib(item, "wp"); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
127 | mo = xmlnode_get_attrib(item, "mo"); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
128 | |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
129 | full_name = nick_name = NULL; |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
130 | alias = NULL; |
| 22966 | 131 | |
| 132 | /* 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
|
133 | 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
|
134 | 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
|
135 | else |
|
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
136 | 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
|
137 | 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
|
138 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
139 | if (nick_name != NULL) |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
140 | 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
|
141 | else if (strlen(full_name) != 0) |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
142 | 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
|
143 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
144 | /* Find the local buddy that matches */ |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
145 | f = yahoo_friend_find(gc, yid); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
146 | b = purple_find_buddy(account, yid); |
|
20277
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 | /* 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
|
149 | if (f != NULL && b != NULL) { |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
150 | 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
|
151 | yahoo_friend_set_alias_id(f, id); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
152 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
153 | /* 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
|
154 | if (alias != NULL) { |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
155 | serv_got_alias(gc, yid, alias); |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
156 | purple_debug_info("yahoo", "Fetched alias '%s' (%s)\n", alias, id); |
|
30692
b23acf248422
The Yahoo prpl makes unnecessary callbacks to the Yahoo servers if the
Eion Robb <eion@robbmob.com>
parents:
27959
diff
changeset
|
157 | } else if (buddy_alias && *buddy_alias && !g_str_equal(buddy_alias, yid)) { |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
158 | /* Or if we have an alias that Yahoo doesn't, send it up */ |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
159 | yahoo_update_alias(gc, yid, buddy_alias); |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
160 | 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
|
161 | } |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
162 | } |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30692
diff
changeset
|
163 | |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
164 | if (f != NULL) |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
165 | ypd = &f->ypd; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
166 | else { |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
167 | /* May be the alias is for the account? */ |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
168 | const char *yidn = purple_normalize(account, yid); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
169 | if (purple_strequal(yidn, purple_connection_get_display_name(gc))) { |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
170 | ypd = &yd->ypd; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
171 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
172 | } |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
173 | |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
174 | if (ypd) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
175 | yahoo_personal_details_reset(ypd, TRUE); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
176 | ypd->id = g_strdup(id); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
177 | ypd->names.first = g_strdup(fn); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
178 | ypd->names.middle = g_strdup(mn); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
179 | ypd->names.last = g_strdup(ln); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
180 | ypd->names.nick = g_strdup(nn); |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
181 | |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
182 | ypd->phone.work = g_strdup(wp); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
183 | ypd->phone.home = g_strdup(hp); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
184 | ypd->phone.mobile = g_strdup(mo); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
185 | } |
| 22966 | 186 | |
| 187 | g_free(full_name); | |
| 188 | g_free(nick_name); | |
|
20277
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 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
191 | xmlnode_free(contacts); |
|
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 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
194 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
195 | void |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
196 | yahoo_fetch_aliases(PurpleConnection *gc) |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
197 | { |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
32147
diff
changeset
|
198 | YahooData *yd = purple_connection_get_protocol_data(gc); |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
199 | PurpleHttpRequest *req; |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
200 | PurpleHttpCookieJar *cookiejar; |
|
34219
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33602
diff
changeset
|
201 | |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
202 | req = purple_http_request_new(yd->jp ? YAHOOJP_ALIAS_FETCH_URL : |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
203 | YAHOO_ALIAS_FETCH_URL); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
204 | /* XXX: see the other note about user-agent */ |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
205 | purple_http_request_header_set(req, "User-Agent", |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
206 | "Mozilla/4.0 (compatible; MSIE 5.5)"); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
207 | cookiejar = purple_http_request_get_cookie_jar(req); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
208 | purple_http_cookie_jar_set(cookiejar, "T", yd->cookie_t); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
209 | purple_http_cookie_jar_set(cookiejar, "Y", yd->cookie_y); |
|
34269
26b4c9a54166
HTTP: Use PurpleHttpConnectionSet instead of GSLists of PurpleHttpConnection structs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34235
diff
changeset
|
210 | purple_http_connection_set_add(yd->http_reqs, purple_http_request(gc, |
|
26b4c9a54166
HTTP: Use PurpleHttpConnectionSet instead of GSLists of PurpleHttpConnection structs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34235
diff
changeset
|
211 | req, yahoo_fetch_aliases_cb, NULL)); |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
212 | purple_http_request_unref(req); |
|
20277
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 | |
|
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 | * Alias Update Functions |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
217 | **************************************************************************/ |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
218 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
219 | static void |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
220 | yahoo_update_alias_cb(PurpleHttpConnection *http_conn, |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
221 | PurpleHttpResponse *response, gpointer _cb) |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
222 | { |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
223 | xmlnode *node, *result; |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
224 | struct callback_data *cb = _cb; |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
225 | |
|
34287
6cd0c77b1f6a
HTTP: successful is spelled with one l
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34269
diff
changeset
|
226 | if (!purple_http_response_is_successful(response)) { |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
227 | purple_debug_info("yahoo", "Error updating alias for %s: %s\n", |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
228 | cb->who, purple_http_response_get_error(response)); |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
229 | g_free(cb->who); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
230 | g_free(cb->id); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
231 | g_free(cb); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
232 | return; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
233 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
234 | |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
235 | result = xmlnode_from_str( |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
236 | purple_http_response_get_data(response, NULL), -1); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
237 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
238 | if (result == NULL) { |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
239 | 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
|
240 | cb->who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
241 | g_free(cb->who); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
242 | g_free(cb->id); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
243 | g_free(cb); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
244 | return; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
245 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
246 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
247 | if ((node = xmlnode_get_child(result, "ct"))) { |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
248 | if (cb->id == NULL) { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
249 | const char *new_id = xmlnode_get_attrib(node, "id"); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
250 | if (new_id != NULL) { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
251 | /* 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
|
252 | YahooFriend *f = yahoo_friend_find(cb->gc, cb->who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
253 | |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
254 | 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
|
255 | |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
256 | if (f) |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
257 | yahoo_friend_set_alias_id(f, new_id); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
258 | else |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
259 | 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
|
260 | } else |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
261 | 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
|
262 | cb->who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
263 | } else { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
264 | 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
|
265 | 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
|
266 | else |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
267 | 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
|
268 | cb->who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
269 | } |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
270 | } else |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
271 | 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
|
272 | |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
273 | g_free(cb->who); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
274 | g_free(cb->id); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
275 | g_free(cb); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
276 | xmlnode_free(result); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
277 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
278 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
279 | void |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
280 | 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
|
281 | { |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
282 | PurpleHttpRequest *req; |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
283 | PurpleHttpCookieJar *cookiejar; |
|
27959
f842ae57da4e
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27957
diff
changeset
|
284 | YahooData *yd; |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
285 | gchar *content; |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
286 | struct callback_data *cb; |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
287 | YahooFriend *f; |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
288 | |
|
22242
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
289 | 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
|
290 | g_return_if_fail(gc != NULL); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
291 | |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
292 | if (alias == NULL) |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
293 | alias = ""; |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
294 | |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22966
diff
changeset
|
295 | 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
|
296 | if (f == NULL) { |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
297 | 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
|
298 | return; |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
299 | } |
|
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
300 | |
|
32280
704f84f692f6
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Andrew Victor <andrew.victor@mxit.com>
parents:
32147
diff
changeset
|
301 | yd = purple_connection_get_protocol_data(gc); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
302 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
303 | /* 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
|
304 | cb = g_new0(struct callback_data, 1); |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
305 | cb->who = g_strdup(who); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
306 | 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
|
307 | cb->gc = gc; |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
308 | |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
309 | if (cb->id == NULL) { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
310 | /* 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
|
311 | 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
|
312 | |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
313 | if (yd->jp) { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
314 | 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
|
315 | gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
316 | content = g_strdup_printf("<ab k=\"%s\" cc=\"9\">\n" |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
317 | "<ct a=\"1\" yi='%s' nn='%s' />\n</ab>\r\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32596
diff
changeset
|
318 | purple_account_get_username(purple_connection_get_account(gc)), |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
319 | who, converted_alias_jp); |
|
25091
40dc2fccf9aa
Use g_free instead of free here too.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24181
diff
changeset
|
320 | g_free(converted_alias_jp); |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
321 | g_free(alias_jp); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
322 | } else { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
323 | gchar *escaped_alias = g_markup_escape_text(alias, -1); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
324 | 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
|
325 | "<ct a=\"1\" yi='%s' nn='%s' />\n</ab>\r\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32596
diff
changeset
|
326 | purple_account_get_username(purple_connection_get_account(gc)), |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
327 | who, escaped_alias); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
328 | g_free(escaped_alias); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
329 | } |
|
23157
cd30047563bf
applied changes from b92fdea98a3ea454f3e9debd7f6ac17e5ae36ef6
Daniel Atallah <datallah@pidgin.im>
parents:
22980
diff
changeset
|
330 | } else { |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
331 | 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
|
332 | |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
333 | if (yd->jp) { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
334 | 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
|
335 | gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
336 | content = g_strdup_printf("<ab k=\"%s\" cc=\"1\">\n" |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
337 | "<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32596
diff
changeset
|
338 | purple_account_get_username(purple_connection_get_account(gc)), |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
339 | 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
|
340 | g_free(converted_alias_jp); |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
341 | g_free(alias_jp); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
342 | } else { |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
343 | gchar *escaped_alias = g_markup_escape_text(alias, -1); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
344 | 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
|
345 | "<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n", |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32596
diff
changeset
|
346 | purple_account_get_username(purple_connection_get_account(gc)), |
|
23159
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
347 | who, cb->id, escaped_alias); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
348 | g_free(escaped_alias); |
|
3565fd1e02c7
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <datallah@pidgin.im>
parents:
23157
diff
changeset
|
349 | } |
|
22242
f2efb6941859
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21453
diff
changeset
|
350 | } |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
351 | |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
352 | req = purple_http_request_new(yd->jp ? YAHOOJP_ALIAS_UPDATE_URL: |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
353 | YAHOO_ALIAS_UPDATE_URL); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
354 | purple_http_request_set_method(req, "POST"); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
355 | /* XXX: We get rs="ERROR:-100:No Login", when we set |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
356 | * YAHOO_CLIENT_USERAGENT (Mozilla/5.0) here. |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
357 | */ |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
358 | purple_http_request_header_set(req, "User-Agent", |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
359 | "Mozilla/4.0 (compatible; MSIE 5.5)"); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
360 | cookiejar = purple_http_request_get_cookie_jar(req); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
361 | purple_http_cookie_jar_set(cookiejar, "T", yd->cookie_t); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
362 | purple_http_cookie_jar_set(cookiejar, "Y", yd->cookie_y); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
363 | purple_http_request_set_contents(req, content, -1); |
|
34269
26b4c9a54166
HTTP: Use PurpleHttpConnectionSet instead of GSLists of PurpleHttpConnection structs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34235
diff
changeset
|
364 | purple_http_connection_set_add(yd->http_reqs, purple_http_request(gc, |
|
26b4c9a54166
HTTP: Use PurpleHttpConnectionSet instead of GSLists of PurpleHttpConnection structs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34235
diff
changeset
|
365 | req, yahoo_update_alias_cb, cb)); |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
366 | purple_http_request_unref(req); |
|
20277
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
367 | |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
368 | g_free(content); |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
369 | } |
|
e10c0e405cdd
applied changes from b8d509fbf120a8eb57e6dfa96005e3c0312c2096
Daniel Atallah <datallah@pidgin.im>
parents:
20228
diff
changeset
|
370 | |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
371 | |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
372 | /************************************************************************** |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
373 | * User Info Update Functions |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
374 | **************************************************************************/ |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
375 | |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
376 | #if 0 |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
377 | /* This block of code can be used to send our contact details to |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
378 | * everyone in the buddylist. But with the official messenger, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
379 | * doing this pops a conversation window at the receiver's end, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
380 | * which is stupid, and thus not really surprising. */ |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
381 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
382 | struct yahoo_userinfo { |
|
27959
f842ae57da4e
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27957
diff
changeset
|
383 | YahooData *yd; |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
384 | char *xml; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
385 | }; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
386 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
387 | static void |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
388 | yahoo_send_userinfo_to_user(struct yahoo_userinfo *yui, const char *who) |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
389 | { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
390 | struct yahoo_packet *pkt; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
391 | PurpleConnection *gc; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
392 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
393 | gc = yui->yd->gc; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
394 | pkt = yahoo_packet_new(YAHOO_SERVICE_CONTACT_DETAILS, 0, 0); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
395 | yahoo_packet_hash(pkt, "siisis", |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
396 | 1, purple_connection_get_display_name(gc), |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
397 | 13, 1, /* This creates a conversation window in the official client */ |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
398 | 302, 5, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
399 | 5, who, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
400 | 303, 5, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
401 | 280, yui->xml); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
402 | yahoo_packet_send_and_free(pkt, yui->yd); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
403 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
404 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
405 | static void |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
406 | yahoo_send_userinfo_foreach(gpointer key, gpointer value, gpointer data) |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
407 | { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
408 | const char *who = key; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
409 | YahooFriend *f = value; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
410 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
411 | if (f->status != YAHOO_STATUS_OFFLINE) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
412 | yahoo_send_userinfo_to_user(data, who); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
413 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
414 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
415 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
416 | static void |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
417 | yahoo_sent_userinfo_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
418 | { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
419 | struct yahoo_userinfo *yui = user_data; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
420 | yahoo_fetch_aliases_cb(url_data, yui->yd->gc, url_text, len, error_message); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
421 | g_hash_table_foreach(yui->yd->friends, yahoo_send_userinfo_foreach, yui); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
422 | g_free(yui->xml); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
423 | g_free(yui); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
424 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
425 | #endif |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
426 | |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
427 | static void |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
428 | yahoo_set_userinfo_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
429 | { |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
430 | PurpleHttpRequest *req; |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
431 | PurpleHttpCookieJar *cookiejar; |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
432 | |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
433 | xmlnode *node = xmlnode_new("ab"); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
434 | xmlnode *ct = xmlnode_new_child(node, "ct"); |
|
27959
f842ae57da4e
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27957
diff
changeset
|
435 | YahooData *yd = purple_connection_get_protocol_data(gc); |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
436 | char *content; |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
437 | int len; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
438 | int i; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
439 | char * yfields[] = { "fn", "ln", "nn", "mn", "hp", "wp", "mo", NULL }; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
440 | |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
441 | xmlnode_set_attrib(node, "k", purple_connection_get_display_name(gc)); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
442 | xmlnode_set_attrib(node, "cc", "1"); /* XXX: ? */ |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
443 | |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
444 | xmlnode_set_attrib(ct, "e", "1"); |
|
27792
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
445 | xmlnode_set_attrib(ct, "yi", purple_request_fields_get_string(fields, "yname")); |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
446 | xmlnode_set_attrib(ct, "id", purple_request_fields_get_string(fields, "yid")); |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
447 | xmlnode_set_attrib(ct, "pr", "0"); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
448 | |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
449 | for (i = 0; yfields[i]; i++) { |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
450 | const char *v = purple_request_fields_get_string(fields, yfields[i]); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
451 | xmlnode_set_attrib(ct, yfields[i], v ? v : ""); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
452 | } |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
453 | |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
454 | content = xmlnode_to_formatted_str(node, &len); |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
455 | xmlnode_free(node); |
|
34219
eee308def583
HTTP: get rid of purple_url_parse
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
33602
diff
changeset
|
456 | |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
457 | #if 0 |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
458 | { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
459 | /* This is if we wanted to send our contact details to everyone |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
460 | * in the buddylist. But this cannot be done now, because in the |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
461 | * official messenger, doing this pops a conversation window at |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
462 | * the receiver's end, which is stupid, and thus not really |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
463 | * surprising. */ |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
464 | struct yahoo_userinfo *ui = g_new(struct yahoo_userinfo, 1); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
465 | node = xmlnode_new("contact"); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
466 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
467 | for (i = 0; yfields[i]; i++) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
468 | const char *v = purple_request_fields_get_string(fields, yfields[i]); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
469 | if (v) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
470 | xmlnode *nd = xmlnode_new_child(node, yfields[i]); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
471 | xmlnode_insert_data(nd, v, -1); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
472 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
473 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
474 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
475 | ui->yd = yd; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
476 | ui->xml = xmlnode_to_str(node, NULL); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
477 | xmlnode_free(node); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
478 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
479 | #endif |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
480 | |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
481 | req = purple_http_request_new(yd->jp ? YAHOOJP_USERINFO_URL : |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
482 | YAHOO_USERINFO_URL); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
483 | purple_http_request_set_method(req, "POST"); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
484 | /* XXX: see the previous comment for user-agent */ |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
485 | purple_http_request_header_set(req, "User-Agent", |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
486 | "Mozilla/4.0 (compatible; MSIE 5.5)"); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
487 | cookiejar = purple_http_request_get_cookie_jar(req); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
488 | purple_http_cookie_jar_set(cookiejar, "T", yd->cookie_t); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
489 | purple_http_cookie_jar_set(cookiejar, "Y", yd->cookie_y); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
490 | purple_http_request_set_contents(req, content, -1); |
|
34269
26b4c9a54166
HTTP: Use PurpleHttpConnectionSet instead of GSLists of PurpleHttpConnection structs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34235
diff
changeset
|
491 | purple_http_connection_set_add(yd->http_reqs, purple_http_request(gc, |
|
26b4c9a54166
HTTP: Use PurpleHttpConnectionSet instead of GSLists of PurpleHttpConnection structs
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34235
diff
changeset
|
492 | req, yahoo_fetch_aliases_cb, NULL)); |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
493 | purple_http_request_unref(req); |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
494 | |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
495 | g_free(content); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
496 | } |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
497 | |
|
27792
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
498 | static PurpleRequestFields * |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
499 | request_fields_from_personal_details(YahooPersonalDetails *ypd, const char *id) |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
500 | { |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
501 | PurpleRequestFields *fields; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
502 | PurpleRequestFieldGroup *group; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
503 | PurpleRequestField *field; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
504 | int i; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
505 | struct { |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
506 | char *id; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
507 | char *text; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
508 | char *value; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
509 | } yfields[] = { |
|
27792
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
510 | {"fn", N_("First Name"), ypd->names.first}, |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
511 | {"ln", N_("Last Name"), ypd->names.last}, |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
512 | {"nn", N_("Nickname"), ypd->names.nick}, |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
513 | {"mn", N_("Middle Name"), ypd->names.middle}, |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
514 | {"hp", N_("Home Phone Number"), ypd->phone.home}, |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
515 | {"wp", N_("Work Phone Number"), ypd->phone.work}, |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
516 | {"mo", N_("Mobile Phone Number"), ypd->phone.mobile}, |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
517 | {NULL, NULL, NULL} |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
518 | }; |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
519 | |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
520 | if (ypd->id == NULL) { |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
521 | purple_debug_error("yahoo", |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
522 | "request_fields_from_personal_details:" |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
523 | "ypd->id == NULL (it doesn't seems to work)\n"); |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
524 | return NULL; |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
525 | } |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
526 | |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
527 | fields = purple_request_fields_new(); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
528 | group = purple_request_field_group_new(NULL); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
529 | purple_request_fields_add_group(fields, group); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
530 | |
|
27792
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
531 | field = purple_request_field_string_new("yname", "", id, FALSE); |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
532 | purple_request_field_set_visible(field, FALSE); |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
533 | purple_request_field_group_add_field(group, field); |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
534 | |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
535 | field = purple_request_field_string_new("yid", "", ypd->id, FALSE); |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
536 | purple_request_field_set_visible(field, FALSE); |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
537 | purple_request_field_group_add_field(group, field); |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
538 | |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
539 | for (i = 0; yfields[i].id; i++) { |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
540 | field = purple_request_field_string_new(yfields[i].id, _(yfields[i].text), |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
541 | yfields[i].value, FALSE); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
542 | purple_request_field_group_add_field(group, field); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
543 | } |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
544 | |
|
27792
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
545 | return fields; |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
546 | } |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
547 | |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
548 | void yahoo_set_userinfo_for_buddy(PurpleConnection *gc, PurpleBuddy *buddy) |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
549 | { |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
550 | PurpleRequestFields *fields; |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
551 | YahooFriend *f; |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
552 | const char *name; |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
553 | |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
554 | name = purple_buddy_get_name(buddy); |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
555 | f = yahoo_friend_find(gc, name); |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
556 | if (!f) |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
557 | return; |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
558 | |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
559 | fields = request_fields_from_personal_details(&f->ypd, name); |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
560 | if (fields == NULL) |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
561 | return; |
|
27792
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
562 | purple_request_fields(gc, NULL, _("Set User Info"), NULL, fields, |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
563 | _("OK"), G_CALLBACK(yahoo_set_userinfo_cb), |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
564 | _("Cancel"), NULL, |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
565 | purple_connection_get_account(gc), NULL, NULL, gc); |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
566 | } |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
567 | |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
568 | void yahoo_set_userinfo(PurpleConnection *gc) |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
569 | { |
|
27959
f842ae57da4e
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27957
diff
changeset
|
570 | YahooData *yd = purple_connection_get_protocol_data(gc); |
|
27792
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
571 | PurpleRequestFields *fields = request_fields_from_personal_details(&yd->ypd, |
|
24c414559007
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27791
diff
changeset
|
572 | purple_connection_get_display_name(gc)); |
|
34235
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
573 | if (fields == NULL) |
|
35b02d591bd9
HTTP: migrate purple_util_fetch_url_request to new API for yahoo prpl (completed)
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
34219
diff
changeset
|
574 | return; |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
575 | purple_request_fields(gc, NULL, _("Set User Info"), NULL, fields, |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
576 | _("OK"), G_CALLBACK(yahoo_set_userinfo_cb), |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
577 | _("Cancel"), NULL, |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
578 | purple_connection_get_account(gc), NULL, NULL, gc); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
579 | } |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27555
diff
changeset
|
580 | |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
581 | static gboolean |
|
27959
f842ae57da4e
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27957
diff
changeset
|
582 | parse_contact_details(YahooData *yd, const char *who, const char *xml) |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
583 | { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
584 | xmlnode *node, *nd; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
585 | YahooFriend *f; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
586 | char *yid; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
587 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
588 | node = xmlnode_from_str(xml, -1); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
589 | if (!node) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
590 | purple_debug_info("yahoo", "Received malformed XML for contact details from '%s':\n%s\n", |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
591 | who, xml); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
592 | return FALSE; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
593 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
594 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
595 | nd = xmlnode_get_child(node, "yi"); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
596 | if (!nd || !(yid = xmlnode_get_data(nd))) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
597 | xmlnode_free(node); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
598 | return FALSE; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
599 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
600 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
601 | if (!purple_strequal(yid, who)) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
602 | /* The user may not want to set the contact details about folks in the buddylist |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
603 | to what some random dude might have sent. So it would be good if we popped |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
604 | up a prompt requiring the user to confirm the details before we set them. |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
605 | However, someone could send details about hundreds of users at the same time, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
606 | which would make things really bad. So for now, until we have a better way of |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
607 | dealing with this, ignore this details. */ |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
608 | purple_debug_info("yahoo", "Ignoring contact details sent by %s about %s\n", |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
609 | who, yid); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
610 | g_free(yid); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
611 | xmlnode_free(node); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
612 | return FALSE; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
613 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
614 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
615 | f = yahoo_friend_find(yd->gc, yid); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
616 | if (!f) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
617 | g_free(yid); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
618 | xmlnode_free(node); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
619 | return FALSE; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
620 | } else { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
621 | int i; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
622 | YahooPersonalDetails *ypd = &f->ypd; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
623 | char *alias = NULL; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
624 | struct { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
625 | char *id; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
626 | char **field; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
627 | } details[] = { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
628 | {"fn", &ypd->names.first}, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
629 | {"mn", &ypd->names.middle}, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
630 | {"ln", &ypd->names.last}, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
631 | {"nn", &ypd->names.nick}, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
632 | {"wp", &ypd->phone.work}, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
633 | {"hp", &ypd->phone.home}, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
634 | {"mo", &ypd->phone.mobile}, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
635 | {NULL, NULL} |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
636 | }; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
637 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
638 | yahoo_personal_details_reset(ypd, FALSE); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
639 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
640 | for (i = 0; details[i].id; i++) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
641 | nd = xmlnode_get_child(node, details[i].id); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
642 | *details[i].field = nd ? xmlnode_get_data(nd) : NULL; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
643 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
644 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
645 | if (ypd->names.nick) |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
646 | alias = ypd->names.nick; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
647 | else if (ypd->names.first || ypd->names.last) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
648 | alias = g_strstrip(g_strdup_printf("%s %s", |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
649 | ypd->names.first ? ypd->names.first : "", |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
650 | ypd->names.last ? ypd->names.last : "")); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
651 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
652 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
653 | if (alias) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
654 | serv_got_alias(yd->gc, yid, alias); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
655 | if (alias != ypd->names.nick) |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
656 | g_free(alias); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
657 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
658 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
659 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
660 | xmlnode_free(node); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
661 | g_free(yid); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
662 | return TRUE; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
663 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
664 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
665 | /* I don't think this happens for MSN buddies. -- sad */ |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
666 | void yahoo_process_contact_details(PurpleConnection *gc, struct yahoo_packet *pkt) |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
667 | { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
668 | GSList *l = pkt->hash; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
669 | const char *who = NULL, *xml = NULL; |
|
27959
f842ae57da4e
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27957
diff
changeset
|
670 | YahooData *yd = purple_connection_get_protocol_data(gc); |
|
27791
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
671 | |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
672 | for (; l; l = l->next) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
673 | struct yahoo_pair *pair = l->data; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
674 | switch (pair->key) { |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
675 | case 4: |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
676 | who = pair->value; /* This is the person who sent us the details. |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
677 | But not necessarily about himself. */ |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
678 | break; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
679 | case 5: |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
680 | break; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
681 | case 13: |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
682 | /* This is '1' if 'who' is sending the contact details about herself, |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
683 | '0' if 'who' is sending the contact details she has about buddies |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
684 | in her list. However, in all cases, the xml in key 280 always seems |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
685 | to contain the yid of the person, so we may as well ignore this field |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
686 | and look into the xml instead to see who the information is about. */ |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
687 | break; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
688 | case 280: |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
689 | xml = pair->value; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
690 | parse_contact_details(yd, who, xml); |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
691 | break; |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
692 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
693 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
694 | } |
|
4601e7074a83
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27726
diff
changeset
|
695 |