Apply second patch from xnyhps this time to show the message salvaged to user.
authorJorge Villaseñor <masca@cpw.pidgin.im>
Thu, 26 Jan 2012 03:00:33 +0000
changesetf9eeb175a5c9 pushlog
parent 1b1b97b8e942
child f5fd49c83637
child a10e4caaa72f
Apply second patch from xnyhps this time to show the message salvaged to user.

Refs #14884
libpurple/protocols/msn/oim.c
      1.1 --- a/libpurple/protocols/msn/oim.c
      1.2 +++ b/libpurple/protocols/msn/oim.c
      1.3 @@ -661,7 +661,7 @@
      1.4  	}
      1.5  
      1.6  
      1.7 -	if (charset && !(purple_utf8_strcasecmp(charset, "UTF-8") || purple_utf8_strcasecmp(charset, "UTF8"))) {
      1.8 +	if (charset && !((strncasecmp(charset, "UTF-8", 5) == 0) || (strncasecmp(charset, "UTF8", 4) == 0))) {
      1.9  		clean_msg = g_convert(decode_msg, strlen(decode_msg), "UTF-8", charset, NULL, NULL, NULL);
     1.10  
     1.11  		if (!clean_msg) {
     1.12 @@ -669,13 +669,8 @@
     1.13  
     1.14  			purple_debug_error("msn", "Failed to convert charset from %s to UTF-8 for OIM message: %s", charset, clean);
     1.15  
     1.16 -			msn_oim_post_delete_msg(rdata);
     1.17 -			msn_message_unref(message);
     1.18 -
     1.19 -			g_free(decode_msg);
     1.20 +			clean_msg = g_strdup_printf(_("%s (There was an error receiving this message. Converting the encoding from %s to UTF-8 failed.)"), clean, charset);
     1.21  			g_free(clean);
     1.22 -
     1.23 -			return;
     1.24  		}
     1.25  
     1.26  		g_free(decode_msg);
     1.27 @@ -686,16 +681,18 @@
     1.28  
     1.29  			purple_debug_error("msn", "Received an OIM message that is not UTF-8, and no encoding specified: %s", clean);
     1.30  
     1.31 -			msn_oim_post_delete_msg(rdata);
     1.32 -			msn_message_unref(message);
     1.33 +			if (charset) {
     1.34 +				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);
     1.35 +			} else {
     1.36 +				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);
     1.37 +			}
     1.38  
     1.39 +			g_free(clean);
     1.40  			g_free(decode_msg);
     1.41 -			g_free(clean);
     1.42  
     1.43 -			return;
     1.44 +		} else {
     1.45 +			clean_msg = decode_msg;
     1.46  		}
     1.47 -
     1.48 -		clean_msg = decode_msg;
     1.49  	}
     1.50  
     1.51  	from = msn_message_get_header_value(message, "X-OIM-originatingSource");