Mercurial > pidgin.yaz
changeset 23919:c241bc48c962
merge of '6404d7635dd48f315b3c8fd3550970a417daa2ef'
and '97fa95e12dee764fb786a1cb1b06c7c259bfda48'
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Wed, 27 Aug 2008 03:06:42 +0000 |
parents | 18a1f0fe5f40 (diff) 11f98b1e605b (current diff) |
children | 62387da2a57f |
files | |
diffstat | 6 files changed, 22 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/util.c Wed Aug 27 03:05:19 2008 +0000 +++ b/libpurple/protocols/yahoo/util.c Wed Aug 27 03:06:42 2008 +0000 @@ -31,6 +31,14 @@ #include "yahoo.h" #include <string.h> + +gboolean +yahoo_account_use_http_proxy(PurpleConnection *conn) +{ + PurpleProxyInfo *ppi = purple_proxy_get_setup(conn->account); + return (ppi->type == PURPLE_PROXY_HTTP || ppi->type == PURPLE_PROXY_USE_ENVVAR); +} + /* * Returns cookies formatted as a null terminated string for the given connection. * Must g_free return value.
--- a/libpurple/protocols/yahoo/yahoo.c Wed Aug 27 03:05:19 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Wed Aug 27 03:06:42 2008 +0000 @@ -3531,18 +3531,16 @@ PurpleUtilFetchUrlData *url_data; const char* base_url = "http://login.yahoo.com"; - char *request = g_strdup_printf( - "POST /config/cookie_token HTTP/1.0\r\n" + /* use whole URL if using HTTP Proxy */ + gboolean use_whole_url = yahoo_account_use_http_proxy(gc); + gchar *request = g_strdup_printf( + "POST %s/config/cookie_token HTTP/1.0\r\n" "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n" "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" "Host: login.yahoo.com\r\n" "Content-Length: 0\r\n\r\n", + use_whole_url ? base_url : "", yd->cookie_t, yd->cookie_y); - gboolean use_whole_url = FALSE; - - /* use whole URL if using HTTP Proxy */ - if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) - use_whole_url = TRUE; url_data = purple_util_fetch_url_request(base_url, use_whole_url, "Mozilla/4.0 (compatible; MSIE 5.5)", TRUE, request, FALSE,
--- a/libpurple/protocols/yahoo/yahoo.h Wed Aug 27 03:05:19 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.h Wed Aug 27 03:06:42 2008 +0000 @@ -204,6 +204,9 @@ char *yahoo_codes_to_html(const char *x); char *yahoo_html_to_codes(const char *src); +gboolean +yahoo_account_use_http_proxy(PurpleConnection *conn); + /** * Encode some text to send to the yahoo server. *
--- a/libpurple/protocols/yahoo/yahoo_aliases.c Wed Aug 27 03:05:19 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo_aliases.c Wed Aug 27 03:06:42 2008 +0000 @@ -155,12 +155,8 @@ gchar *request, *webpage, *webaddress; PurpleUtilFetchUrlData *url_data; - gboolean use_whole_url = FALSE; - /* use whole URL if using HTTP Proxy */ - if ((gc->account->proxy_info) - && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) - use_whole_url = TRUE; + gboolean use_whole_url = yahoo_account_use_http_proxy(gc); /* Using callback_data so I have access to gc in the callback function */ cb = g_new0(struct callback_data, 1); @@ -266,13 +262,9 @@ gchar *content, *request, *webpage, *webaddress; struct callback_data *cb; PurpleUtilFetchUrlData *url_data; - gboolean use_whole_url = FALSE; YahooFriend *f; - /* use whole URL if using HTTP Proxy */ - if ((gc->account->proxy_info) - && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) - use_whole_url = TRUE; + gboolean use_whole_url = yahoo_account_use_http_proxy(gc); g_return_if_fail(who != NULL); g_return_if_fail(gc != NULL);
--- a/libpurple/protocols/yahoo/yahoo_picture.c Wed Aug 27 03:05:19 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo_picture.c Wed Aug 27 03:06:42 2008 +0000 @@ -122,11 +122,8 @@ struct yahoo_fetch_picture_data *data; PurpleBuddy *b = purple_find_buddy(gc->account, who); const char *locksum = NULL; - gboolean use_whole_url = FALSE; - /* use whole URL if using HTTP Proxy */ - if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) - use_whole_url = TRUE; + gboolean use_whole_url = yahoo_account_use_http_proxy(gc); /* FIXME: Cleanup this strtol() stuff if possible. */ if (b && (locksum = purple_buddy_icons_get_checksum_for_user(b)) != NULL && @@ -463,7 +460,8 @@ PurpleConnection *gc = d->gc; PurpleAccount *account; struct yahoo_data *yd; - gboolean use_whole_url = FALSE; + /* use whole URL if using HTTP Proxy */ + gboolean use_whole_url = yahoo_account_use_http_proxy(gc); account = purple_connection_get_account(gc); yd = gc->proto_data; @@ -476,10 +474,6 @@ yahoo_buddy_icon_upload_data_free(d); return; } - /* use whole URL if using HTTP Proxy */ - if ((gc->account->proxy_info) - && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) - use_whole_url = TRUE; pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_UPLOAD, YAHOO_STATUS_AVAILABLE, yd->session_id);
--- a/libpurple/protocols/yahoo/yahoo_profile.c Wed Aug 27 03:05:19 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo_profile.c Wed Aug 27 03:06:42 2008 +0000 @@ -933,11 +933,8 @@ /* Try to put the photo in there too, if there's one */ if (photo_url_text) { PurpleUtilFetchUrlData *url_data; - gboolean use_whole_url = FALSE; - /* use whole URL if using HTTP Proxy */ - if ((info_data->gc->account->proxy_info) && (info_data->gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) - use_whole_url = TRUE; + gboolean use_whole_url = yahoo_account_use_http_proxy(info_data->gc); /* User-uploaded photos use a different server that requires the Host * header, but Yahoo Japan will use the "chunked" content encoding if