libpurple/protocols/qq/im.c

branch
openq
changeset 31393
04447b1f6403
parent 30857
1a7e2da2ab01
child 31405
c101dd644b2b
--- a/libpurple/protocols/qq/im.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/im.c	Sun Feb 06 05:23:22 2011 +0000
@@ -71,8 +71,8 @@
 struct _qq_im_header {
 	/* this is the common part of normal_text */
 	guint16 version_from;
-	guint32 uid_from;
-	guint32 uid_to;
+	UID uid_from;
+	UID uid_to;
 	guint8 session_md5[QQ_KEY_LENGTH];
 	guint16 im_type;
 };
@@ -528,7 +528,8 @@
 qq_im_format *qq_im_fmt_new(void)
 {
 	qq_im_format *fmt;
-	const gchar simsun[] = { 0xcb, 0xce, 0xcc, 0xe5, 0};	/* simsun in Chinese */
+	/* '0xcb, 0xce, 0xcc, 0xe5' means Chinese '宋体' in utf8 */
+	const gchar simsun[] = { 0xcb, 0xce, 0xcc, 0xe5, 0};
 
 	fmt = g_new0(qq_im_format, 1);
 	memset(fmt, 0, sizeof(qq_im_format));
@@ -541,6 +542,17 @@
 	return fmt;
 }
 
+void qq_im_fmt_reset_font(qq_im_format *fmt)
+{
+	const gchar simsun[] = {0xcb, 0xce, 0xcc, 0xe5, 0x00};
+	g_return_if_fail(NULL != fmt);
+
+	if (NULL != fmt->font) {
+		g_free(fmt->font);
+		fmt->font = g_strdup(simsun);
+	}
+}
+
 qq_im_format *qq_im_fmt_new_by_purple(const gchar *msg)
 {
 	qq_im_format *fmt;
@@ -1036,7 +1048,7 @@
 }
 
 /* send an IM to uid_to */
-static void request_send_im(PurpleConnection *gc, guint32 uid_to, gint type,
+static void request_send_im(PurpleConnection *gc, UID uid_to, gint type,
 	qq_im_format *fmt, gchar *msg, guint8 id, guint8 frag_count, guint8 frag_index)
 {
 	qq_data *qd;
@@ -1241,7 +1253,7 @@
 gint qq_send_im(PurpleConnection *gc, const gchar *who, const gchar *what, PurpleMessageFlags flags)
 {
 	qq_data *qd;
-	guint32 uid_to;
+	UID uid_to;
 	gint type;
 	qq_im_format *fmt;
 	gchar *msg_stripped, *tmp;

mercurial