Mercurial > pidgin
annotate libpurple/protocols/yahoo/yahoo_aliases.c @ 21789:cbf778310bdd
Ignore the generated purple.h
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Thu, 06 Dec 2007 01:30:38 +0000 |
parents | 6de09629f091 |
children | b0ed2ce8514d 4ab154a14e55 |
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" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
32 #include "version.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
|
33 #include "yahoo.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
|
34 #include "yahoo_aliases.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
|
35 #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
|
36 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 /* 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
|
38 #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
|
39 #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" |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 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
|
42 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
43 /** |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 * 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
|
45 */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 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
|
47 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
|
48 char *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
|
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 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
52 /************************************************************************** |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
53 * 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
|
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 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
56 static 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
|
57 yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,const gchar *url_text, size_t len, const gchar *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
|
58 { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
59 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
|
60 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
|
61 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
|
62 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
63 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
|
64 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
65 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
|
66 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
|
67 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
|
68 } else { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 const char *yid, *full_name, *nick_name, *alias, *id, *fn, *ln, *nn; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 PurpleBuddy *b = 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
|
71 xmlnode *item, *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
|
72 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
73 /* 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
|
74 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
|
75 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 if (contacts == 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
|
77 purple_debug_error("yahoo_aliases","Badly formed XML\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
|
78 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
|
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 purple_debug_info("yahoo", "Fetched %i bytes of alias data\n", len); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 /* 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
|
83 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
|
84 /* 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
|
85 if ((yid = xmlnode_get_attrib(item, "yi"))) { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
86 /* Grab all the bits of information we can */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
87 fn = xmlnode_get_attrib(item,"fn"); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
88 ln = xmlnode_get_attrib(item,"ln"); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 nn = xmlnode_get_attrib(item,"nn"); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
90 id = xmlnode_get_attrib(item,"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
|
91 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
92 /* Yahoo stores first and last names separately, lets put them together into a full name */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 full_name = g_strstrip(g_strdup_printf("%s %s", (fn != NULL ? fn : "") , (ln != NULL ? ln : ""))); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 nick_name = (nn != NULL ? g_strstrip(g_strdup_printf("%s", nn)) : 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
|
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 (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
|
97 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
|
98 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
|
99 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
|
100 else |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
101 alias = NULL; /* No nickname, first name or last name, then you get no 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
|
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 /* Find the local buddy that matches */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 b = purple_find_buddy(cb->gc->account, yid); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 we don't find a matching buddy, ignore the 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
|
107 if (b != 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
|
108 /* Create an object that we can attach to the buddies proto_data pointer */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
109 struct YahooUser *yu; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
110 yu = g_new0(struct YahooUser, 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
|
111 yu->id = g_strdup(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
|
112 yu->firstname = g_strdup(fn); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 yu->lastname = g_strdup(ln); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
114 yu->nickname = g_strdup(nn); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
115 b->proto_data=yu; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
116 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
117 /* 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
|
118 if (alias != 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
|
119 serv_got_alias(cb->gc, yid, 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
|
120 purple_debug_info("yahoo","Fetched alias '%s' (%s)\n",alias,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
|
121 } else if (b->alias != alias && strcmp(b->alias, "") != 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
|
122 /* Or if we have an alias that Yahoo doesn't, send it up */ |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
123 yahoo_update_alias(cb->gc, yid, b->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
|
124 purple_debug_info("yahoo","Sent alias '%s'\n", b->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
|
125 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
126 } else { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 purple_debug_info("yahoo", "Bizarre, received alias for %s, but they are not on your list...\n", yid); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
129 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
130 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 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
|
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 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
|
134 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
|
135 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 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
|
138 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
|
139 { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
140 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
|
141 struct callback_data *cb; |
21016
abd768f06e7b
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@hxbc.us>
parents:
21013
diff
changeset
|
142 const char *url = YAHOO_ALIAS_FETCH_URL; |
abd768f06e7b
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@hxbc.us>
parents:
21013
diff
changeset
|
143 char *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
|
144 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
|
145 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
146 /* 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
|
147 cb = g_new0(struct callback_data, 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
|
148 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
|
149 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 /* Build all the info to make the web request */ |
21016
abd768f06e7b
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@hxbc.us>
parents:
21013
diff
changeset
|
151 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
|
152 request = g_strdup_printf("GET /%s HTTP/1.1\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
|
153 "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\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
|
154 "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
|
155 "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
|
156 "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
|
157 webpage, yd->cookie_t,yd->cookie_y, webaddress); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
158 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
159 /* We have a URL and some header information, let's connect and get some 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
|
160 url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_fetch_aliases_cb, 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
|
161 if (url_data != 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
|
162 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
|
163 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
164 |
21016
abd768f06e7b
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@hxbc.us>
parents:
21013
diff
changeset
|
165 g_free(webaddress); |
abd768f06e7b
Another patch from Andrew Gaul that plugs a leak:
Ka-Hing Cheung <khc@hxbc.us>
parents:
21013
diff
changeset
|
166 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
|
167 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
|
168 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
169 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
170 /************************************************************************** |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
171 * 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
|
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 static 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
|
175 yahoo_update_alias_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,const gchar *url_text, size_t len, const gchar *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
|
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 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
|
178 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
|
179 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
|
180 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
|
181 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
182 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
|
183 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
|
184 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
185 if (len == 0 || error_message != 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
|
186 purple_debug_info("yahoo", "Error updating alias: %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
|
187 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
|
188 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
|
189 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
|
190 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
|
191 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
192 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
193 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
|
194 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 purple_debug_info("yahoo", "ID: %s, Return data: %s\n",cb->id, url_text); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
197 if (result == 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
|
198 purple_debug_error("yahoo","Alias update failed: Badly formed response\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
|
199 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
|
200 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
|
201 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
|
202 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
203 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
204 if ((node = xmlnode_get_child(result, "ct"))) { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
205 if (g_ascii_strncasecmp(xmlnode_get_attrib(node, "id"), cb->id, strlen(cb->id))==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
|
206 purple_debug_info("yahoo", "Alias update succeeded\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
|
207 else |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
208 purple_debug_error("yahoo", "Alias update failed (Contact record return mismatch)\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
|
209 } else { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 purple_debug_info("yahoo", "Alias update failed (No contact record returned)\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
|
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 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
|
214 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
|
215 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
|
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 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
218 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
|
219 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
|
220 { |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
221 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
|
222 struct YahooUser *yu; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 char *content, *url, *request, *webpage, *webaddress, *strtmp; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 int inttmp; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 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
|
226 PurpleBuddy *buddy; |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 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
|
228 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
229 g_return_if_fail(alias!= 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
|
230 g_return_if_fail(who!=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
|
231 g_return_if_fail(gc!=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
|
232 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
233 purple_debug_info("yahoo", "Sending '%s' as new alias for user '%s'.\n",alias, who); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 buddy = purple_find_buddy(gc->account, who); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
236 if (buddy == NULL || buddy->proto_data == 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
|
237 purple_debug_info("yahoo", "Missing proto_data (get_yahoo_aliases must have failed), bailing out\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
|
238 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
|
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 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
241 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
|
242 yu = buddy->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
|
243 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 /* 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
|
245 cb = g_new0(struct callback_data, 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
|
246 cb->id = g_strdup(yu->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
|
247 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
|
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 /* Build all the info to make the web 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
|
250 url = g_strdup(YAHOO_ALIAS_UPDATE_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
|
251 purple_url_parse(url, &webaddress, &inttmp, &webpage, &strtmp, &strtmp); |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
252 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
253 content = g_strdup_printf("<?xml version=\"1.0\" encoding=\"utf-8\"?><ab k=\"%s\" cc=\"1\">\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
|
254 "<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\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
|
255 gc->account->username, who, yu->id, g_markup_escape_text(alias, strlen(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
|
256 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
257 request = g_strdup_printf("POST /%s HTTP/1.1\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
|
258 "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\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
|
259 "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
|
260 "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
|
261 "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
|
262 "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
|
263 "%s", |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
264 webpage, yd->cookie_t,yd->cookie_y, webaddress, |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
265 strlen(content), 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
|
266 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
267 /* We have a URL and some header information, let's connect and update the 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
|
268 url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_update_alias_cb, 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
|
269 if (url_data != 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
|
270 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
|
271 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
272 |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_util_fetch_url_request() returns NULL, it has already triggered the callback. Fixes #3668.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20336
diff
changeset
|
273 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
|
274 g_free(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
|
275 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
|
276 } |
32e3d45aa1b2
Fix a crash that occurs when the HTTP call to set/get yahoo aliases fails. When purple_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 |