comparison libpurple/protocols/yahoo/yahoo.c @ 22807:0b11895cc564

Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
author Daniel Atallah <daniel.atallah@gmail.com>
date Sat, 03 May 2008 21:03:13 +0000
parents cc8903c59d6b
children 0f94ed7e362b 8c3444f04709 1dd0e007514d
comparison
equal deleted inserted replaced
22806:f15d9ded0c45 22807:0b11895cc564
3481 yahoo_get_inbox_token_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, 3481 yahoo_get_inbox_token_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
3482 const gchar *token, size_t len, const gchar *error_message) 3482 const gchar *token, size_t len, const gchar *error_message)
3483 { 3483 {
3484 PurpleConnection *gc = user_data; 3484 PurpleConnection *gc = user_data;
3485 gboolean set_cookie = FALSE; 3485 gboolean set_cookie = FALSE;
3486 char *url; 3486 gchar *url;
3487 struct yahoo_data *yd = gc->proto_data;
3487 3488
3488 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); 3489 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
3490
3491 yd->url_datas = g_slist_remove(yd->url_datas, url_data);
3489 3492
3490 if (error_message != NULL) 3493 if (error_message != NULL)
3491 purple_debug_error("yahoo", "Requesting mail login token failed: %s\n", error_message); 3494 purple_debug_error("yahoo", "Requesting mail login token failed: %s\n", error_message);
3492 else if (len > 0 && token && *token) { 3495 else if (len > 0 && token && *token) {
3493 /* Should we not be hardcoding the rd url? */ 3496 /* Should we not be hardcoding the rd url? */
3498 token); 3501 token);
3499 set_cookie = TRUE; 3502 set_cookie = TRUE;
3500 } 3503 }
3501 3504
3502 if (!set_cookie) { 3505 if (!set_cookie) {
3503 struct yahoo_data *yd = gc->proto_data;
3504 purple_debug_error("yahoo", "No mail login token; forwarding to login screen.\n"); 3506 purple_debug_error("yahoo", "No mail login token; forwarding to login screen.\n");
3505 url = g_strdup(yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL); 3507 url = g_strdup(yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL);
3506 } 3508 }
3507 3509
3508 /* Open the mailbox with the parsed url data */ 3510 /* Open the mailbox with the parsed url data */
3539 "Mozilla/4.0 (compatible; MSIE 5.5)", TRUE, request, FALSE, 3541 "Mozilla/4.0 (compatible; MSIE 5.5)", TRUE, request, FALSE,
3540 yahoo_get_inbox_token_cb, gc); 3542 yahoo_get_inbox_token_cb, gc);
3541 3543
3542 g_free(request); 3544 g_free(request);
3543 3545
3544 if (url_data == NULL) { 3546 if (url_data != NULL)
3547 yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
3548 else {
3545 const char *yahoo_mail_url = (yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL); 3549 const char *yahoo_mail_url = (yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL);
3546 purple_debug_error("yahoo", 3550 purple_debug_error("yahoo",
3547 "Unable to request mail login token; forwarding to login screen."); 3551 "Unable to request mail login token; forwarding to login screen.");
3548 purple_notify_uri(gc, yahoo_mail_url); 3552 purple_notify_uri(gc, yahoo_mail_url);
3549 } 3553 }