im.pidgin.pidgin: 735c3286464306d43a2109836ecbdc3bc26b479f

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sat Jan 12 20:05:38 EST 2008


-----------------------------------------------------------------
Revision: 735c3286464306d43a2109836ecbdc3bc26b479f
Ancestor: 19fce3d53125c9e79060d85550227bb51c18f35f
Author: rekkanoryo at pidgin.im
Date: 2008-01-13T01:00:29
Branch: im.pidgin.pidgin

Modified files:
        libpurple/protocols/yahoo/yahoo.h
        libpurple/protocols/yahoo/yahoochat.c

ChangeLog: 

>From what little I could see, it  appears that for Yahoo Japan there is only
one valid roomlist URL and locale, so make it work instead of forcing users
to edit their accounts.xml to change the setting from the default.  This
should fix #1369 without breaking anything.  It also has the side effect of
(in my opinion) cleaning the code up a bit.

-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/yahoo.h	84b0ccd6e7834f104bad9833fdcd04226508d0c6
+++ libpurple/protocols/yahoo/yahoo.h	908634fe89ad4df26985215b10f04aa75b0c40a5
@@ -48,6 +48,8 @@
 /*not sure, must test:*/
 #define YAHOOJP_XFER_RELAY_HOST "relay.msg.yahoo.com" 
 #define YAHOOJP_XFER_RELAY_PORT 80
+#define YAHOOJP_ROOMLIST_URL "http://insider.msg.yahoo.co.jp/ycontent/"
+#define YAHOOJP_ROOMLIST_LOCALE "ja"
 
 #define YAHOO_AUDIBLE_URL "http://us.dl1.yimg.com/download.yahoo.com/dl/aud"
 
============================================================
--- libpurple/protocols/yahoo/yahoochat.c	7e7326ba4e05c93e9e195ef943812868611c16f3
+++ libpurple/protocols/yahoo/yahoochat.c	4a350ff9607ede7517361f4257051017959ca1e8
@@ -1461,28 +1461,30 @@ PurpleRoomlist *yahoo_roomlist_get_list(
 
 PurpleRoomlist *yahoo_roomlist_get_list(PurpleConnection *gc)
 {
-	struct yahoo_roomlist *yrl;
+	PurpleAccount *account;
 	PurpleRoomlist *rl;
-	const char *rll;
-	char *url;
+	PurpleRoomlistField *f;
 	GList *fields = NULL;
-	PurpleRoomlistField *f;
+	struct yahoo_roomlist *yrl;
+	const char *rll, *rlurl;
+	char *url;
 
-	rll = purple_account_get_string(purple_connection_get_account(gc),
-								  "room_list_locale", YAHOO_ROOMLIST_LOCALE);
+	account = purple_connection_get_account(gc);
 
-	if (rll != NULL && *rll != '\0') {
-		url = g_strdup_printf("%s?chatcat=0&intl=%s",
-	        purple_account_get_string(purple_connection_get_account(gc),
-	        "room_list", YAHOO_ROOMLIST_URL), rll);
-	} else {
-		url = g_strdup_printf("%s?chatcat=0",
-	        purple_account_get_string(purple_connection_get_account(gc),
-	        "room_list", YAHOO_ROOMLIST_URL));
+	/* for Yahoo Japan, it appears there is only one valid URL and locale */
+	if(purple_account_get_bool(account, "yahoojp", FALSE)) {
+		rll = YAHOOJP_ROOMLIST_LOCALE;
+		rlurl = YAHOOJP_ROOMLIST_URL;
 	}
+	else { /* but for the rest of the world that isn't the case */
+		rll = purple_account_get_string(account, "room_list_locale", YAHOO_ROOMLIST_LOCALE);
+		rlurl = purple_account_get_string(account, "room_list", YAHOO_ROOMLIST_URL);
+	}
 
+	url = g_strdup_printf("%s?chatcat=0&intl=%s", rlurl, rll);
+
 	yrl = g_new0(struct yahoo_roomlist, 1);
-	rl = purple_roomlist_new(purple_connection_get_account(gc));
+	rl = purple_roomlist_new(account);
 	yrl->list = rl;
 
 	purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL);
@@ -1508,7 +1510,7 @@ PurpleRoomlist *yahoo_roomlist_get_list(
 
 	purple_roomlist_set_fields(rl, fields);
 
-	if (purple_proxy_connect(NULL, purple_connection_get_account(gc), yrl->host, 80,
+	if (purple_proxy_connect(NULL, account, yrl->host, 80,
 	                       yahoo_roomlist_got_connected, yrl) == NULL)
 	{
 		purple_notify_error(gc, NULL, _("Connection problem"), _("Unable to fetch room list."));


More information about the Commits mailing list