pidgin: ecabfaee: Apply second patch from xnyhps this time...

masca at cpw.pidgin.im masca at cpw.pidgin.im
Wed Jan 25 22:05:44 EST 2012


----------------------------------------------------------------------
Revision: ecabfaee8a1ca02e18ebadbb41cdcce19e78bc2e
Parent:   3053d6a37cc6d8774aba7607b992a4408216adcd
Author:   masca at cpw.pidgin.im
Date:     01/25/12 22:00:33
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ecabfaee8a1ca02e18ebadbb41cdcce19e78bc2e

Changelog: 

Apply second patch from xnyhps this time to show the message salvaged to user.

Refs #14884

Changes against parent 3053d6a37cc6d8774aba7607b992a4408216adcd

  patched  libpurple/protocols/msn/oim.c

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/oim.c	a33b539ae69ec24d7260fb3c7d21df6e477a7893
+++ libpurple/protocols/msn/oim.c	c8e2c02ec8580bd446caca688bc80b90a52cb0f6
@@ -661,7 +661,7 @@ msn_oim_report_to_user(MsnOimRecvData *r
 	}
 
 
-	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 @@ msn_oim_report_to_user(MsnOimRecvData *r
 
 			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 @@ msn_oim_report_to_user(MsnOimRecvData *r
 
 			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");


More information about the Commits mailing list