Mercurial > pidgin
comparison src/protocols/oscar/oscar.c @ 4662:6d8a3e81db48
[gaim-migrate @ 4973]
I removed AIM_IMFLAGS_CUSTOMCHARSET because I think it's a little
misleading, and a little silly.
3rd party client developers!!!
You must set args.charset and args.charsubset before calling
aim_im_sendch1_ext. Just set them to 0 for plain ASCII.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 07 Mar 2003 06:39:10 +0000 |
parents | 745f583372cd |
children | eab1309693b8 |
comparison
equal
deleted
inserted
replaced
4661:ccc304cb0389 | 4662:6d8a3e81db48 |
---|---|
1993 g_free(buf); | 1993 g_free(buf); |
1994 } else | 1994 } else |
1995 debug_printf("Can't stat buddy icon file!\n"); | 1995 debug_printf("Can't stat buddy icon file!\n"); |
1996 } | 1996 } |
1997 | 1997 |
1998 debug_printf("Character set is %hu %hu\n", args->charset, args->charsubset); | |
1998 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { | 1999 if (args->icbmflags & AIM_IMFLAGS_UNICODE) { |
1999 /* This message is marked as UNICODE, so we have to | 2000 /* This message is marked as UNICODE, so we have to |
2000 * convert it to utf-8 before handing it to the gaim core. | 2001 * convert it to utf-8 before handing it to the gaim core. |
2001 * This conversion should *never* fail, if it does it | 2002 * This conversion should *never* fail, if it does it |
2002 * means that either the incoming ICBM is corrupted or | 2003 * means that either the incoming ICBM is corrupted or |
2003 * there is something we don't understand about it. */ | 2004 * there is something we don't understand about it. |
2004 /* For the record, AIM Unicode is big-endian UCS-2 */ | 2005 * For the record, AIM Unicode is big-endian UCS-2 */ |
2006 | |
2007 debug_printf("Received UNICODE IM\n"); | |
2005 | 2008 |
2006 if (!args->msg || !args->msglen) | 2009 if (!args->msg || !args->msglen) |
2007 return 1; | 2010 return 1; |
2008 | 2011 |
2009 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); | 2012 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
2017 * ASCII is a strict subset of ISO-8859-1; this should | 2020 * ASCII is a strict subset of ISO-8859-1; this should |
2018 * help with compatibility with old, broken versions of | 2021 * help with compatibility with old, broken versions of |
2019 * gaim (everything before 0.60) and other broken clients | 2022 * gaim (everything before 0.60) and other broken clients |
2020 * that will happily send ISO-8859-1 without marking it as | 2023 * that will happily send ISO-8859-1 without marking it as |
2021 * such */ | 2024 * such */ |
2022 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) { | 2025 if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) |
2023 debug_printf("Received ISO-8859-1 IM\n"); | 2026 debug_printf("Received ISO-8859-1 IM\n"); |
2024 } | |
2025 | 2027 |
2026 if (!args->msg || !args->msglen) | 2028 if (!args->msg || !args->msglen) |
2027 return 1; | 2029 return 1; |
2028 | 2030 |
2029 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); | 2031 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
2030 if (err) { | 2032 if (err) { |
2031 debug_printf("ISO-8859-1 IM conversion: %s\n", err->message); | 2033 debug_printf("ISO-8859-1 IM conversion: %s\n", err->message); |
2032 tmp = strdup(_("(There was an error receiving this message)")); | 2034 tmp = strdup(_("(There was an error receiving this message)")); |
2033 } | 2035 } |
2034 } | |
2035 | |
2036 if (args->icbmflags & AIM_IMFLAGS_CUSTOMCHARSET) { | |
2037 debug_printf("Custom character set: %hu %hu\n", args->charset, args->charsubset); | |
2038 } | 2036 } |
2039 | 2037 |
2040 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) { | 2038 if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) { |
2041 char *who = normalize(userinfo->sn); | 2039 char *who = normalize(userinfo->sn); |
2042 if (!g_hash_table_lookup(od->supports_tn, who)) | 2040 if (!g_hash_table_lookup(od->supports_tn, who)) |
3878 | 3876 |
3879 len = strlen(message); | 3877 len = strlen(message); |
3880 args.flags |= check_encoding(message); | 3878 args.flags |= check_encoding(message); |
3881 if (args.flags & AIM_IMFLAGS_UNICODE) { | 3879 if (args.flags & AIM_IMFLAGS_UNICODE) { |
3882 debug_printf("Sending Unicode IM\n"); | 3880 debug_printf("Sending Unicode IM\n"); |
3881 args.charset = 0x0002; | |
3882 args.charsubset = 0x0002; | |
3883 args.msg = g_convert(message, len, "UCS-2BE", "UTF-8", NULL, &len, &err); | 3883 args.msg = g_convert(message, len, "UCS-2BE", "UTF-8", NULL, &len, &err); |
3884 if (err) { | 3884 if (err) { |
3885 debug_printf("Error converting a unicode message: %s\n", err->message); | 3885 debug_printf("Error converting a unicode message: %s\n", err->message); |
3886 debug_printf("This really shouldn't happen!\n"); | 3886 debug_printf("This really shouldn't happen!\n"); |
3887 /* We really shouldn't try to send the | 3887 /* We really shouldn't try to send the |
3888 * IM now, but I'm not sure what to do */ | 3888 * IM now, but I'm not sure what to do */ |
3889 } | 3889 } |
3890 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { | 3890 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { |
3891 debug_printf("Sending ISO-8859-1 IM\n"); | 3891 debug_printf("Sending ISO-8859-1 IM\n"); |
3892 args.charset = 0x0003; | |
3893 args.charsubset = 0x0003; | |
3892 args.msg = g_convert(message, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); | 3894 args.msg = g_convert(message, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); |
3893 if (err) { | 3895 if (err) { |
3894 debug_printf("conversion error: %s\n", err->message); | 3896 debug_printf("conversion error: %s\n", err->message); |
3895 debug_printf("Someone tell Ethan his 8859-1 detection is wrong\n"); | 3897 debug_printf("Someone tell Ethan his 8859-1 detection is wrong\n"); |
3896 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; | 3898 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; |
3899 if (err) { | 3901 if (err) { |
3900 debug_printf("Error in unicode fallback: %s\n", err->message); | 3902 debug_printf("Error in unicode fallback: %s\n", err->message); |
3901 } | 3903 } |
3902 } | 3904 } |
3903 } else { | 3905 } else { |
3906 args.charset = 0x0000; | |
3907 args.charsubset = 0x0000; | |
3904 args.msg = message; | 3908 args.msg = message; |
3905 } | 3909 } |
3906 args.msglen = len; | 3910 args.msglen = len; |
3907 | 3911 |
3908 ret = aim_im_sendch1_ext(od->sess, &args); | 3912 ret = aim_im_sendch1_ext(od->sess, &args); |