Mercurial > pidgin.yaz
annotate libpurple/protocols/yahoo/yahoo_aliases.c @ 27589:ecae4c8ee0c3
Changelog/Merge im.pidgin.cpw.darkrain42.obsolete to im.pidgin.pidgin.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 12 Jul 2009 05:44:23 +0000 |
parents | 7980a2bbad35 |
children | fa827f6f990f |
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 |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
56 void yahoo_personal_details_reset(YahooPersonalDetails *ypd) |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
57 { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
58 g_free(ypd->id); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
59 g_free(ypd->names.first); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
60 g_free(ypd->names.last); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
61 g_free(ypd->names.middle); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
62 g_free(ypd->names.nick); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
63 g_free(ypd->phone.work); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
64 g_free(ypd->phone.home); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
65 g_free(ypd->phone.mobile); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
66 } |
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
|
67 |
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 * 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
|
70 **************************************************************************/ |
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 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
|
73 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
|
74 { |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
75 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
|
76 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
|
77 |
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 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
|
79 |
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 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
|
81 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
|
82 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
|
83 } 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
|
84 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
|
85 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
|
86 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
|
87 YahooFriend *f; |
0b11895cc564
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22794
diff
changeset
|
88 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
|
89 xmlnode *item, *contacts; |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
90 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
|
91 |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
92 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
|
93 /* 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
|
94 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
|
95 |
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 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
|
97 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
|
98 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
|
99 } |
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
|
100 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
|
101 " 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
|
102 |
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 /* 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
|
104 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
|
105 /* 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
|
106 if ((yid = xmlnode_get_attrib(item, "yi"))) { |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
107 /* 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
|
108 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
|
109 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
|
110 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
|
111 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
|
112 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
|
113 |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
114 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
|
115 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
|
116 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
|
117 |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
118 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
|
119 alias = NULL; |
22794 | 120 |
121 /* 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
|
122 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
|
123 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
|
124 else |
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", (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
|
126 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
|
127 |
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
|
128 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
|
129 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
|
130 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
|
131 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
|
132 |
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 /* 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
|
134 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
|
135 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
|
136 |
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
|
137 /* 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
|
138 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
|
139 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
|
140 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
|
141 |
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
|
142 /* 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
|
143 if (alias != NULL) { |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
144 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
|
145 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
|
146 } 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
|
147 /* 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
|
148 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
|
149 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
|
150 } |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
151 } else { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
152 /* 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
|
153 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
|
154 if (purple_strequal(yidn, 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
|
155 yahoo_personal_details_reset(&yd->ypd); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
156 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
157 yd->ypd.id = g_strdup(id); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
158 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
159 yd->ypd.names.first = g_strdup(fn); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
160 yd->ypd.names.middle = g_strdup(mn); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
161 yd->ypd.names.last = g_strdup(ln); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
162 yd->ypd.names.nick = g_strdup(nn); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
163 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
164 yd->ypd.phone.work = g_strdup(wp); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
165 yd->ypd.phone.home = g_strdup(hp); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
166 yd->ypd.phone.mobile = g_strdup(mo); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
167 } |
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
|
168 } |
22794 | 169 |
170 g_free(full_name); | |
171 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
|
172 } |
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
|
173 } |
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
|
174 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
|
175 } |
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 } |
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
|
177 |
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
|
178 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
|
179 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
|
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 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
|
182 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
|
183 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
|
184 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
|
185 |
22056
b0ed2ce8514d
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
186 /* 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
|
187 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
|
188 |
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
|
189 /* 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
|
190 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
|
191 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
|
192 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
|
193 "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
|
194 "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
|
195 "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
|
196 "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
|
197 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
|
198 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
|
199 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
|
200 |
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
|
201 /* 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
|
202 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
|
203 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
|
204 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
|
205 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
|
206 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
|
207 |
21016
abd768f06e7b
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@hxbc.us>
parents:
21013
diff
changeset
|
208 g_free(webaddress); |
abd768f06e7b
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@hxbc.us>
parents:
21013
diff
changeset
|
209 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
|
210 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
|
211 } |
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
|
212 |
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
|
213 /************************************************************************** |
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 * 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
|
215 **************************************************************************/ |
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
|
216 |
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
|
217 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
|
218 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
|
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 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
|
221 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
|
222 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
|
223 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
|
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 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
|
226 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
|
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 if (len == 0 || error_message != NULL) { |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
229 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
|
230 cb->who, |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
231 error_message ? error_message : ""); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
232 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
|
233 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
|
234 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
|
235 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
|
236 } |
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
|
237 |
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
|
238 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
|
239 |
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
|
240 if (result == NULL) { |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
241 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
|
242 cb->who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
243 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
|
244 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
|
245 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
|
246 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
|
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 |
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
|
249 if ((node = xmlnode_get_child(result, "ct"))) { |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
250 if (cb->id == NULL) { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
251 const char *new_id = xmlnode_get_attrib(node, "id"); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
252 if (new_id != NULL) { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
253 /* 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
|
254 YahooFriend *f = yahoo_friend_find(cb->gc, cb->who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
255 |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
256 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
|
257 |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
258 if (f) |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
259 yahoo_friend_set_alias_id(f, new_id); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
260 else |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
261 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
|
262 } else |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
263 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
|
264 cb->who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
265 } else { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
266 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
|
267 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
|
268 else |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
269 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
|
270 cb->who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
271 } |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
272 } else |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
273 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
|
274 |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
275 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
|
276 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
|
277 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
|
278 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
|
279 } |
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
|
280 |
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
|
281 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
|
282 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
|
283 { |
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 struct yahoo_data *yd; |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
285 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
|
286 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
|
287 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
|
288 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
|
289 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
|
290 /* 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
|
291 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
|
292 |
22115
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
293 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
|
294 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
|
295 |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
296 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
|
297 alias = ""; |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
298 |
22807
0b11895cc564
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22794
diff
changeset
|
299 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
|
300 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
|
301 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
|
302 return; |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
303 } |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
304 |
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
|
305 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
|
306 |
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
|
307 /* 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
|
308 cb = g_new0(struct callback_data, 1); |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
309 cb->who = g_strdup(who); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
310 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
|
311 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
|
312 |
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 /* 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
|
314 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
|
315 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
|
316 |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
317 if (cb->id == NULL) { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
318 /* 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
|
319 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
|
320 |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
321 if (yd->jp) { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
322 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
|
323 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
|
324 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
|
325 "<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
|
326 purple_account_get_username(gc->account), |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
327 who, converted_alias_jp); |
24617
c0226e400836
Use g_free instead of free here too.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23916
diff
changeset
|
328 g_free(converted_alias_jp); |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
329 g_free(alias_jp); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
330 } else { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
331 gchar *escaped_alias = g_markup_escape_text(alias, -1); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
332 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
|
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, escaped_alias); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
336 g_free(escaped_alias); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
337 } |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
338 } else { |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
339 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
|
340 |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
341 if (yd->jp) { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
342 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
|
343 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
|
344 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
|
345 "<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
|
346 purple_account_get_username(gc->account), |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
347 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
|
348 g_free(converted_alias_jp); |
23019
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
349 g_free(alias_jp); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
350 } else { |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
351 gchar *escaped_alias = g_markup_escape_text(alias, -1); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
352 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
|
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, escaped_alias); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
356 g_free(escaped_alias); |
adbcf5b84438
applied changes from 7a490c356e10f7fff3432f875897aa0ca0ad1ff0
Daniel Atallah <daniel.atallah@gmail.com>
parents:
23009
diff
changeset
|
357 } |
22115
4ab154a14e55
Patch from Yusuke Odate, modified by me, to support retrieving the full
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
358 } |
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
|
359 |
22056
b0ed2ce8514d
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21284
diff
changeset
|
360 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
|
361 "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
|
362 "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
|
363 "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
|
364 "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
|
365 "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
|
366 "%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
|
367 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
|
368 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
|
369 webaddress, |
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
370 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
|
371 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
|
372 |
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 /* 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
|
374 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
|
375 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
|
376 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
|
377 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
|
378 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
|
379 |
23009
318905da6f8d
Fix a printf("%s", NULL) situation and plug some leakage. Fixes #5280.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
22807
diff
changeset
|
380 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
|
381 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
|
382 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
|
383 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
|
384 } |
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
|
385 |
27531
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
386 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
387 /************************************************************************** |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
388 * User Info Update Functions |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
389 **************************************************************************/ |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
390 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
391 static void |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
392 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
|
393 { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
394 xmlnode *node = xmlnode_new("ab"); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
395 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
|
396 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
|
397 PurpleAccount *account; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
398 PurpleUtilFetchUrlData *url_data; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
399 char *webaddress, *webpage; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
400 char *request, *content; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
401 int len; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
402 int i; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
403 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
|
404 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
405 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
|
406 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
407 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
|
408 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
|
409 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
410 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
|
411 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
|
412 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
|
413 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
|
414 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
415 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
|
416 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
|
417 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
|
418 } |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
419 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
420 content = xmlnode_to_formatted_str(node, &len); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
421 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
|
422 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
423 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
|
424 "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
|
425 "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
|
426 "Host: %s\r\n" |
27544 | 427 "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
|
428 "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
|
429 "%s\r\n\r\n", |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
430 webpage, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
431 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
|
432 webaddress, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
433 len + 4, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
434 content); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
435 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
436 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
|
437 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
|
438 yahoo_fetch_aliases_cb, gc); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
439 if (url_data != NULL) |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
440 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
|
441 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
442 g_free(webaddress); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
443 g_free(webpage); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
444 g_free(content); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
445 g_free(request); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
446 xmlnode_free(node); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
447 } |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
448 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
449 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
|
450 { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
451 PurpleRequestFields *fields; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
452 PurpleRequestFieldGroup *group; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
453 PurpleRequestField *field; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
454 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
|
455 int i; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
456 struct { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
457 char *id; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
458 char *text; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
459 char *value; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
460 } yfields[] = { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
461 {"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
|
462 {"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
|
463 {"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
|
464 {"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
|
465 {"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
|
466 {"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
|
467 {"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
|
468 {NULL, NULL, NULL} |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
469 }; |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
470 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
471 fields = purple_request_fields_new(); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
472 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
|
473 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
|
474 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
475 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
|
476 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
|
477 yfields[i].value, FALSE); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
478 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
|
479 } |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
480 |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
481 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
|
482 _("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
|
483 _("Cancel"), NULL, |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
484 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
|
485 } |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27395
diff
changeset
|
486 |