changeset 7817:954b986ad3e3

[gaim-migrate @ 8464] Email parsing changes from Felipe Contreras (revo): Currently only MSN send email notifications with MIME fields, so, only decode MIME fields in MSN. This makes me feel warm. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 09 Dec 2003 01:55:15 +0000
parents 061b39119a1b
children 318ed59300e4
files src/gtknotify.c src/protocols/msn/notification.c
diffstat 2 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtknotify.c	Tue Dec 09 01:20:36 2003 +0000
+++ b/src/gtknotify.c	Tue Dec 09 01:55:15 2003 +0000
@@ -215,17 +215,13 @@
 		char *from_text = NULL, *subject_text = NULL;
 
 		if (froms != NULL) {
-			char *from_decoded = gaim_mime_decode_field(*froms);
 			from_text = g_strdup_printf(
-				_("<span weight=\"bold\">From:</span> %s\n"), from_decoded);
-			g_free(from_decoded);
+				_("<span weight=\"bold\">From:</span> %s\n"), *froms);
 		}
 
 		if (subjects != NULL) {
-			char *subject_decoded = gaim_mime_decode_field(*subjects);
 			subject_text = g_strdup_printf(
-				_("<span weight=\"bold\">Subject:</span> %s\n"), subject_decoded);
-			g_free(subject_decoded);
+				_("<span weight=\"bold\">Subject:</span> %s\n"), *subjects);
 		}
 
 		label_text = g_strdup_printf(
--- a/src/protocols/msn/notification.c	Tue Dec 09 01:20:36 2003 +0000
+++ b/src/protocols/msn/notification.c	Tue Dec 09 01:55:15 2003 +0000
@@ -2053,7 +2053,7 @@
 	MsnSession *session = servconn->session;
 	GaimConnection *gc = session->account->gc;
 	GHashTable *table;
-	const char *from, *subject;
+	char *from, *subject;
 
 	if (strcmp(servconn->msg_passport, "Hotmail")) {
 		/* This isn't an official message. */
@@ -2073,12 +2073,15 @@
 
 	table = msn_message_get_hashtable_from_body(msg);
 
-	from    = g_hash_table_lookup(table, "From");
-	subject = g_hash_table_lookup(table, "Subject");
+	from    = gaim_mime_decode_field(g_hash_table_lookup(table, "From"));
+	subject = gaim_mime_decode_field(g_hash_table_lookup(table, "Subject"));
 
 	gaim_notify_email(gc, subject, from, msn_user_get_passport(session->user),
 					  session->passport_info.file, NULL, NULL);
 
+	g_free(from);
+	g_free(subject);
+
 	g_hash_table_destroy(table);
 
 	return TRUE;