Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/oscar.h @ 30818:9d386bf63eab
Stop using custom encodings (and LATIN-1, for that matter) for sending
OSCAR messages (ICBM, chat, Direct IM). Now, we use ASCII if a message
contains ASCII characters only, and UTF-16 in all other cases.
That fixes #10833 (offline messages now will be sent as UTF-16)
and also a whole bunch of potential problems we can get
with charset 0x3. Different clients tend to interpret this
charset differently; for instance, the official client
always interprets it as LATIN-1, while alternative
clients may decode it as some other user-specified
8-bit encoding. On the other hand, ASCII messages
(charset 0x0) and UTF-16 messages (charset 0x2) are understood
uniformly by all clients.
I also cleaned-up the code a little (got rid of code paths that were
never executed, flags that were always set, unused struct members, etc.)
author | ivan.komarov@soc.pidgin.im |
---|---|
date | Tue, 27 Jul 2010 21:17:01 +0000 |
parents | 47dfe1d54e9e |
children | 420907755a2f |
comparison
equal
deleted
inserted
replaced
30817:42862490dcb7 | 30818:9d386bf63eab |
---|---|
843 #define AIM_IMFLAGS_HASICON 0x0020 /* already has icon */ | 843 #define AIM_IMFLAGS_HASICON 0x0020 /* already has icon */ |
844 #define AIM_IMFLAGS_SUBENC_MACINTOSH 0x0040 /* damn that Steve Jobs! */ | 844 #define AIM_IMFLAGS_SUBENC_MACINTOSH 0x0040 /* damn that Steve Jobs! */ |
845 #define AIM_IMFLAGS_CUSTOMFEATURES 0x0080 /* features field present */ | 845 #define AIM_IMFLAGS_CUSTOMFEATURES 0x0080 /* features field present */ |
846 #define AIM_IMFLAGS_EXTDATA 0x0100 | 846 #define AIM_IMFLAGS_EXTDATA 0x0100 |
847 #define AIM_IMFLAGS_X 0x0200 | 847 #define AIM_IMFLAGS_X 0x0200 |
848 #define AIM_IMFLAGS_MULTIPART 0x0400 /* ->mpmsg section valid */ | |
849 #define AIM_IMFLAGS_OFFLINE 0x0800 /* send to offline user */ | 848 #define AIM_IMFLAGS_OFFLINE 0x0800 /* send to offline user */ |
850 #define AIM_IMFLAGS_TYPINGNOT 0x1000 /* typing notification */ | 849 #define AIM_IMFLAGS_TYPINGNOT 0x1000 /* typing notification */ |
851 | 850 |
852 #define AIM_CHARSET_ASCII 0x0000 /* ISO 646 */ | 851 #define AIM_CHARSET_ASCII 0x0000 /* ISO 646 */ |
853 #define AIM_CHARSET_UNICODE 0x0002 /* ISO 10646 (UTF-16/UCS-2BE) */ | 852 #define AIM_CHARSET_UNICODE 0x0002 /* ISO 10646 (UTF-16/UCS-2BE) */ |
883 * This is really complicated. But immensely versatile. | 882 * This is really complicated. But immensely versatile. |
884 * | 883 * |
885 */ | 884 */ |
886 struct aim_sendimext_args | 885 struct aim_sendimext_args |
887 { | 886 { |
888 | |
889 /* These are _required_ */ | 887 /* These are _required_ */ |
890 const char *destbn; | 888 const char *destbn; |
891 guint32 flags; /* often 0 */ | 889 guint32 flags; /* often 0 */ |
892 | 890 |
893 /* Only required if not using multipart messages */ | |
894 const char *msg; | 891 const char *msg; |
895 int msglen; | 892 gsize msglen; |
896 | |
897 /* Required if ->msg is not provided */ | |
898 aim_mpmsg_t *mpmsg; | |
899 | 893 |
900 /* Only used if AIM_IMFLAGS_HASICON is set */ | 894 /* Only used if AIM_IMFLAGS_HASICON is set */ |
901 guint32 iconlen; | 895 guint32 iconlen; |
902 time_t iconstamp; | 896 time_t iconstamp; |
903 guint32 iconsum; | 897 guint32 iconsum; |
904 | 898 |
905 /* Only used if AIM_IMFLAGS_CUSTOMFEATURES is set */ | |
906 guint16 featureslen; | 899 guint16 featureslen; |
907 guint8 *features; | 900 guint8 *features; |
908 | 901 |
909 /* Only used if AIM_IMFLAGS_CUSTOMCHARSET is set and mpmsg not used */ | |
910 guint16 charset; | 902 guint16 charset; |
911 guint16 charsubset; | |
912 }; | 903 }; |
913 | 904 |
914 /* | 905 /* |
915 * Arguments to aim_send_rtfmsg(). | 906 * Arguments to aim_send_rtfmsg(). |
916 */ | 907 */ |
924 | 915 |
925 /* | 916 /* |
926 * This information is provided in the Incoming ICBM callback for | 917 * This information is provided in the Incoming ICBM callback for |
927 * Channel 1 ICBM's. | 918 * Channel 1 ICBM's. |
928 * | 919 * |
929 * Note that although CUSTOMFEATURES and CUSTOMCHARSET say they | |
930 * are optional, both are always set by the current libfaim code. | |
931 * That may or may not change in the future. It is mainly for | |
932 * consistency with aim_sendimext_args. | |
933 * | |
934 * Multipart messages require some explanation. If you want to use them, | 920 * Multipart messages require some explanation. If you want to use them, |
935 * I suggest you read all the comments in family_icbm.c. | 921 * I suggest you read all the comments in family_icbm.c. |
936 * | 922 * |
937 */ | 923 */ |
938 struct aim_incomingim_ch1_args | 924 struct aim_incomingim_ch1_args |
939 { | 925 { |
940 | |
941 /* Always provided */ | 926 /* Always provided */ |
942 aim_mpmsg_t mpmsg; | 927 aim_mpmsg_t mpmsg; |
943 guint32 icbmflags; /* some flags apply only to ->msg, not all mpmsg */ | 928 guint32 icbmflags; /* some flags apply only to ->msg, not all mpmsg */ |
944 time_t timestamp; /* Only set for offline messages */ | 929 time_t timestamp; /* Only set for offline messages */ |
945 | 930 |