This extra if-level can be dropped.
authorElliott Sales de Andrade <qulogic@pidgin.im>
Sat, 28 Jan 2012 06:20:21 +0000
changeset85ec889f1675 pushlog
parent 5c02bc93f2c4
child ae897b77a987
This extra if-level can be dropped.
libpurple/protocols/msn/oim.c
     1.1 --- a/libpurple/protocols/msn/oim.c
     1.2 +++ b/libpurple/protocols/msn/oim.c
     1.3 @@ -676,29 +676,27 @@
     1.4  
     1.5  		g_free(decode_msg);
     1.6  
     1.7 +	} else if (!g_utf8_validate(decode_msg, body_len, NULL)) {
     1.8 +		char *clean = purple_utf8_salvage(decode_msg);
     1.9 +
    1.10 +		purple_debug_error("msn", "Received an OIM message that is not UTF-8,"
    1.11 +		                          " and no encoding specified: %s\n", clean);
    1.12 +
    1.13 +		if (charset) {
    1.14 +			clean_msg = g_strdup_printf(_("%s (There was an error receiving this message."
    1.15 +			                              " The charset was %s, but it was not valid UTF-8.)"),
    1.16 +			                            clean, charset);
    1.17 +		} else {
    1.18 +			clean_msg = g_strdup_printf(_("%s (There was an error receiving this message."
    1.19 +			                              " The charset was missing, but it was not valid UTF-8.)"),
    1.20 +			                            clean);
    1.21 +		}
    1.22 +
    1.23 +		g_free(clean);
    1.24 +		g_free(decode_msg);
    1.25 +
    1.26  	} else {
    1.27 -		if (!g_utf8_validate(decode_msg, body_len, NULL)) {
    1.28 -			char *clean = purple_utf8_salvage(decode_msg);
    1.29 -
    1.30 -			purple_debug_error("msn", "Received an OIM message that is not UTF-8,"
    1.31 -			                          " and no encoding specified: %s\n", clean);
    1.32 -
    1.33 -			if (charset) {
    1.34 -				clean_msg = g_strdup_printf(_("%s (There was an error receiving this message."
    1.35 -				                              " The charset was %s, but it was not valid UTF-8.)"),
    1.36 -				                            clean, charset);
    1.37 -			} else {
    1.38 -				clean_msg = g_strdup_printf(_("%s (There was an error receiving this message."
    1.39 -				                              " The charset was missing, but it was not valid UTF-8.)"),
    1.40 -				                            clean);
    1.41 -			}
    1.42 -
    1.43 -			g_free(clean);
    1.44 -			g_free(decode_msg);
    1.45 -
    1.46 -		} else {
    1.47 -			clean_msg = decode_msg;
    1.48 -		}
    1.49 +		clean_msg = decode_msg;
    1.50  	}
    1.51  
    1.52  	from = msn_message_get_header_value(message, "X-OIM-originatingSource");