Mercurial > pidgin.yaz
annotate libpurple/protocols/yahoo/yahoo_aliases.c @ 27614:fa827f6f990f
Add support for receiving contact details from buddies.
Also, show some contact details (e.g. phone number) in the tooltip and in
'Get Info' when available.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Tue, 14 Jul 2009 21:08:56 +0000 |
parents | 7980a2bbad35 |
children | b909c4a7bfc8 |
rev | line source |
---|---|
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
1 /* |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
2 * purple |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
3 * |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
6 * source distribution. |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
7 * |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
11 * (at your option) any later version. |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
12 * |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
16 * GNU General Public License for more details. |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
17 * |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
21 * |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
22 */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
23 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
24 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
25 #include "internal.h" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
26 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
27 #include "account.h" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
28 #include "accountopt.h" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
29 #include "blist.h" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
30 #include "debug.h" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
31 #include "util.h" |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
32 #include "request.h" |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
33 #include "version.h" |
27395
ef5f0cde8d74
Update for file renames.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25911
diff
changeset
|
34 #include "libymsg.h" |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
35 #include "yahoo_aliases.h" |
22807
0b11895cc564
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22794
diff
changeset
|
36 #include "yahoo_friend.h" |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
37 #include "yahoo_packet.h" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
38 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
39 /* I hate hardcoding this stuff, but Yahoo never sends us anything to use. Someone in the know may be able to tweak this URL */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
40 #define YAHOO_ALIAS_FETCH_URL "http://address.yahoo.com/yab/us?v=XM&prog=ymsgr&.intl=us&diffs=1&t=0&tags=short&rt=0&prog-ver=8.1.0.249&useutf8=1&legenc=codepage-1252" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
41 #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" |
22115
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
42 #define YAHOOJP_ALIAS_FETCH_URL "http://address.yahoo.co.jp/yab/jp?v=XM&prog=ymsgr&.intl=jp&diffs=1&t=0&tags=short&rt=0&prog-ver=7.0.0.7" |
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
43 #define YAHOOJP_ALIAS_UPDATE_URL "http://address.yahoo.co.jp/yab/jp?v=XM&prog=ymsgr&.intl=jp&sync=1&tags=short&noclear=1" |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
44 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
45 void yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
46 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
47 /** |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
48 * Stuff we want passed to the callback function |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
49 */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
50 struct callback_data { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
51 PurpleConnection *gc; |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
52 gchar *id; |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
53 gchar *who; |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
54 }; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
55 |
27614
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
56 void yahoo_personal_details_reset(YahooPersonalDetails *ypd, gboolean all) |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
57 { |
27614
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
58 if (all) |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
59 g_free(ypd->id); |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
60 g_free(ypd->names.first); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
61 g_free(ypd->names.last); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
62 g_free(ypd->names.middle); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
63 g_free(ypd->names.nick); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
64 g_free(ypd->phone.work); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
65 g_free(ypd->phone.home); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
66 g_free(ypd->phone.mobile); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
67 } |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
68 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
69 /************************************************************************** |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
70 * Alias Fetch Functions |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
71 **************************************************************************/ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
72 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
73 static void |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
74 yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
75 { |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
76 PurpleConnection *gc = user_data; |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
77 struct yahoo_data *yd = gc->proto_data; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
78 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
79 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
80 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
81 if (len == 0) { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
82 purple_debug_info("yahoo", "No Aliases to process.%s%s\n", |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
83 error_message ? " Error:" : "", error_message ? error_message : ""); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
84 } else { |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
85 gchar *full_name, *nick_name; |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
86 const char *yid, *id, *fn, *ln, *nn, *alias, *mn; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
87 const char *hp, *wp, *mo; |
22807
0b11895cc564
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22794
diff
changeset
|
88 YahooFriend *f; |
0b11895cc564
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22794
diff
changeset
|
89 PurpleBuddy *b; |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
90 xmlnode *item, *contacts; |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
91 PurpleAccount *account; |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
92 |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
93 account = purple_connection_get_account(gc); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
94 /* Put our web response into a xmlnode for easy management */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
95 contacts = xmlnode_from_str(url_text, -1); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
96 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
97 if (contacts == NULL) { |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
98 purple_debug_error("yahoo", "Badly formed Alias XML\n"); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
99 return; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
100 } |
22475
3225c99785b8
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <mark@kingant.net>
parents:
22320
diff
changeset
|
101 purple_debug_info("yahoo", "Fetched %" G_GSIZE_FORMAT |
3225c99785b8
Fix a bunch of compiler warnings caused by my addition of G_GNUC_PRINTF()
Mark Doliner <mark@kingant.net>
parents:
22320
diff
changeset
|
102 " bytes of alias data\n", len); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
103 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
104 /* Loop around and around and around until we have gone through all the received aliases */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
105 for(item = xmlnode_get_child(contacts, "ct"); item; item = xmlnode_get_next_twin(item)) { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
106 /* Yahoo replies with two types of contact (ct) record, we are only interested in the alias ones */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
107 if ((yid = xmlnode_get_attrib(item, "yi"))) { |
27614
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
108 YahooPersonalDetails *ypd = NULL; |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
109 /* Grab all the bits of information we can */ |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
110 fn = xmlnode_get_attrib(item, "fn"); |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
111 ln = xmlnode_get_attrib(item, "ln"); |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
112 nn = xmlnode_get_attrib(item, "nn"); |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
113 mn = xmlnode_get_attrib(item, "mn"); |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
114 id = xmlnode_get_attrib(item, "id"); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
115 |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
116 hp = xmlnode_get_attrib(item, "hp"); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
117 wp = xmlnode_get_attrib(item, "wp"); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
118 mo = xmlnode_get_attrib(item, "mo"); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
119 |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
120 full_name = nick_name = NULL; |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
121 alias = NULL; |
22794 | 122 |
123 /* Yahoo stores first and last names separately, lets put them together into a full name */ | |
22115
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
124 if (yd->jp) |
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
125 full_name = g_strstrip(g_strdup_printf("%s %s", (ln != NULL ? ln : "") , (fn != NULL ? fn : ""))); |
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
126 else |
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
127 full_name = g_strstrip(g_strdup_printf("%s %s", (fn != NULL ? fn : "") , (ln != NULL ? ln : ""))); |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
128 nick_name = (nn != NULL ? g_strstrip(g_strdup(nn)) : NULL); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
129 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
130 if (nick_name != NULL) |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
131 alias = nick_name; /* If we have a nickname from Yahoo, let's use it */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
132 else if (strlen(full_name) != 0) |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
133 alias = full_name; /* If no Yahoo nickname, we can use the full_name created above */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
134 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
135 /* Find the local buddy that matches */ |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
136 f = yahoo_friend_find(gc, yid); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
137 b = purple_find_buddy(account, yid); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
138 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
139 /* If we don't find a matching buddy, ignore the alias !! */ |
22807
0b11895cc564
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22794
diff
changeset
|
140 if (f != NULL && b != NULL) { |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
141 const char *buddy_alias = purple_buddy_get_alias(b); |
22807
0b11895cc564
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22794
diff
changeset
|
142 yahoo_friend_set_alias_id(f, id); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
143 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
144 /* Finally, if we received an alias, we better update the buddy list */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
145 if (alias != NULL) { |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
146 serv_got_alias(gc, yid, alias); |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
147 purple_debug_info("yahoo", "Fetched alias '%s' (%s)\n", alias, id); |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
148 } else if (buddy_alias != NULL && strcmp(buddy_alias, "") != 0) { |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
149 /* Or if we have an alias that Yahoo doesn't, send it up */ |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
150 yahoo_update_alias(gc, yid, buddy_alias); |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
151 purple_debug_info("yahoo", "Sent updated alias '%s'\n", buddy_alias); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
152 } |
27614
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
153 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
154 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
155 if (f != NULL) |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
156 ypd = &f->ypd; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
157 else { |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
158 /* May be the alias is for the account? */ |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
159 const char *yidn = purple_normalize(account, yid); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
160 if (purple_strequal(yidn, purple_connection_get_display_name(gc))) { |
27614
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
161 ypd = &yd->ypd; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
162 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
163 } |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
164 |
27614
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
165 if (ypd) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
166 yahoo_personal_details_reset(ypd, TRUE); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
167 ypd->id = g_strdup(id); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
168 ypd->names.first = g_strdup(fn); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
169 ypd->names.middle = g_strdup(mn); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
170 ypd->names.last = g_strdup(ln); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
171 ypd->names.nick = g_strdup(nn); |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
172 |
27614
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
173 ypd->phone.work = g_strdup(wp); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
174 ypd->phone.home = g_strdup(hp); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
175 ypd->phone.mobile = g_strdup(mo); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
176 } |
22794 | 177 |
178 g_free(full_name); | |
179 g_free(nick_name); | |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
180 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
181 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
182 xmlnode_free(contacts); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
183 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
184 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
185 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
186 void |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
187 yahoo_fetch_aliases(PurpleConnection *gc) |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
188 { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
189 struct yahoo_data *yd = gc->proto_data; |
22115
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
190 const char *url; |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
191 gchar *request, *webpage, *webaddress; |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
192 PurpleUtilFetchUrlData *url_data; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
193 |
22056
b0ed2ce8514d
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
194 /* use whole URL if using HTTP Proxy */ |
23916
18a1f0fe5f40
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23019
diff
changeset
|
195 gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
22056
b0ed2ce8514d
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
196 |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
197 /* Build all the info to make the web request */ |
22115
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
198 url = yd->jp ? YAHOOJP_ALIAS_FETCH_URL : YAHOO_ALIAS_FETCH_URL; |
21016
abd768f06e7b
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@hxbc.us>
parents:
21013
diff
changeset
|
199 purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL); |
22056
b0ed2ce8514d
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
200 request = g_strdup_printf("GET %s%s/%s HTTP/1.1\r\n" |
25907
e4d738813cd8
Backport the parts of b859960a4a19f57f20db0536c1815a6d79e08e36 that apply to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24617
diff
changeset
|
201 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
202 "Cookie: T=%s; Y=%s\r\n" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
203 "Host: %s\r\n" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
204 "Cache-Control: no-cache\r\n\r\n", |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
205 use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
206 yd->cookie_t, yd->cookie_y, |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
207 webaddress); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
208 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
209 /* We have a URL and some header information, let's connect and get some aliases */ |
25911
8965e9730987
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25907
diff
changeset
|
210 url_data = purple_util_fetch_url_request_len_with_account(purple_connection_get_account(gc), |
8965e9730987
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25907
diff
changeset
|
211 url, use_whole_url, NULL, TRUE, request, FALSE, -1, |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
212 yahoo_fetch_aliases_cb, gc); |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
213 if (url_data != NULL) |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
214 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
215 |
21016
abd768f06e7b
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@hxbc.us>
parents:
21013
diff
changeset
|
216 g_free(webaddress); |
abd768f06e7b
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@hxbc.us>
parents:
21013
diff
changeset
|
217 g_free(webpage); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
218 g_free(request); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
219 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
220 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
221 /************************************************************************** |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
222 * Alias Update Functions |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
223 **************************************************************************/ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
224 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
225 static void |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
226 yahoo_update_alias_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
227 { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
228 xmlnode *node, *result; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
229 struct callback_data *cb = user_data; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
230 PurpleConnection *gc = cb->gc; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
231 struct yahoo_data *yd; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
232 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
233 yd = gc->proto_data; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
234 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
235 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
236 if (len == 0 || error_message != NULL) { |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
237 purple_debug_info("yahoo", "Error updating alias for %s: %s\n", |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
238 cb->who, |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
239 error_message ? error_message : ""); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
240 g_free(cb->who); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
241 g_free(cb->id); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
242 g_free(cb); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
243 return; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
244 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
245 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
246 result = xmlnode_from_str(url_text, -1); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
247 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
248 if (result == NULL) { |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
249 purple_debug_error("yahoo", "Alias update for %s failed: Badly formed response\n", |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
250 cb->who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
251 g_free(cb->who); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
252 g_free(cb->id); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
253 g_free(cb); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
254 return; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
255 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
256 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
257 if ((node = xmlnode_get_child(result, "ct"))) { |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
258 if (cb->id == NULL) { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
259 const char *new_id = xmlnode_get_attrib(node, "id"); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
260 if (new_id != NULL) { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
261 /* We now have an addressbook id for the friend; we should save it */ |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
262 YahooFriend *f = yahoo_friend_find(cb->gc, cb->who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
263 |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
264 purple_debug_info("yahoo", "Alias creation for %s succeeded\n", cb->who); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
265 |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
266 if (f) |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
267 yahoo_friend_set_alias_id(f, new_id); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
268 else |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
269 purple_debug_error("yahoo", "Missing YahooFriend. Unable to store new addressbook id.\n"); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
270 } else |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
271 purple_debug_error("yahoo", "Missing new addressbook id in add response for %s (weird).\n", |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
272 cb->who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
273 } else { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
274 if (g_ascii_strncasecmp(xmlnode_get_attrib(node, "id"), cb->id, strlen(cb->id))==0) |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
275 purple_debug_info("yahoo", "Alias update for %s succeeded\n", cb->who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
276 else |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
277 purple_debug_error("yahoo", "Alias update for %s failed (Contact record return mismatch)\n", |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
278 cb->who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
279 } |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
280 } else |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
281 purple_debug_info("yahoo", "Alias update for %s failed (No contact record returned)\n", cb->who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
282 |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
283 g_free(cb->who); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
284 g_free(cb->id); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
285 g_free(cb); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
286 xmlnode_free(result); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
287 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
288 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
289 void |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
290 yahoo_update_alias(PurpleConnection *gc, const char *who, const char *alias) |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
291 { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
292 struct yahoo_data *yd; |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
293 const char *url; |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
294 gchar *content, *request, *webpage, *webaddress; |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
295 struct callback_data *cb; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
296 PurpleUtilFetchUrlData *url_data; |
22807
0b11895cc564
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22794
diff
changeset
|
297 YahooFriend *f; |
22056
b0ed2ce8514d
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
298 /* use whole URL if using HTTP Proxy */ |
23916
18a1f0fe5f40
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23019
diff
changeset
|
299 gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
300 |
22115
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
301 g_return_if_fail(who != NULL); |
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
302 g_return_if_fail(gc != NULL); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
303 |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
304 if (alias == NULL) |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
305 alias = ""; |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
306 |
22807
0b11895cc564
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22794
diff
changeset
|
307 f = yahoo_friend_find(gc, who); |
0b11895cc564
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22794
diff
changeset
|
308 if (f == NULL) { |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
309 purple_debug_error("yahoo", "Missing YahooFriend. Unable to set server alias.\n"); |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
310 return; |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
311 } |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
312 |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
313 yd = gc->proto_data; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
314 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
315 /* Using callback_data so I have access to gc in the callback function */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
316 cb = g_new0(struct callback_data, 1); |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
317 cb->who = g_strdup(who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
318 cb->id = g_strdup(yahoo_friend_get_alias_id(f)); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
319 cb->gc = gc; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
320 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
321 /* Build all the info to make the web request */ |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
322 url = yd->jp ? YAHOOJP_ALIAS_UPDATE_URL: YAHOO_ALIAS_UPDATE_URL; |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
323 purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
324 |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
325 if (cb->id == NULL) { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
326 /* No id for this buddy, so create an address book entry */ |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
327 purple_debug_info("yahoo", "Creating '%s' as new alias for user '%s'\n", alias, who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
328 |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
329 if (yd->jp) { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
330 gchar *alias_jp = g_convert(alias, -1, "EUC-JP", "UTF-8", NULL, NULL, NULL); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
331 gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
332 content = g_strdup_printf("<ab k=\"%s\" cc=\"9\">\n" |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
333 "<ct a=\"1\" yi='%s' nn='%s' />\n</ab>\r\n", |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
334 purple_account_get_username(gc->account), |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
335 who, converted_alias_jp); |
24617
c0226e400836
Use g_free instead of free here too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23916
diff
changeset
|
336 g_free(converted_alias_jp); |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
337 g_free(alias_jp); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
338 } else { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
339 gchar *escaped_alias = g_markup_escape_text(alias, -1); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
340 content = g_strdup_printf("<?xml version=\"1.0\" encoding=\"utf-8\"?><ab k=\"%s\" cc=\"9\">\n" |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
341 "<ct a=\"1\" yi='%s' nn='%s' />\n</ab>\r\n", |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
342 purple_account_get_username(gc->account), |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
343 who, escaped_alias); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
344 g_free(escaped_alias); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
345 } |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
346 } else { |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
347 purple_debug_info("yahoo", "Updating '%s' as new alias for user '%s'\n", alias, who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
348 |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
349 if (yd->jp) { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
350 gchar *alias_jp = g_convert(alias, -1, "EUC-JP", "UTF-8", NULL, NULL, NULL); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
351 gchar *converted_alias_jp = yahoo_convert_to_numeric(alias_jp); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
352 content = g_strdup_printf("<ab k=\"%s\" cc=\"1\">\n" |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
353 "<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n", |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
354 purple_account_get_username(gc->account), |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
355 who, cb->id, converted_alias_jp); |
24617
c0226e400836
Use g_free instead of free here too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23916
diff
changeset
|
356 g_free(converted_alias_jp); |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
357 g_free(alias_jp); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
358 } else { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
359 gchar *escaped_alias = g_markup_escape_text(alias, -1); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
360 content = g_strdup_printf("<?xml version=\"1.0\" encoding=\"utf-8\"?><ab k=\"%s\" cc=\"1\">\n" |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
361 "<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n", |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
362 purple_account_get_username(gc->account), |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
363 who, cb->id, escaped_alias); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
364 g_free(escaped_alias); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
365 } |
22115
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
366 } |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
367 |
22056
b0ed2ce8514d
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
368 request = g_strdup_printf("POST %s%s/%s HTTP/1.1\r\n" |
25907
e4d738813cd8
Backport the parts of b859960a4a19f57f20db0536c1815a6d79e08e36 that apply to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24617
diff
changeset
|
369 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
370 "Cookie: T=%s; Y=%s\r\n" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
371 "Host: %s\r\n" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
372 "Content-Length: %" G_GSIZE_FORMAT "\r\n" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
373 "Cache-Control: no-cache\r\n\r\n" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
374 "%s", |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
375 use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
376 yd->cookie_t, yd->cookie_y, |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
377 webaddress, |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
378 strlen(content), |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
379 content); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
380 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
381 /* We have a URL and some header information, let's connect and update the alias */ |
25911
8965e9730987
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25907
diff
changeset
|
382 url_data = purple_util_fetch_url_request_len_with_account( |
8965e9730987
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25907
diff
changeset
|
383 purple_connection_get_account(gc), url, use_whole_url, NULL, TRUE, |
8965e9730987
Manually apply revision 5c5977a6ed3591121ef82ff587586850b9dcd176 here. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
25907
diff
changeset
|
384 request, FALSE, -1, yahoo_update_alias_cb, cb); |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
385 if (url_data != NULL) |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
386 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
387 |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
388 g_free(webpage); |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
389 g_free(webaddress); |
21013
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
390 g_free(content); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
391 g_free(request); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
392 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
393 |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
394 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
395 /************************************************************************** |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
396 * User Info Update Functions |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
397 **************************************************************************/ |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
398 |
27614
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
399 #if 0 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
400 /* This block of code can be used to send our contact details to |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
401 * everyone in the buddylist. But with the official messenger, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
402 * doing this pops a conversation window at the receiver's end, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
403 * which is stupid, and thus not really surprising. */ |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
404 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
405 struct yahoo_userinfo { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
406 struct yahoo_data *yd; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
407 char *xml; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
408 }; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
409 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
410 static void |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
411 yahoo_send_userinfo_to_user(struct yahoo_userinfo *yui, const char *who) |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
412 { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
413 struct yahoo_packet *pkt; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
414 PurpleConnection *gc; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
415 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
416 gc = yui->yd->gc; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
417 pkt = yahoo_packet_new(YAHOO_SERVICE_CONTACT_DETAILS, 0, 0); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
418 yahoo_packet_hash(pkt, "siisis", |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
419 1, purple_connection_get_display_name(gc), |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
420 13, 1, /* This creates a conversation window in the official client */ |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
421 302, 5, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
422 5, who, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
423 303, 5, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
424 280, yui->xml); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
425 yahoo_packet_send_and_free(pkt, yui->yd); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
426 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
427 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
428 static void |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
429 yahoo_send_userinfo_foreach(gpointer key, gpointer value, gpointer data) |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
430 { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
431 const char *who = key; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
432 YahooFriend *f = value; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
433 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
434 if (f->status != YAHOO_STATUS_OFFLINE) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
435 yahoo_send_userinfo_to_user(data, who); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
436 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
437 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
438 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
439 static void |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
440 yahoo_sent_userinfo_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message) |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
441 { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
442 struct yahoo_userinfo *yui = user_data; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
443 yahoo_fetch_aliases_cb(url_data, yui->yd->gc, url_text, len, error_message); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
444 g_hash_table_foreach(yui->yd->friends, yahoo_send_userinfo_foreach, yui); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
445 g_free(yui->xml); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
446 g_free(yui); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
447 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
448 #endif |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
449 |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
450 static void |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
451 yahoo_set_userinfo_cb(PurpleConnection *gc, PurpleRequestFields *fields) |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
452 { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
453 xmlnode *node = xmlnode_new("ab"); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
454 xmlnode *ct = xmlnode_new_child(node, "ct"); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
455 struct yahoo_data *yd = purple_connection_get_protocol_data(gc); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
456 PurpleAccount *account; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
457 PurpleUtilFetchUrlData *url_data; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
458 char *webaddress, *webpage; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
459 char *request, *content; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
460 int len; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
461 int i; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
462 char * yfields[] = { "fn", "ln", "nn", "mn", "hp", "wp", "mo", NULL }; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
463 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
464 account = purple_connection_get_account(gc); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
465 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
466 xmlnode_set_attrib(node, "k", purple_connection_get_display_name(gc)); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
467 xmlnode_set_attrib(node, "cc", "1"); /* XXX: ? */ |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
468 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
469 xmlnode_set_attrib(ct, "e", "1"); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
470 xmlnode_set_attrib(ct, "yi", purple_connection_get_display_name(gc)); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
471 xmlnode_set_attrib(ct, "id", yd->ypd.id); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
472 xmlnode_set_attrib(ct, "pr", "0"); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
473 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
474 for (i = 0; yfields[i]; i++) { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
475 const char *v = purple_request_fields_get_string(fields, yfields[i]); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
476 xmlnode_set_attrib(ct, yfields[i], v ? v : ""); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
477 } |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
478 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
479 content = xmlnode_to_formatted_str(node, &len); |
27614
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
480 xmlnode_free(node); |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
481 purple_url_parse(yd->jp ? YAHOOJP_USERINFO_URL : YAHOO_USERINFO_URL, &webaddress, NULL, &webpage, NULL, NULL); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
482 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
483 request = g_strdup_printf("POST %s HTTP/1.1\r\n" |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
484 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
485 "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n" |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
486 "Host: %s\r\n" |
27544 | 487 "Content-Length: %d\r\n" |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
488 "Cache-Control: no-cache\r\n\r\n" |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
489 "%s\r\n\r\n", |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
490 webpage, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
491 yd->cookie_t, yd->cookie_y, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
492 webaddress, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
493 len + 4, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
494 content); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
495 |
27614
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
496 #if 0 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
497 { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
498 /* This is if we wanted to send our contact details to everyone |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
499 * in the buddylist. But this cannot be done now, because in the |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
500 * official messenger, doing this pops a conversation window at |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
501 * the receiver's end, which is stupid, and thus not really |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
502 * surprising. */ |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
503 struct yahoo_userinfo *ui = g_new(struct yahoo_userinfo, 1); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
504 node = xmlnode_new("contact"); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
505 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
506 for (i = 0; yfields[i]; i++) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
507 const char *v = purple_request_fields_get_string(fields, yfields[i]); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
508 if (v) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
509 xmlnode *nd = xmlnode_new_child(node, yfields[i]); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
510 xmlnode_insert_data(nd, v, -1); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
511 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
512 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
513 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
514 ui->yd = yd; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
515 ui->xml = xmlnode_to_str(node, NULL); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
516 xmlnode_free(node); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
517 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
518 #endif |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
519 |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
520 url_data = purple_util_fetch_url_request_len_with_account(account, webaddress, FALSE, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
521 YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
522 yahoo_fetch_aliases_cb, gc); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
523 if (url_data != NULL) |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
524 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
525 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
526 g_free(webaddress); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
527 g_free(webpage); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
528 g_free(content); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
529 g_free(request); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
530 } |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
531 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
532 void yahoo_set_userinfo(PurpleConnection *gc) |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
533 { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
534 PurpleRequestFields *fields; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
535 PurpleRequestFieldGroup *group; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
536 PurpleRequestField *field; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
537 struct yahoo_data *yd = purple_connection_get_protocol_data(gc); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
538 int i; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
539 struct { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
540 char *id; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
541 char *text; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
542 char *value; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
543 } yfields[] = { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
544 {"fn", N_("First Name"), yd->ypd.names.first}, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
545 {"ln", N_("Last Name"), yd->ypd.names.last}, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
546 {"nn", N_("Nickname"), yd->ypd.names.nick}, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
547 {"mn", N_("Middle Name"), yd->ypd.names.middle}, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
548 {"hp", N_("Home Phone Number"), yd->ypd.phone.home}, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
549 {"wp", N_("Work Phone Number"), yd->ypd.phone.work}, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
550 {"mo", N_("Mobile Phone Number"), yd->ypd.phone.mobile}, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
551 {NULL, NULL, NULL} |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
552 }; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
553 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
554 fields = purple_request_fields_new(); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
555 group = purple_request_field_group_new(NULL); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
556 purple_request_fields_add_group(fields, group); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
557 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
558 for (i = 0; yfields[i].id; i++) { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
559 field = purple_request_field_string_new(yfields[i].id, _(yfields[i].text), |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
560 yfields[i].value, FALSE); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
561 purple_request_field_group_add_field(group, field); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
562 } |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
563 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
564 purple_request_fields(gc, NULL, _("Set User Info"), NULL, fields, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
565 _("OK"), G_CALLBACK(yahoo_set_userinfo_cb), |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
566 _("Cancel"), NULL, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
567 purple_connection_get_account(gc), NULL, NULL, gc); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
568 } |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
569 |
27614
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
570 static gboolean |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
571 parse_contact_details(struct yahoo_data *yd, const char *who, const char *xml) |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
572 { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
573 xmlnode *node, *nd; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
574 YahooFriend *f; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
575 char *yid; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
576 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
577 node = xmlnode_from_str(xml, -1); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
578 if (!node) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
579 purple_debug_info("yahoo", "Received malformed XML for contact details from '%s':\n%s\n", |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
580 who, xml); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
581 return FALSE; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
582 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
583 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
584 nd = xmlnode_get_child(node, "yi"); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
585 if (!nd || !(yid = xmlnode_get_data(nd))) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
586 xmlnode_free(node); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
587 return FALSE; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
588 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
589 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
590 if (!purple_strequal(yid, who)) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
591 /* The user may not want to set the contact details about folks in the buddylist |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
592 to what some random dude might have sent. So it would be good if we popped |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
593 up a prompt requiring the user to confirm the details before we set them. |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
594 However, someone could send details about hundreds of users at the same time, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
595 which would make things really bad. So for now, until we have a better way of |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
596 dealing with this, ignore this details. */ |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
597 purple_debug_info("yahoo", "Ignoring contact details sent by %s about %s\n", |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
598 who, yid); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
599 g_free(yid); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
600 xmlnode_free(node); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
601 return FALSE; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
602 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
603 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
604 f = yahoo_friend_find(yd->gc, yid); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
605 if (!f) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
606 g_free(yid); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
607 xmlnode_free(node); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
608 return FALSE; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
609 } else { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
610 int i; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
611 YahooPersonalDetails *ypd = &f->ypd; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
612 char *alias = NULL; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
613 struct { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
614 char *id; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
615 char **field; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
616 } details[] = { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
617 {"fn", &ypd->names.first}, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
618 {"mn", &ypd->names.middle}, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
619 {"ln", &ypd->names.last}, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
620 {"nn", &ypd->names.nick}, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
621 {"wp", &ypd->phone.work}, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
622 {"hp", &ypd->phone.home}, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
623 {"mo", &ypd->phone.mobile}, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
624 {NULL, NULL} |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
625 }; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
626 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
627 yahoo_personal_details_reset(ypd, FALSE); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
628 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
629 for (i = 0; details[i].id; i++) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
630 nd = xmlnode_get_child(node, details[i].id); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
631 *details[i].field = nd ? xmlnode_get_data(nd) : NULL; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
632 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
633 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
634 if (ypd->names.nick) |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
635 alias = ypd->names.nick; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
636 else if (ypd->names.first || ypd->names.last) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
637 alias = g_strstrip(g_strdup_printf("%s %s", |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
638 ypd->names.first ? ypd->names.first : "", |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
639 ypd->names.last ? ypd->names.last : "")); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
640 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
641 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
642 if (alias) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
643 serv_got_alias(yd->gc, yid, alias); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
644 if (alias != ypd->names.nick) |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
645 g_free(alias); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
646 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
647 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
648 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
649 xmlnode_free(node); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
650 g_free(yid); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
651 return TRUE; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
652 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
653 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
654 /* I don't think this happens for MSN buddies. -- sad */ |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
655 void yahoo_process_contact_details(PurpleConnection *gc, struct yahoo_packet *pkt) |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
656 { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
657 GSList *l = pkt->hash; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
658 const char *who = NULL, *xml = NULL; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
659 struct yahoo_data *yd = purple_connection_get_protocol_data(gc); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
660 |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
661 for (; l; l = l->next) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
662 struct yahoo_pair *pair = l->data; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
663 switch (pair->key) { |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
664 case 4: |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
665 who = pair->value; /* This is the person who sent us the details. |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
666 But not necessarily about himself. */ |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
667 break; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
668 case 5: |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
669 break; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
670 case 13: |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
671 /* This is '1' if 'who' is sending the contact details about herself, |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
672 '0' if 'who' is sending the contact details she has about buddies |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
673 in her list. However, in all cases, the xml in key 280 always seems |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
674 to contain the yid of the person, so we may as well ignore this field |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
675 and look into the xml instead to see who the information is about. */ |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
676 break; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
677 case 280: |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
678 xml = pair->value; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
679 parse_contact_details(yd, who, xml); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
680 break; |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
681 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
682 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
683 } |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27544
diff
changeset
|
684 |