pidgin: 6404d763: Do a better job of detecting if the yaho...
datallah at pidgin.im
datallah at pidgin.im
Tue Aug 26 22:55:35 EDT 2008
-----------------------------------------------------------------
Revision: 6404d7635dd48f315b3c8fd3550970a417daa2ef
Ancestor: b0f84921c4f0106181a1f1903ef9d41f1adb603f
Author: datallah at pidgin.im
Date: 2008-08-27T02:52:50
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6404d7635dd48f315b3c8fd3550970a417daa2ef
Modified files:
libpurple/protocols/yahoo/util.c
libpurple/protocols/yahoo/yahoo.c
libpurple/protocols/yahoo/yahoo.h
libpurple/protocols/yahoo/yahoo_aliases.c
libpurple/protocols/yahoo/yahoo_picture.c
libpurple/protocols/yahoo/yahoo_profile.c
ChangeLog:
Do a better job of detecting if the yahoo account is connecting through a HTTP
Proxy in order to generate acceptable HTTP requests.
Hopefully fixes #6527
-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/util.c 2a3725bcc455684e1c1bb42bd4982cc322732f38
+++ libpurple/protocols/yahoo/util.c af7423f29af07d5f3029ee42d43ff07eb325450a
@@ -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.
============================================================
--- libpurple/protocols/yahoo/yahoo.c 01fb04b9875466a521a151e4a6f5366b7f1c2b9f
+++ libpurple/protocols/yahoo/yahoo.c 8e54d3b6ca217196b7aea88b3db3db73f9ee44bc
@@ -3531,19 +3531,17 @@ static void yahoo_show_inbox(PurplePlugi
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,
yahoo_get_inbox_token_cb, gc);
============================================================
--- libpurple/protocols/yahoo/yahoo.h 88f1c90f2d0c08025299f1fea562ff61d747e229
+++ libpurple/protocols/yahoo/yahoo.h e0daa1b8ad392fb22b487a60b766f83c777e3783
@@ -204,6 +204,9 @@ char *yahoo_html_to_codes(const char *sr
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.
*
============================================================
--- libpurple/protocols/yahoo/yahoo_aliases.c 2aca36e0d75c04f83834d4eda774361e04544cb5
+++ libpurple/protocols/yahoo/yahoo_aliases.c 0b2219a4c6ecf72dc38c4e1828ee321615df096b
@@ -155,12 +155,8 @@ yahoo_fetch_aliases(PurpleConnection *gc
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 @@ yahoo_update_alias(PurpleConnection *gc,
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);
============================================================
--- libpurple/protocols/yahoo/yahoo_picture.c 85e1eb63706460d2d8a310ccb90ed45375635859
+++ libpurple/protocols/yahoo/yahoo_picture.c 05ac3cf5fad5e74b9ad6594d9894bfbc0db0d839
@@ -122,11 +122,8 @@ 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;
+ 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 @@ static void yahoo_buddy_icon_upload_conn
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 @@ static void yahoo_buddy_icon_upload_conn
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);
============================================================
--- libpurple/protocols/yahoo/yahoo_profile.c f0d1f0c4a63c3f3b0c40beb445a5f9afaf017fa5
+++ libpurple/protocols/yahoo/yahoo_profile.c e97dfd619ed4abfce3dd8ecbf04c729a76d18342
@@ -933,11 +933,8 @@ 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;
+ 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
More information about the Commits
mailing list