comparison libpurple/protocols/qq/char_conv.c @ 24095: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
comparison
equal deleted inserted replaced
24094:7f5433ffbf8d 24095:2a19984c0005
142 *ret = do_convert((gchar *) (data + 1), (gssize) len, UTF8, from_charset); 142 *ret = do_convert((gchar *) (data + 1), (gssize) len, UTF8, from_charset);
143 143
144 return len + 1; 144 return len + 1;
145 } 145 }
146 146
147 gint qq_put_vstr(guint8 *buf, const gchar *str_utf8, const gchar *to_charset)
148 {
149 gchar *str;
150 guint8 len;
151
152 if (str_utf8 == NULL || (len = strlen(str_utf8)) == 0) {
153 buf[0] = 0;
154 return 1;
155 }
156 str = do_convert(str_utf8, -1, to_charset, UTF8);
157 len = strlen(str_utf8);
158 buf[0] = len;
159 if (len > 0) {
160 memcpy(buf + 1, str, len);
161 }
162 return 1 + len;
163 }
164
147 /* convert QQ formatted msg to Purple formatted msg (and UTF-8) */ 165 /* convert QQ formatted msg to Purple formatted msg (and UTF-8) */
148 gchar *qq_encode_to_purple(guint8 *data, gint len, const gchar *msg, const gint client_version) 166 gchar *qq_encode_to_purple(guint8 *data, gint len, const gchar *msg, const gint client_version)
149 { 167 {
150 GString *encoded; 168 GString *encoded;
151 guint8 font_attr, font_size, color[3], bar; 169 guint8 font_attr, font_size, color[3], bar;