comparison libpurple/protocols/oscar/oscar.c @ 31041:e358c09cd765

Restore the previous behavior (kind of) of falling back to the specified Account-specific encoding when we receive a message without the encoding specified (such as the ones that Miranda sends when "Send Unicode messages" is disabled). Fixes #12778 committer: Daniel Atallah <daniel.atallah@gmail.com>
author ivan.komarov@soc.pidgin.im
date Thu, 16 Dec 2010 21:18:02 +0000
parents 873cd5e068c4
children a8cc50c2279f
comparison
equal deleted inserted replaced
31040:1029e81fe8e5 31041:e358c09cd765
1797 purple_debug_info("oscar", "Got an ICQ Server Relay message of " 1797 purple_debug_info("oscar", "Got an ICQ Server Relay message of "
1798 "type %d\n", args->info.rtfmsg.msgtype); 1798 "type %d\n", args->info.rtfmsg.msgtype);
1799 1799
1800 if (args->info.rtfmsg.msgtype == 1) { 1800 if (args->info.rtfmsg.msgtype == 1) {
1801 if (args->info.rtfmsg.msg != NULL) { 1801 if (args->info.rtfmsg.msg != NULL) {
1802 char *rtfmsg = oscar_encoding_to_utf8(args->encoding, args->info.rtfmsg.msg, strlen(args->info.rtfmsg.msg)); 1802 char *rtfmsg;
1803 const char *encoding = args->encoding;
1804 size_t len = strlen(args->info.rtfmsg.msg);
1803 char *tmp, *tmp2; 1805 char *tmp, *tmp2;
1806
1807 if (encoding == NULL && !g_utf8_validate(args->info.rtfmsg.msg, len, NULL)) {
1808 /* Yet another wonderful Miranda-related hack. If their user disables the "Send Unicode messages" setting,
1809 * Miranda sends us ch2 messages in whatever Windows codepage is set as default on their user's system (instead of UTF-8).
1810 * Of course, they don't bother to specify that codepage. Let's just fallback to the encoding OUR users can
1811 * specify in account options as a last resort.
1812 */
1813 encoding = purple_account_get_string(account, "encoding", OSCAR_DEFAULT_CUSTOM_ENCODING);
1814 purple_debug_info("oscar", "Miranda, is that you? Using '%s' as encoding\n", encoding);
1815 }
1816
1817 rtfmsg = oscar_encoding_to_utf8(encoding, args->info.rtfmsg.msg, len);
1804 1818
1805 /* Channel 2 messages are supposed to be plain-text (never mind the name "rtfmsg", even 1819 /* Channel 2 messages are supposed to be plain-text (never mind the name "rtfmsg", even
1806 * the official client doesn't parse them as RTF). Therefore, we should escape them before 1820 * the official client doesn't parse them as RTF). Therefore, we should escape them before
1807 * showing to the user. */ 1821 * showing to the user. */
1808 tmp = g_markup_escape_text(rtfmsg, -1); 1822 tmp = g_markup_escape_text(rtfmsg, -1);