changeset 27319:430eb9e9042a

Correctly determine if the prpl calling a given function is the Yahoo! JAPAN prpl or not. Both Yahoo! prpl's now appear to me to work. Further testing and a migration path is still required.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Mon, 06 Jul 2009 00:16:00 +0000
parents 31534ae3406a
children 87586d7bdbbd
files libpurple/protocols/yahoo/libymsg.c
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/libymsg.c	Sun Jul 05 23:56:07 2009 +0000
+++ b/libpurple/protocols/yahoo/libymsg.c	Mon Jul 06 00:16:00 2009 +0000
@@ -65,6 +65,11 @@
 static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message);
 #endif /* TRY_WEBMESSENGER_LOGIN */
 
+static gboolean yahoo_is_japan(PurpleAccount *account)
+{
+	return purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoojp");
+}
+
 static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f)
 {
 	char *status = NULL;
@@ -1831,14 +1836,13 @@
 		else {
 			/* OK to login, correct information provided */
 			PurpleUtilFetchUrlData *url_data = NULL;
+			PurpleAccount *account = purple_connection_get_account(gc);
 			char *url = NULL;
-			gboolean yahoojp = purple_account_get_bool(purple_connection_get_account(gc),
-				"yahoojp", 0);
+			gboolean yahoojp = yahoo_is_japan(account);
 
 			url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token);
-			url_data = purple_util_fetch_url_request_len_with_account(
-					purple_connection_get_account(gc), url, TRUE,
-					YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1,
+			url_data = purple_util_fetch_url_request_len_with_account(account, url,
+					TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1,
 					yahoo_auth16_stage2, auth_data);
 			g_free(url);
 			g_free(token);
@@ -1862,8 +1866,7 @@
 		return;
 	}
 
-	yahoojp =  purple_account_get_bool(purple_connection_get_account(gc),
-			"yahoojp", 0);
+	yahoojp = yahoo_is_japan(purple_connection_get_account(gc));
 	auth_data = g_new0(struct yahoo_auth_data, 1);
 	auth_data->gc = gc;
 	auth_data->seed = g_strdup(seed);
@@ -3426,7 +3429,7 @@
 	yahoo_server_check(account);
 	yahoo_picture_check(account);
 
-	if (purple_strequal(purple_account_get_protocol_id(account), "yahoojp")) {
+	if (yahoo_is_japan(account)) {
 		yd->jp = TRUE;
 		if (purple_proxy_connect(gc, account,
 		                       purple_account_get_string(account, "server",  YAHOOJP_PAGER_HOST),