libpurple/protocols/qq/char_conv.c

changeset 24022
d01a6b8ccfad
parent 24019
c0801ae3c886
child 24304
7fcbc127617e
--- a/libpurple/protocols/qq/char_conv.c	Mon Sep 15 03:02:06 2008 +0000
+++ b/libpurple/protocols/qq/char_conv.c	Mon Sep 15 03:03:11 2008 +0000
@@ -98,7 +98,7 @@
 }
 
 /* convert a string from from_charset to to_charset, using g_convert */
-static gchar *_my_convert(const gchar *str, gssize len, const gchar *to_charset, const gchar *from_charset) 
+static gchar *_my_convert(const gchar *str, gssize len, const gchar *to_charset, const gchar *from_charset)
 {
 	GError *error = NULL;
 	gchar *ret;
@@ -111,7 +111,7 @@
 	if (error == NULL) {
 		return ret;	/* conversion is OK */
 	}
-	
+
 	/* conversion error */
 	purple_debug_error("QQ_CONVERT", "%s\n", error->message);
 
@@ -127,8 +127,8 @@
  * take the input as a pascal string and return a converted c-string in UTF-8
  * returns the number of bytes read, return -1 if fatal error
  * the converted UTF-8 will be saved in ret
- */ 
-gint convert_as_pascal_string(guint8 *data, gchar **ret, const gchar *from_charset) 
+ */
+gint convert_as_pascal_string(guint8 *data, gchar **ret, const gchar *from_charset)
 {
 	guint8 len;
 
@@ -222,7 +222,7 @@
 	return _my_convert(str, -1, UTF8, from_charset);
 }
 
-/* QQ uses binary code for smiley, while purple uses strings. 
+/* QQ uses binary code for smiley, while purple uses strings.
  * There is a mapping relation between these two. */
 gchar *qq_smiley_to_purple(gchar *text)
 {
@@ -286,7 +286,8 @@
 	}
 
 	for (temp = str; *temp != 0; temp++) {
-		if (*temp == '\r' || *temp == '\n')  *temp = ' ';
+		/*if (*temp == '\r' || *temp == '\n')  *temp = ' ';*/
+		if (*temp > 0 && *temp < 0x20)  *temp = ' ';
 	}
 	g_strstrip(str);
 }

mercurial