changeset 24159:9be95f0b9472

2008.10.10 - ccpaging <ccpaging(at)gmail.com> * Keep group_search.c/h for later use * Update 'group'
author SHiNE CsyFeK <csyfek@gmail.com>
date Tue, 28 Oct 2008 16:40:56 +0000
parents b6f09c1c79ce
children d35672443baa
files libpurple/protocols/qq/ChangeLog libpurple/protocols/qq/buddy_opt.c libpurple/protocols/qq/group_im.c libpurple/protocols/qq/group_im.h libpurple/protocols/qq/group_join.c libpurple/protocols/qq/group_join.h libpurple/protocols/qq/group_opt.c libpurple/protocols/qq/group_opt.h libpurple/protocols/qq/group_search.c libpurple/protocols/qq/group_search.h libpurple/protocols/qq/qq.c libpurple/protocols/qq/qq.h libpurple/protocols/qq/qq_process.c
diffstat 13 files changed, 393 insertions(+), 314 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/qq/ChangeLog	Tue Oct 28 16:39:23 2008 +0000
+++ b/libpurple/protocols/qq/ChangeLog	Tue Oct 28 16:40:56 2008 +0000
@@ -1,3 +1,7 @@
+2008.10.10 - ccpaging <ccpaging(at)gmail.com>
+	* Keep group_search.c/h for later use
+	* Update 'group' 
+
 2008.10.09 - ccpaging <ccpaging(at)gmail.com>
 	* 20081009-1
 
--- a/libpurple/protocols/qq/buddy_opt.c	Tue Oct 28 16:39:23 2008 +0000
+++ b/libpurple/protocols/qq/buddy_opt.c	Tue Oct 28 16:40:56 2008 +0000
@@ -52,6 +52,11 @@
 	QQ_MY_AUTH_REQUEST = 0x32,	/* ASCII value of "2" */
 };
 
+typedef struct _qq_buddy_req {
+	guint32 uid;
+	PurpleConnection *gc;
+} qq_buddy_req;
+
 /* send packet to remove a buddy from my buddy list */
 static void request_buddy_remove(PurpleConnection *gc, guint32 uid)
 {
@@ -116,7 +121,7 @@
 	qq_send_cmd(gc, QQ_CMD_BUDDY_ADD_AUTH, raw_data, bytes);
 }
 
-static void request_buddy_add_auth_cb(qq_add_request *add_req, const gchar *text)
+static void request_buddy_add_auth_cb(qq_buddy_req *add_req, const gchar *text)
 {
 	g_return_if_fail(add_req != NULL);
 	if (add_req->gc == NULL || add_req->uid == 0) {
@@ -129,7 +134,7 @@
 }
 
 /* the real packet to reject and request is sent from here */
-static void buddy_add_deny_reason_cb(qq_add_request *add_req, const gchar *reason)
+static void buddy_add_deny_reason_cb(qq_buddy_req *add_req, const gchar *reason)
 {
 	g_return_if_fail(add_req != NULL);
 	if (add_req->gc == NULL || add_req->uid == 0) {
@@ -142,7 +147,7 @@
 }
 
 /* we approve other's request of adding me as friend */
-static void buddy_add_authorize_cb(qq_add_request *add_req)
+static void buddy_add_authorize_cb(qq_buddy_req *add_req)
 {
 	g_return_if_fail(add_req != NULL);
 	if (add_req->gc == NULL || add_req->uid != 0) {
@@ -155,7 +160,7 @@
 }
 
 /* we reject other's request of adding me as friend */
-static void buddy_add_deny_cb(qq_add_request *add_req)
+static void buddy_add_deny_cb(qq_buddy_req *add_req)
 {
 	gint uid;
 	gchar *msg1, *msg2;
@@ -184,7 +189,7 @@
 }
 
 /* suggested by rakescar@linuxsir, can still approve after search */
-static void buddy_add_check_info_cb(qq_add_request *add_req)
+static void buddy_add_check_info_cb(qq_buddy_req *add_req)
 {
 	PurpleConnection *gc;
 	guint32 uid;
@@ -267,13 +272,13 @@
 	request_buddy_add_no_auth(gc, uid);
 }
 
-static void buddy_cancel_cb(qq_add_request *add_req, const gchar *msg)
+static void buddy_cancel_cb(qq_buddy_req *add_req, const gchar *msg)
 {
 	g_return_if_fail(add_req != NULL);
 	g_free(add_req);
 }
 
-static void buddy_add_no_auth_cb(qq_add_request *add_req)
+static void buddy_add_no_auth_cb(qq_buddy_req *add_req)
 {
 	g_return_if_fail(add_req != NULL);
 	if (add_req->gc == NULL || add_req->uid == 0) {
@@ -285,7 +290,7 @@
 	g_free(add_req);
 }
 
-static void buddy_remove_both_cb(qq_add_request *add_req)
+static void buddy_remove_both_cb(qq_buddy_req *add_req)
 {
 	PurpleConnection *gc;
 	qq_data *qd;
@@ -329,7 +334,7 @@
 	PurpleConnection *gc;
 	qq_data *qd;
 	guint32 uid;
-	qq_add_request *add_req;
+	qq_buddy_req *add_req;
 	PurpleBuddy *buddy;
 	const gchar *who;
 
@@ -351,7 +356,7 @@
 		return;
 	}
 
-	add_req = g_new0(qq_add_request, 1);
+	add_req = g_new0(qq_buddy_req, 1);
 	add_req->gc = gc;
 	add_req->uid = uid;
 
@@ -429,7 +434,7 @@
 	qq_data *qd;
 	gchar *msg, **segments, *dest_uid, *reply;
 	PurpleBuddy *b;
-	qq_add_request *add_req;
+	qq_buddy_req *add_req;
 	gchar *nombre;
 
 	g_return_if_fail(data != NULL && data_len != 0);
@@ -460,7 +465,7 @@
 		b = purple_find_buddy(gc->account, nombre);
 		if (b != NULL)
 			purple_blist_remove_buddy(b);
-		add_req = g_new0(qq_add_request, 1);
+		add_req = g_new0(qq_buddy_req, 1);
 		add_req->gc = gc;
 		add_req->uid = uid;
 		msg = g_strdup_printf(_("%d needs authentication"), uid);
@@ -647,14 +652,14 @@
 {
 	gchar *message, *reason;
 	guint32 uid;
-	qq_add_request *g, *g2;
+	qq_buddy_req *g, *g2;
 	PurpleBuddy *b;
 	gchar *name;
 
 	g_return_if_fail(from != NULL && to != NULL);
 
 	uid = strtol(from, NULL, 10);
-	g = g_new0(qq_add_request, 1);
+	g = g_new0(qq_buddy_req, 1);
 	g->gc = gc;
 	g->uid = uid;
 
@@ -680,7 +685,7 @@
 	/* XXX: Is this needed once the above goes through purple_account_request_authorization()? */
 	b = purple_find_buddy(gc->account, name);
 	if (b == NULL) {	/* the person is not in my list  */
-		g2 = g_new0(qq_add_request, 1);
+		g2 = g_new0(qq_buddy_req, 1);
 		g2->gc = gc;
 		g2->uid = strtol(from, NULL, 10);
 		message = g_strdup_printf(_("%s is not in buddy list"), from);
@@ -703,7 +708,7 @@
 	gchar *message;
 	PurpleBuddy *b;
 	guint32 uid;
-	qq_add_request *add_req;
+	qq_buddy_req *add_req;
 	gchar *name;
 
 	g_return_if_fail(from != NULL && to != NULL);
@@ -713,7 +718,7 @@
 	b = purple_find_buddy(gc->account, name);
 
 	if (b == NULL) {	/* the person is not in my list */
-		add_req = g_new0(qq_add_request, 1);
+		add_req = g_new0(qq_buddy_req, 1);
 		add_req->gc = gc;
 		add_req->uid = uid;	/* only need to get value */
 		message = g_strdup_printf(_("You have been added by %s"), from);
--- a/libpurple/protocols/qq/group_im.c	Tue Oct 28 16:39:23 2008 +0000
+++ b/libpurple/protocols/qq/group_im.c	Tue Oct 28 16:40:56 2008 +0000
@@ -34,6 +34,7 @@
 #include "char_conv.h"
 #include "group_internal.h"
 #include "group_info.h"
+#include "group_join.h"
 #include "group_im.h"
 #include "group_opt.h"
 #include "im.h"
@@ -157,7 +158,7 @@
 }
 
 /* send IM to a group */
-void qq_send_packet_group_im(PurpleConnection *gc, guint32 room_id, const gchar *msg)
+void qq_request_room_send_im(PurpleConnection *gc, guint32 room_id, const gchar *msg)
 {
 	gint data_len, bytes;
 	guint8 *raw_data, *send_im_tail;
@@ -191,64 +192,13 @@
 }
 
 /* this is the ACK */
-void qq_process_group_cmd_im(guint8 *data, gint len, PurpleConnection *gc)
+void qq_process_room_send_im(PurpleConnection *gc, guint8 *data, gint len)
 {
 	/* return should be the internal group id
 	 * but we have nothing to do with it */
 	return;
 }
 
-/* receive an application to join the group */
-void qq_process_room_msg_apply_join(guint8 *data, gint len, guint32 id, PurpleConnection *gc)
-{
-	guint32 ext_id, user_uid;
-	guint8 type8;
-	gchar *reason_utf8, *msg, *reason;
-	group_member_opt *g;
-	gchar *nombre;
-	gint bytes = 0;
-
-	g_return_if_fail(id > 0 && data != NULL && len > 0);
-
-	/* FIXME: check length here */
-
-	bytes += qq_get32(&ext_id, data + bytes);
-	bytes += qq_get8(&type8, data + bytes);
-	bytes += qq_get32(&user_uid, data + bytes);
-
-	g_return_if_fail(ext_id > 0 && user_uid > 0);
-
-	bytes += qq_get_vstr(&reason_utf8, QQ_CHARSET_DEFAULT, data + bytes);
-
-	msg = g_strdup_printf(_("%d request to join Qun %d"), user_uid, ext_id);
-	reason = g_strdup_printf(_("Message: %s"), reason_utf8);
-
-	g = g_new0(group_member_opt, 1);
-	g->gc = gc;
-	g->id = id;
-	g->member = user_uid;
-
-	nombre = uid_to_purple_name(user_uid);
-
-	purple_request_action(gc, _("QQ Qun Operation"),
-			msg, reason,
-			PURPLE_DEFAULT_ACTION_NONE,
-			purple_connection_get_account(gc), nombre, NULL,
-			g, 3,
-			_("Approve"),
-			G_CALLBACK
-			(qq_group_approve_application_with_struct),
-			_("Reject"),
-			G_CALLBACK
-			(qq_group_reject_application_with_struct),
-			_("Search"), G_CALLBACK(qq_group_search_application_with_struct));
-
-	g_free(nombre);
-	g_free(reason);
-	g_free(msg);
-	g_free(reason_utf8);
-}
-
 void qq_room_got_chat_in(PurpleConnection *gc,
 		guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time)
 {
@@ -285,147 +235,8 @@
 	g_free(from);
 }
 
-/* the request to join a group is rejected */
-void qq_process_room_msg_been_rejected(guint8 *data, gint len, guint32 id, PurpleConnection *gc)
-{
-	guint32 ext_id, admin_uid;
-	guint8 type8;
-	gchar *reason_utf8, *msg, *reason;
-	qq_room_data *rmd;
-	gint bytes;
-
-	g_return_if_fail(data != NULL && len > 0);
-
-	/* FIXME: check length here */
-	bytes = 0;
-	bytes += qq_get32(&ext_id, data + bytes);
-	bytes += qq_get8(&type8, data + bytes);
-	bytes += qq_get32(&admin_uid, data + bytes);
-
-	g_return_if_fail(ext_id > 0 && admin_uid > 0);
-
-	bytes += qq_get_vstr(&reason_utf8, QQ_CHARSET_DEFAULT, data + bytes);
-
-	msg = g_strdup_printf
-		(_("Failed to join Qun %d, operated by admin %d"), ext_id, admin_uid);
-	reason = g_strdup_printf(_("Message: %s"), reason_utf8);
-
-	purple_notify_warning(gc, _("QQ Qun Operation"), msg, reason);
-
-	qq_room_find_or_new(gc, id, ext_id);
-	rmd = qq_room_data_find(gc, id);
-	if (rmd != NULL) {
-		rmd->my_role = QQ_ROOM_ROLE_NO;
-	}
-
-	g_free(msg);
-	g_free(reason);
-	g_free(reason_utf8);
-}
-
-/* the request to join a group is approved */
-void qq_process_room_msg_been_approved(guint8 *data, gint len, guint32 id, PurpleConnection *gc)
-{
-	guint32 ext_id, admin_uid;
-	guint8 type8;
-	gchar *msg, *reason;
-	qq_room_data *rmd;
-	gint bytes;
-	time_t now;
-
-	g_return_if_fail(data != NULL && len > 0);
-
-	/* FIXME: check length here */
-	bytes = 0;
-	bytes += qq_get32(&ext_id, data + bytes);
-	bytes += qq_get8(&type8, data + bytes);
-	bytes += qq_get32(&admin_uid, data + bytes);
-
-	g_return_if_fail(ext_id > 0 && admin_uid > 0);
-	/* it is also a "无" here, so do not display */
-	bytes += qq_get_vstr(&reason, QQ_CHARSET_DEFAULT, data + bytes);
-
-	qq_room_find_or_new(gc, id, ext_id);
-	rmd = qq_room_data_find(gc, id);
-	if (rmd != NULL) {
-		rmd->my_role = QQ_ROOM_ROLE_YES;
-	}
-
-	msg = g_strdup_printf(_("<b>Joinning Qun %d is approved by Admin %d for %s</b>"),
-			ext_id, admin_uid, reason);
-	now = time(NULL);
-	qq_room_got_chat_in(gc, id, 0, msg, now);
-
-	g_free(msg);
-	g_free(reason);
-}
-
-/* process the packet when removed from a group */
-void qq_process_room_msg_been_removed(guint8 *data, gint len, guint32 id, PurpleConnection *gc)
-{
-	guint32 ext_id, uid;
-	guint8 type8;
-	gchar *msg;
-	qq_room_data *rmd;
-	gint bytes = 0;
-	time_t now = time(NULL);
-
-	g_return_if_fail(data != NULL && len > 0);
-
-	/* FIXME: check length here */
-	bytes = 0;
-	bytes += qq_get32(&ext_id, data + bytes);
-	bytes += qq_get8(&type8, data + bytes);
-	bytes += qq_get32(&uid, data + bytes);
-
-	g_return_if_fail(ext_id > 0 && uid > 0);
-
-	qq_room_find_or_new(gc, id, ext_id);
-	rmd = qq_room_data_find(gc, id);
-	if (rmd != NULL) {
-		rmd->my_role = QQ_ROOM_ROLE_NO;
-	}
-
-	msg = g_strdup_printf(_("<b>Removed buddy %d.</b>"), uid);
-	qq_room_got_chat_in(gc, id, 0, msg, now);
-	g_free(msg);
-}
-
-/* process the packet when added to a group */
-void qq_process_room_msg_been_added(guint8 *data, gint len, guint32 id, PurpleConnection *gc)
-{
-	guint32 ext_id, uid;
-	guint8 type8;
-	qq_room_data *rmd;
-	gint bytes;
-	gchar *msg;
-	time_t now = time(NULL);
-
-	g_return_if_fail(data != NULL && len > 0);
-
-	/* FIXME: check length here */
-	bytes = 0;
-	bytes += qq_get32(&ext_id, data + bytes);
-	bytes += qq_get8(&type8, data + bytes);
-	bytes += qq_get32(&uid, data + bytes);
-
-	g_return_if_fail(ext_id > 0 && id > 0);
-
-	qq_room_find_or_new(gc, id, ext_id);
-	rmd = qq_room_data_find(gc, id);
-	g_return_if_fail(rmd != NULL);
-
-	rmd->my_role = QQ_ROOM_ROLE_YES;
-
-	qq_update_room(gc, 0, rmd->id);
-
-	msg = g_strdup_printf(_("<b>Added new buddy %d.</b>"), uid);
-	qq_room_got_chat_in(gc, id, 0, msg, now);
-	g_free(msg);
-}
-
 /* recv an IM from a group chat */
-void qq_process_room_msg_normal(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type)
+void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type)
 {
 	gchar *msg_with_purple_smiley, *msg_utf8_encoded;
 	qq_data *qd;
@@ -506,7 +317,7 @@
 	} else {
 		packet.font_attr = NULL;
 	}
-	
+
 	/* group im_group has no flag to indicate whether it has font_attr or not */
 	msg_with_purple_smiley = qq_smiley_to_purple(packet.msg);
 	if (packet.font_attr_len > 0) {
--- a/libpurple/protocols/qq/group_im.h	Tue Oct 28 16:39:23 2008 +0000
+++ b/libpurple/protocols/qq/group_im.h	Tue Oct 28 16:40:56 2008 +0000
@@ -36,19 +36,9 @@
 void qq_room_got_chat_in(PurpleConnection *gc,
 		guint32 room_id, guint32 uid_from, const gchar *msg, time_t in_time);
 
-void qq_send_packet_group_im(PurpleConnection *gc, guint32 room_id, const gchar *msg);
-
-void qq_process_group_cmd_im(guint8 *data, gint len, PurpleConnection *gc);
-
-void qq_process_room_msg_normal(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type);
-
-void qq_process_room_msg_apply_join(guint8 *data, gint len, guint32 id, PurpleConnection *gc);
+void qq_request_room_send_im(PurpleConnection *gc, guint32 room_id, const gchar *msg);
+void qq_process_room_send_im(PurpleConnection *gc, guint8 *data, gint len);
 
-void qq_process_room_msg_been_rejected(guint8 *data, gint len, guint32 id, PurpleConnection *gc);
-
-void qq_process_room_msg_been_approved(guint8 *data, gint len, guint32 id, PurpleConnection *gc);
+void qq_process_room_im(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type);
 
-void qq_process_room_msg_been_removed(guint8 *data, gint len, guint32 id, PurpleConnection *gc);
-
-void qq_process_room_msg_been_added(guint8 *data, gint len, guint32 id, PurpleConnection *gc);
 #endif
--- a/libpurple/protocols/qq/group_join.c	Tue Oct 28 16:39:23 2008 +0000
+++ b/libpurple/protocols/qq/group_join.c	Tue Oct 28 16:40:56 2008 +0000
@@ -52,19 +52,19 @@
 	QQ_ROOM_SEARCH_TYPE_DEMO = 0x02
 };
 
-static void group_quit_cb(qq_add_request *add_req)
+static void group_quit_cb(qq_room_req *add_req)
 {
 	PurpleConnection *gc;
 	guint32 id;
 	qq_room_data *rmd;
 
-	if (add_req->gc == NULL || add_req->uid == 0) {
+	if (add_req->gc == NULL || add_req->id == 0) {
 		g_free(add_req);
 		return;
 	}
 
 	gc = add_req->gc;
-	id = add_req->uid;
+	id = add_req->id;
 
 	rmd = qq_room_data_find(gc, id);
 	if (rmd == NULL) {
@@ -104,19 +104,19 @@
 	qq_send_room_cmd_only(gc, QQ_ROOM_CMD_JOIN, rmd->id);
 }
 
-static void group_join_cb(qq_add_request *add_req, const gchar *reason_utf8)
+static void group_join_cb(qq_room_req *add_req, const gchar *reason_utf8)
 {
 	qq_room_data *rmd;
 
 	g_return_if_fail(add_req != NULL);
-	if (add_req->gc == NULL || add_req->uid == 0) {
+	if (add_req->gc == NULL || add_req->id == 0) {
 		g_free(add_req);
 		return;
 	}
 
-	rmd = qq_room_data_find(add_req->gc, add_req->uid);
+	rmd = qq_room_data_find(add_req->gc, add_req->id);
 	if (rmd == NULL) {
-		purple_debug_error("QQ", "Can not find qq_room_data by internal_id: %d\n", add_req->uid);
+		purple_debug_error("QQ", "Can not find room data of %d\n", add_req->id);
 		g_free(add_req);
 		return;
 	}
@@ -125,30 +125,30 @@
 	g_free(add_req);
 }
 
-void qq_group_cancel_cb(qq_add_request *add_req, const gchar *msg)
+static void room_join_cancel_cb(qq_room_req *add_req, const gchar *msg)
 {
 	g_return_if_fail(add_req != NULL);
 	g_free(add_req);
 }
 
-static void _qq_group_join_auth(PurpleConnection *gc, qq_room_data *rmd)
+static void do_room_join_request(PurpleConnection *gc, qq_room_data *rmd)
 {
 	gchar *msg;
-	qq_add_request *add_req;
+	qq_room_req *add_req;
 	g_return_if_fail(rmd != NULL);
 
 	purple_debug_info("QQ", "Group (internal id: %d) needs authentication\n", rmd->id);
 
 	msg = g_strdup_printf("Group \"%s\" needs authentication\n", rmd->title_utf8);
-	add_req = g_new0(qq_add_request, 1);
+	add_req = g_new0(qq_room_req, 1);
 	add_req->gc = gc;
-	add_req->uid = rmd->id;
+	add_req->id = rmd->id;
 	purple_request_input(gc, NULL, msg,
 			   _("Input request here"),
 			   _("Would you be my friend?"), TRUE, FALSE, NULL,
 			   _("Send"),
 			   G_CALLBACK(group_join_cb),
-			   _("Cancel"), G_CALLBACK(qq_group_cancel_cb),
+			   _("Cancel"), G_CALLBACK(room_join_cancel_cb),
 			   purple_connection_get_account(gc), rmd->title_utf8, NULL,
 			   add_req);
 	g_free(msg);
@@ -272,7 +272,7 @@
 			   "Fail joining group [%d] %s, needs authentication\n",
 			   rmd->ext_id, rmd->title_utf8);
 		rmd->my_role = QQ_ROOM_ROLE_NO;
-		_qq_group_join_auth(gc, rmd);
+		do_room_join_request(gc, rmd);
 		break;
 	case QQ_ROOM_JOIN_DENIED:
 		msg = g_strdup_printf(_("Qun %d denied to join"), rmd->ext_id);
@@ -330,11 +330,11 @@
 
 void qq_room_quit(PurpleConnection *gc, guint32 room_id)
 {
-	qq_add_request *add_req;
+	qq_room_req *add_req;
 
-	add_req = g_new0(qq_add_request, 1);
+	add_req = g_new0(qq_room_req, 1);
 	add_req->gc = gc;
-	add_req->uid = room_id;
+	add_req->id = room_id;
 
 	purple_request_action(gc, _("QQ Qun Operation"),
 			    _("Quit Qun"),
@@ -342,7 +342,7 @@
 			    1,
 				purple_connection_get_account(gc), NULL, NULL,
 			    add_req, 2, _("Cancel"),
-			    G_CALLBACK(qq_group_cancel_cb),
+			    G_CALLBACK(room_join_cancel_cb),
 			    _("Continue"), G_CALLBACK(group_quit_cb));
 }
 
@@ -429,7 +429,7 @@
 		chat = qq_room_find_or_new(gc, rmd.id, rmd.ext_id);
 		g_return_if_fail(chat != NULL);
 
-		qq_room_update_chat_info(gc, &rmd);
+		qq_room_update_chat_info(chat, &rmd);
 		qq_request_room_join(gc, &rmd);
 	} else {
 		add_to_roomlist(qd, &rmd);
--- a/libpurple/protocols/qq/group_join.h	Tue Oct 28 16:39:23 2008 +0000
+++ b/libpurple/protocols/qq/group_join.h	Tue Oct 28 16:40:56 2008 +0000
@@ -56,6 +56,4 @@
 void qq_process_group_cmd_exit_group(guint8 *data, gint len, PurpleConnection *gc);
 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);
-
-void qq_group_cancel_cb(qq_add_request *add_req, const gchar *msg);
 #endif
--- a/libpurple/protocols/qq/group_opt.c	Tue Oct 28 16:39:23 2008 +0000
+++ b/libpurple/protocols/qq/group_opt.c	Tue Oct 28 16:40:56 2008 +0000
@@ -77,66 +77,67 @@
 	qq_send_room_cmd(gc, QQ_ROOM_CMD_MEMBER_OPT, rmd->id, data, bytes);
 }
 
-static void _qq_group_do_nothing_with_struct(group_member_opt *g)
+static void room_req_cancel_cb(qq_room_req *add_req)
 {
-	if (g != NULL)
-		g_free(g);
+	if (add_req != NULL)
+		g_free(add_req);
 }
 
-static void _qq_group_reject_application_real(group_member_opt *g, gchar *msg_utf8)
+static void member_join_reject_send_cb(qq_room_req *add_req, gchar *msg_utf8)
 {
 	qq_room_data *rmd;
-	g_return_if_fail(g != NULL && g->gc != NULL && g->id > 0 && g->member > 0);
-	rmd = qq_room_data_find(g->gc, g->id);
+	g_return_if_fail(add_req != NULL && add_req->gc != NULL && add_req->id > 0 && add_req->member > 0);
+	rmd = qq_room_data_find(add_req->gc, add_req->id);
 	g_return_if_fail(rmd != NULL);
-	qq_send_cmd_group_auth(g->gc, rmd, QQ_ROOM_AUTH_REQUEST_REJECT, g->member, msg_utf8);
-	g_free(g);
+	qq_send_cmd_group_auth(add_req->gc, rmd, QQ_ROOM_AUTH_REQUEST_REJECT, add_req->member, msg_utf8);
+	g_free(add_req);
 }
 
-void qq_group_search_application_with_struct(group_member_opt *g)
+static void member_join_reject_cb(qq_room_req *add_req)
 {
-	g_return_if_fail(g != NULL && g->gc != NULL && g->member > 0);
+	gchar *msg1, *msg2, *who;
+	g_return_if_fail(add_req != NULL && add_req->gc != NULL && add_req->member > 0);
 
-	qq_request_buddy_info(g->gc, g->member, 0, QQ_BUDDY_INFO_DISPLAY);
-	purple_request_action(g->gc, NULL, _("Do you want to approve the request?"), "",
-				PURPLE_DEFAULT_ACTION_NONE,
-				purple_connection_get_account(g->gc), NULL, NULL,
-				g, 2,
-				_("Reject"), G_CALLBACK(qq_group_reject_application_with_struct),
-				_("Approve"), G_CALLBACK(qq_group_approve_application_with_struct));
-}
-
-void qq_group_reject_application_with_struct(group_member_opt *g)
-{
-	gchar *msg1, *msg2, *nombre;
-	g_return_if_fail(g != NULL && g->gc != NULL && g->member > 0);
-
-	msg1 = g_strdup_printf(_("You rejected %d's request"), g->member);
+	msg1 = g_strdup_printf(_("You rejected %d's request"), add_req->member);
 	msg2 = g_strdup(_("Message:"));
 
-	nombre = uid_to_purple_name(g->member);
-	purple_request_input(g->gc, /* title */ NULL, msg1, msg2,
+	who = uid_to_purple_name(add_req->member);
+	purple_request_input(add_req->gc, /* title */ NULL, msg1, msg2,
 			   _("Sorry, you are not my style..."), /* multiline */ TRUE, /* masked */ FALSE,
 			   /* hint */ NULL,
-			   _("Send"), G_CALLBACK(_qq_group_reject_application_real),
-			   _("Cancel"), G_CALLBACK(_qq_group_do_nothing_with_struct),
-			   purple_connection_get_account(g->gc), nombre, NULL,
-			   g);
+			   _("Send"), G_CALLBACK(member_join_reject_send_cb),
+			   _("Cancel"), G_CALLBACK(room_req_cancel_cb),
+			   purple_connection_get_account(add_req->gc), who, NULL,
+			   add_req);
 
 	g_free(msg1);
 	g_free(msg2);
-	g_free(nombre);
+	g_free(who);
 }
 
-void qq_group_approve_application_with_struct(group_member_opt *g)
+static void member_join_authorize_cb(qq_room_req *add_req)
 {
 	qq_room_data *rmd;
-	g_return_if_fail(g != NULL && g->gc != NULL && g->id > 0 && g->member > 0);
-	rmd = qq_room_data_find(g->gc, g->id);
+	g_return_if_fail(add_req != NULL && add_req->gc != NULL && add_req->id > 0 && add_req->member > 0);
+	rmd = qq_room_data_find(add_req->gc, add_req->id);
 	g_return_if_fail(rmd != NULL);
-	qq_send_cmd_group_auth(g->gc, rmd, QQ_ROOM_AUTH_REQUEST_APPROVE, g->member, "");
-	qq_room_buddy_find_or_new(g->gc, rmd, g->member);
-	g_free(g);
+
+	qq_send_cmd_group_auth(add_req->gc, rmd, QQ_ROOM_AUTH_REQUEST_APPROVE, add_req->member, "");
+	qq_room_buddy_find_or_new(add_req->gc, rmd, add_req->member);
+	g_free(add_req);
+}
+
+static void member_join_search_cb(qq_room_req *add_req)
+{
+	g_return_if_fail(add_req != NULL && add_req->gc != NULL && add_req->member > 0);
+
+	qq_request_buddy_info(add_req->gc, add_req->member, 0, QQ_BUDDY_INFO_DISPLAY);
+	purple_request_action(add_req->gc, NULL, _("Do you want to approve the request?"), "",
+				PURPLE_DEFAULT_ACTION_NONE,
+				purple_connection_get_account(add_req->gc), NULL, NULL,
+				add_req, 2,
+				_("Reject"), G_CALLBACK(member_join_reject_cb),
+				_("Approve"), G_CALLBACK(member_join_authorize_cb));
 }
 
 void qq_group_modify_members(PurpleConnection *gc, qq_room_data *rmd, guint32 *new_members)
@@ -279,7 +280,7 @@
 }
 
 /* we create a very simple room first, and then let the user to modify */
-void qq_room_create_new(PurpleConnection *gc, const gchar *name)
+void qq_create_room(PurpleConnection *gc, const gchar *name)
 {
 	guint8 *data;
 	gint data_len;
@@ -319,16 +320,16 @@
 	qq_send_room_cmd_noid(gc, QQ_ROOM_CMD_CREATE, data, bytes);
 }
 
-static void qq_group_setup_cb(qq_add_request *add_req)
+static void room_create_cb(qq_room_req *add_req)
 {
 	qq_room_data *rmd;
 	g_return_if_fail(add_req != NULL);
-	if (add_req->gc == NULL || add_req->uid == 0) {
+	if (add_req->gc == NULL || add_req->id == 0) {
 		g_free(add_req);
 		return;
 	}
 
-	rmd = qq_room_data_find(add_req->gc, add_req->uid);
+	rmd = qq_room_data_find(add_req->gc, add_req->id);
 	if (rmd == NULL) {
 		g_free(add_req);
 		return;
@@ -344,7 +345,7 @@
 	gint bytes;
 	guint32 id, ext_id;
 	qq_room_data *rmd;
-	qq_add_request *add_req;
+	qq_room_req *add_req;
 	qq_data *qd;
 
 	g_return_if_fail(data != NULL);
@@ -368,9 +369,9 @@
 
 	purple_debug_info("QQ", "Succeed in create Qun, external ID %d\n", rmd->ext_id);
 
-	add_req = g_new0(qq_add_request, 1);
+	add_req = g_new0(qq_room_req, 1);
 	add_req->gc = gc;
-	add_req->uid = id;
+	add_req->id = id;
 
 	purple_request_action(gc, _("QQ Qun Operation"),
 			    _("You have successfully created a Qun"),
@@ -378,8 +379,8 @@
 			    1,
 				purple_connection_get_account(gc), NULL, NULL,
 				add_req, 2,
-				_("Setup"), G_CALLBACK(qq_group_setup_cb),
-			    _("Cancel"), G_CALLBACK(qq_group_cancel_cb));
+				_("Setup"), G_CALLBACK(room_create_cb),
+			    _("Cancel"), G_CALLBACK(room_req_cancel_cb));
 }
 
 void qq_group_process_activate_group_reply(guint8 *data, gint len, PurpleConnection *gc)
@@ -418,3 +419,210 @@
 	/* XXX insert UI code here */
 	/* qq_group_detail_window_show(gc, rmd); */
 }
+
+/* receive an application to join the group */
+void qq_process_room_buddy_request_join(guint8 *data, gint len, guint32 id, PurpleConnection *gc)
+{
+	guint32 ext_id, member_id;
+	guint8 type8;
+	gchar *reason_utf8, *msg, *reason;
+	qq_room_req *add_req;
+	gchar *who;
+	gint bytes = 0;
+	qq_room_data *rmd;
+	time_t now = time(NULL);
+
+	g_return_if_fail(id > 0 && data != NULL && len > 0);
+
+	/* FIXME: check length here */
+
+	bytes += qq_get32(&ext_id, data + bytes);
+	bytes += qq_get8(&type8, data + bytes);
+	bytes += qq_get32(&member_id, data + bytes);
+
+	g_return_if_fail(ext_id > 0 && member_id > 0);
+
+	bytes += qq_get_vstr(&reason_utf8, QQ_CHARSET_DEFAULT, data + bytes);
+
+	add_req = g_new0(qq_room_req, 1);
+	add_req->gc = gc;
+	add_req->id = id;
+	add_req->member = member_id;
+
+	purple_debug_info("QQ", "%d requested to join room, ext id %d\n", member_id, ext_id);
+
+	rmd = qq_room_data_find(gc, id);
+	g_return_if_fail(rmd != NULL);
+	if (qq_room_buddy_find(rmd, member_id)) {
+		purple_debug_info("QQ", "Approve join, buddy joined before\n");
+		msg = g_strdup_printf(_("%d requested to join Qun %d for %s"),
+				member_id, ext_id, reason_utf8);
+		qq_room_got_chat_in(gc, id, 0, msg, now);
+		qq_send_cmd_group_auth(gc, rmd, QQ_ROOM_AUTH_REQUEST_APPROVE, member_id, "");
+		g_free(msg);
+		g_free(reason_utf8);
+		return;
+	}
+
+	who = uid_to_purple_name(member_id);
+	msg = g_strdup_printf(_("%d request to join Qun %d"), member_id, ext_id);
+	reason = g_strdup_printf(_("Message: %s"), reason_utf8);
+
+	purple_request_action(gc, _("QQ Qun Operation"),
+			msg, reason,
+			PURPLE_DEFAULT_ACTION_NONE,
+			purple_connection_get_account(gc), who, NULL,
+			add_req, 3,
+			_("Approve"),
+			G_CALLBACK
+			(member_join_authorize_cb),
+			_("Reject"),
+			G_CALLBACK
+			(member_join_reject_cb),
+			_("Search"), G_CALLBACK(member_join_search_cb));
+
+	g_free(who);
+	g_free(msg);
+	g_free(reason);
+	g_free(reason_utf8);
+}
+
+/* the request to join a group is rejected */
+void qq_process_room_buddy_rejected(guint8 *data, gint len, guint32 id, PurpleConnection *gc)
+{
+	guint32 ext_id, admin_uid;
+	guint8 type8;
+	gchar *reason_utf8, *msg, *reason;
+	qq_room_data *rmd;
+	gint bytes;
+
+	g_return_if_fail(data != NULL && len > 0);
+
+	/* FIXME: check length here */
+	bytes = 0;
+	bytes += qq_get32(&ext_id, data + bytes);
+	bytes += qq_get8(&type8, data + bytes);
+	bytes += qq_get32(&admin_uid, data + bytes);
+
+	g_return_if_fail(ext_id > 0 && admin_uid > 0);
+
+	bytes += qq_get_vstr(&reason_utf8, QQ_CHARSET_DEFAULT, data + bytes);
+
+	msg = g_strdup_printf
+		(_("Failed to join Qun %d, operated by admin %d"), ext_id, admin_uid);
+	reason = g_strdup_printf(_("Message: %s"), reason_utf8);
+
+	purple_notify_warning(gc, _("QQ Qun Operation"), msg, reason);
+
+	qq_room_find_or_new(gc, id, ext_id);
+	rmd = qq_room_data_find(gc, id);
+	if (rmd != NULL) {
+		rmd->my_role = QQ_ROOM_ROLE_NO;
+	}
+
+	g_free(msg);
+	g_free(reason);
+	g_free(reason_utf8);
+}
+
+/* the request to join a group is approved */
+void qq_process_room_buddy_approved(guint8 *data, gint len, guint32 id, PurpleConnection *gc)
+{
+	guint32 ext_id, admin_uid;
+	guint8 type8;
+	gchar *msg, *reason;
+	qq_room_data *rmd;
+	gint bytes;
+	time_t now;
+
+	g_return_if_fail(data != NULL && len > 0);
+
+	/* FIXME: check length here */
+	bytes = 0;
+	bytes += qq_get32(&ext_id, data + bytes);
+	bytes += qq_get8(&type8, data + bytes);
+	bytes += qq_get32(&admin_uid, data + bytes);
+
+	g_return_if_fail(ext_id > 0 && admin_uid > 0);
+	/* it is also a "无" here, so do not display */
+	bytes += qq_get_vstr(&reason, QQ_CHARSET_DEFAULT, data + bytes);
+
+	qq_room_find_or_new(gc, id, ext_id);
+	rmd = qq_room_data_find(gc, id);
+	if (rmd != NULL) {
+		rmd->my_role = QQ_ROOM_ROLE_YES;
+	}
+
+	msg = g_strdup_printf(_("<b>Joinning Qun %d is approved by Admin %d for %s</b>"),
+			ext_id, admin_uid, reason);
+	now = time(NULL);
+	qq_room_got_chat_in(gc, id, 0, msg, now);
+
+	g_free(msg);
+	g_free(reason);
+}
+
+/* process the packet when removed from a group */
+void qq_process_room_buddy_removed(guint8 *data, gint len, guint32 id, PurpleConnection *gc)
+{
+	guint32 ext_id, uid;
+	guint8 type8;
+	gchar *msg;
+	qq_room_data *rmd;
+	gint bytes = 0;
+	time_t now = time(NULL);
+
+	g_return_if_fail(data != NULL && len > 0);
+
+	/* FIXME: check length here */
+	bytes = 0;
+	bytes += qq_get32(&ext_id, data + bytes);
+	bytes += qq_get8(&type8, data + bytes);
+	bytes += qq_get32(&uid, data + bytes);
+
+	g_return_if_fail(ext_id > 0 && uid > 0);
+
+	qq_room_find_or_new(gc, id, ext_id);
+	rmd = qq_room_data_find(gc, id);
+	if (rmd != NULL) {
+		rmd->my_role = QQ_ROOM_ROLE_NO;
+	}
+
+	msg = g_strdup_printf(_("<b>Removed buddy %d.</b>"), uid);
+	qq_room_got_chat_in(gc, id, 0, msg, now);
+	g_free(msg);
+}
+
+/* process the packet when added to a group */
+void qq_process_room_buddy_joined(guint8 *data, gint len, guint32 id, PurpleConnection *gc)
+{
+	guint32 ext_id, uid;
+	guint8 type8;
+	qq_room_data *rmd;
+	gint bytes;
+	gchar *msg;
+	time_t now = time(NULL);
+
+	g_return_if_fail(data != NULL && len > 0);
+
+	/* FIXME: check length here */
+	bytes = 0;
+	bytes += qq_get32(&ext_id, data + bytes);
+	bytes += qq_get8(&type8, data + bytes);
+	bytes += qq_get32(&uid, data + bytes);
+
+	g_return_if_fail(ext_id > 0 && id > 0);
+
+	qq_room_find_or_new(gc, id, ext_id);
+	rmd = qq_room_data_find(gc, id);
+	g_return_if_fail(rmd != NULL);
+
+	rmd->my_role = QQ_ROOM_ROLE_YES;
+
+	qq_update_room(gc, 0, rmd->id);
+
+	msg = g_strdup_printf(_("<b>New buddy %d joined.</b>"), uid);
+	qq_room_got_chat_in(gc, id, 0, msg, now);
+	g_free(msg);
+}
+
--- a/libpurple/protocols/qq/group_opt.h	Tue Oct 28 16:39:23 2008 +0000
+++ b/libpurple/protocols/qq/group_opt.h	Tue Oct 28 16:40:56 2008 +0000
@@ -31,11 +31,11 @@
 
 #define QQ_QUN_MEMBER_MAX       80	/* max number of the group */
 
-typedef struct _group_member_opt {
+typedef struct _qq_room_req {
 	PurpleConnection *gc;
 	guint32 id;
 	guint32 member;
-} group_member_opt;
+} qq_room_req;
 
 enum {
 	QQ_ROOM_TYPE_PERMANENT = 0x01,
@@ -50,15 +50,16 @@
 void qq_group_modify_members(PurpleConnection *gc, qq_room_data *rmd, guint32 *new_members);
 void qq_room_change_info(PurpleConnection *gc, qq_room_data *rmd);
 
-void qq_group_approve_application_with_struct(group_member_opt *g);
-void qq_group_reject_application_with_struct(group_member_opt *g);
-void qq_group_search_application_with_struct(group_member_opt *g);
-
+void qq_create_room(PurpleConnection *gc, const gchar *name);
 void qq_group_process_modify_info_reply(guint8 *data, gint len, PurpleConnection *gc);
 void qq_group_process_modify_members_reply(guint8 *data, gint len, PurpleConnection *gc);
 void qq_group_manage_group(PurpleConnection *gc, GHashTable *data);
-void qq_room_create_new(PurpleConnection *gc, const gchar *name);
 void qq_group_process_activate_group_reply(guint8 *data, gint len, PurpleConnection *gc);
 void qq_group_process_create_group_reply(guint8 *data, gint len, PurpleConnection *gc);
 
+void qq_process_room_buddy_request_join(guint8 *data, gint len, guint32 id, PurpleConnection *gc);
+void qq_process_room_buddy_rejected(guint8 *data, gint len, guint32 id, PurpleConnection *gc);
+void qq_process_room_buddy_approved(guint8 *data, gint len, guint32 id, PurpleConnection *gc);
+void qq_process_room_buddy_removed(guint8 *data, gint len, guint32 id, PurpleConnection *gc);
+void qq_process_room_buddy_joined(guint8 *data, gint len, guint32 id, PurpleConnection *gc);
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/qq/group_search.c	Tue Oct 28 16:40:56 2008 +0000
@@ -0,0 +1,37 @@
+/**
+ * @file group_search.c
+ *
+ * purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+
+#include "internal.h"
+
+#include "debug.h"
+
+#include "char_conv.h"
+#include "group_internal.h"
+#include "group_join.h"
+#include "group_search.h"
+#include "utils.h"
+#include "qq_define.h"
+#include "packet_parse.h"
+#include "qq_network.h"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/protocols/qq/group_search.h	Tue Oct 28 16:40:56 2008 +0000
@@ -0,0 +1,31 @@
+/**
+ * @file group_search.h
+ *
+ * purple
+ *
+ * Purple is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+
+#ifndef _QQ_GROUP_SEARCH_H_
+#define _QQ_GROUP_SEARCH_H_
+
+#include <glib.h>
+#include "connection.h"
+
+#endif
--- a/libpurple/protocols/qq/qq.c	Tue Oct 28 16:39:23 2008 +0000
+++ b/libpurple/protocols/qq/qq.c	Tue Oct 28 16:40:56 2008 +0000
@@ -484,7 +484,7 @@
 	purple_debug_info("QQ_MESG", "Send qun mesg in utf8: %s\n", message);
 	msg = utf8_to_qq(message, QQ_CHARSET_DEFAULT);
 	msg_with_qq_smiley = purple_smiley_to_qq(msg);
-	qq_send_packet_group_im(gc, room_id, msg_with_qq_smiley);
+	qq_request_room_send_im(gc, room_id, msg_with_qq_smiley);
 	g_free(msg);
 	g_free(msg_with_qq_smiley);
 
@@ -736,7 +736,7 @@
 			   _("Input Qun name here"),
 			   _("Only QQ members can create permanent Qun"),
 			   "OpenQ", FALSE, FALSE, NULL,
-			   _("Create"), G_CALLBACK(qq_room_create_new), _("Cancel"), NULL, gc);
+			   _("Create"), G_CALLBACK(qq_create_room), _("Cancel"), NULL, gc);
 }
 */
 
--- a/libpurple/protocols/qq/qq.h	Tue Oct 28 16:39:23 2008 +0000
+++ b/libpurple/protocols/qq/qq.h	Tue Oct 28 16:40:56 2008 +0000
@@ -40,7 +40,6 @@
 typedef struct _qq_buddy_data qq_buddy_data;
 typedef struct _qq_interval qq_interval;
 typedef struct _qq_net_stat qq_net_stat;
-typedef struct _qq_add_request qq_add_request;
 typedef struct _qq_login_data qq_login_data;
 typedef struct _qq_captcha_data qq_captcha_data;
 
@@ -67,11 +66,6 @@
 	guint8 login_key[QQ_KEY_LENGTH];
 };
 
-struct _qq_add_request {
-	guint32 uid;
-	PurpleConnection *gc;
-};
-
 struct _qq_interval {
 	gint resend;
 	gint keep_alive;
--- a/libpurple/protocols/qq/qq_process.c	Tue Oct 28 16:39:23 2008 +0000
+++ b/libpurple/protocols/qq/qq_process.c	Tue Oct 28 16:40:56 2008 +0000
@@ -311,35 +311,35 @@
 		case QQ_MSG_TEMP_QUN_IM:
 		case QQ_MSG_QUN_IM:
 			purple_debug_info("QQ", "MSG from room [%d]\n", header.uid_from);
-			qq_process_room_msg_normal(data + bytes, data_len - bytes, header.uid_from, gc, header.msg_type);
+			qq_process_room_im(data + bytes, data_len - bytes, header.uid_from, gc, header.msg_type);
 			break;
 		case QQ_MSG_ADD_TO_QUN:
 			purple_debug_info("QQ", "Notice from [%d], Added\n", header.uid_from);
 			/* uid_from is group id
 			 * we need this to create a dummy group and add to blist */
-			qq_process_room_msg_been_added(data + bytes, data_len - bytes, header.uid_from, gc);
+			qq_process_room_buddy_joined(data + bytes, data_len - bytes, header.uid_from, gc);
 			break;
 		case QQ_MSG_DEL_FROM_QUN:
 			purple_debug_info("QQ", "Notice from room [%d], Removed\n", header.uid_from);
 			/* uid_from is group id */
-			qq_process_room_msg_been_removed(data + bytes, data_len - bytes, header.uid_from, gc);
+			qq_process_room_buddy_removed(data + bytes, data_len - bytes, header.uid_from, gc);
 			break;
 		case QQ_MSG_APPLY_ADD_TO_QUN:
 			purple_debug_info("QQ", "Notice from room [%d], Joined\n", header.uid_from);
 			/* uid_from is group id */
-			qq_process_room_msg_apply_join(data + bytes, data_len - bytes, header.uid_from, gc);
+			qq_process_room_buddy_request_join(data + bytes, data_len - bytes, header.uid_from, gc);
 			break;
 		case QQ_MSG_APPROVE_APPLY_ADD_TO_QUN:
 			purple_debug_info("QQ", "Notice from room [%d], Confirm add in\n",
 					header.uid_from);
 			/* uid_from is group id */
-			qq_process_room_msg_been_approved(data + bytes, data_len - bytes, header.uid_from, gc);
+			qq_process_room_buddy_approved(data + bytes, data_len - bytes, header.uid_from, gc);
 			break;
 		case QQ_MSG_REJCT_APPLY_ADD_TO_QUN:
 			purple_debug_info("QQ", "Notice from room [%d], Refuse add in\n",
 					header.uid_from);
 			/* uid_from is group id */
-			qq_process_room_msg_been_rejected(data + bytes, data_len - bytes, header.uid_from, gc);
+			qq_process_room_buddy_rejected(data + bytes, data_len - bytes, header.uid_from, gc);
 			break;
 		case QQ_MSG_SYS_30:
 			do_msg_sys_30(gc, data + bytes, data_len - bytes);
@@ -802,7 +802,7 @@
 		qq_process_group_cmd_exit_group(data + bytes, data_len - bytes, gc);
 		break;
 	case QQ_ROOM_CMD_SEND_MSG:
-		qq_process_group_cmd_im(data + bytes, data_len - bytes, gc);
+		qq_process_room_send_im(gc, data + bytes, data_len - bytes);
 		break;
 	case QQ_ROOM_CMD_GET_ONLINES:
 		qq_process_room_cmd_get_onlines(data + bytes, data_len - bytes, gc);