# HG changeset patch
# User Luke Schierer <lschiere@pidgin.im>
# Date 1070540430 0
# Node ID 3906c0957d4f9027cc9dbd9d0bf2a28820638e8e
# Parent  d7fd01f7bdcb1f785235ae2b246df261c601326c
[gaim-migrate @ 8392]
Felipe Contreras (revo) gives us i18n yahoo email notification

committer: Tailor Script <tailor@pidgin.im>

diff -r d7fd01f7bdcb -r 3906c0957d4f src/protocols/yahoo/yahoo.c
--- a/src/protocols/yahoo/yahoo.c	Thu Dec 04 12:12:11 2003 +0000
+++ b/src/protocols/yahoo/yahoo.c	Thu Dec 04 12:20:30 2003 +0000
@@ -799,6 +799,32 @@
 	}
 }
 
+#define OUT_CHARSET "utf-8"
+
+static char *yahoo_decode(const char *text)
+{
+	char *converted;
+	char *p, *n, *new;
+	
+	n = new = g_malloc(strlen (text));
+
+	for (p = (char *)text; *p; p++, n++) {
+		if (*p == '\\') {
+			sscanf(p + 1, "%3o\n", (int *)n);
+			p += 3;
+		}
+		else
+			*n = *p;
+	}
+
+	*n = '\0';
+	
+	converted = g_convert(new, n - new, OUT_CHARSET, "iso-8859-1", NULL, NULL, NULL);
+	g_free(new);
+
+	return converted;
+}
+
 static void yahoo_process_mail(GaimConnection *gc, struct yahoo_packet *pkt)
 {
 	GaimAccount *account = gaim_connection_get_account(gc);
@@ -825,11 +851,15 @@
 	}
 
 	if (who && subj && email && *email) {
-		char *from = g_strdup_printf("%s (%s)", who, email);
-
-		gaim_notify_email(gc, subj, from, gaim_account_get_username(account),
+		char *dec_who = yahoo_decode(who);
+		char *dec_subj = yahoo_decode(subj);
+		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);
 
+		g_free(dec_who);
+		g_free(dec_subj);
 		g_free(from);
 	} else if (count > 0) {
 		const char *to = gaim_account_get_username(account);