pidgin.openq: 4ca166a4: 2010.01.23 - flos <lonicerae(at)gmail.co...

csyfek at gmail.com csyfek at gmail.com
Sun Feb 6 00:25:54 EST 2011


----------------------------------------------------------------------
Revision: 4ca166a4577992e025d979389130769bd825ce86
Parent:   5837b6da7965ab98b966103102bc22ebbbbbfccf
Author:   csyfek at gmail.com
Date:     02/06/11 00:23:22
Branch:   im.pidgin.pidgin.openq
URL: http://d.pidgin.im/viewmtn/revision/info/4ca166a4577992e025d979389130769bd825ce86

Changelog: 

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

Changes against parent 5837b6da7965ab98b966103102bc22ebbbbbfccf

  patched  libpurple/protocols/qq/ChangeLog
  patched  libpurple/protocols/qq/buddy_info.c
  patched  libpurple/protocols/qq/buddy_info.h
  patched  libpurple/protocols/qq/buddy_list.c
  patched  libpurple/protocols/qq/buddy_list.h
  patched  libpurple/protocols/qq/buddy_memo.c
  patched  libpurple/protocols/qq/buddy_memo.h
  patched  libpurple/protocols/qq/buddy_opt.c
  patched  libpurple/protocols/qq/buddy_opt.h
  patched  libpurple/protocols/qq/file_trans.c
  patched  libpurple/protocols/qq/file_trans.h
  patched  libpurple/protocols/qq/group.h
  patched  libpurple/protocols/qq/group_im.c
  patched  libpurple/protocols/qq/group_im.h
  patched  libpurple/protocols/qq/group_info.c
  patched  libpurple/protocols/qq/group_info.h
  patched  libpurple/protocols/qq/group_internal.c
  patched  libpurple/protocols/qq/group_internal.h
  patched  libpurple/protocols/qq/group_join.c
  patched  libpurple/protocols/qq/group_join.h
  patched  libpurple/protocols/qq/im.c
  patched  libpurple/protocols/qq/im.h
  patched  libpurple/protocols/qq/qq.c
  patched  libpurple/protocols/qq/qq.h
  patched  libpurple/protocols/qq/qq_base.c
  patched  libpurple/protocols/qq/qq_base.h
  patched  libpurple/protocols/qq/qq_define.c
  patched  libpurple/protocols/qq/qq_define.h
  patched  libpurple/protocols/qq/qq_network.c
  patched  libpurple/protocols/qq/qq_network.h
  patched  libpurple/protocols/qq/qq_process.c
  patched  libpurple/protocols/qq/qq_process.h
  patched  libpurple/protocols/qq/qq_trans.c
  patched  libpurple/protocols/qq/qq_trans.h
  patched  libpurple/protocols/qq/send_file.c
  patched  libpurple/protocols/qq/send_file.h
  patched  libpurple/protocols/qq/utils.c
  patched  libpurple/protocols/qq/utils.h

-------------- next part --------------
============================================================
--- libpurple/protocols/qq/buddy_info.c	77865a937540f57ac6b8c41556f0c4e32a4ff7c2
+++ libpurple/protocols/qq/buddy_info.c	89f559f781bea79afc0ec93d570600238a417a85
@@ -222,8 +222,8 @@ static void info_display_only(PurpleConn
 	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 @@ static void update_buddy_info(PurpleConn
 	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 @@ void qq_process_get_buddy_info(guint8 *d
 	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 @@ void qq_request_get_level(PurpleConnecti
 	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 @@ void qq_request_get_level_2007(PurpleCon
 	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(PurpleConnecti
 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(PurpleCon
 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;
============================================================
--- libpurple/protocols/qq/buddy_info.h	52fda46038e310247f497f99260754dcf94c0fea
+++ libpurple/protocols/qq/buddy_info.h	55c6e8baac1be421c8688258ea2347ccd29a7853
@@ -78,15 +78,14 @@ void qq_change_icon_cb(PurpleConnection 
 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);
============================================================
--- libpurple/protocols/qq/buddy_list.c	732495eed078770e7bcfcc7a5944148b9f1a8f4b
+++ libpurple/protocols/qq/buddy_list.c	683629adc8eab23c5c3a06f9132fb3421fe46b2d
@@ -53,7 +53,7 @@ typedef struct _qq_buddy_online {
 } 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 @@ void qq_request_get_buddies_online(Purpl
 
 /* 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 @@ void qq_request_get_buddies(PurpleConnec
 }
 
 /* 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 @@ guint32 qq_process_get_buddies_and_rooms
 	gint bytes;
 	guint8 sub_cmd, reply_code;
 	guint32 unknown, position;
-	guint32 uid;
+	UID uid;
 	guint8 type;
 	qq_room_data *rmd;
 
@@ -455,7 +455,7 @@ static guint8  get_status_from_purple(Pu
 }
 
 /* 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 @@ void qq_process_buddy_change_status(guin
 {
 	qq_data *qd;
 	gint bytes;
-	guint32 my_uid;
+	UID my_uid;
 	gchar *who;
 	PurpleBuddy *buddy;
 	qq_buddy_data *bd;
@@ -583,7 +583,7 @@ void qq_process_buddy_change_status(guin
 }
 
 /*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;
============================================================
--- libpurple/protocols/qq/buddy_list.h	1dfb72eb97dd62e2260662a29725666d438b759e
+++ libpurple/protocols/qq/buddy_list.h	4f7266d3e41a841cbc3cde1cb65b0eec30db66c3
@@ -30,7 +30,7 @@ typedef struct _qq_buddy_status {
 
 #include "qq.h"
 typedef struct _qq_buddy_status {
-	guint32 uid;
+	UID uid;
 	guint8 unknown1;
 	struct in_addr ip;
 	guint16 port;
@@ -40,20 +40,20 @@ typedef struct _qq_buddy_status {
 	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
============================================================
--- libpurple/protocols/qq/buddy_opt.c	9585204b2154297e91fecae0babb897f85ed18ad
+++ libpurple/protocols/qq/buddy_opt.c	71c26dc26ecdeadd1cddd38ce61ff13f6e27c8aa
@@ -51,12 +51,12 @@ typedef struct _qq_buddy_req {
 
 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 @@ PurpleGroup *qq_group_find_or_new(const 
 	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 @@ static qq_buddy_data *qq_buddy_data_new(
 	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 @@ void qq_buddy_data_free(qq_buddy_data *b
 }
 
 /* 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 @@ static void qq_buddy_free(PurpleBuddy *b
 	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 @@ PurpleBuddy *qq_buddy_find(PurpleConnect
 	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 @@ PurpleBuddy *qq_buddy_find_or_new(Purple
 }
 
 /* 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(Purp
 }
 
 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 @@ static void request_remove_buddy_ex(Purp
 	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 @@ void qq_request_auth_code(PurpleConnecti
 	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 @@ static void add_buddy_question_cb(qq_bud
 	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(PurpleConnectio
 }
 
 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 @@ void qq_request_question(PurpleConnectio
 	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 @@ static void request_add_buddy_by_questio
 	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 @@ void qq_process_question(PurpleConnectio
 }
 
 /* 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 @@ static void request_buddy_remove_me(Purp
 }
 
 /* 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 @@ static void request_add_buddy_no_auth(Pu
 			(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 @@ static void request_add_buddy_no_auth_ex
 }
 
 /* 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 @@ static void request_add_buddy_auth(Purpl
 	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 @@ static void add_buddy_no_auth_cb(qq_budd
 	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, 
 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 @@ void qq_process_add_buddy_auth(guint8 *d
 }
 
 /* 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 @@ void qq_process_remove_buddy(PurpleConne
 }
 
 /* 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(Purple
 }
 
 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(Pur
 }
 
 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 @@ void qq_remove_buddy(PurpleConnection *g
 {
 	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 @@ void qq_remove_buddy(PurpleConnection *g
 	 * 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(Pur
 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 @@ void qq_process_buddy_check_code(PurpleC
 	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 @@ static void request_buddy_check_code(Pur
 {
 	guint8 *raw_data;
 	gint bytes;
-	guint32 uid;
+	UID uid;
 
 	g_return_if_fail(code != NULL && code_len > 0 && from != NULL);
 
@@ -1073,7 +1073,7 @@ static void server_buddy_add_request_ex(
 		guint8 *data, gint data_len)
 {
 	gint bytes;
-	guint32 uid;
+	UID uid;
 	gchar *msg;
 	guint8 allow_reverse;
 
@@ -1103,7 +1103,7 @@ static void server_buddy_added(PurpleCon
 {
 	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 @@ static void server_buddy_added_me(Purple
 {
 	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(Pur
 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;
============================================================
--- libpurple/protocols/qq/buddy_opt.h	f61ba9701960402d062c44e1155edd35549ab7e8
+++ libpurple/protocols/qq/buddy_opt.h	050164cab303f7c14a10b08de44f542fa13864b2
@@ -54,31 +54,31 @@ void qq_remove_buddy(PurpleConnection *g
 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
============================================================
--- libpurple/protocols/qq/file_trans.c	22a64cacba86c79804a897042a76984d22c0bfae
+++ libpurple/protocols/qq/file_trans.c	23b0b55cc7bfec840a72fd04221526dc91376068
@@ -41,8 +41,8 @@ struct _qq_file_header {
 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 @@ static guint32 _gen_file_key(void)
 	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 @@ void qq_xfer_close_file(PurpleXfer *xfer
 }
 #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 @@ static gint _qq_send_file(PurpleConnecti
 }
 
 /* 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;
============================================================
--- libpurple/protocols/qq/file_trans.h	cad96d897aa2af69b781a158208eedf34c327b9e
+++ libpurple/protocols/qq/file_trans.h	649c9c68db606fd5b67e461dac40793be0aa7a12
@@ -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 @@ enum {
 #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);
============================================================
--- libpurple/protocols/qq/group.h	19b1b60b96ec006878764610310b1e1b2609cb99
+++ libpurple/protocols/qq/group.h	f425fa0f8e5024e9d87d19e39b50fb6d5217564c
@@ -47,7 +47,7 @@ struct _qq_room_data {
 	guint32 id;
 	guint32 ext_id;
 	guint8 type8;			/* permanent or temporory */
-	guint32 creator_uid;
+	UID creator_uid;
 	guint32 category;
 	guint8 auth_type;
 	gchar *title_utf8;
============================================================
--- libpurple/protocols/qq/group_im.c	170ccd005e23f6f0dd58989de0c2a3c94ee8b2b0
+++ libpurple/protocols/qq/group_im.c	4dab2ef7f74624d320ffb89d92f7fa63d4ce456a
@@ -161,7 +161,7 @@ void qq_room_got_chat_in(PurpleConnectio
 }
 
 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 @@ void qq_process_room_im(guint8 *data, gi
 {
 	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 @@ void qq_process_room_im(guint8 *data, gi
 	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 @@ void qq_process_room_im(guint8 *data, gi
 	/* 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 {
============================================================
--- libpurple/protocols/qq/group_im.h	00ef08e7d5cf9f7192c1935b9c710eb98d20e01a
+++ libpurple/protocols/qq/group_im.h	3d924d6979fdab9ffcbeab43ea848afe7859ade5
@@ -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, gi
 void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type);
 
 #endif
+
============================================================
--- libpurple/protocols/qq/group_info.c	16e337153a264ae599ea78cd7289b397e672c169
+++ libpurple/protocols/qq/group_info.c	2e65c358196579ecb415a7bdd6e89c6b833fc9df
@@ -65,7 +65,7 @@ static void set_all_offline(qq_room_data
 }
 
 /* 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 @@ void qq_process_room_cmd_get_info(guint8
 	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(gui
 
 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 @@ void qq_process_room_cmd_get_buddies(gui
 {
 	gint bytes;
 	gint num;
-	guint32 id, member_uid;
+	guint32 id;
+	UID member_uid;
 	guint16 unknown;
 	qq_room_data *rmd;
 	qq_buddy_data *bd;
============================================================
--- libpurple/protocols/qq/group_info.h	7ef27bed8ba72a525ff07ca1918ce0d130035428
+++ libpurple/protocols/qq/group_info.h	cb91f3acc87f0161f32c3f721d5c434426b72717
@@ -34,7 +34,7 @@ enum {
 	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);
============================================================
--- libpurple/protocols/qq/group_join.c	4d84b6d78768504dc8c6387efd56cc0151616d55
+++ libpurple/protocols/qq/group_join.c	2dcabfde07defc333b37890290c56f4b03250d24
@@ -155,7 +155,7 @@ void qq_send_cmd_group_auth(PurpleConnec
 }
 
 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;
============================================================
--- libpurple/protocols/qq/group_join.h	f8dea8cbee7ff9e4b096c5217a74286d673275c5
+++ libpurple/protocols/qq/group_join.h	fb86d43d462a67b669293d016fe32897153129de
@@ -49,7 +49,7 @@ void qq_process_room_search(PurpleConnec
 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(gui
 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
+
============================================================
--- libpurple/protocols/qq/qq_define.c	39cbe85d9130d050d169912b9c7eb459c5ddac1a
+++ libpurple/protocols/qq/qq_define.c	f58b1ef6013ebe93d397cd809d2250b136ae6395
@@ -118,6 +118,8 @@ const gchar *qq_get_ver_desc(gint source
 		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:
============================================================
--- libpurple/protocols/qq/qq_define.h	65d533d21d7ac59100e847b75be56480dc8e8a8f
+++ libpurple/protocols/qq/qq_define.h	2a705c60728583f3fb3af72e2abd6642d73c5663
@@ -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);
 
============================================================
--- libpurple/protocols/qq/im.c	6464068551bb1b7e76badb77a334719a595ebf71
+++ libpurple/protocols/qq/im.c	b9f9939b150822fbc12cc3012d29140ff9e44563
@@ -71,8 +71,8 @@ struct _qq_im_header {
 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 *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 @@ qq_im_format *qq_im_fmt_new(void)
 	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 @@ void qq_process_extend_im(PurpleConnecti
 }
 
 /* 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, co
 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;
============================================================
--- libpurple/protocols/qq/im.h	9a8b83b1f7e13adfbc178e333b90e02276bb3dfa
+++ libpurple/protocols/qq/im.h	a4772884967c52e51a2ca41adb3f0ee5f282a1f5
@@ -49,6 +49,10 @@ typedef struct {
 };
 
 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 @@ void qq_im_fmt_free(qq_im_format *fmt);
 
 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);
============================================================
--- libpurple/protocols/qq/qq.c	65b0db80d635b689e0b9f9608015cd0331e4f545
+++ libpurple/protocols/qq/qq.c	e3606c0990e06986feb766378fafcb94eda9660e
@@ -173,6 +173,13 @@ static void qq_login(PurpleAccount *acco
 	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 @@ static void qq_show_buddy_info(PurpleCon
 /* 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 @@ static void qq_modify_buddy_memo_from_me
 	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 @@ static void qq_get_chat_buddy_info(Purpl
 {
 	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 @@ static void init_plugin(PurplePlugin *pl
 	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);
 
============================================================
--- libpurple/protocols/qq/qq.h	b4ed69040d76f7b8a3bd5a0c1f0c1607bbac786a
+++ libpurple/protocols/qq/qq.h	994f0ee89e3352b71eef4c5af6b5812356f29941
@@ -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 {
 };
 
 struct _qq_buddy_data {
-	guint32 uid;
+	UID uid;
 	guint16 face;		/* index: 0 - 299 */
 	guint8 age;
 	guint8 gender;
@@ -153,7 +157,7 @@ struct _qq_data {
 
 	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 @@ struct _qq_data {
 	gboolean is_show_notice;
 	gboolean is_show_news;
 	gboolean is_show_chat;
+	guint32 custom;
 
 	guint16 send_im_id;		/* send IM sequence number */
 };
============================================================
--- libpurple/protocols/qq/send_file.c	a22ab6c390ed532a96777880f8cd0f96481d7b08
+++ libpurple/protocols/qq/send_file.c	bd07ca30230fa0b49a2634099d36b081bc90e537
@@ -278,7 +278,7 @@ static gint _qq_create_packet_file_heade
 
 /* 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 @@ static void _qq_xfer_init_socket(PurpleX
 }
 
 /* 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 @@ static void _qq_send_packet_file_request
 }
 
 /* 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 @@ static void _qq_send_packet_file_accept(
 			    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 @@ static void _qq_send_packet_file_notifyi
 }
 
 /* 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 @@ static void _qq_send_packet_file_reject 
 }
 
 /* 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 @@ _qq_xfer_init (PurpleXfer * xfer)
 {
 	PurpleConnection *gc;
 	PurpleAccount *account;
-	guint32 to_uid;
+	UID to_uid;
 	const gchar *filename;
 	gchar *base_filename;
 
@@ -678,7 +678,7 @@ void qq_process_recv_file_reject (guint8
 
 /* 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 @@ void qq_process_recv_file_cancel (guint8
 
 /* 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 @@ void qq_process_recv_file_cancel (guint8
 }
 
 /* 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 @@ void qq_process_recv_file_accept(guint8 
 }
 
 /* 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 
 }
 
 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;
============================================================
--- libpurple/protocols/qq/send_file.h	5208ab6e8ace611f701df25b6c37299b65d32760
+++ libpurple/protocols/qq/send_file.h	dc2be46904bf1033155951c658a4d40bdb4575e3
@@ -29,7 +29,7 @@ typedef struct _ft_info {
 #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 @@ typedef struct _ft_info {
 	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);
============================================================
--- libpurple/protocols/qq/utils.c	684e52bf9e09207844207a3e05e06bc64af91e97
+++ libpurple/protocols/qq/utils.c	ee5ca53f721beb7ce3ec32b0a91cb65b4d8980fd
@@ -131,9 +131,9 @@ gchar **split_data(guint8 *data, gint le
 }
 
 /* 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 @@ guint8 *str_ip_gen(gchar *str) {
 
 /* 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);
 }
============================================================
--- libpurple/protocols/qq/utils.h	b0606acd4421934ed3b7285a568425dc617f50a9
+++ libpurple/protocols/qq/utils.h	414935a43245b6ee7ba4c16c1442fdac741d62e9
@@ -27,6 +27,7 @@
 
 #include <stdio.h>
 #include <glib.h>
+#include "qq.h"
 
 #include "debug.h"
 
@@ -40,8 +41,8 @@ guint8 *str_ip_gen(gchar *str);
 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);
 
============================================================
--- libpurple/protocols/qq/group_internal.c	5352d98aebda500fbb4654ce2beddb8c2371c1b3
+++ libpurple/protocols/qq/group_internal.c	762ae0912d801db02d069f85be740822d2465c5c
@@ -207,7 +207,7 @@ void qq_room_remove(PurpleConnection *gc
 }
 
 /* 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 @@ qq_buddy_data *qq_room_buddy_find(qq_roo
 }
 
 /* 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 @@ void qq_room_buddy_remove(qq_room_data *
 	}
 }
 
-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;
============================================================
--- libpurple/protocols/qq/group_internal.h	9c5600be9b59c837680ffbbf85f18e5bd11430f9
+++ libpurple/protocols/qq/group_internal.h	e4701f7a71d55ad2e3c64f60e36fabb04bc7fc9b
@@ -36,9 +36,9 @@ void qq_room_update_chat_info(PurpleChat
 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);
============================================================
--- libpurple/protocols/qq/ChangeLog	96e5c5db83dd40be064824cad9ca0690f1928af9
+++ libpurple/protocols/qq/ChangeLog	82a14ec0fef77a87970b8dc49c575c063f4f983e
@@ -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
 
============================================================
--- libpurple/protocols/qq/qq_network.c	8a50082efce52017e0fbe5846bb55a1b001b9049
+++ libpurple/protocols/qq/qq_network.c	23098527e28ce526f834df70924a4e8b94bcfc14
@@ -268,7 +268,7 @@ static gboolean packet_process(PurpleCon
 	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 @@ static gint send_cmd_detail(PurpleConnec
 /* 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 *
 }
 
 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(PurpleConnecti
 }
 
 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(PurpleConnect
 }
 
 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);
============================================================
--- libpurple/protocols/qq/qq_network.h	7581edb90c19b84bf1257d8af103f3026d8d0bc8
+++ libpurple/protocols/qq/qq_network.h	7d9aaad3d4febf6aa3c96c41c870967e08b75497
@@ -39,7 +39,7 @@ gint qq_send_cmd_mess(PurpleConnection *
 		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_mess(PurpleConnect
 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);
============================================================
--- libpurple/protocols/qq/qq_trans.c	127f41ef02bce27e2fdae67a817655385538ead0
+++ libpurple/protocols/qq/qq_trans.c	b2e268c2fcf80bb2a4bad7093b9513fc40da7e01
@@ -58,7 +58,7 @@ struct _qq_transaction {
 	gint rcved_times;
 	gint scan_times;
 
-	guint32 update_class;
+	UPDCLS update_class;
 	guint32 ship32;
 };
 
@@ -107,7 +107,7 @@ static qq_transaction *trans_create(Purp
 }
 
 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(PurpleConne
 }
 
 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(PurpleConnect
 
 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,
============================================================
--- libpurple/protocols/qq/qq_trans.h	ef2f184120a42289fd9b775b11b629a505ee0ff6
+++ libpurple/protocols/qq/qq_trans.h	71426ee8a3a120b8bbbc768a24775cd5ed85420d
@@ -39,10 +39,10 @@ void qq_trans_add_client_cmd(PurpleConne
 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,
============================================================
--- libpurple/protocols/qq/qq_base.c	c3e3337837bcc870fed5986634889fb9f017cd8b
+++ libpurple/protocols/qq/qq_base.c	008576ce59ffbc122c88ea056dabd2a5361a0c54
@@ -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 @@ static gint8 process_login_ok(PurpleConn
 	gint bytes;
 
 	guint8 ret;
-	guint32 uid;
+	UID uid;
 	struct in_addr ip;
 	guint16 port;
 	struct tm *tm_local;
@@ -151,7 +151,7 @@ static gint8 process_login_redirect(Purp
 	gint bytes;
 	struct {
 		guint8 result;
-		guint32 uid;
+		UID uid;
 		struct in_addr new_server_ip;
 		guint16 new_server_port;
 	} packet;
@@ -1236,7 +1236,7 @@ guint8 qq_process_login_2007( PurpleConn
 	qq_data *qd;
 	gint bytes;
 	guint8 ret;
-	guint32 uid;
+	UID uid;
 	gchar *error;
 	gchar *msg;
 	gchar *msg_utf8;
@@ -1427,7 +1427,7 @@ guint8 qq_process_login_2008( PurpleConn
 	qq_data *qd;
 	gint bytes;
 	guint8 ret;
-	guint32 uid;
+	UID uid;
 	gchar *error;
 	gchar *msg;
 	gchar *msg_utf8;
============================================================
--- libpurple/protocols/qq/qq_base.h	0e87e8ada2b15089700f6e48d7995ab0003480e4
+++ libpurple/protocols/qq/qq_base.h	6a45eb2494af8c301559a19f1dbca6b168d9dd10
@@ -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 @@ guint8 qq_process_login_2008( PurpleConn
 void qq_request_login_2008(PurpleConnection *gc);
 guint8 qq_process_login_2008( PurpleConnection *gc, guint8 *data, gint data_len);
 #endif
+
============================================================
--- libpurple/protocols/qq/qq_process.c	e4e405cfcfb9f510077b1b0b0d7a399922f928d8
+++ libpurple/protocols/qq/qq_process.c	8efd766bb3a57bce5a70c3cb66e236e871166142
@@ -254,8 +254,8 @@ static void process_private_msg(guint8 *
 	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 
 
 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(PurpleConnecti
 }
 
 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(PurpleConnectio
 }
 
 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;
 
============================================================
--- libpurple/protocols/qq/qq_process.h	907e4bb3611adb98e24483d04929eb56b4cc9195
+++ libpurple/protocols/qq/qq_process.h	fa873ee5668d820e8578b530c10c467f3dfa184e
@@ -39,12 +39,12 @@ guint8 qq_proc_login_cmds(PurpleConnecti
 };
 
 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);
 
============================================================
--- libpurple/protocols/qq/buddy_memo.c	288926787dce5bbf5d237b86cc837476cf57acb0
+++ libpurple/protocols/qq/buddy_memo.c	d59cdf678d36a2f637e847904e6bcd1add3bfcfa
@@ -83,7 +83,7 @@ typedef struct _modify_memo_request {
 
 typedef struct _modify_memo_request {
 	PurpleConnection *gc;
-	guint32 bd_uid;
+	UID bd_uid;
 	gchar **segments;
 } modify_memo_request;
 
@@ -107,7 +107,7 @@ static void memo_free(gchar **segments)
 	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 @@ static void update_buddy_memo(PurpleConn
 	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_mem
 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 @@ static void memo_modify_ok_cb(modify_mem
 		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 @@ static void memo_modify_ok_cb(modify_mem
 }
 
 /* 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 memo_modify_dialogue(PurpleC
 	}
 }
 
-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 @@ static void qq_create_buddy_memo(PurpleC
 	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 @@ void qq_process_get_buddy_memo(PurpleCon
 	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 @@ void qq_process_get_buddy_memo(PurpleCon
 			}
 
 			/* 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 @@ void qq_process_get_buddy_memo(PurpleCon
 	}
 }
 
-/* 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;
============================================================
--- libpurple/protocols/qq/buddy_memo.h	9a8d96b82c5454ca238ea7eacf45d5859a7cf1dd
+++ libpurple/protocols/qq/buddy_memo.h	70b74a12d3caead14ce193b21e9d0123e9ecbbec
@@ -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 @@ enum
 };
 
 
-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
 


More information about the Commits mailing list