im.pidgin.pidgin: c1feccb59fff57f000efd2b3f63ad2b5029bfc97
rekkanoryo at pidgin.im
rekkanoryo at pidgin.im
Sun Feb 24 13:35:59 EST 2008
-----------------------------------------------------------------
Revision: c1feccb59fff57f000efd2b3f63ad2b5029bfc97
Ancestor: 199360f2c6f1f8abd7e83f9b5a23f88328296d78
Author: rekkanoryo at pidgin.im
Date: 2008-02-24T18:20:52
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c1feccb59fff57f000efd2b3f63ad2b5029bfc97
Modified files:
libpurple/protocols/yahoo/yahoo.c
libpurple/protocols/yahoo/yahoo_aliases.c
libpurple/protocols/yahoo/yahoo_picture.c
libpurple/protocols/yahoo/yahoo_profile.c
ChangeLog:
A patch from Gideon N. Guillen, with some minor modifications from me. This
patch fixes retrieval of buddy icons and setting of server-side aliases when
using an HTTP proxy.
-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.c 6cdb54f25d9518f09c4b1b9aed970201745e54e6
+++ libpurple/protocols/yahoo/yahoo.c fe2db0da4a7a9554407d81d58de115a2e321eec0
@@ -3484,8 +3484,13 @@ static void yahoo_show_inbox(PurplePlugi
"Host: login.yahoo.com\r\n"
"Content-Length: 0\r\n\r\n",
yd->cookie_t, yd->cookie_y);
+ gboolean use_whole_url = FALSE;
- url_data = purple_util_fetch_url_request(base_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,
yahoo_get_inbox_token_cb, gc);
============================================================
--- libpurple/protocols/yahoo/yahoo_aliases.c 6c500c519679c800f3a43df22d8fb28f603dbed5
+++ libpurple/protocols/yahoo/yahoo_aliases.c 61999f0980f424a1f0de5bcc7d9f2b9ac66a70b1
@@ -143,21 +143,27 @@ yahoo_fetch_aliases(PurpleConnection *gc
char *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;
+
/* Using callback_data so I have access to gc in the callback function */
cb = g_new0(struct callback_data, 1);
cb->gc = gc;
/* Build all the info to make the web request */
purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL);
- request = g_strdup_printf("GET /%s HTTP/1.1\r\n"
+ request = g_strdup_printf("GET %s%s/%s HTTP/1.1\r\n"
"User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n"
"Cookie: T=%s; Y=%s\r\n"
"Host: %s\r\n"
"Cache-Control: no-cache\r\n\r\n",
- webpage, yd->cookie_t,yd->cookie_y, webaddress);
+ use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, yd->cookie_t,yd->cookie_y, webaddress);
/* We have a URL and some header information, let's connect and get some aliases */
- url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_fetch_aliases_cb, cb);
+ url_data = purple_util_fetch_url_request(url, use_whole_url, NULL, TRUE, request, FALSE, yahoo_fetch_aliases_cb, cb);
if (url_data != NULL) {
yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
}
@@ -225,7 +231,12 @@ yahoo_update_alias(PurpleConnection *gc,
struct callback_data *cb;
PurpleBuddy *buddy;
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;
+
g_return_if_fail(alias!= NULL);
g_return_if_fail(who!=NULL);
g_return_if_fail(gc!=NULL);
@@ -254,18 +265,18 @@ yahoo_update_alias(PurpleConnection *gc,
"<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n",
gc->account->username, who, yu->id, g_markup_escape_text(alias, strlen(alias)));
- request = g_strdup_printf("POST /%s HTTP/1.1\r\n"
+ request = g_strdup_printf("POST %s%s/%s HTTP/1.1\r\n"
"User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n"
"Cookie: T=%s; Y=%s\r\n"
"Host: %s\r\n"
"Content-Length: %" G_GSIZE_FORMAT "\r\n"
"Cache-Control: no-cache\r\n\r\n"
"%s",
- webpage, yd->cookie_t,yd->cookie_y, webaddress,
+ use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, yd->cookie_t,yd->cookie_y, webaddress,
strlen(content), content);
/* We have a URL and some header information, let's connect and update the alias */
- url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_update_alias_cb, cb);
+ url_data = purple_util_fetch_url_request(url, use_whole_url, NULL, TRUE, request, FALSE, yahoo_update_alias_cb, cb);
if (url_data != NULL) {
yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
}
============================================================
--- libpurple/protocols/yahoo/yahoo_picture.c 343fbbf5a874a7d08da662cc557b3be5d7395cd0
+++ libpurple/protocols/yahoo/yahoo_picture.c 1b127a32d43bdf54963b417a77804bd286e8ae0c
@@ -116,7 +116,12 @@ void yahoo_process_picture(PurpleConnect
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;
+
/* FIXME: Cleanup this strtol() stuff if possible. */
if (b && (locksum = purple_buddy_icons_get_checksum_for_user(b)) != NULL &&
(checksum == strtol(locksum, NULL, 10)))
@@ -126,7 +131,7 @@ void yahoo_process_picture(PurpleConnect
data->gc = gc;
data->who = g_strdup(who);
data->checksum = checksum;
- url_data = purple_util_fetch_url(url, FALSE,
+ url_data = purple_util_fetch_url(url, use_whole_url,
"Mozilla/4.0 (compatible; MSIE 5.0)", FALSE,
yahoo_fetch_picture_cb, data);
if (url_data != NULL) {
============================================================
--- libpurple/protocols/yahoo/yahoo_profile.c 38bfa0b232f11a03359dad70e7e0d1300d7282d4
+++ libpurple/protocols/yahoo/yahoo_profile.c 951dbd6d885ca9a549a1dc5ba47a8261ad2a72fb
@@ -932,11 +932,17 @@ static void yahoo_got_info(PurpleUtilFet
/* 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;
+
/* User-uploaded photos use a different server that requires the Host
* header, but Yahoo Japan will use the "chunked" content encoding if
* we specify HTTP 1.1. So we have to specify 1.0 & fix purple_util_fetch_url
*/
- url_data = purple_util_fetch_url(photo_url_text, FALSE, NULL,
+ url_data = purple_util_fetch_url(photo_url_text, use_whole_url, NULL,
FALSE, yahoo_got_photo, info2_data);
if (url_data != NULL)
yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
More information about the Commits
mailing list