gobjectification: 9d37e933: Fix QQ compile.

qulogic at pidgin.im qulogic at pidgin.im
Sat Dec 13 22:19:05 EST 2008


-----------------------------------------------------------------
Revision: 9d37e933803491a9c27f23e9626471d0d1983a93
Ancestor: 3e9ec1b1fbcee802b8f7c0a10f2668466e482abb
Author: qulogic at pidgin.im
Date: 2008-12-14T01:17:35
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/9d37e933803491a9c27f23e9626471d0d1983a93

Modified files:
        libpurple/protocols/qq/buddy_opt.c
        libpurple/protocols/qq/group_im.c
        libpurple/protocols/qq/group_internal.c
        libpurple/protocols/qq/group_join.c
        libpurple/protocols/qq/im.c libpurple/protocols/qq/qq.c
        libpurple/protocols/qq/qq_base.c
        libpurple/protocols/qq/qq_network.c
        libpurple/protocols/qq/qq_process.c

ChangeLog: 

Fix QQ compile.

-------------- next part --------------
============================================================
--- libpurple/protocols/qq/buddy_opt.c	b50a6950250f6a0cad2b2301ff2a3f68c825f9e8
+++ libpurple/protocols/qq/buddy_opt.c	20842a0e4719034e0a603da19d107a1ae6222e85
@@ -164,7 +164,7 @@ static void qq_buddy_free(PurpleBuddy *b
 	if (purple_object_get_protocol_data(PURPLE_OBJECT(buddy)))	{
 		qq_buddy_data_free(purple_object_get_protocol_data(PURPLE_OBJECT(buddy)));
 	}
-	purple_object_set_protocol_data(PURPLE_OBJECT(buddy), NULL)
+	purple_object_set_protocol_data(PURPLE_OBJECT(buddy), NULL);
 	purple_blist_remove_buddy(buddy);
 }
 
@@ -185,7 +185,7 @@ PurpleBuddy *qq_buddy_find_or_new(Purple
 {
 	PurpleBuddy *buddy;
 
-	g_return_val_if_fail(gc->account != NULL && uid != 0, NULL);
+	g_return_val_if_fail(gc != NULL && uid != 0, NULL);
 
 	buddy = qq_buddy_find(gc, uid);
 	if (buddy == NULL) {
@@ -682,10 +682,11 @@ void qq_add_buddy(PurpleConnection *gc, 
 	qq_data *qd;
 	guint32 uid;
 
-	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
+	g_return_if_fail(gc != NULL);
 	g_return_if_fail(buddy != NULL);
-
 	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
+
 	if (!qd->is_login)
 		return;		/* IMPORTANT ! */
 
@@ -924,7 +925,7 @@ void qq_remove_buddy(PurpleConnection *g
 		}
 	}
 
-	bd = purple_object_get_protocol_data(PURPLE_OBJECT(buddy))
+	bd = purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
 	if (bd) {
 		qq_buddy_data_free(bd);
 		purple_object_set_protocol_data(PURPLE_OBJECT(buddy), NULL);
@@ -1259,7 +1260,7 @@ static void server_buddy_rejected_me(Pur
 	if (buddy != NULL && purple_object_get_protocol_data(PURPLE_OBJECT(buddy)) != NULL) {
 		/* Not authorized now, free buddy data */
 		qq_buddy_data_free(purple_object_get_protocol_data(PURPLE_OBJECT(buddy)));
-		purple_object_get_protocol_data(PURPLE_OBJECT(buddy), NULL);
+		purple_object_set_protocol_data(PURPLE_OBJECT(buddy), NULL);
 	}
 }
 
============================================================
--- libpurple/protocols/qq/group_im.c	d8483aa179793e7ac2697e910f2af0a2f746fc23
+++ libpurple/protocols/qq/group_im.c	4f656cd0a62956c2669009e21ecb81ed6039ef0c
@@ -52,7 +52,7 @@ PurpleConversation *qq_room_conv_open(Pu
 	gchar *topic_utf8;
 
 	g_return_val_if_fail(rmd != NULL, NULL);
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT,
 			rmd->title_utf8, purple_connection_get_account(gc));
@@ -225,7 +225,7 @@ void qq_process_room_im(guint8 *data, gi
 
 	/* at least include im_text.msg_len */
 	g_return_if_fail(data != NULL && data_len > 23);
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* qq_show_packet("ROOM_IM", data, data_len); */
 	memset(&im_text, 0, sizeof(im_text));
@@ -374,11 +374,13 @@ int qq_chat_send(PurpleConnection *gc, i
 	gboolean is_smiley_none;
 	guint8 frag_count, frag_index;
 
-	g_return_val_if_fail(NULL != gc && NULL != gc->proto_data, -1);
+	g_return_val_if_fail(gc != NULL, -1);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_val_if_fail(qd != NULL, -1);
 	g_return_val_if_fail(id != 0 && what != NULL, -1);
 
-	qd = (qq_data *) gc->proto_data;
-	purple_debug_info("QQ", "Send chat IM to %u, len %d:\n%s\n", id, strlen(what), what);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	purple_debug_info("QQ", "Send chat IM to %u, len %d:\n%s\n", id, (int)strlen(what), what);
 
 	/* qq_show_packet("chat IM UTF8", (guint8 *)what, strlen(what)); */
 
============================================================
--- libpurple/protocols/qq/group_internal.c	0c1a9a139300f02d86f979b5ab665e2e17f8b255
+++ libpurple/protocols/qq/group_internal.c	250de7746101360c62ce4110d78b2ce5600e2e78
@@ -147,8 +147,9 @@ PurpleChat *qq_room_find_or_new(PurpleCo
 	PurpleChat *chat;
 	gchar *num_str;
 
-	g_return_val_if_fail (gc != NULL && gc->proto_data != NULL, NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_val_if_fail(gc != NULL, NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_val_if_fail(qd != NULL, NULL);
 
 	g_return_val_if_fail(id != 0 && ext_id != 0, NULL);
 
@@ -180,8 +181,9 @@ void qq_room_remove(PurpleConnection *gc
 	gchar *num_str;
 	guint32 ext_id;
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	purple_debug_info("QQ", "Find and remove room data, id %u", id);
 	rmd = qq_room_data_find(gc, id);
@@ -251,7 +253,7 @@ qq_buddy_data *qq_room_buddy_find_or_new
 		member->uid = member_uid;
 		buddy = purple_find_buddy(purple_connection_get_account(gc), uid_to_purple_name(member_uid));
 		if (buddy != NULL) {
-			bd = (qq_buddy_data *) buddy->proto_data;
+			bd = (qq_buddy_data *) purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
 			if (bd != NULL && bd->nickname != NULL)
 				member->nickname = g_strdup(bd->nickname);
 			else if (buddy->alias != NULL)
@@ -269,7 +271,7 @@ qq_room_data *qq_room_data_find(PurpleCo
 	qq_room_data *rmd;
 	qq_data *qd;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	if (qd->groups == NULL || room_id <= 0)
 		return 0;
@@ -293,7 +295,7 @@ guint32 qq_room_get_next(PurpleConnectio
 	qq_data *qd;
 	gboolean is_find = FALSE;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	if (qd->groups == NULL) {
 		return 0;
@@ -328,7 +330,7 @@ guint32 qq_room_get_next_conv(PurpleConn
 	qq_data *qd;
 	gboolean is_find;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
  	list = qd->groups;
 	if (room_id > 0) {
@@ -374,7 +376,7 @@ void qq_room_data_initial(PurpleConnecti
 	gint count;
 
 	account = purple_connection_get_account(gc);
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	purple_debug_info("QQ", "Initial QQ Qun configurations\n");
 	purple_group = purple_find_group(PURPLE_GROUP_QQ_QUN);
@@ -407,8 +409,9 @@ void qq_room_data_free_all(PurpleConnect
 	qq_room_data *rmd;
 	gint count;
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	count = 0;
 	while (qd->groups != NULL) {
@@ -422,3 +425,4 @@ void qq_room_data_free_all(PurpleConnect
 		purple_debug_info("QQ", "%d rooms are freed\n", count);
 	}
 }
+
============================================================
--- libpurple/protocols/qq/group_join.c	6db8f9030fb1163b80698293edfee23473da8787
+++ libpurple/protocols/qq/group_join.c	221088dd06d9b688701c39feb18d7535b20b9712
@@ -391,7 +391,7 @@ void qq_process_room_search(PurpleConnec
 	guint16 unknown;
 
 	g_return_if_fail(data != NULL && len > 0);
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	bytes = 0;
 	bytes += qq_get8(&search_type, data + bytes);
============================================================
--- libpurple/protocols/qq/im.c	fa7dd09b964c98e09a01309b92560fc5a130d147
+++ libpurple/protocols/qq/im.c	19e437a2aa8649718c9f53e292dc9c0b5ef17c43
@@ -707,8 +707,9 @@ void qq_got_message(PurpleConnection *gc
 	gchar *from;
 	time_t now = time(NULL);
 
-	g_return_if_fail(gc != NULL  && gc->proto_data != NULL);
-	qd = gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	g_return_if_fail(qd->uid > 0);
 
@@ -749,7 +750,7 @@ static void process_im_text(PurpleConnec
 	g_return_if_fail (data != NULL && len > 0);
 	g_return_if_fail(im_header != NULL);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	memset(&im_text, 0, sizeof(im_text));
 
 	/* qq_show_packet("IM text", data, len); */
@@ -780,16 +781,16 @@ static void process_im_text(PurpleConnec
 	/* qq_show_packet("IM text", (guint8 *)im_text.msg , strlen(im_text.msg) ); */
 
 	who = uid_to_purple_name(im_header->uid_from);
-	buddy = purple_find_buddy(gc->account, who);
+	buddy = purple_find_buddy(purple_connection_get_account(gc), who);
 	if (buddy == NULL) {
 		/* create no-auth buddy */
 		buddy = qq_buddy_new(gc, im_header->uid_from);
 	}
-	bd = (buddy == NULL) ? NULL : (qq_buddy_data *) buddy->proto_data;
+	bd = (buddy == NULL) ? NULL : (qq_buddy_data *) purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
 	if (bd != NULL) {
 		bd->client_tag = im_header->version_from;
 		bd->face = im_text.sender_icon;
-		qq_update_buddy_icon(gc->account, who, bd->face);
+		qq_update_buddy_icon(purple_connection_get_account(gc), who, bd->face);
 	}
 
 	purple_msg_type = (im_text.msg_type == QQ_IM_AUTO_REPLY)
@@ -848,7 +849,7 @@ static void process_extend_im_text(Purpl
 	g_return_if_fail (data != NULL && len > 0);
 	g_return_if_fail(im_header != NULL);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	memset(&im_text, 0, sizeof(im_text));
 
 	/* qq_show_packet("Extend IM text", data, len); */
@@ -881,16 +882,16 @@ static void process_extend_im_text(Purpl
 	if(im_text.fragment_count == 0) 	im_text.fragment_count = 1;
 
 	who = uid_to_purple_name(im_header->uid_from);
-	buddy = purple_find_buddy(gc->account, who);
+	buddy = purple_find_buddy(purple_connection_get_account(gc), who);
 	if (buddy == NULL) {
 		/* create no-auth buddy */
 		buddy = qq_buddy_new(gc, im_header->uid_from);
 	}
-	bd = (buddy == NULL) ? NULL : (qq_buddy_data *) buddy->proto_data;
+	bd = (buddy == NULL) ? NULL : (qq_buddy_data *) purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
 	if (bd != NULL) {
 		bd->client_tag = im_header->version_from;
 		bd->face = im_text.sender_icon;
-		qq_update_buddy_icon(gc->account, who, bd->face);
+		qq_update_buddy_icon(purple_connection_get_account(gc), who, bd->face);
 	}
 
 	purple_msg_type = 0;
@@ -1044,7 +1045,7 @@ static void request_send_im(PurpleConnec
 	gint bytes;
 	time_t now;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	im_type = QQ_NORMAL_IM_TEXT;
 
 	/* purple_debug_info("QQ", "Send IM %d-%d\n", frag_count, frag_index); */
@@ -1254,11 +1255,12 @@ gint qq_send_im(PurpleConnection *gc, co
 	guint8 frag_count, frag_index;
 	guint8 msg_id;
 
-	g_return_val_if_fail(NULL != gc && NULL != gc->proto_data, -1);
+	g_return_val_if_fail(gc != NULL, -1);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_val_if_fail(qd != NULL, -1);
 	g_return_val_if_fail(who != NULL && what != NULL, -1);
 
-	qd = (qq_data *) gc->proto_data;
-	purple_debug_info("QQ", "Send IM to %s, len %d:\n%s\n", who, strlen(what), what);
+	purple_debug_info("QQ", "Send IM to %s, len %d:\n%s\n", who, (int)strlen(what), what);
 
 	uid_to = purple_name_to_uid(who);
 	if (uid_to == qd->uid) {
============================================================
--- libpurple/protocols/qq/qq.c	d0fc3aed883e2dc261fc8daaa67c5eed86f21a6f
+++ libpurple/protocols/qq/qq.c	4b42532fc3074c2cea2ddee0b4cc10a42afd57aa
@@ -92,8 +92,9 @@ static void server_list_create(PurpleAcc
 	const gchar *custom_server;
 
 	gc = purple_account_get_connection(account);
-	g_return_if_fail(gc != NULL  && gc->proto_data != NULL);
-	qd = gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	gpi = purple_proxy_get_setup(account);
 
@@ -138,12 +139,13 @@ static void qq_login(PurpleAccount *acco
 	gc = purple_account_get_connection(account);
 	g_return_if_fail(gc != NULL);
 
-	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_AUTO_RESP;
+	purple_connection_turn_on_flags(gc,
+		PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_NO_BGCOLOR | PURPLE_CONNECTION_FLAGS_AUTO_RESP);
 
 	qd = g_new0(qq_data, 1);
 	memset(qd, 0, sizeof(qq_data));
 	qd->gc = gc;
-	gc->proto_data = qd;
+	purple_object_set_protocol_data(PURPLE_OBJECT(gc), qd);
 
 	presence = purple_account_get_presence(account);
 	if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE)) {
@@ -206,8 +208,9 @@ static void qq_close(PurpleConnection *g
 {
 	qq_data *qd;
 
-	g_return_if_fail(gc != NULL  && gc->proto_data);
-	qd = gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	if (qd->check_watcher > 0) {
 		purple_timeout_remove(qd->check_watcher);
@@ -230,7 +233,7 @@ static void qq_close(PurpleConnection *g
 	server_list_remove_all(qd);
 
 	g_free(qd);
-	gc->proto_data = NULL;
+	purple_object_set_protocol_data(PURPLE_OBJECT(gc), NULL);
 }
 
 /* returns the icon name for a buddy or protocol */
@@ -246,7 +249,7 @@ static gchar *qq_status_text(PurpleBuddy
 	qq_buddy_data *bd;
 	GString *status;
 
-	bd = (qq_buddy_data *) b->proto_data;
+	bd = (qq_buddy_data *) purple_object_get_protocol_data(PURPLE_OBJECT(b));
 	if (bd == NULL)
 		return NULL;
 
@@ -289,7 +292,7 @@ static void qq_tooltip_text(PurpleBuddy 
 
 	g_return_if_fail(b != NULL);
 
-	bd = (qq_buddy_data *) b->proto_data;
+	bd = (qq_buddy_data *) purple_object_get_protocol_data(PURPLE_OBJECT(b));
 	if (bd == NULL)
 		return;
 
@@ -381,10 +384,11 @@ static const char *qq_list_emblem(Purple
 	qq_buddy_data *buddy;
 
 	if (!b || !(account = b->account) ||
-		!(gc = purple_account_get_connection(account)) || !(qd = gc->proto_data))
+		!(gc = purple_account_get_connection(account)) ||
+		!(qd = purple_object_get_protocol_data(PURPLE_OBJECT(gc))))
 		return NULL;
 
-	buddy = (qq_buddy_data *)b->proto_data;
+	buddy = (qq_buddy_data *)purple_object_get_protocol_data(PURPLE_OBJECT(b));
 	if (!buddy) {
 		return "not-authorized";
 	}
@@ -446,7 +450,7 @@ static void qq_show_buddy_info(PurpleCon
 	guint32 uid;
 	qq_data *qd;
 
-	qd = gc->proto_data;
+	qd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	uid = purple_name_to_uid(who);
 
 	if (uid <= 0) {
@@ -468,8 +472,9 @@ static void action_update_all_rooms(Purp
 	PurpleConnection *gc = (PurpleConnection *) action->context;
 	qq_data *qd;
 
-	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	if ( !qd->is_login ) {
 		return;
@@ -485,8 +490,9 @@ static void action_change_icon(PurplePlu
 	gchar *icon_name;
 	gchar *icon_path;
 
-	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	if ( !qd->is_login ) {
 		return;
@@ -510,8 +516,9 @@ static void action_modify_info_base(Purp
 	PurpleConnection *gc = (PurpleConnection *) action->context;
 	qq_data *qd;
 
-	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 	qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_BASE);
 }
 
@@ -520,8 +527,9 @@ static void action_modify_info_ext(Purpl
 	PurpleConnection *gc = (PurpleConnection *) action->context;
 	qq_data *qd;
 
-	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 	qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_EXT);
 }
 
@@ -530,8 +538,9 @@ static void action_modify_info_addr(Purp
 	PurpleConnection *gc = (PurpleConnection *) action->context;
 	qq_data *qd;
 
-	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 	qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_ADDR);
 }
 
@@ -540,16 +549,20 @@ static void action_modify_info_contact(P
 	PurpleConnection *gc = (PurpleConnection *) action->context;
 	qq_data *qd;
 
-	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 	qq_request_buddy_info(gc, qd->uid, 0, QQ_BUDDY_INFO_MODIFY_CONTACT);
 }
 
 static void action_change_password(PurplePluginAction *action)
 {
-	PurpleConnection *gc = (PurpleConnection *) action->context;
+/*	PurpleConnection *gc = (PurpleConnection *) action->context;
+	qq_data *qd;
 
-	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
+	g_return_if_fail(gc != NULL);
+	qd = (qd_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);*/
 	purple_notify_uri(NULL, "https://password.qq.com");
 }
 
@@ -562,8 +575,9 @@ static void action_show_account_info(Pur
 	struct tm *tm_local;
 	int index;
 
-	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 	info = g_string_new("<html><body>");
 
 	tm_local = localtime(&qd->login_time);
@@ -618,8 +632,9 @@ static void action_about_openq(PurplePlu
 	GString *info;
 	gchar *title;
 
-	g_return_if_fail(NULL != gc && NULL != gc->proto_data);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	info = g_string_new("<html><body>");
 	g_string_append(info, _("<p><b>Original Author</b>:<br>\n"));
@@ -739,10 +754,10 @@ static void _qq_menu_send_file(PurpleBli
 
 	g_return_if_fail (PURPLE_BLIST_NODE_IS_BUDDY (node));
 	buddy = (PurpleBuddy *) node;
-	bd = (qq_buddy_data *) buddy->proto_data;
+	bd = (qq_buddy_data *) purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
 /*	if (is_online (bd->status)) { */
 	gc = purple_account_get_connection (buddy->account);
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
+	g_return_if_fail(gc != NULL);
 	qq_send_file(gc, buddy->name, NULL);
 /*	} */
 }
@@ -811,9 +826,9 @@ static GList *qq_buddy_menu(PurpleBuddy 
 	PurpleMenuAction *act;
 	/*
 	PurpleConnection *gc = purple_account_get_connection(buddy->account);
-	qq_data *qd = gc->proto_data;
+	qq_data *qd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	*/
-	qq_buddy_data *bd = (qq_buddy_data *)buddy->proto_data;
+	qq_buddy_data *bd = (qq_buddy_data *)purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
 
 	if (bd == NULL) {
 		act = purple_menu_action_new(_("Add Buddy"),
@@ -898,7 +913,7 @@ static void qq_get_chat_buddy_info(Purpl
 		return;
 	}
 
-	qd = gc->proto_data;
+	qd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	uid = purple_name_to_uid(uid_str);
 	g_free(uid_str);
 
============================================================
--- libpurple/protocols/qq/qq_base.c	c8da79024ef3f493ddd8eef7006c3f6db6433f5f
+++ libpurple/protocols/qq/qq_base.c	6044f4e6c58bd6f9dc51a80435fbd2a2d6ef0945
@@ -65,7 +65,7 @@ static gint8 process_login_ok(PurpleConn
 	guint16 port;
 	struct tm *tm_local;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	/* qq_show_packet("Login reply", data, len); */
 
 	if (len < 148) {
@@ -164,7 +164,7 @@ static gint8 process_login_redirect(Purp
 		return QQ_LOGIN_REPLY_ERR;
 	}
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	bytes = 0;
 	/* 000-000: reply code */
 	bytes += qq_get8(&packet.result, data + bytes);
@@ -193,8 +193,9 @@ void qq_request_token(PurpleConnection *
 	guint8 buf[16] = {0};
 	gint bytes = 0;
 
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	bytes += qq_put8(buf + bytes, 0);
 
@@ -240,8 +241,9 @@ void qq_request_login(PurpleConnection *
 		0x00, 0x00, 0x00, 0x00
 	};
 
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0);
 
@@ -301,8 +303,9 @@ guint8 qq_process_token(PurpleConnection
 
 	g_return_val_if_fail(buf != NULL && buf_len != 0, QQ_LOGIN_REPLY_ERR);
 
-	g_return_val_if_fail(gc != NULL  && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR);
-	qd = (qq_data *) gc->proto_data;
+	g_return_val_if_fail(gc != NULL, QQ_LOGIN_REPLY_ERR);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_val_if_fail(qd != NULL, QQ_LOGIN_REPLY_ERR);
 
 	bytes = 0;
 	bytes += qq_get8(&ret, buf + bytes);
@@ -350,7 +353,7 @@ void qq_request_logout(PurpleConnection 
 	gint i;
 	qq_data *qd;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	for (i = 0; i < 4; i++)
 		qq_send_cmd(gc, QQ_CMD_LOGOUT, qd->ld.pwd_twice_md5, QQ_KEY_LENGTH);
 
@@ -391,10 +394,11 @@ guint8 qq_process_login( PurpleConnectio
 	gchar *msg, *msg_utf8;
 	gchar *error;
 	PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
+	PurpleAccount *account;
 
 	g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	switch (ret) {
 		case QQ_LOGIN_REPLY_OK:
@@ -409,8 +413,9 @@ guint8 qq_process_login( PurpleConnectio
 			reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
 			break;
 		case 0x05:		/* invalid password */
-			if (!purple_account_get_remember_password(gc->account)) {
-				purple_account_set_password(gc->account, NULL);
+			account = purple_connection_get_account(gc);
+			if (!purple_account_get_remember_password(account)) {
+				purple_account_set_password(account, NULL);
 			}
 			error = g_strdup( _("Incorrect password."));
 			reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
@@ -449,7 +454,7 @@ void qq_request_keep_alive(PurpleConnect
 	guint8 raw_data[16] = {0};
 	gint bytes= 0;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* In fact, we can send whatever we like to server
 	 * with this command, server return the same result including
@@ -467,7 +472,7 @@ gboolean qq_process_keep_alive(guint8 *d
 	g_return_val_if_fail(data != NULL, FALSE);
 	g_return_val_if_fail(data_len != 0, FALSE);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* qq_show_packet("Keep alive reply packet", data, len); */
 
@@ -500,7 +505,7 @@ void qq_request_keep_alive_2007(PurpleCo
 	gint bytes= 0;
 	gchar *uid_str;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* In fact, we can send whatever we like to server
 	 * with this command, server return the same result including
@@ -520,7 +525,7 @@ gboolean qq_process_keep_alive_2007(guin
 
 	g_return_val_if_fail(data != NULL && data_len != 0, FALSE);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* qq_show_packet("Keep alive reply packet", data, len); */
 
@@ -544,7 +549,7 @@ void qq_request_keep_alive_2008(PurpleCo
 	guint8 raw_data[16] = {0};
 	gint bytes= 0;
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* In fact, we can send whatever we like to server
 	 * with this command, server return the same result including
@@ -564,7 +569,7 @@ gboolean qq_process_keep_alive_2008(guin
 
 	g_return_val_if_fail(data != NULL && data_len != 0, FALSE);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	/* qq_show_packet("Keep alive reply packet", data, len); */
 
@@ -603,8 +608,9 @@ void qq_request_get_server(PurpleConnect
 	guint8 *encrypted;
 	gint encrypted_len;
 
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	raw_data = g_newa(guint8, 128);
 	memset(raw_data, 0, 128);
@@ -638,8 +644,9 @@ guint16 qq_process_get_server(PurpleConn
 	gint bytes;
 	guint16 ret;
 
-	g_return_val_if_fail (gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR);
-	qd = (qq_data *) gc->proto_data;
+	g_return_val_if_fail(gc != NULL, QQ_LOGIN_REPLY_ERR);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_val_if_fail(qd != NULL, QQ_LOGIN_REPLY_ERR);
 
 	g_return_val_if_fail (data != NULL, QQ_LOGIN_REPLY_ERR);
 
@@ -677,8 +684,9 @@ void qq_request_token_ex(PurpleConnectio
 	guint8 *encrypted;
 	gint encrypted_len;
 
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0);
 
@@ -716,8 +724,9 @@ void qq_request_token_ex_next(PurpleConn
 	guint8 *encrypted;
 	gint encrypted_len;
 
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0);
 
@@ -759,8 +768,9 @@ static void request_token_ex_code(Purple
 	guint8 *encrypted;
 	gint encrypted_len;
 
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0);
 	g_return_if_fail(code != NULL && code_len > 0);
@@ -896,8 +906,9 @@ guint8 qq_process_token_ex(PurpleConnect
 
 	g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR);
 
-	g_return_val_if_fail(gc != NULL  && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR);
-	qd = (qq_data *) gc->proto_data;
+	g_return_val_if_fail(gc != NULL, QQ_LOGIN_REPLY_ERR);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_val_if_fail(qd != NULL, QQ_LOGIN_REPLY_ERR);
 
 	ret = data[0];
 
@@ -993,8 +1004,9 @@ void qq_request_check_pwd(PurpleConnecti
 			0xE6, 0x20, 0x43, 0xBE, 0x53, 0xCA, 0x65, 0x03
 	};
 
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	g_return_if_fail(qd->ld.token_ex != NULL && qd->ld.token_ex_len > 0);
 
@@ -1059,11 +1071,13 @@ guint8 qq_process_check_pwd( PurpleConne
 	gchar *msg, *msg_utf8;
 	guint16 msg_len;
 	PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
+	PurpleAccount *account;
 
 	g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR);
 
-	g_return_val_if_fail(gc != NULL  && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR);
-	qd = (qq_data *) gc->proto_data;
+	g_return_val_if_fail(gc != NULL, QQ_LOGIN_REPLY_ERR);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_val_if_fail(qd != NULL, QQ_LOGIN_REPLY_ERR);
 
 	/* qq_show_packet("Check password reply", data, data_len); */
 
@@ -1094,8 +1108,9 @@ guint8 qq_process_check_pwd( PurpleConne
 	switch (ret)
 	{
 		case 0x34:		/* invalid password */
-			if (!purple_account_get_remember_password(gc->account)) {
-				purple_account_set_password(gc->account, NULL);
+			account = purple_connection_get_account(gc);
+			if (!purple_account_get_remember_password(account)) {
+				purple_account_set_password(account, NULL);
 			}
 			error = g_strdup(_("Incorrect password."));
 			reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
@@ -1161,8 +1176,9 @@ void qq_request_login_2007(PurpleConnect
 			0xC9, 0xCC, 0xCF, 0xCA, 0x9F, 0xFF, 0x88, 0xC0,
 			0x5C, 0x88, 0xD5
 	};
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0);
 
@@ -1241,7 +1257,7 @@ guint8 qq_process_login_2007( PurpleConn
 
 	g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	bytes = 0;
 	bytes += qq_get8(&ret, data + bytes);
@@ -1337,8 +1353,9 @@ void qq_request_login_2008(PurpleConnect
 			0x3B, 0xCE, 0x43, 0xF1, 0x8B, 0xA4, 0x2B, 0xB5,
 			0xB3, 0x51, 0x57, 0xF7, 0x06, 0x4B, 0x18, 0xFC
 	};
-	g_return_if_fail(gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	g_return_if_fail(qd->ld.token != NULL && qd->ld.token_len > 0);
 
@@ -1432,7 +1449,7 @@ guint8 qq_process_login_2008( PurpleConn
 
 	g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	bytes = 0;
 	bytes += qq_get8(&ret, data + bytes);
@@ -1487,3 +1504,4 @@ guint8 qq_process_login_2008( PurpleConn
 			inet_ntoa(qd->last_login_ip), ctime(&qd->last_login_time[0]));
 	return QQ_LOGIN_REPLY_OK;
 }
+
============================================================
--- libpurple/protocols/qq/qq_network.c	cdf55eab62d4c06ec595cbbdcaa57578de7aa3d7
+++ libpurple/protocols/qq/qq_network.c	ea542dc356f9699d360bbefe52cd076c3c24ae5e
@@ -233,13 +233,14 @@ static void redirect_server(PurpleConnec
 static void redirect_server(PurpleConnection *gc)
 {
 	qq_data *qd;
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	if (qd->check_watcher > 0) {
 			purple_timeout_remove(qd->check_watcher);
 			qd->check_watcher = 0;
 	}
-	if (qd->connect_watcher > 0)	purple_timeout_remove(qd->connect_watcher);
+	if (qd->connect_watcher > 0)
+		purple_timeout_remove(qd->connect_watcher);
 	qd->connect_watcher = purple_timeout_add_seconds(QQ_CONNECT_INTERVAL, qq_connect_later, gc);
 }
 
============================================================
--- libpurple/protocols/qq/qq_process.c	7f3ccc2fd1731393f4f618090c7865fa3d1b54ca
+++ libpurple/protocols/qq/qq_process.c	1d0d653cffd38b7b9f5e4b5accb5818e71987593
@@ -64,7 +64,7 @@ static void process_unknow_cmd(PurpleCon
 
 	qq_show_packet(title, data, data_len);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	qq_hex_dump(PURPLE_DEBUG_WARNING, "QQ",
 			data, data_len,
@@ -83,7 +83,7 @@ static void do_im_ack(guint8 *data, gint
 
 	g_return_if_fail(data != NULL && data_len != 0);
 
-	qd = gc->proto_data;
+	qd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	if (data[0] != 0) {
 		purple_debug_warning("QQ", "Failed sent IM\n");
@@ -96,7 +96,7 @@ static void do_server_news(PurpleConnect
 
 static void do_server_news(PurpleConnection *gc, guint8 *data, gint data_len)
 {
-	qq_data *qd = (qq_data *) gc->proto_data;
+	qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	gint bytes;
 	gchar *title, *brief, *url;
 	gchar *content;
@@ -270,7 +270,7 @@ static void process_private_msg(guint8 *
 
 	g_return_if_fail(data != NULL && data_len != 0);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	if (data_len < 16) {	/* we need to ack with the first 16 bytes */
 		purple_debug_error("QQ", "MSG is too short\n");
@@ -385,9 +385,8 @@ static void request_server_ack(PurpleCon
 	guint8 bar;
 
 	g_return_if_fail(funct_str != NULL && from != NULL);
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
-
 	bar = 0x1e;
 	raw_data = g_newa(guint8, strlen(funct_str) + strlen(from) + 16);
 
@@ -404,7 +403,7 @@ static void do_server_notice(PurpleConne
 static void do_server_notice(PurpleConnection *gc, gchar *from, gchar *to,
 		guint8 *data, gint data_len)
 {
-	qq_data *qd = (qq_data *) gc->proto_data;
+	qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	gchar *msg, *msg_utf8;
 	gchar *title, *content;
 
@@ -442,7 +441,7 @@ static void process_server_msg(PurpleCon
 
 	g_return_if_fail(data != NULL && data_len != 0);
 
-	qd = (qq_data *) gc->proto_data;
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 
 	data_str = g_newa(guint8, data_len + 1);
 	g_memmove(data_str, data, data_len);
@@ -506,8 +505,9 @@ void qq_proc_server_cmd(PurpleConnection
 	guint8 *data;
 	gint data_len;
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	data = g_newa(guint8, rcved_len);
 	data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key);
@@ -568,8 +568,9 @@ void qq_update_room(PurpleConnection *gc
 	qq_data *qd;
 	gint ret;
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	switch (room_cmd) {
 		case 0:
@@ -600,8 +601,9 @@ void qq_update_all_rooms(PurpleConnectio
 	gboolean is_new_turn = FALSE;
 	guint32 next_id;
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	next_id = qq_room_get_next(gc, room_id);
 	purple_debug_info("QQ", "Update rooms, next id %u, prev id %u\n", next_id, room_id);
@@ -647,8 +649,9 @@ void qq_update_all(PurpleConnection *gc,
 {
 	qq_data *qd;
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	switch (cmd) {
 		case 0:
@@ -689,8 +692,9 @@ static void update_all_rooms_online(Purp
 	qq_data *qd;
 	guint32 next_id;
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	next_id = qq_room_get_next_conv(gc, room_id);
 	if (next_id <= 0 && room_id <= 0) {
@@ -719,8 +723,9 @@ void qq_update_online(PurpleConnection *
 void qq_update_online(PurpleConnection *gc, guint16 cmd)
 {
 	qq_data *qd;
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	switch (cmd) {
 		case 0:
@@ -747,8 +752,9 @@ void qq_proc_room_cmds(PurpleConnection 
 	gint bytes;
 	guint8 reply_cmd, reply;
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	data = g_newa(guint8, rcved_len);
 	data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key);
@@ -881,8 +887,9 @@ guint8 qq_proc_login_cmds(PurpleConnecti
 	gint data_len = 0;
 	guint ret_8 = QQ_LOGIN_REPLY_ERR;
 
-	g_return_val_if_fail (gc != NULL && gc->proto_data != NULL, QQ_LOGIN_REPLY_ERR);
-	qd = (qq_data *) gc->proto_data;
+	g_return_val_if_fail(gc != NULL, QQ_LOGIN_REPLY_ERR);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_val_if_fail(qd != NULL, QQ_LOGIN_REPLY_ERR);
 
 	g_return_val_if_fail(rcved_len > 0, QQ_LOGIN_REPLY_ERR);
 	data = g_newa(guint8, rcved_len);
@@ -1007,7 +1014,7 @@ guint8 qq_proc_login_cmds(PurpleConnecti
 
 			purple_connection_update_progress(gc, _("Logging in"), QQ_CONNECT_STEPS - 1, QQ_CONNECT_STEPS);
 			purple_debug_info("QQ", "Login replies OK; everything is fine\n");
-			purple_connection_set_state(gc, PURPLE_CONNECTED);
+			purple_connection_set_state(gc, PURPLE_CONNECTION_STATE_CONNECTED);
 			qd->is_login = TRUE;	/* must be defined after sev_finish_login */
 
 			/* now initiate QQ Qun, do it first as it may take longer to finish */
@@ -1040,8 +1047,9 @@ void qq_proc_client_cmds(PurpleConnectio
 
 	g_return_if_fail(rcved_len > 0);
 
-	g_return_if_fail (gc != NULL && gc->proto_data != NULL);
-	qd = (qq_data *) gc->proto_data;
+	g_return_if_fail(gc != NULL);
+	qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+	g_return_if_fail(qd != NULL);
 
 	data = g_newa(guint8, rcved_len);
 	data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key);


More information about the Commits mailing list