diff libpurple/protocols/qq/char_conv.c @ 24164:2a19984c0005

2008.10.27 - ccpaging <ccpaging(at)gmail.com> * Update 'buddy_adding' protocol
author SHiNE CsyFeK <csyfek@gmail.com>
date Tue, 28 Oct 2008 16:47:06 +0000
parents 7c0a56c5fea0
children d92830aee726
line wrap: on
line diff
--- a/libpurple/protocols/qq/char_conv.c	Tue Oct 28 16:46:08 2008 +0000
+++ b/libpurple/protocols/qq/char_conv.c	Tue Oct 28 16:47:06 2008 +0000
@@ -144,6 +144,24 @@
 	return len + 1;
 }
 
+gint qq_put_vstr(guint8 *buf, const gchar *str_utf8, const gchar *to_charset)
+{
+	gchar *str;
+	guint8 len;
+
+	if (str_utf8 == NULL || (len = strlen(str_utf8)) == 0) {
+		buf[0] = 0;
+		return 1;
+	}
+	str = do_convert(str_utf8, -1, to_charset, UTF8);
+	len = strlen(str_utf8);
+	buf[0] = len;
+	if (len > 0) {
+		memcpy(buf + 1, str, len);
+	}
+	return 1 + len;
+}
+
 /* convert QQ formatted msg to Purple formatted msg (and UTF-8) */
 gchar *qq_encode_to_purple(guint8 *data, gint len, const gchar *msg, const gint client_version)
 {