diff src/protocols/yahoo/yahoo_profile.c @ 9221:8054855f2bb9

[gaim-migrate @ 10017] a yahoo japan patch from wing: 1. Recognize ISO2022 in Subject header 2. Go to mail.yahoo.co.jp if account is marked as "Yahoo Japan" 3. Make profiles.yahoo.co.jp a #define and use it in yahoo_profile.c I poked at it myself some too, to make it give the right profile url in the get info box for yahoo japan. I also added a new macro to connection.h to check if a connection is valid. I'm not very good at macros, however, and used its argument twice. Someone should fix that :) committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sun, 06 Jun 2004 18:45:06 +0000
parents f0488214826f
children fb517adf4972
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo_profile.c	Sun Jun 06 18:01:32 2004 +0000
+++ b/src/protocols/yahoo/yahoo_profile.c	Sun Jun 06 18:45:06 2004 +0000
@@ -626,9 +626,18 @@
 	char *last_updated_utf8_string;
 	int lang, strid;
 	GaimBuddy *b;
+	struct yahoo_data *yd;
+
+	if (!GAIM_CONNECTION_IS_VALID(info_data->gc)) {
+		g_free(info_data->name);
+		g_free(info_data);
+		return;
+	}
 
 	gaim_debug_info("yahoo", "In yahoo_got_info\n");
 
+	yd = info_data->gc->proto_data;
+	
 	/* we failed to grab the profile URL. this should never happen */
 	if (url_text == NULL || strcmp(url_text, "") == 0) {
 		gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
@@ -673,7 +682,7 @@
 	}
 	if (p) {
 		for (strid = 0; profile_strings[strid].lang != XX; strid += 1) {
-		if (profile_strings[strid].lang == profile_langs[lang].lang) break;
+			if (profile_strings[strid].lang == profile_langs[lang].lang) break;
 		}
 		gaim_debug_info("yahoo", "detected profile lang = %s (%d)\n", profile_strings[strid].lang_string, lang);
 	}
@@ -895,8 +904,8 @@
 	/* put a link to the actual profile URL */
 	g_string_append_printf(s, _("<b>%s:</b> "), _("Profile URL"));
 	g_string_append_printf(s, "<a href=\"%s%s\">%s%s</a><br>",
-			YAHOO_PROFILE_URL, info_data->name,
-			YAHOO_PROFILE_URL, info_data->name);
+			(yd->jp? YAHOOJP_PROFILE_URL: YAHOO_PROFILE_URL), info_data->name,
+			(yd->jp? YAHOOJP_PROFILE_URL: YAHOO_PROFILE_URL), info_data->name);
 
 	/* finish off the html */
 	g_string_append(s, "</body></html>\n");
@@ -934,11 +943,8 @@
 	data->gc   = gc;
 	data->name = g_strdup(name);
 
-	if (yd->jp) {
-		url = g_strdup_printf("%s%s", "http://profiles.yahoo.co.jp/", name);
-	} else {
-		url = g_strdup_printf("%s%s", YAHOO_PROFILE_URL, name);
-	}
+	url = g_strdup_printf("%s%s",
+			(yd->jp? YAHOOJP_PROFILE_URL: YAHOO_PROFILE_URL), name);
 
 	gaim_url_fetch(url, FALSE, NULL, FALSE, yahoo_got_info, data);