diff libpurple/protocols/qq/char_conv.c @ 24071:619ac2303c46

2009.10.02 - ccpaging <ccpaging(at)gmail.com> * Added 'Captcha Display' function * Most functions from patch written by Emil Alexiev merged into trunk, except 'buddy operations' * 'online buddy status' and 'qun buddies' still have problems
author SHiNE CsyFeK <csyfek@gmail.com>
date Wed, 22 Oct 2008 14:43:46 +0000
parents bcfc98c7a55f
children df699d739b8f
line wrap: on
line diff
--- a/libpurple/protocols/qq/char_conv.c	Wed Oct 22 14:42:23 2008 +0000
+++ b/libpurple/protocols/qq/char_conv.c	Wed Oct 22 14:43:46 2008 +0000
@@ -141,7 +141,7 @@
 }
 
 /* convert QQ formatted msg to Purple formatted msg (and UTF-8) */
-gchar *qq_encode_to_purple(guint8 *data, gint len, const gchar *msg)
+gchar *qq_encode_to_purple(guint8 *data, gint len, const gchar *msg, const gint client_version)
 {
 	GString *encoded;
 	guint8 font_attr, font_size, color[3], bar;
@@ -153,6 +153,9 @@
 	/* checked qq_show_packet OK */
 	/* qq_show_packet("QQ_MESG recv for font style", data, len); */
 
+	if (client_version >= 2007) {
+		bytes += 1;
+	}
 	bytes += qq_get8(&font_attr, data + bytes);
 	bytes += qq_getdata(color, 3, data + bytes);	/* red,green,blue */
 	color_code = g_strdup_printf("#%02x%02x%02x", color[0], color[1], color[2]);
@@ -232,8 +235,10 @@
 
 	converted = g_string_new("");
 	segments = split_data((guint8 *) text, strlen(text), "\x14\x15", 0);
+	if(segments == NULL)
+		return NULL;
+
 	g_string_append(converted, segments[0]);
-
 	while ((*(++segments)) != NULL) {
 		cur_seg = *segments;
 		qq_smiley = cur_seg[0];