changeset 31639:4deef745de87

2010.01.23 - flos <lonicerae(at)gmail.com> * added an option to force incoming message in chat room to use a default font instead of the font in message itself 2010.01.18 - flos <lonicerae(at)gmail.com> * added type 'UPDCLS' and 'UID' for implementing business logic layer 2010.01.13 - ccpaging <ccpaging(at)gmail.com> * qq2009-1 patch from ccpaging
author SHiNE CsyFeK <csyfek@gmail.com>
date Sun, 06 Feb 2011 05:23:22 +0000
parents f0e6aaf942f8
children ab175460cea7
files libpurple/protocols/qq/ChangeLog libpurple/protocols/qq/buddy_info.c libpurple/protocols/qq/buddy_info.h libpurple/protocols/qq/buddy_list.c libpurple/protocols/qq/buddy_list.h libpurple/protocols/qq/buddy_memo.c libpurple/protocols/qq/buddy_memo.h libpurple/protocols/qq/buddy_opt.c libpurple/protocols/qq/buddy_opt.h libpurple/protocols/qq/file_trans.c libpurple/protocols/qq/file_trans.h libpurple/protocols/qq/group.h libpurple/protocols/qq/group_im.c libpurple/protocols/qq/group_im.h libpurple/protocols/qq/group_info.c libpurple/protocols/qq/group_info.h libpurple/protocols/qq/group_internal.c libpurple/protocols/qq/group_internal.h libpurple/protocols/qq/group_join.c libpurple/protocols/qq/group_join.h libpurple/protocols/qq/im.c libpurple/protocols/qq/im.h libpurple/protocols/qq/qq.c libpurple/protocols/qq/qq.h libpurple/protocols/qq/qq_base.c libpurple/protocols/qq/qq_base.h libpurple/protocols/qq/qq_define.c libpurple/protocols/qq/qq_define.h libpurple/protocols/qq/qq_network.c libpurple/protocols/qq/qq_network.h libpurple/protocols/qq/qq_process.c libpurple/protocols/qq/qq_process.h libpurple/protocols/qq/qq_trans.c libpurple/protocols/qq/qq_trans.h libpurple/protocols/qq/send_file.c libpurple/protocols/qq/send_file.h libpurple/protocols/qq/utils.c libpurple/protocols/qq/utils.h
diffstat 38 files changed, 255 insertions(+), 177 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/qq/ChangeLog	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/ChangeLog	Sun Feb 06 05:23:22 2011 +0000
@@ -1,3 +1,12 @@
+2010.01.23 - flos <lonicerae(at)gmail.com>
+	* added an option to force incoming message in chat room to use a default font instead of the font in message itself
+
+2010.01.18 - flos <lonicerae(at)gmail.com>
+	* added type 'UPDCLS' and 'UID' for implementing business logic layer
+
+2010.01.13 - ccpaging <ccpaging(at)gmail.com>
+	* qq2009-1 patch from ccpaging
+
 2009.04.23 - flos <lonicerae(at)gmail.com>
 	* Fixed a bug of updating buddy who is not in user's buddy list
 
--- a/libpurple/protocols/qq/buddy_info.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/buddy_info.c	Sun Feb 06 05:23:22 2011 +0000
@@ -222,8 +222,8 @@
 	g_strfreev(segments);
 }
 
-void qq_request_buddy_info(PurpleConnection *gc, guint32 uid,
-		guint32 update_class, int action)
+void qq_request_buddy_info(PurpleConnection *gc, UID uid,
+		UPDCLS update_class, int action)
 {
 	gchar raw_data[16] = {0};
 
@@ -621,7 +621,7 @@
 	PurpleBuddy *buddy = NULL;
 	qq_data *qd = NULL;
 	qq_buddy_data *bd = NULL;
-	guint32 uid;
+	UID uid;
 	gchar *who;
 	gchar *alias_utf8;
 
@@ -742,7 +742,7 @@
 	return;
 }
 
-void qq_request_get_level(PurpleConnection *gc, guint32 uid)
+void qq_request_get_level(PurpleConnection *gc, UID uid)
 {
 	qq_data *qd = (qq_data *) gc->proto_data;
 	guint8 buf[16] = {0};
@@ -757,7 +757,7 @@
 	qq_send_cmd(gc, QQ_CMD_GET_LEVEL, buf, bytes);
 }
 
-void qq_request_get_level_2007(PurpleConnection *gc, guint32 uid)
+void qq_request_get_level_2007(PurpleConnection *gc, UID uid)
 {
 	guint8 buf[16] = {0};
 	gint bytes = 0;
@@ -768,7 +768,7 @@
 	qq_send_cmd(gc, QQ_CMD_GET_LEVEL, buf, bytes);
 }
 
-void qq_request_get_buddies_level(PurpleConnection *gc, guint32 update_class)
+void qq_request_get_buddies_level(PurpleConnection *gc, UPDCLS update_class)
 {
 	qq_data *qd = (qq_data *) gc->proto_data;
 	PurpleBuddy *buddy;
@@ -798,7 +798,8 @@
 static void process_level(PurpleConnection *gc, guint8 *data, gint data_len)
 {
 	gint bytes = 0;
-	guint32 uid, onlineTime;
+	UID uid;
+	guint32 onlineTime;
 	guint16 level, timeRemainder;
 	qq_buddy_data *bd;
 
@@ -830,7 +831,8 @@
 static void process_level_2007(PurpleConnection *gc, guint8 *data, gint data_len)
 {
 	gint bytes;
-	guint32 uid, onlineTime;
+	UID uid;
+	guint32 onlineTime;
 	guint16 level, timeRemainder;
 	qq_buddy_data *bd;
 	guint16 str_len;
--- a/libpurple/protocols/qq/buddy_info.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/buddy_info.h	Sun Feb 06 05:23:22 2011 +0000
@@ -78,15 +78,14 @@
 gchar *qq_get_icon_path(gchar *icon_name);
 void qq_change_icon_cb(PurpleConnection *gc, const char *filepath);
 
-void qq_request_buddy_info(PurpleConnection *gc, guint32 uid,
-		guint32 update_class, int action);
+void qq_request_buddy_info(PurpleConnection *gc, UID uid, UPDCLS update_class, int action);
 void qq_set_custom_icon(PurpleConnection *gc, PurpleStoredImage *img);
 void qq_process_change_info(PurpleConnection *gc, guint8 *data, gint data_len);
 void qq_process_get_buddy_info(guint8 *data, gint data_len, guint32 action, PurpleConnection *gc);
 
-void qq_request_get_level(PurpleConnection *gc, guint32 uid);
-void qq_request_get_level_2007(PurpleConnection *gc, guint32 uid);
-void qq_request_get_buddies_level(PurpleConnection *gc, guint32 update_class);
+void qq_request_get_level(PurpleConnection *gc, UID uid);
+void qq_request_get_level_2007(PurpleConnection *gc, UID uid);
+void qq_request_get_buddies_level(PurpleConnection *gc, UPDCLS update_class);
 void qq_process_get_level_reply(guint8 *buf, gint buf_len, PurpleConnection *gc);
 
 void qq_update_buddy_icon(PurpleAccount *account, const gchar *who, gint face);
--- a/libpurple/protocols/qq/buddy_list.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/buddy_list.c	Sun Feb 06 05:23:22 2011 +0000
@@ -53,7 +53,7 @@
 } qq_buddy_online;
 
 /* get a list of online_buddies */
-void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, guint32 update_class)
+void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, UPDCLS update_class)
 {
 	guint8 *raw_data;
 	gint bytes = 0;
@@ -77,7 +77,7 @@
 
 /* position starts with 0x0000,
  * server may return a position tag if list is too long for one packet */
-void qq_request_get_buddies(PurpleConnection *gc, guint16 position, guint32 update_class)
+void qq_request_get_buddies(PurpleConnection *gc, guint16 position, UPDCLS update_class)
 {
 	qq_data *qd;
 	guint8 raw_data[16] = {0};
@@ -101,7 +101,7 @@
 }
 
 /* get all list, buddies & Quns with groupsid support */
-void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, guint32 update_class)
+void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, UPDCLS update_class)
 {
 	guint8 raw_data[16] = {0};
 	gint bytes = 0;
@@ -362,7 +362,7 @@
 	gint bytes;
 	guint8 sub_cmd, reply_code;
 	guint32 unknown, position;
-	guint32 uid;
+	UID uid;
 	guint8 type;
 	qq_room_data *rmd;
 
@@ -455,7 +455,7 @@
 }
 
 /* send a packet to change my online status */
-void qq_request_change_status(PurpleConnection *gc, guint32 update_class)
+void qq_request_change_status(PurpleConnection *gc, UPDCLS update_class)
 {
 	qq_data *qd;
 	guint8 raw_data[16] = {0};
@@ -525,7 +525,7 @@
 {
 	qq_data *qd;
 	gint bytes;
-	guint32 my_uid;
+	UID my_uid;
 	gchar *who;
 	PurpleBuddy *buddy;
 	qq_buddy_data *bd;
@@ -583,7 +583,7 @@
 }
 
 /*TODO: maybe this should be qq_update_buddy_status() ?*/
-void qq_update_buddy_status(PurpleConnection *gc, guint32 uid, guint8 status, guint8 flag)
+void qq_update_buddy_status(PurpleConnection *gc, UID uid, guint8 status, guint8 flag)
 {
 	gchar *who;
 	const gchar *status_id;
--- a/libpurple/protocols/qq/buddy_list.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/buddy_list.h	Sun Feb 06 05:23:22 2011 +0000
@@ -30,7 +30,7 @@
 
 #include "qq.h"
 typedef struct _qq_buddy_status {
-	guint32 uid;
+	UID uid;
 	guint8 unknown1;
 	struct in_addr ip;
 	guint16 port;
@@ -40,20 +40,20 @@
 	guint8 unknown_key[QQ_KEY_LENGTH];
 } qq_buddy_status;
 
-void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, guint32 update_class);
+void qq_request_get_buddies_online(PurpleConnection *gc, guint8 position, UPDCLS update_class);
 guint8 qq_process_get_buddies_online(guint8 *data, gint data_len, PurpleConnection *gc);
 
-void qq_request_get_buddies(PurpleConnection *gc, guint16 position, guint32 update_class);
+void qq_request_get_buddies(PurpleConnection *gc, guint16 position, UPDCLS update_class);
 guint16 qq_process_get_buddies(guint8 *data, gint data_len, PurpleConnection *gc);
 
-void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, guint32 update_class);
+void qq_request_get_buddies_and_rooms(PurpleConnection *gc, guint32 position, UPDCLS update_class);
 guint32 qq_process_get_buddies_and_rooms(guint8 *data, gint data_len, PurpleConnection *gc);
 
-void qq_request_change_status(PurpleConnection *gc, guint32 update_class);
+void qq_request_change_status(PurpleConnection *gc, UPDCLS update_class);
 void qq_process_change_status(guint8 *data, gint data_len, PurpleConnection *gc);
 void qq_process_buddy_change_status(guint8 *data, gint data_len, PurpleConnection *gc);
 
 void qq_update_buddyies_status(PurpleConnection *gc);
-void qq_update_buddy_status(PurpleConnection *gc, guint32 uid, guint8 status, guint8 flag);
+void qq_update_buddy_status(PurpleConnection *gc, UID uid, guint8 status, guint8 flag);
 void qq_buddy_data_free_all(PurpleConnection *gc);
 #endif
--- a/libpurple/protocols/qq/buddy_memo.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/buddy_memo.c	Sun Feb 06 05:23:22 2011 +0000
@@ -83,7 +83,7 @@
 
 typedef struct _modify_memo_request {
 	PurpleConnection *gc;
-	guint32 bd_uid;
+	UID bd_uid;
 	gchar **segments;
 } modify_memo_request;
 
@@ -107,7 +107,7 @@
 	purple_debug_info("QQ", "memo freed\n");
 }
 
-static void update_buddy_memo(PurpleConnection *gc, guint32 bd_uid, gchar *alias)
+static void update_buddy_memo(PurpleConnection *gc, UID bd_uid, gchar *alias)
 {
 	PurpleAccount *account;
 	PurpleBuddy *buddy;
@@ -127,7 +127,7 @@
 	purple_blist_alias_buddy(buddy, (const char*)alias);
 }
 
-static void request_change_memo(PurpleConnection *gc, guint32 bd_uid, gchar **segments)
+static void request_change_memo(PurpleConnection *gc, UID bd_uid, gchar **segments)
 {
 	gint bytes;
 	/* Attention, length of each segment must be guint8(0~255),
@@ -170,7 +170,7 @@
 static void memo_modify_ok_cb(modify_memo_request *memo_request, PurpleRequestFields *fields)
 {
 	PurpleConnection *gc;
-	guint32 bd_uid;
+	UID bd_uid;
 	gchar **segments;
 	const gchar *utf8_str;
 	gchar *value = NULL;
@@ -187,7 +187,7 @@
 		utf8_str = purple_request_fields_get_string(fields, memo_id[index]);
 		/* update alias */
 		if (QQ_MEMO_ALIAS == index) {
-			update_buddy_memo(gc, bd_uid, segments[QQ_MEMO_ALIAS]);
+			update_buddy_memo(gc, (UID)bd_uid, segments[QQ_MEMO_ALIAS]);
 		}
 		if (NULL == utf8_str) {
 			value = g_strdup("");
@@ -213,7 +213,7 @@
 }
 
 /* memo modify dialogue */
-static void memo_modify_dialogue(PurpleConnection *gc, guint32 bd_uid, gchar **segments, guint32 action)
+static void memo_modify_dialogue(PurpleConnection *gc, UID bd_uid, gchar **segments, guint32 action)
 {
 	modify_memo_request *memo_request;
 	PurpleRequestField *field;
@@ -272,7 +272,7 @@
 	}
 }
 
-static void qq_create_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 action)
+static void qq_create_buddy_memo(PurpleConnection *gc, UID bd_uid, guint32 action)
 {
 	gchar **segments;
 	gint index;
@@ -285,9 +285,11 @@
 	memo_modify_dialogue(gc, bd_uid, segments, action);
 }
 
-/* process reply to get_memo packet */
+/* process reply to get_memo packet
+ * here, update_class will be regarded as buddy's uid. because some 
+ * memo packages returned without uid, which will make us confused */
 void qq_process_get_buddy_memo(PurpleConnection *gc, guint8* data, gint data_len,
-		guint32 update_class, guint32 action)
+		UPDCLS update_class, guint32 action)
 {
 	gchar **segments;
 	gint bytes;
@@ -314,7 +316,9 @@
 	if (1 == data_len) { /* only one byte */
 		purple_debug_info("QQ", "memo packet contains no buddy uid and memo...\n");
 		if (QQ_BUDDY_MEMO_MODIFY == action) {
-			qq_create_buddy_memo(gc, (guint32)update_class, QQ_BUDDY_MEMO_MODIFY);
+			UID mod_uid;
+			mod_uid = (UID)update_class;
+			qq_create_buddy_memo(gc, mod_uid, QQ_BUDDY_MEMO_MODIFY);
 			return;
 		}
 		return;
@@ -354,9 +358,9 @@
 			}
 
 			/* common action, update buddy memo */
-			update_buddy_memo(gc, rcv_uid, segments[QQ_MEMO_ALIAS]);
+			update_buddy_memo(gc, (UID)rcv_uid, segments[QQ_MEMO_ALIAS]);
 
-			/* memo is thing that we regard our buddy as, so we need one more buddy_uid */
+			/* memo is a thing that we regard our buddy as, so we need one more buddy_uid */
 			memo_modify_dialogue(gc, rcv_uid, segments, action);
 			break;
 		default:
@@ -365,8 +369,12 @@
 	}
 }
 
-/* request buddy memo */
-void qq_request_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 update_class, guint32 action)
+/* request buddy memo
+ *
+ * param: gc, uid, update_class, action
+ * here, update_class will be set to buddy's uid. because some memo 
+ * packages returned without uid, which will make us confused */
+void qq_request_buddy_memo(PurpleConnection *gc, UID bd_uid, UPDCLS update_class, guint32 action)
 {
 	guint8 raw_data[16] = {0};
 	gint bytes;
--- a/libpurple/protocols/qq/buddy_memo.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/buddy_memo.h	Sun Feb 06 05:23:22 2011 +0000
@@ -28,6 +28,7 @@
 #include <glib.h>
 #include "connection.h"
 #include "blist.h"
+#include "qq.h"
 
 #define QQ_BUDDY_MEMO_REQUEST_SUCCESS 0x00
 
@@ -40,9 +41,9 @@
 };
 
 
-void qq_process_get_buddy_memo(PurpleConnection *gc, guint8* data, gint data_len, guint32 update_class, guint32 action);
+void qq_process_get_buddy_memo(PurpleConnection *gc, guint8* data, gint data_len, UPDCLS update_class, guint32 action);
 
-void qq_request_buddy_memo(PurpleConnection *gc, guint32 bd_uid, guint32 update_class, guint32 action);
+void qq_request_buddy_memo(PurpleConnection *gc, UID bd_uid, UPDCLS update_class, guint32 action);
 
 #endif
 
--- a/libpurple/protocols/qq/buddy_opt.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/buddy_opt.c	Sun Feb 06 05:23:22 2011 +0000
@@ -51,12 +51,12 @@
 
 typedef struct _qq_buddy_req {
 	PurpleConnection *gc;
-	guint32 uid;
+	UID uid;
 	guint8 *auth;
 	guint8 auth_len;
 } qq_buddy_req;
 
-void add_buddy_authorize_input(PurpleConnection *gc, guint32 uid,
+void add_buddy_authorize_input(PurpleConnection *gc, UID uid,
 		guint8 *auth, guint8 auth_len);
 
 static void buddy_req_free(qq_buddy_req *add_req)
@@ -88,7 +88,7 @@
 	return g;
 }
 
-static qq_buddy_data *qq_buddy_data_new(guint32 uid)
+static qq_buddy_data *qq_buddy_data_new(UID uid)
 {
 	qq_buddy_data *bd = g_new0(qq_buddy_data, 1);
 	memset(bd, 0, sizeof(qq_buddy_data));
@@ -97,7 +97,7 @@
 	return bd;
 }
 
-qq_buddy_data *qq_buddy_data_find(PurpleConnection *gc, guint32 uid)
+qq_buddy_data *qq_buddy_data_find(PurpleConnection *gc, UID uid)
 {
 	gchar *who;
 	PurpleBuddy *buddy;
@@ -131,7 +131,7 @@
 }
 
 /* create purple buddy without data and display with no-auth icon */
-PurpleBuddy *qq_buddy_new(PurpleConnection *gc, guint32 uid)
+PurpleBuddy *qq_buddy_new(PurpleConnection *gc, UID uid)
 {
 	PurpleBuddy *buddy;
 	PurpleGroup *group;
@@ -175,7 +175,7 @@
 	purple_blist_remove_buddy(buddy);
 }
 
-PurpleBuddy *qq_buddy_find(PurpleConnection *gc, guint32 uid)
+PurpleBuddy *qq_buddy_find(PurpleConnection *gc, UID uid)
 {
 	PurpleBuddy *buddy;
 	gchar *who;
@@ -188,7 +188,7 @@
 	return buddy;
 }
 
-PurpleBuddy *qq_buddy_find_or_new(PurpleConnection *gc, guint32 uid)
+PurpleBuddy *qq_buddy_find_or_new(PurpleConnection *gc, UID uid)
 {
 	PurpleBuddy *buddy;
 	qq_buddy_data *bd;
@@ -213,7 +213,7 @@
 }
 
 /* send packet to remove a buddy from my buddy list */
-static void request_remove_buddy(PurpleConnection *gc, guint32 uid)
+static void request_remove_buddy(PurpleConnection *gc, UID uid)
 {
 	gchar uid_str[11];
 	gint bytes;
@@ -226,7 +226,7 @@
 }
 
 static void request_remove_buddy_ex(PurpleConnection *gc,
-		guint32 uid, guint8 *auth, guint8 auth_len)
+		UID uid, guint8 *auth, guint8 auth_len)
 {
 	gint bytes;
 	guint8 *raw_data;
@@ -246,7 +246,7 @@
 	qq_send_cmd_mess(gc, QQ_CMD_REMOVE_BUDDY, raw_data, bytes, 0, uid);
 }
 
-void qq_request_auth_code(PurpleConnection *gc, guint8 cmd, guint16 sub_cmd, guint32 uid)
+void qq_request_auth_code(PurpleConnection *gc, guint8 cmd, guint16 sub_cmd, UID uid)
 {
 	guint8 raw_data[16];
 	gint bytes;
@@ -260,7 +260,7 @@
 	qq_send_cmd_mess(gc, QQ_CMD_AUTH_CODE, raw_data, bytes, 0, uid);
 }
 
-void qq_process_auth_code(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid)
+void qq_process_auth_code(PurpleConnection *gc, guint8 *data, gint data_len, UID uid)
 {
 	gint bytes;
 	guint8 cmd, reply;
@@ -308,7 +308,7 @@
 	buddy_req_free(add_req);
 }
 
-static void add_buddy_question_input(PurpleConnection *gc, guint32 uid, gchar *question)
+static void add_buddy_question_input(PurpleConnection *gc, UID uid, gchar *question)
 {
 	gchar *who, *msg;
 	qq_buddy_req *add_req;
@@ -336,7 +336,7 @@
 }
 
 void qq_request_question(PurpleConnection *gc,
-		guint8 cmd, guint32 uid, const gchar *question_utf8, const gchar *answer_utf8)
+		guint8 cmd, UID uid, const gchar *question_utf8, const gchar *answer_utf8)
 {
 	guint8 raw_data[MAX_PACKET_SIZE - 16];
 	gint bytes;
@@ -371,7 +371,7 @@
 	return;
 }
 
-static void request_add_buddy_by_question(PurpleConnection *gc, guint32 uid,
+static void request_add_buddy_by_question(PurpleConnection *gc, UID uid,
 	guint8 *code, guint16 code_len)
 {
 	guint8 raw_data[MAX_PACKET_SIZE - 16];
@@ -395,7 +395,7 @@
 	qq_send_cmd(gc, QQ_CMD_ADD_BUDDY_AUTH_EX, raw_data, bytes);
 }
 
-void qq_process_question(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid)
+void qq_process_question(PurpleConnection *gc, guint8 *data, gint data_len, UID uid)
 {
 	gint bytes;
 	guint8 cmd, reply;
@@ -461,7 +461,7 @@
 }
 
 /* try to remove myself from someone's buddy list */
-static void request_buddy_remove_me(PurpleConnection *gc, guint32 uid)
+static void request_buddy_remove_me(PurpleConnection *gc, UID uid)
 {
 	guint8 raw_data[16] = {0};
 	gint bytes = 0;
@@ -474,7 +474,7 @@
 }
 
 /* try to add a buddy without authentication */
-static void request_add_buddy_no_auth(PurpleConnection *gc, guint32 uid)
+static void request_add_buddy_no_auth(PurpleConnection *gc, UID uid)
 {
 	gchar uid_str[11];
 
@@ -486,7 +486,7 @@
 			(guint8 *) uid_str, strlen(uid_str), 0, uid);
 }
 
-static void request_add_buddy_no_auth_ex(PurpleConnection *gc, guint32 uid)
+static void request_add_buddy_no_auth_ex(PurpleConnection *gc, UID uid)
 {
 	guint bytes;
 	guint8 raw_data[16];
@@ -499,7 +499,7 @@
 }
 
 /* this buddy needs authentication, text conversion is done at lowest level */
-static void request_add_buddy_auth(PurpleConnection *gc, guint32 uid, const gchar response, const gchar *text)
+static void request_add_buddy_auth(PurpleConnection *gc, UID uid, const gchar response, const gchar *text)
 {
 	guint8 raw_data[MAX_PACKET_SIZE - 16];
 	gint bytes;
@@ -526,7 +526,7 @@
 	qq_send_cmd(gc, QQ_CMD_ADD_BUDDY_AUTH, raw_data, bytes);
 }
 
-static void request_add_buddy_auth_ex(PurpleConnection *gc, guint32 uid,
+static void request_add_buddy_auth_ex(PurpleConnection *gc, UID uid,
 	const gchar *text, guint8 *auth, guint8 auth_len)
 {
 	guint8 raw_data[MAX_PACKET_SIZE - 16];
@@ -643,7 +643,7 @@
 	buddy_req_free(add_req);
 }
 
-void add_buddy_authorize_input(PurpleConnection *gc, guint32 uid,
+void add_buddy_authorize_input(PurpleConnection *gc, UID uid,
 		guint8 *auth, guint8 auth_len)
 {
 	gchar *who, *msg;
@@ -683,7 +683,7 @@
 void qq_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
 {
 	qq_data *qd;
-	guint32 uid;
+	UID uid;
 
 	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
 	g_return_if_fail(buddy != NULL);
@@ -733,7 +733,7 @@
 }
 
 /* process the server reply for my request to remove a buddy */
-void qq_process_remove_buddy(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid)
+void qq_process_remove_buddy(PurpleConnection *gc, guint8 *data, gint data_len, UID uid)
 {
 	PurpleBuddy *buddy = NULL;
 	gchar *msg;
@@ -756,7 +756,7 @@
 }
 
 /* process the server reply for my request to remove myself from a buddy */
-void qq_process_buddy_remove_me(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid)
+void qq_process_buddy_remove_me(PurpleConnection *gc, guint8 *data, gint data_len, UID uid)
 {
 	gchar *msg;
 
@@ -772,7 +772,7 @@
 }
 
 void qq_process_add_buddy_no_auth(PurpleConnection *gc,
-		guint8 *data, gint data_len, guint32 uid)
+		guint8 *data, gint data_len, UID uid)
 {
 	qq_data *qd;
 	gchar **segments;
@@ -834,11 +834,11 @@
 }
 
 void qq_process_add_buddy_no_auth_ex(PurpleConnection *gc,
-		guint8 *data, gint data_len, guint32 uid)
+		guint8 *data, gint data_len, UID uid)
 {
 	qq_data *qd;
 	gint bytes;
-	guint32 dest_uid;
+	UID dest_uid;
 	guint8 reply;
 	guint8 auth_type;
 
@@ -903,7 +903,7 @@
 {
 	qq_data *qd;
 	qq_buddy_data *bd;
-	guint32 uid;
+	UID uid;
 
 	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
 	g_return_if_fail(buddy != NULL);
@@ -933,7 +933,7 @@
 	 * otherwise purple segmentation fault */
 }
 
-static void buddy_add_input(PurpleConnection *gc, guint32 uid, gchar *reason)
+static void buddy_add_input(PurpleConnection *gc, UID uid, gchar *reason)
 {
 	PurpleAccount *account = purple_connection_get_account(gc);
 	qq_buddy_req *add_req;
@@ -967,7 +967,7 @@
 static void server_buddy_add_request(PurpleConnection *gc, gchar *from, gchar *to,
 		guint8 *data, gint data_len)
 {
-	guint32 uid;
+	UID uid;
 	gchar *msg, *reason;
 
 	g_return_if_fail(from != NULL && to != NULL);
@@ -996,7 +996,7 @@
 	gint bytes;
 	guint8 cmd;
 	guint8 reply;
-	guint32 uid;
+	UID uid;
 	guint16 flag1, flag2;
 
 	g_return_if_fail(data != NULL && data_len >= 5);
@@ -1026,7 +1026,7 @@
 {
 	guint8 *raw_data;
 	gint bytes;
-	guint32 uid;
+	UID uid;
 
 	g_return_if_fail(code != NULL && code_len > 0 && from != NULL);
 
@@ -1073,7 +1073,7 @@
 		guint8 *data, gint data_len)
 {
 	gint bytes;
-	guint32 uid;
+	UID uid;
 	gchar *msg;
 	guint8 allow_reverse;
 
@@ -1103,7 +1103,7 @@
 {
 	PurpleAccount *account = purple_connection_get_account(gc);
 	PurpleBuddy *buddy;
-	guint32 uid;
+	UID uid;
 	qq_buddy_req *add_req;
 	gchar *who;
 	gchar *primary;
@@ -1177,7 +1177,7 @@
 {
 	PurpleAccount *account = purple_connection_get_account(gc);
 	qq_data *qd;
-	guint32 uid;
+	UID uid;
 
 	g_return_if_fail(from != NULL && to != NULL);
 
@@ -1204,7 +1204,7 @@
 static void server_buddy_rejected_me(PurpleConnection *gc, gchar *from, gchar *to,
 		guint8 *data, gint data_len)
 {
-	guint32 uid;
+	UID uid;
 	PurpleBuddy *buddy;
 	gchar *msg, *msg_utf8;
 	gint bytes;
--- a/libpurple/protocols/qq/buddy_opt.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/buddy_opt.h	Sun Feb 06 05:23:22 2011 +0000
@@ -54,31 +54,31 @@
 void qq_remove_buddy_and_me(PurpleBlistNode * node);
 void qq_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group);
 
-void qq_process_remove_buddy(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid);
-void qq_process_buddy_remove_me(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid);
+void qq_process_remove_buddy(PurpleConnection *gc, guint8 *data, gint data_len, UID uid);
+void qq_process_buddy_remove_me(PurpleConnection *gc, guint8 *data, gint data_len, UID uid);
 void qq_process_add_buddy_no_auth(PurpleConnection *gc,
-		guint8 *data, gint data_len, guint32 uid);
+		guint8 *data, gint data_len, UID uid);
 void qq_process_add_buddy_no_auth_ex(PurpleConnection *gc,
-		guint8 *data, gint data_len, guint32 uid);
+		guint8 *data, gint data_len, UID uid);
 void qq_process_add_buddy_auth(guint8 *data, gint data_len, PurpleConnection *gc);
 void qq_process_buddy_from_server(PurpleConnection *gc, int funct,
 		gchar *from, gchar *to, guint8 *data, gint data_len);
 
 void qq_process_buddy_check_code(PurpleConnection *gc, guint8 *data, gint data_len);
 
-void qq_request_auth_code(PurpleConnection *gc, guint8 cmd, guint16 sub_cmd, guint32 uid);
-void qq_process_auth_code(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid);
+void qq_request_auth_code(PurpleConnection *gc, guint8 cmd, guint16 sub_cmd, UID uid);
+void qq_process_auth_code(PurpleConnection *gc, guint8 *data, gint data_len, UID uid);
 void qq_request_question(PurpleConnection *gc,
-		guint8 cmd, guint32 uid, const gchar *question_utf8, const gchar *answer_utf8);
-void qq_process_question(PurpleConnection *gc, guint8 *data, gint data_len, guint32 uid);
+		guint8 cmd, UID uid, const gchar *question_utf8, const gchar *answer_utf8);
+void qq_process_question(PurpleConnection *gc, guint8 *data, gint data_len, UID uid);
 
 void qq_process_add_buddy_auth_ex(PurpleConnection *gc, guint8 *data, gint data_len, guint32 ship32);
 
-qq_buddy_data *qq_buddy_data_find(PurpleConnection *gc, guint32 uid);
+qq_buddy_data *qq_buddy_data_find(PurpleConnection *gc, UID uid);
 void qq_buddy_data_free(qq_buddy_data *bd);
 
-PurpleBuddy *qq_buddy_new(PurpleConnection *gc, guint32 uid);
-PurpleBuddy *qq_buddy_find_or_new(PurpleConnection *gc, guint32 uid);
-PurpleBuddy *qq_buddy_find(PurpleConnection *gc, guint32 uid);
+PurpleBuddy *qq_buddy_new(PurpleConnection *gc, UID uid);
+PurpleBuddy *qq_buddy_find_or_new(PurpleConnection *gc, UID uid);
+PurpleBuddy *qq_buddy_find(PurpleConnection *gc, UID uid);
 PurpleGroup *qq_group_find_or_new(const gchar *group_name);
 #endif
--- a/libpurple/protocols/qq/file_trans.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/file_trans.c	Sun Feb 06 05:23:22 2011 +0000
@@ -41,8 +41,8 @@
 struct _qq_file_header {
 	guint16 client_ver;
 	guint8 file_key;
-	guint32 sender_uid;
-	guint32 receiver_uid;
+	UID sender_uid;
+	UID receiver_uid;
 };
 
 typedef struct _qq_file_header qq_file_header;
@@ -62,12 +62,12 @@
 	return _get_file_key(seed);
 }
 
-static guint32 _decrypt_qq_uid(guint32 uid, guint32 key)
+static guint32 _decrypt_qq_uid(UID uid, guint32 key)
 {
 	return ~(uid ^ key);
 }
 
-static guint32 _encrypt_qq_uid(guint32 uid, guint32 key)
+static guint32 _encrypt_qq_uid(UID uid, guint32 key)
 {
 	return (~uid) ^ key;
 }
@@ -232,7 +232,7 @@
 }
 #endif
 
-static gint _qq_send_file(PurpleConnection *gc, guint8 *data, gint len, guint16 packet_type, guint32 to_uid)
+static gint _qq_send_file(PurpleConnection *gc, guint8 *data, gint len, guint16 packet_type, UID to_uid)
 {
 	guint8 *raw_data;
 	gint bytes = 0;
@@ -259,7 +259,7 @@
 }
 
 /* send a file to udp channel with QQ_FILE_CONTROL_PACKET_TAG */
-void qq_send_file_ctl_packet(PurpleConnection *gc, guint16 packet_type, guint32 to_uid, guint8 hellobyte)
+void qq_send_file_ctl_packet(PurpleConnection *gc, guint16 packet_type, UID to_uid, guint8 hellobyte)
 {
 	qq_data *qd;
 	gint bytes, bytes_expected, encrypted_len;
--- a/libpurple/protocols/qq/file_trans.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/file_trans.h	Sun Feb 06 05:23:22 2011 +0000
@@ -26,6 +26,7 @@
 #define _QQ_QQ_FILE_TRANS_H_
 
 #include "server.h"
+#include "qq.h"
 
 enum {
 	QQ_FILE_CMD_SENDER_SAY_HELLO = 0x31,
@@ -59,7 +60,7 @@
 #define QQ_FILE_AGENT_PACKET_TAG 0x04
 /* #define QQ_PACKET_TAIL          0x03 */   /* all QQ text packets end with it */
 
-void qq_send_file_ctl_packet(PurpleConnection *gc, guint16 packet_type, guint32 to_uid, guint8 hellobyte);
+void qq_send_file_ctl_packet(PurpleConnection *gc, guint16 packet_type, UID to_uid, guint8 hellobyte);
 void qq_process_recv_file(PurpleConnection *gc, guint8 *data, gint len);
 /* void qq_send_file_data_packet(PurpleConnection *gc, guint16 packet_type, guint8 sub_type, guint32 fragment_index, guint16 seq, guint8 *data, gint len); */
 void qq_xfer_close_file(PurpleXfer *xfer);
--- a/libpurple/protocols/qq/group.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/group.h	Sun Feb 06 05:23:22 2011 +0000
@@ -47,7 +47,7 @@
 	guint32 id;
 	guint32 ext_id;
 	guint8 type8;			/* permanent or temporory */
-	guint32 creator_uid;
+	UID creator_uid;
 	guint32 category;
 	guint8 auth_type;
 	gchar *title_utf8;
--- a/libpurple/protocols/qq/group_im.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/group_im.c	Sun Feb 06 05:23:22 2011 +0000
@@ -161,7 +161,7 @@
 }
 
 void qq_room_got_chat_in(PurpleConnection *gc,
-		guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time)
+		guint32 room_id, UID uid_from, const gchar *msg, time_t in_time)
 {
 	PurpleConversation *conv;
 	qq_data *qd;
@@ -207,10 +207,11 @@
 {
 	gchar *msg_smiley, *msg_fmt, *msg_utf8;
 	gint bytes, tail_len;
+	qq_data *qd;
 	struct {
 		guint32 ext_id;
 		guint8 type8;
-		guint32 member_uid;
+		UID member_uid;
 		guint16 unknown;
 		guint16 msg_seq;
 		time_t send_time;
@@ -222,11 +223,15 @@
 	guint16 content_type;
 	guint8 frag_count, frag_index;
 	guint16 msg_id;
+	guint32 use_default_font;
 	qq_im_format *fmt = NULL;
+	qd = (qq_data *) gc->proto_data;
 
 	/* at least include im_text.msg_len */
 	g_return_if_fail(data != NULL && data_len > 23);
 
+	use_default_font = (qd->custom) & QQ_CUSTOM_USE_DEFAULT_FONT;
+
 	/* qq_show_packet("ROOM_IM", data, data_len); */
 	memset(&im_text, 0, sizeof(im_text));
 	bytes = 0;
@@ -279,8 +284,14 @@
 	/* group im_group has no flag to indicate whether it has font_attr or not */
 	msg_smiley = qq_emoticon_to_purple(im_text.msg);
 	if (fmt != NULL) {
+		purple_debug_info("QQ", "going to use_default_font\n");
+		if (QQ_CUSTOM_USE_DEFAULT_FONT == use_default_font) {
+			qq_im_fmt_reset_font(fmt);
+			purple_debug_info("QQ", "use_default_font set\n");
+		}
 		msg_fmt = qq_im_fmt_to_purple(fmt, msg_smiley);
 		msg_utf8 =  qq_to_utf8(msg_fmt, QQ_CHARSET_DEFAULT);
+		purple_debug_info("QQ", "passed!\n");
 		g_free(msg_fmt);
 		qq_im_fmt_free(fmt);
 	} else {
--- a/libpurple/protocols/qq/group_im.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/group_im.h	Sun Feb 06 05:23:22 2011 +0000
@@ -30,11 +30,16 @@
 #include "conversation.h"
 #include "group.h"
 
+enum {
+	QQ_CUSTOM_USE_DEFAULT_FONT = 0x00000001,
+	QQ_CUSTOM_NONE = 0x00000000
+};
+
 PurpleConversation *qq_room_conv_open(PurpleConnection *gc, qq_room_data *rmd);
 void qq_room_conv_set_onlines(PurpleConnection *gc, qq_room_data *rmd);
 
 void qq_room_got_chat_in(PurpleConnection *gc,
-		guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time);
+		guint32 room_id, UID uid_from, const gchar *msg, time_t in_time);
 
 int qq_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags);
 void qq_process_room_send_im(PurpleConnection *gc, guint8 *data, gint len);
@@ -43,3 +48,4 @@
 void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type);
 
 #endif
+
--- a/libpurple/protocols/qq/group_info.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/group_info.c	Sun Feb 06 05:23:22 2011 +0000
@@ -65,7 +65,7 @@
 }
 
 /* send packet to get info for each group member */
-gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, guint32 update_class)
+gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, UPDCLS update_class)
 {
 	guint8 *raw_data;
 	gint bytes, num;
@@ -177,7 +177,8 @@
 	PurpleConversation *conv;
 	guint8 organization, role;
 	guint16 unknown, max_members;
-	guint32 member_uid, id, ext_id;
+	UID member_uid;
+	guint32 id, ext_id;
 	guint32 unknown4;
 	guint8 unknown1;
 	gint bytes, num;
@@ -286,7 +287,8 @@
 
 void qq_process_room_cmd_get_onlines(guint8 *data, gint len, PurpleConnection *gc)
 {
-	guint32 room_id, member_uid;
+	guint32 room_id;
+	UID member_uid;
 	guint8 unknown;
 	gint bytes, num;
 	qq_room_data *rmd;
@@ -334,7 +336,8 @@
 {
 	gint bytes;
 	gint num;
-	guint32 id, member_uid;
+	guint32 id;
+	UID member_uid;
 	guint16 unknown;
 	qq_room_data *rmd;
 	qq_buddy_data *bd;
--- a/libpurple/protocols/qq/group_info.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/group_info.h	Sun Feb 06 05:23:22 2011 +0000
@@ -34,7 +34,7 @@
 	QQ_ROOM_INFO_DISPLAY
 };
 
-gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, guint32 update_class);
+gint qq_request_room_get_buddies(PurpleConnection *gc, guint32 room_id, UPDCLS update_class);
 
 void qq_process_room_cmd_get_info(guint8 *data, gint len, guint32 action, PurpleConnection *gc);
 void qq_process_room_cmd_get_onlines(guint8 *data, gint len, PurpleConnection *gc);
--- a/libpurple/protocols/qq/group_internal.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/group_internal.c	Sun Feb 06 05:23:22 2011 +0000
@@ -207,7 +207,7 @@
 }
 
 /* find a qq_buddy_data by uid, called by im.c */
-qq_buddy_data *qq_room_buddy_find(qq_room_data *rmd, guint32 uid)
+qq_buddy_data *qq_room_buddy_find(qq_room_data *rmd, UID uid)
 {
 	GList *list;
 	qq_buddy_data *bd;
@@ -226,7 +226,7 @@
 }
 
 /* remove a qq_buddy_data by uid, called by qq_group_opt.c */
-void qq_room_buddy_remove(qq_room_data *rmd, guint32 uid)
+void qq_room_buddy_remove(qq_room_data *rmd, UID uid)
 {
 	GList *list;
 	qq_buddy_data *bd;
@@ -244,7 +244,7 @@
 	}
 }
 
-qq_buddy_data *qq_room_buddy_find_or_new(PurpleConnection *gc, qq_room_data *rmd, guint32 member_uid)
+qq_buddy_data *qq_room_buddy_find_or_new(PurpleConnection *gc, qq_room_data *rmd, UID member_uid)
 {
 	qq_buddy_data *member, *bd;
 	PurpleBuddy *buddy;
--- a/libpurple/protocols/qq/group_internal.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/group_internal.h	Sun Feb 06 05:23:22 2011 +0000
@@ -36,9 +36,9 @@
 void qq_room_remove(PurpleConnection *gc, guint32 id);
 void qq_room_update_chat_info(PurpleChat *chat, qq_room_data *rmd);
 
-qq_buddy_data *qq_room_buddy_find(qq_room_data *rmd, guint32 uid);
-void qq_room_buddy_remove(qq_room_data *rmd, guint32 uid);
-qq_buddy_data *qq_room_buddy_find_or_new(PurpleConnection *gc, qq_room_data *rmd, guint32 member_uid);
+qq_buddy_data *qq_room_buddy_find(qq_room_data *rmd, UID uid);
+void qq_room_buddy_remove(qq_room_data *rmd, UID uid);
+qq_buddy_data *qq_room_buddy_find_or_new(PurpleConnection *gc, qq_room_data *rmd, UID member_uid);
 
 void qq_room_data_initial(PurpleConnection *gc);
 void qq_room_data_free_all(PurpleConnection *gc);
--- a/libpurple/protocols/qq/group_join.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/group_join.c	Sun Feb 06 05:23:22 2011 +0000
@@ -155,7 +155,7 @@
 }
 
 void qq_send_cmd_group_auth(PurpleConnection *gc, qq_room_data *rmd,
-		guint8 opt, guint32 uid, const gchar *reason_utf8)
+		guint8 opt, UID uid, const gchar *reason_utf8)
 {
 	guint8 raw_data[MAX_PACKET_SIZE - 16];
 	gint bytes;
--- a/libpurple/protocols/qq/group_join.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/group_join.h	Sun Feb 06 05:23:22 2011 +0000
@@ -49,7 +49,7 @@
 void qq_request_room_search(PurpleConnection *gc, guint32 ext_id, int action);
 void qq_process_room_search(PurpleConnection *gc, guint8 *data, gint len, guint32 ship32);
 
-void qq_send_cmd_group_auth(PurpleConnection *gc, qq_room_data *rmd, guint8 opt, guint32 uid, const gchar *reason_utf8);
+void qq_send_cmd_group_auth(PurpleConnection *gc, qq_room_data *rmd, guint8 opt, UID uid, const gchar *reason_utf8);
 void qq_group_join(PurpleConnection *gc, GHashTable *data);
 void qq_request_room_join(PurpleConnection *gc, qq_room_data *rmd);
 void qq_room_quit(PurpleConnection *gc, guint32 room_id);
@@ -57,3 +57,4 @@
 void qq_process_group_cmd_join_group_auth(guint8 *data, gint len, PurpleConnection *gc);
 void qq_process_group_cmd_join_group(guint8 *data, gint len, PurpleConnection *gc);
 #endif
+
--- 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;
--- a/libpurple/protocols/qq/im.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/im.h	Sun Feb 06 05:23:22 2011 +0000
@@ -49,6 +49,10 @@
 };
 
 typedef struct {
+	/* attr:
+		bit0-4 for font size, bit5 for bold,
+		bit6 for italic, bit7 for underline
+	*/
 	guint8 attr;
 	guint8 rgb[3];
 	guint16 charset;
@@ -61,6 +65,7 @@
 
 qq_im_format *qq_im_fmt_new(void);
 void qq_im_fmt_free(qq_im_format *fmt);
+void qq_im_fmt_reset_font(qq_im_format *fmt);
 qq_im_format *qq_im_fmt_new_by_purple(const gchar *msg);
 gchar *qq_im_fmt_to_purple(qq_im_format *fmt, gchar *text);
 gboolean qq_im_smiley_none(const gchar *msg);
--- a/libpurple/protocols/qq/qq.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq.c	Sun Feb 06 05:23:22 2011 +0000
@@ -173,6 +173,13 @@
 	qd->is_show_news = purple_account_get_bool(account, "show_news", TRUE);
 	qd->is_show_chat = purple_account_get_bool(account, "show_chat", TRUE);
 
+	if (purple_account_get_bool(account, "default_font", FALSE)) {
+		qd->custom = QQ_CUSTOM_USE_DEFAULT_FONT;
+	}
+	else {
+		qd->custom = QQ_CUSTOM_NONE;
+	}
+
 	qd->resend_times = purple_prefs_get_int("/plugins/prpl/qq/resend_times");
 	if (qd->resend_times <= 1) qd->itv_config.resend = 4;
 
@@ -443,7 +450,7 @@
 /* send packet to get who's detailed information */
 static void qq_show_buddy_info(PurpleConnection *gc, const gchar *who)
 {
-	guint32 uid;
+	UID uid;
 	qq_data *qd;
 
 	qd = gc->proto_data;
@@ -823,7 +830,7 @@
 	PurpleBuddy *buddy;
 	qq_buddy_data *bd;
 	PurpleConnection *gc;
-	guint32 bd_uid;
+	UID bd_uid;
 
 	g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
 
@@ -927,7 +934,7 @@
 {
 	qq_data *qd;
 	gchar *uid_str;
-	guint32 uid;
+	UID uid;
 
 	purple_debug_info("QQ", "Get chat buddy info of %s\n", who);
 	g_return_if_fail(who != NULL);
@@ -1142,6 +1149,9 @@
 	option = purple_account_option_bool_new(_("Show chat room when msg comes"), "show_chat", TRUE);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
 
+	option = purple_account_option_bool_new(_("Use default font"), "default_font", FALSE);
+	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
+
 	option = purple_account_option_int_new(_("Keep alive interval (seconds)"), "keep_alive_interval", 60);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
 
--- a/libpurple/protocols/qq/qq.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq.h	Sun Feb 06 05:23:22 2011 +0000
@@ -39,6 +39,10 @@
 #define qq_strlen(s) ((s)!=NULL?strlen(s):0)
 #define qq_strcmp(s1,s2) ((s1)!=NULL && (s2)!=NULL?strcmp(s1,s2):0)
 
+/* business logic layer */
+typedef guint32 UPDCLS;
+typedef guint32 UID;
+
 typedef struct _qq_data qq_data;
 typedef struct _qq_buddy_data qq_buddy_data;
 typedef struct _qq_interval qq_interval;
@@ -84,7 +88,7 @@
 };
 
 struct _qq_buddy_data {
-	guint32 uid;
+	UID uid;
 	guint16 face;		/* index: 0 - 299 */
 	guint8 age;
 	guint8 gender;
@@ -153,7 +157,7 @@
 
 	GList *transactions;	/* check ack packet and resend */
 
-	guint32 uid;			/* QQ number */
+	UID uid;			/* QQ number */
 
 	qq_login_data ld;
 	qq_captcha_data captcha;
@@ -187,6 +191,7 @@
 	gboolean is_show_notice;
 	gboolean is_show_news;
 	gboolean is_show_chat;
+	guint32 custom;
 
 	guint16 send_im_id;		/* send IM sequence number */
 };
--- a/libpurple/protocols/qq/qq_base.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq_base.c	Sun Feb 06 05:23:22 2011 +0000
@@ -42,7 +42,7 @@
 #include "utils.h"
 
 /* generate a md5 key using uid and session_key */
-static void get_session_md5(guint8 *session_md5, guint32 uid, guint8 *session_key)
+static void get_session_md5(guint8 *session_md5, UID uid, guint8 *session_key)
 {
 	guint8 src[QQ_KEY_LENGTH + QQ_KEY_LENGTH];
 	gint bytes = 0;
@@ -60,7 +60,7 @@
 	gint bytes;
 
 	guint8 ret;
-	guint32 uid;
+	UID uid;
 	struct in_addr ip;
 	guint16 port;
 	struct tm *tm_local;
@@ -151,7 +151,7 @@
 	gint bytes;
 	struct {
 		guint8 result;
-		guint32 uid;
+		UID uid;
 		struct in_addr new_server_ip;
 		guint16 new_server_port;
 	} packet;
@@ -1236,7 +1236,7 @@
 	qq_data *qd;
 	gint bytes;
 	guint8 ret;
-	guint32 uid;
+	UID uid;
 	gchar *error;
 	gchar *msg;
 	gchar *msg_utf8;
@@ -1427,7 +1427,7 @@
 	qq_data *qd;
 	gint bytes;
 	guint8 ret;
-	guint32 uid;
+	UID uid;
 	gchar *error;
 	gchar *msg;
 	gchar *msg_utf8;
--- a/libpurple/protocols/qq/qq_base.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq_base.h	Sun Feb 06 05:23:22 2011 +0000
@@ -28,12 +28,12 @@
 #include <glib.h>
 #include "connection.h"
 
-#define QQ_LOGIN_REPLY_OK							0x00
+#define QQ_LOGIN_REPLY_OK				0x00
 #define QQ_LOGIN_REPLY_REDIRECT				0x01
 /* defined by myself */
 #define QQ_LOGIN_REPLY_CAPTCHA_DLG			0xfd
-#define QQ_LOGIN_REPLY_NEXT_TOKEN_EX		0xfe
-#define QQ_LOGIN_REPLY_ERR							0xff
+#define QQ_LOGIN_REPLY_NEXT_TOKEN_EX			0xfe
+#define QQ_LOGIN_REPLY_ERR				0xff
 
 #define QQ_LOGIN_MODE_NORMAL		0x0a
 #define QQ_LOGIN_MODE_AWAY	    	0x1e
@@ -76,3 +76,4 @@
 void qq_request_login_2008(PurpleConnection *gc);
 guint8 qq_process_login_2008( PurpleConnection *gc, guint8 *data, gint data_len);
 #endif
+
--- a/libpurple/protocols/qq/qq_define.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq_define.c	Sun Feb 06 05:23:22 2011 +0000
@@ -118,6 +118,8 @@
 		return "QQMac 1.0 preview1 build 670";
 	case QQ_CLIENT_1441:
 		return "QQ2009 preview2";
+	case QQ_CLIENT_1663:
+		return "QQ2009";
 	case QQ_SERVER_0100:
 		return "QQ Server 0100";
 	default:
--- a/libpurple/protocols/qq/qq_define.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq_define.h	Sun Feb 06 05:23:22 2011 +0000
@@ -35,7 +35,8 @@
 
 #define QQ_CLIENT_0D55 0x0d55	/* QQ2005 used by openq before */
 #define QQ_CLIENT_111D 0x111D	/* QQ2007 */
-#define QQ_CLIENT_115B 0x115B	/* QQ2008 He Sui*/
+#define QQ_CLIENT_115B 0x115B	/* QQ2008 He Sui */
+#define QQ_CLIENT_1663 0x1663	/* QQ2009 Release */
 
 const gchar *qq_get_ver_desc(gint source);
 
--- a/libpurple/protocols/qq/qq_network.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq_network.c	Sun Feb 06 05:23:22 2011 +0000
@@ -268,7 +268,7 @@
 	guint16 seq;		/* May be ack_seq or send_seq, depends on cmd */
 	guint8 room_cmd;
 	guint32 room_id;
-	guint32 update_class;
+	UPDCLS update_class;
 	guint32 ship32;
 	int ret;
 
@@ -1131,7 +1131,7 @@
 /* Encrypt data with session_key, and send packet out */
 static gint send_cmd_detail(PurpleConnection *gc, guint16 cmd, guint16 seq,
 	guint8 *data, gint data_len, gboolean is_save2trans,
-        guint32 update_class, guint32 ship32)
+        UPDCLS update_class, guint32 ship32)
 {
 	qq_data *qd;
 	guint8 *encrypted;
@@ -1161,7 +1161,7 @@
 }
 
 gint qq_send_cmd_mess(PurpleConnection *gc, guint16 cmd, guint8 *data, gint data_len,
-		guint32 update_class, guint32 ship32)
+		UPDCLS update_class, guint32 ship32)
 {
 	qq_data *qd;
 	guint16 seq;
@@ -1235,7 +1235,7 @@
 }
 
 static gint send_room_cmd(PurpleConnection *gc, guint8 room_cmd, guint32 room_id,
-		guint8 *data, gint data_len, guint32 update_class, guint32 ship32)
+		guint8 *data, gint data_len, UPDCLS update_class, guint32 ship32)
 {
 	qq_data *qd;
 	guint8 *buf;
@@ -1289,7 +1289,7 @@
 }
 
 gint qq_send_room_cmd_mess(PurpleConnection *gc, guint8 room_cmd, guint32 room_id,
-		guint8 *data, gint data_len, guint32 update_class, guint32 ship32)
+		guint8 *data, gint data_len, UPDCLS update_class, guint32 ship32)
 {
 	g_return_val_if_fail(room_cmd > 0, -1);
 	return send_room_cmd(gc, room_cmd, room_id, data, data_len, update_class, ship32);
--- a/libpurple/protocols/qq/qq_network.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq_network.h	Sun Feb 06 05:23:22 2011 +0000
@@ -39,7 +39,7 @@
 		guint8 *encrypted_data, gint encrypted_len, gboolean is_save2trans);
 gint qq_send_cmd(PurpleConnection *gc, guint16 cmd, guint8 *data, gint datalen);
 gint qq_send_cmd_mess(PurpleConnection *gc, guint16 cmd, guint8 *data, gint data_len,
-		guint32 update_class, guint32 ship32);
+		UPDCLS update_class, guint32 ship32);
 
 gint qq_send_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq,
 		guint8 *data, gint data_len);
@@ -47,7 +47,7 @@
 gint qq_send_room_cmd(PurpleConnection *gc, guint8 room_cmd, guint32 room_id,
 		guint8 *data, gint data_len);
 gint qq_send_room_cmd_mess(PurpleConnection *gc, guint8 room_cmd, guint32 room_id,
-		guint8 *data, gint data_len, guint32 update_class, guint32 ship32);
+		guint8 *data, gint data_len, UPDCLS update_class, guint32 ship32);
 gint qq_send_room_cmd_only(PurpleConnection *gc, guint8 room_cmd, guint32 room_id);
 gint qq_send_room_cmd_noid(PurpleConnection *gc, guint8 room_cmd,
 		guint8 *data, gint data_len);
--- a/libpurple/protocols/qq/qq_process.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq_process.c	Sun Feb 06 05:23:22 2011 +0000
@@ -254,8 +254,8 @@
 	gint bytes;
 
 	struct {
-		guint32 uid_from;
-		guint32 uid_to;
+		UID uid_from;
+		UID uid_to;
 		guint32 seq;
 		struct in_addr ip_from;
 		guint16 port_from;
@@ -725,7 +725,7 @@
 
 void qq_proc_room_cmds(PurpleConnection *gc, guint16 seq,
 		guint8 room_cmd, guint32 room_id, guint8 *rcved, gint rcved_len,
-		guint32 update_class, guint32 ship32)
+		UPDCLS update_class, guint32 ship32)
 {
 	qq_data *qd;
 	guint8 *data;
@@ -861,7 +861,7 @@
 }
 
 guint8 qq_proc_login_cmds(PurpleConnection *gc,  guint16 cmd, guint16 seq,
-		guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32)
+		guint8 *rcved, gint rcved_len, UPDCLS update_class, guint32 ship32)
 {
 	qq_data *qd;
 	guint8 *data = NULL;
@@ -1013,7 +1013,7 @@
 }
 
 void qq_proc_client_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq,
-		guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32)
+		guint8 *rcved, gint rcved_len, UPDCLS update_class, guint32 ship32)
 {
 	qq_data *qd;
 
--- a/libpurple/protocols/qq/qq_process.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq_process.h	Sun Feb 06 05:23:22 2011 +0000
@@ -39,12 +39,12 @@
 };
 
 guint8 qq_proc_login_cmds(PurpleConnection *gc,  guint16 cmd, guint16 seq,
-		guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32);
+		guint8 *rcved, gint rcved_len, UPDCLS update_class, guint32 ship32);
 void qq_proc_client_cmds(PurpleConnection *gc, guint16 cmd, guint16 seq,
-		guint8 *rcved, gint rcved_len, guint32 update_class, guint32 ship32);
+		guint8 *rcved, gint rcved_len, UPDCLS update_class, guint32 ship32);
 void qq_proc_room_cmds(PurpleConnection *gc, guint16 seq,
 		guint8 room_cmd, guint32 room_id, guint8 *rcved, gint rcved_len,
-		guint32 update_class, guint32 ship32);
+		UPDCLS update_class, guint32 ship32);
 
 void qq_proc_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq, guint8 *rcved, gint rcved_len);
 
--- a/libpurple/protocols/qq/qq_trans.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq_trans.c	Sun Feb 06 05:23:22 2011 +0000
@@ -58,7 +58,7 @@
 	gint rcved_times;
 	gint scan_times;
 
-	guint32 update_class;
+	UPDCLS update_class;
 	guint32 ship32;
 };
 
@@ -107,7 +107,7 @@
 }
 
 static qq_transaction *trans_create(PurpleConnection *gc, gint fd,
-	guint16 cmd, guint16 seq, guint8 *data, gint data_len, guint32 update_class, guint32 ship32)
+	guint16 cmd, guint16 seq, guint8 *data, gint data_len, UPDCLS update_class, guint32 ship32)
 {
 	qq_transaction *trans;
 
@@ -178,7 +178,7 @@
 }
 
 void qq_trans_add_client_cmd(PurpleConnection *gc,
-	guint16 cmd, guint16 seq, guint8 *data, gint data_len, guint32 update_class, guint32 ship32)
+	guint16 cmd, guint16 seq, guint8 *data, gint data_len, UPDCLS update_class, guint32 ship32)
 {
 	qq_data *qd = (qq_data *)gc->proto_data;
 	qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, data, data_len, update_class, ship32);
@@ -218,7 +218,7 @@
 
 void qq_trans_add_room_cmd(PurpleConnection *gc,
 		guint16 seq, guint8 room_cmd, guint32 room_id, guint8 *data, gint data_len,
-		guint32 update_class, guint32 ship32)
+		UPDCLS update_class, guint32 ship32)
 {
 	qq_data *qd = (qq_data *)gc->proto_data;
 	qq_transaction *trans = trans_create(gc, qd->fd, QQ_CMD_ROOM, seq, data, data_len,
--- a/libpurple/protocols/qq/qq_trans.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/qq_trans.h	Sun Feb 06 05:23:22 2011 +0000
@@ -39,10 +39,10 @@
 guint32 qq_trans_get_ship(qq_transaction *trans);
 
 void qq_trans_add_client_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq,
-		guint8 *data, gint data_len, guint32 update_class, guint32 ship32);
+		guint8 *data, gint data_len, UPDCLS update_class, guint32 ship32);
 void qq_trans_add_room_cmd(PurpleConnection *gc,
 		guint16 seq, guint8 room_cmd, guint32 room_id,
-		guint8 *data, gint data_len, guint32 update_class, guint32 ship32);
+		guint8 *data, gint data_len, UPDCLS update_class, guint32 ship32);
 void qq_trans_add_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq,
 	guint8 *rcved, gint rcved_len);
 void qq_trans_add_server_reply(PurpleConnection *gc, guint16 cmd, guint16 seq,
--- a/libpurple/protocols/qq/send_file.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/send_file.c	Sun Feb 06 05:23:22 2011 +0000
@@ -278,7 +278,7 @@
 
 /* fill in the common information of file transfer */
 static gint _qq_create_packet_file_header
-(guint8 *raw_data, guint32 to_uid, guint16 message_type, qq_data *qd, gboolean seq_ack)
+(guint8 *raw_data, UID to_uid, guint16 message_type, qq_data *qd, gboolean seq_ack)
 {
 	gint bytes;
 	time_t now;
@@ -430,7 +430,7 @@
 }
 
 /* create the QQ_FILE_TRANS_REQ packet with file infomations */
-static void _qq_send_packet_file_request (PurpleConnection *gc, guint32 to_uid, gchar *filename, gint filesize)
+static void _qq_send_packet_file_request (PurpleConnection *gc, UID to_uid, gchar *filename, gint filesize)
 {
 	qq_data *qd;
 	guint8 *raw_data;
@@ -482,7 +482,7 @@
 }
 
 /* tell the buddy we want to accept the file */
-static void _qq_send_packet_file_accept(PurpleConnection *gc, guint32 to_uid)
+static void _qq_send_packet_file_accept(PurpleConnection *gc, UID to_uid)
 {
 	qq_data *qd;
 	guint8 *raw_data;
@@ -520,7 +520,7 @@
 			    packet_len, bytes);
 }
 
-static void _qq_send_packet_file_notifyip(PurpleConnection *gc, guint32 to_uid)
+static void _qq_send_packet_file_notifyip(PurpleConnection *gc, UID to_uid)
 {
 	PurpleXfer *xfer;
 	ft_info *info;
@@ -552,7 +552,7 @@
 }
 
 /* tell the buddy we don't want the file */
-static void _qq_send_packet_file_reject (PurpleConnection *gc, guint32 to_uid)
+static void _qq_send_packet_file_reject (PurpleConnection *gc, UID to_uid)
 {
 	qq_data *qd;
 	guint8 *raw_data;
@@ -576,7 +576,7 @@
 }
 
 /* tell the buddy to cancel transfer */
-static void _qq_send_packet_file_cancel (PurpleConnection *gc, guint32 to_uid)
+static void _qq_send_packet_file_cancel (PurpleConnection *gc, UID to_uid)
 {
 	qq_data *qd;
 	guint8 *raw_data;
@@ -611,7 +611,7 @@
 {
 	PurpleConnection *gc;
 	PurpleAccount *account;
-	guint32 to_uid;
+	UID to_uid;
 	const gchar *filename;
 	gchar *base_filename;
 
@@ -678,7 +678,7 @@
 
 /* process reject im for file transfer request */
 void qq_process_recv_file_reject (guint8 *data, gint data_len,
-		guint32 sender_uid, PurpleConnection *gc)
+		UID sender_uid, PurpleConnection *gc)
 {
 	gchar *msg, *filename;
 	qq_data *qd;
@@ -708,7 +708,7 @@
 
 /* process cancel im for file transfer request */
 void qq_process_recv_file_cancel (guint8 *data, gint data_len,
-		guint32 sender_uid, PurpleConnection *gc)
+		UID sender_uid, PurpleConnection *gc)
 {
 	gchar *msg, *filename;
 	qq_data *qd;
@@ -738,7 +738,7 @@
 }
 
 /* process accept im for file transfer request */
-void qq_process_recv_file_accept(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc)
+void qq_process_recv_file_accept(guint8 *data, gint data_len, UID sender_uid, PurpleConnection *gc)
 {
 	qq_data *qd;
 	gint bytes;
@@ -764,7 +764,7 @@
 }
 
 /* process request from buddy's im for file transfer request */
-void qq_process_recv_file_request(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection * gc)
+void qq_process_recv_file_request(guint8 *data, gint data_len, UID sender_uid, PurpleConnection * gc)
 {
 	qq_data *qd;
 	PurpleXfer *xfer;
@@ -874,7 +874,7 @@
 }
 
 void qq_process_recv_file_notify(guint8 *data, gint data_len,
-		guint32 sender_uid, PurpleConnection *gc)
+		UID sender_uid, PurpleConnection *gc)
 {
 	gint bytes;
 	qq_data *qd;
--- a/libpurple/protocols/qq/send_file.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/send_file.h	Sun Feb 06 05:23:22 2011 +0000
@@ -29,7 +29,7 @@
 #include "qq.h"
 
 typedef struct _ft_info {
-	guint32 to_uid;
+	UID to_uid;
 	guint16 send_seq;
 	guint8 file_session_key[QQ_KEY_LENGTH];
 	guint8 conn_method;
@@ -67,11 +67,11 @@
 	gboolean use_major;
 } ft_info;
 
-void qq_process_recv_file_accept(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc);
-void qq_process_recv_file_reject(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc);
-void qq_process_recv_file_cancel(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc);
-void qq_process_recv_file_request(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc);
-void qq_process_recv_file_notify(guint8 *data, gint data_len, guint32 sender_uid, PurpleConnection *gc);
+void qq_process_recv_file_accept(guint8 *data, gint data_len, UID sender_uid, PurpleConnection *gc);
+void qq_process_recv_file_reject(guint8 *data, gint data_len, UID sender_uid, PurpleConnection *gc);
+void qq_process_recv_file_cancel(guint8 *data, gint data_len, UID sender_uid, PurpleConnection *gc);
+void qq_process_recv_file_request(guint8 *data, gint data_len, UID sender_uid, PurpleConnection *gc);
+void qq_process_recv_file_notify(guint8 *data, gint data_len, UID sender_uid, PurpleConnection *gc);
 gboolean qq_can_receive_file(PurpleConnection *gc, const char *who);
 void qq_send_file(PurpleConnection *gc, const char *who, const char *file);
 gint qq_get_conn_info(ft_info *info, guint8 *data);
--- a/libpurple/protocols/qq/utils.c	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/utils.c	Sun Feb 06 05:23:22 2011 +0000
@@ -131,9 +131,9 @@
 }
 
 /* convert Purple name to original QQ UID */
-guint32 purple_name_to_uid(const gchar *const name)
+UID purple_name_to_uid(const gchar *const name)
 {
-	guint32 ret;
+	UID ret;
 	g_return_val_if_fail(name != NULL, 0);
 
 	ret = strtoul(name, NULL, 10);
@@ -168,7 +168,7 @@
 
 /* convert a QQ UID to a unique name of Purple
  * the return needs to be freed */
-gchar *uid_to_purple_name(guint32 uid)
+gchar *uid_to_purple_name(UID uid)
 {
 	return g_strdup_printf("%u", uid);
 }
--- a/libpurple/protocols/qq/utils.h	Tue Feb 01 12:55:48 2011 +0000
+++ b/libpurple/protocols/qq/utils.h	Sun Feb 06 05:23:22 2011 +0000
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <glib.h>
+#include "qq.h"
 
 #include "debug.h"
 
@@ -40,8 +41,8 @@
 gchar *gen_ip_str(guint8 *ip);
 guint8 *str_ip_gen(gchar *str);
 
-guint32 purple_name_to_uid(const gchar *name);
-gchar *uid_to_purple_name(guint32 uid);
+UID purple_name_to_uid(const gchar *name);
+gchar *uid_to_purple_name(UID uid);
 
 gchar *try_dump_as_gbk(const guint8 *const data, gint len);