changeset 32477:e456bcd69588

Apply second patch from xnyhps this time to show the message salvaged to user. Refs #14884
author masca@cpw.pidgin.im
date Thu, 26 Jan 2012 03:00:33 +0000
parents c4c9ebac3d7f
children cd51eccbe602
files libpurple/protocols/msn/oim.c
diffstat 1 files changed, 10 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/oim.c	Fri Jan 20 05:15:22 2012 +0000
+++ b/libpurple/protocols/msn/oim.c	Thu Jan 26 03:00:33 2012 +0000
@@ -661,7 +661,7 @@
 	}
 
 
-	if (charset && !(purple_utf8_strcasecmp(charset, "UTF-8") || purple_utf8_strcasecmp(charset, "UTF8"))) {
+	if (charset && !((strncasecmp(charset, "UTF-8", 5) == 0) || (strncasecmp(charset, "UTF8", 4) == 0))) {
 		clean_msg = g_convert(decode_msg, strlen(decode_msg), "UTF-8", charset, NULL, NULL, NULL);
 
 		if (!clean_msg) {
@@ -669,13 +669,8 @@
 
 			purple_debug_error("msn", "Failed to convert charset from %s to UTF-8 for OIM message: %s", charset, clean);
 
-			msn_oim_post_delete_msg(rdata);
-			msn_message_unref(message);
-
-			g_free(decode_msg);
+			clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. Converting the encoding from %s to UTF-8 failed.)"), clean, charset);
 			g_free(clean);
-
-			return;
 		}
 
 		g_free(decode_msg);
@@ -686,16 +681,18 @@
 
 			purple_debug_error("msn", "Received an OIM message that is not UTF-8, and no encoding specified: %s", clean);
 
-			msn_oim_post_delete_msg(rdata);
-			msn_message_unref(message);
+			if (charset) {
+				clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. The charset was %s, but it was not valid UTF-8.)"), clean, charset);
+			} else {
+				clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. The charset was missing, but it was not valid UTF-8.)"), clean);
+			}
 
-			g_free(decode_msg);
 			g_free(clean);
+			g_free(decode_msg);
 
-			return;
+		} else {
+			clean_msg = decode_msg;
 		}
-
-		clean_msg = decode_msg;
 	}
 
 	from = msn_message_get_header_value(message, "X-OIM-originatingSource");