diff src/protocols/yahoo/yahoo.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 3e0cd1c6ddc7
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo.c	Sun Jun 06 18:01:32 2004 +0000
+++ b/src/protocols/yahoo/yahoo.c	Sun Jun 06 18:45:06 2004 +0000
@@ -894,7 +894,7 @@
 
 static char *yahoo_decode(const char *text)
 {
-	char *converted;
+	char *converted = NULL;
 	char *n, *new;
 	const char *end, *p;
 	int i, k;
@@ -934,7 +934,10 @@
 
 	*n = '\0';
 
-	converted = g_convert(new, n - new, OUT_CHARSET, "iso-8859-1", NULL, NULL, NULL);
+	if (strstr(text, "\033$B"))
+		converted = g_convert(new, n - new, OUT_CHARSET, "iso-2022-jp", NULL, NULL, NULL);
+	if (!converted)
+		converted = g_convert(new, n - new, OUT_CHARSET, "iso-8859-1", NULL, NULL, NULL);
 	g_free(new);
 
 	return converted;
@@ -943,9 +946,11 @@
 static void yahoo_process_mail(GaimConnection *gc, struct yahoo_packet *pkt)
 {
 	GaimAccount *account = gaim_connection_get_account(gc);
+	struct yahoo_data *yd = gc->proto_data;
 	char *who = NULL;
 	char *email = NULL;
 	char *subj = NULL;
+	char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL);
 	int count = 0;
 	GSList *l = pkt->hash;
 
@@ -971,14 +976,14 @@
 		char *from = g_strdup_printf("%s (%s)", dec_who, email);
 
 		gaim_notify_email(gc, dec_subj, from, gaim_account_get_username(account),
-						  "http://mail.yahoo.com/", NULL, NULL);
+						  yahoo_mail_url, NULL, NULL);
 
 		g_free(dec_who);
 		g_free(dec_subj);
 		g_free(from);
 	} else if (count > 0) {
 		const char *to = gaim_account_get_username(account);
-		const char *url = "http://mail.yahoo.com/";
+		const char *url = yahoo_mail_url;
 
 		gaim_notify_emails(gc, count, FALSE, NULL, NULL, &to, &url,
 						   NULL, NULL);