Mercurial > pidgin.yaz
diff libpurple/protocols/yahoo/libymsg.c @ 30383:2a19f7385ba5
merged from im.pidgin.pidgin
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Tue, 18 May 2010 02:29:24 +0900 |
parents | bd0ce3844104 04c84a3f9553 |
children | 81ffeb069847 |
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/libymsg.c Fri May 14 17:24:16 2010 +0900 +++ b/libpurple/protocols/yahoo/libymsg.c Tue May 18 02:29:24 2010 +0900 @@ -1793,23 +1793,17 @@ return tmp2; } -static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) +static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) { struct yahoo_auth_data *auth_data = user_data; PurpleConnection *gc = auth_data->gc; - YahooData *yd; + YahooData *yd = purple_connection_get_protocol_data(gc); gboolean try_login_on_error = FALSE; purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage2\n"); - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - g_free(auth_data->seed); - g_free(auth_data); - g_return_if_reached(); - } - - yd = (YahooData *)gc->proto_data; - + yd->url_datas = g_slist_remove(yd->url_datas, url_data); + if (error_message != NULL) { purple_debug_error("yahoo", "Login Failed, unable to retrieve stage 2 url: %s\n", error_message); purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); @@ -1916,18 +1910,15 @@ g_free(auth_data); } -static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) +static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) { struct yahoo_auth_data *auth_data = user_data; PurpleConnection *gc = auth_data->gc; + YahooData *yd = purple_connection_get_protocol_data(gc); purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage1_cb\n"); - if (!PURPLE_CONNECTION_IS_VALID(gc)) { - g_free(auth_data->seed); - g_free(auth_data); - g_return_if_reached(); - } + yd->url_datas = g_slist_remove(yd->url_datas, url_data); if (error_message != NULL) { purple_debug_error("yahoo", "Login Failed, unable to retrieve login url: %s\n", error_message); @@ -2029,6 +2020,8 @@ url_data = purple_util_fetch_url_request_len_with_account( proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, TRUE, -1, yahoo_auth16_stage2, auth_data); + if (url_data) + yd->url_datas = g_slist_prepend(yd->url_datas, url_data); g_free(url); g_free(token); } @@ -2037,6 +2030,7 @@ static void yahoo_auth16_stage1(PurpleConnection *gc, const char *seed) { + YahooData *yd = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); PurpleUtilFetchUrlData *url_data = NULL; struct yahoo_auth_data *auth_data = NULL; @@ -2068,6 +2062,8 @@ proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1, yahoo_auth16_stage1_cb, auth_data); + if (url_data) + yd->url_datas = g_slist_prepend(yd->url_datas, url_data); g_free(url); } @@ -3606,6 +3602,8 @@ gchar **strings = NULL, *cs_server = NULL; int port = 0, stringslen = 0; + yd->url_datas = g_slist_remove(yd->url_datas, url_data); + if(error_message != NULL || len == 0) { purple_debug_error("yahoo", "Unable to retrieve server info. %" G_GSIZE_FORMAT " bytes retrieved with error message: %s\n", len, @@ -3652,6 +3650,7 @@ YahooData *yd = gc->proto_data = g_new0(YahooData, 1); PurpleStatus *status = purple_account_get_active_status(account); gboolean use_whole_url = yahoo_account_use_http_proxy(gc); + PurpleUtilFetchUrlData *url_data; gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; @@ -3684,12 +3683,14 @@ /* Get the pager server. Actually start connecting in the callback since we * must have the contents of the HTTP response to proceed. */ - purple_util_fetch_url_request_len_with_account( + url_data = purple_util_fetch_url_request_len_with_account( purple_connection_get_account(gc), yd->jp ? YAHOOJP_PAGER_HOST_REQ_URL : YAHOO_PAGER_HOST_REQ_URL, use_whole_url ? TRUE : FALSE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1, yahoo_got_pager_server, yd); + if (url_data) + yd->url_datas = g_slist_prepend(yd->url_datas, url_data); return; } @@ -4379,6 +4380,8 @@ PurpleAccount *account = purple_connection_get_account(gc); PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); + yd->url_datas = g_slist_remove(yd->url_datas, url_data); + if (error_message != NULL) { purple_conversation_write(conv, NULL, _("Can't send SMS. Unable to obtain mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); @@ -4472,7 +4475,9 @@ g_free(request); g_free(validate_request_str); - if (!url_data) { + if (url_data) + yd->url_datas = g_slist_prepend(yd->url_datas, url_data); + else { PurpleAccount *account = purple_connection_get_account(gc); PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); purple_conversation_write(conv, NULL, _("Can't send SMS. Unable to obtain mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL));