Wed, 28 Jul 2010 16:30:04 +0000
Refactored oscar_encoding_to_utf8().
1. Removed elb's hack from #1645. It doesn't appear to be necessary
anymore, since the recent official clients (6.5, 7.1) aren't that stupid
now.
2. Simplified logic in incomingim_chan2().
3. Removed all NULL return check for oscar_encoding_to_utf8(), because
it will always return non-NULL value.
| 30659 | 1 | /* |
| 2 | * Purple's oscar protocol plugin | |
| 3 | * This file is the legal property of its developers. | |
| 4 | * Please see the AUTHORS file distributed alongside this file. | |
| 5 | * | |
| 6 | * This library is free software; you can redistribute it and/or | |
| 7 | * modify it under the terms of the GNU Lesser General Public | |
| 8 | * License as published by the Free Software Foundation; either | |
| 9 | * version 2 of the License, or (at your option) any later version. | |
| 10 | * | |
| 11 | * This library is distributed in the hope that it will be useful, | |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | * Lesser General Public License for more details. | |
| 15 | * | |
| 16 | * You should have received a copy of the GNU Lesser General Public | |
| 17 | * License along with this library; if not, write to the Free Software | |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
| 19 | */ | |
| 20 | ||
| 21 | #ifndef _ENCODING_H_ | |
| 22 | #define _ENCODING_H_ | |
| 23 | ||
| 24 | #include "oscar.h" | |
| 25 | #include "oscarcommon.h" | |
| 26 | ||
| 27 | /** | |
| 28 | * Determine the simplest encoding we can send this message in. | |
| 29 | */ | |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30659
diff
changeset
|
30 | guint16 oscar_charset_check(const char *utf8); |
| 30659 | 31 | |
|
30661
b33b4612a753
Refactored oscar_encoding_to_utf8().
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30660
diff
changeset
|
32 | gchar * oscar_encoding_to_utf8(const char *encoding, const char *text, int textlen); |
| 30659 | 33 | gchar * oscar_utf8_try_convert(PurpleAccount *account, OscarData *od, const gchar *msg); |
| 34 | ||
| 35 | /** | |
| 36 | * This attemps to decode an incoming IM into a UTF8 string. | |
| 37 | * | |
| 38 | * We try decoding using two different character sets. The charset | |
| 39 | * specified in the IM determines the order in which we attempt to | |
| 40 | * decode. We do this because there are lots of broken ICQ clients | |
| 41 | * that don't correctly send non-ASCII messages. And if Purple isn't | |
| 42 | * able to deal with that crap, then people complain like banshees. | |
| 43 | */ | |
| 44 | gchar * oscar_decode_im_part(PurpleAccount *account, | |
| 45 | const char *sourcebn, | |
| 46 | guint16 charset, guint16 charsubset, | |
| 47 | const gchar *data, gsize datalen); | |
| 48 | ||
| 49 | /** | |
| 50 | * Figure out what encoding to use when sending a given outgoing message. | |
| 51 | */ | |
|
30660
cd134a2014f2
Stop using custom encodings (and LATIN-1, for that matter) for sending
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30659
diff
changeset
|
52 | gchar * oscar_convert_to_best_encoding(const gchar *msg, gsize *result_len, guint16 *charset, gchar **charsetstr); |
| 30659 | 53 | |
| 54 | #endif |