gobjectification: a53654db: compile qq.
sadrul at pidgin.im
sadrul at pidgin.im
Thu Mar 13 04:39:31 EDT 2008
-----------------------------------------------------------------
Revision: a53654db614a5452c0b9e42be933070fd60ff52e
Ancestor: 8609f9b299fcedb04aa02a512d9f16723f33c4cb
Author: sadrul at pidgin.im
Date: 2008-03-13T07:47:04
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/a53654db614a5452c0b9e42be933070fd60ff52e
Modified files:
libpurple/protocols/qq/buddy_info.c
libpurple/protocols/qq/buddy_list.c
libpurple/protocols/qq/buddy_opt.c
libpurple/protocols/qq/buddy_status.c
libpurple/protocols/qq/file_trans.c
libpurple/protocols/qq/group.c
libpurple/protocols/qq/group_conv.c
libpurple/protocols/qq/group_find.c
libpurple/protocols/qq/group_im.c
libpurple/protocols/qq/group_info.c
libpurple/protocols/qq/group_internal.c
libpurple/protocols/qq/group_join.c
libpurple/protocols/qq/group_network.c
libpurple/protocols/qq/group_opt.c
libpurple/protocols/qq/group_search.c
libpurple/protocols/qq/im.c
libpurple/protocols/qq/keep_alive.c
libpurple/protocols/qq/login_logout.c
libpurple/protocols/qq/qq.c
libpurple/protocols/qq/qq_proxy.c
libpurple/protocols/qq/recv_core.c
libpurple/protocols/qq/send_core.c
libpurple/protocols/qq/send_file.c
libpurple/protocols/qq/sendqueue.c
libpurple/protocols/qq/sys_msg.c
ChangeLog:
compile qq.
-------------- next part --------------
============================================================
--- libpurple/protocols/qq/buddy_info.c 9f1420fa4ba7c283e5d6cd4026935742463ef4fe
+++ libpurple/protocols/qq/buddy_info.c d3113ea4634f090c93769fe554e2ea668ecf364f
@@ -241,7 +241,7 @@ void qq_send_packet_get_info(PurpleConne
g_return_if_fail(uid != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
g_snprintf(uid_str, sizeof(uid_str), "%d", uid);
qq_send_cmd(gc, QQ_CMD_GET_USER_INFO, TRUE, 0, TRUE, (guint8 *) uid_str, strlen(uid_str));
@@ -260,7 +260,7 @@ void qq_prepare_modify_info(PurpleConnec
GList *ql;
qq_info_query *query;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
qq_send_packet_get_info(gc, qd->uid, FALSE);
/* traverse backwards so we get the most recent info_query */
for (ql = g_list_last(qd->info_query); ql != NULL; ql = g_list_previous(ql)) {
@@ -299,7 +299,7 @@ static void modify_info_cancel_cb(modify
{
qq_data *qd;
- qd = (qq_data *) purple_account_get_connection(mid)->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(mid->gc));
qd->modifying_info = FALSE;
g_strfreev((gchar **) mid->info);
@@ -331,8 +331,8 @@ static void modify_info_ok_cb(modify_inf
GList *groups;
contact_info *info;
- gc = purple_account_get_connection(mid);
- qd = (qq_data *) gc->proto_data;
+ gc = mid->gc;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
qd->modifying_info = FALSE;
info = mid->info;
@@ -460,7 +460,7 @@ static void create_modify_info_dialogue(
modify_info_data *mid;
/* so we only have one dialog open at a time */
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (!qd->modifying_info) {
qd->modifying_info = TRUE;
@@ -497,7 +497,7 @@ static void create_modify_info_dialogue(
/* prepare unmodifiable info */
mid = g_new0(modify_info_data, 1);
- purple_account_get_connection(mid) = gc;
+ mid->gc = gc;
/* QQ_CONTACT_FIELDS+1 so that the array is NULL-terminated and can be g_strfreev()'ed later */
mid->info = (contact_info *) g_new0(gchar *, QQ_CONTACT_FIELDS+1);
mid->info->pager_sn = g_strdup(info->pager_sn);
@@ -537,7 +537,7 @@ void qq_process_modify_info_reply(guint8
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
@@ -556,7 +556,7 @@ static void _qq_send_packet_modify_face(
{
PurpleAccount *account = purple_connection_get_account(gc);
PurplePresence *presence = purple_account_get_presence(account);
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
gint offset;
if(purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_INVISIBLE)) {
@@ -673,7 +673,7 @@ void qq_refresh_buddy_and_myself(contact
gchar *alias_utf8, *purple_name;
PurpleAccount *account = purple_connection_get_account(gc);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
purple_name = uid_to_purple_name(strtol(info->uid, NULL, 10));
alias_utf8 = qq_to_utf8(info->nick, QQ_CHARSET_DEFAULT);
@@ -684,7 +684,7 @@ void qq_refresh_buddy_and_myself(contact
}
/* update buddy list (including myself, if myself is the buddy) */
b = purple_find_buddy(purple_connection_get_account(gc), purple_name);
- q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
+ q_bud = (b == NULL) ? NULL : (qq_buddy *) purple_object_get_protocol_data(PURPLE_OBJECT(b));
if (q_bud != NULL) { /* I have this buddy */
q_bud->age = strtol(info->age, NULL, 10);
q_bud->gender = strtol(info->gender, NULL, 10);
@@ -712,7 +712,7 @@ void qq_process_get_info_reply(guint8 *b
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
list = query_list = NULL;
len = buf_len;
data = g_newa(guint8, len);
@@ -789,7 +789,7 @@ void qq_send_packet_get_buddies_levels(P
guint8 *buf, *tmp;
guint16 size;
qq_buddy *q_bud;
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GList *node = qd->buddies;
if (qd->buddies) {
@@ -824,7 +824,7 @@ void qq_process_get_level_reply(guint8 *
gint decr_len, i;
guint8 *decr_buf, *tmp;
PurpleAccount *account = purple_connection_get_account(gc);
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
decr_len = buf_len;
decr_buf = g_new0(guint8, buf_len);
@@ -859,7 +859,7 @@ void qq_process_get_level_reply(guint8 *
*/
purple_name = uid_to_purple_name(uid);
b = purple_find_buddy(account, purple_name);
- q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
+ q_bud = (b == NULL) ? NULL : (qq_buddy *) purple_object_get_protocol_data(PURPLE_OBJECT(b));
if (q_bud != NULL || uid == qd->uid) {
if (q_bud) {
============================================================
--- libpurple/protocols/qq/buddy_list.c 7cabf5d51de96f49825ccdc20f3f8a2916a013a9
+++ libpurple/protocols/qq/buddy_list.c 3178478be81156956accc67182cb07411840e7ac
@@ -66,7 +66,7 @@ void qq_send_packet_get_buddies_online(P
qq_data *qd;
guint8 *raw_data, *cursor;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
raw_data = g_newa(guint8, 5);
cursor = raw_data;
@@ -159,7 +159,7 @@ void qq_process_get_buddies_online_reply
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
cursor = data;
@@ -205,7 +205,7 @@ void qq_process_get_buddies_online_reply
/* update buddy information */
b = purple_find_buddy(purple_connection_get_account(gc), uid_to_purple_name(fe->s->uid));
- q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
+ q_bud = (b == NULL) ? NULL : (qq_buddy *) purple_object_get_protocol_data(PURPLE_OBJECT(b));
if (q_bud != NULL) { /* we find one and update qq_buddy */
if(0 != fe->s->client_version)
@@ -257,7 +257,7 @@ void qq_process_get_buddies_list_reply(g
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
cursor = data;
@@ -318,7 +318,7 @@ void qq_process_get_buddies_list_reply(g
if (b == NULL)
b = qq_add_buddy_by_recv_packet(gc, q_bud->uid, TRUE, FALSE);
- b->proto_data = q_bud;
+ purple_object_set_protocol_data(PURPLE_OBJECT(b),q_bud);
qd->buddies = g_list_append(qd->buddies, q_bud);
qq_update_buddy_contact(gc, q_bud);
}
@@ -351,7 +351,7 @@ void qq_process_get_all_list_with_group_
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
cursor = data;
============================================================
--- libpurple/protocols/qq/buddy_opt.c da35eb57f7cd150d9bbeb48a5aef3cddfa97a822
+++ libpurple/protocols/qq/buddy_opt.c a403ae7c95fd086344c45db6cae9860aa47e1b71
@@ -99,7 +99,7 @@ static void _qq_send_packet_add_buddy(Pu
TRUE, (guint8 *) uid_str, strlen(uid_str));
/* must be set after sending packet to get the correct send_seq */
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
req = g_new0(qq_add_buddy_request, 1);
req->seq = qd->send_seq;
req->uid = uid;
@@ -139,7 +139,7 @@ static void _qq_send_packet_add_buddy_au
guint32 uid;
g_return_if_fail(g != NULL);
- gc = purple_account_get_connection(g);
+ gc = g->gc;
uid = g->uid;
g_return_if_fail(uid != 0);
@@ -155,7 +155,7 @@ static void _qq_reject_add_request_real(
g_return_if_fail(g != NULL);
- gc = purple_account_get_connection(g);
+ gc = g->gc;
uid = g->uid;
g_return_if_fail(uid != 0);
@@ -171,7 +171,7 @@ void qq_approve_add_request_with_gc_and_
g_return_if_fail(g != NULL);
- gc = purple_account_get_connection(g);
+ gc = g->gc;
uid = g->uid;
g_return_if_fail(uid != 0);
@@ -195,14 +195,14 @@ void qq_reject_add_request_with_gc_and_u
g_return_if_fail(g != NULL);
- gc = purple_account_get_connection(g);
+ gc = g->gc;
uid = g->uid;
g_return_if_fail(uid != 0);
g_free(g);
g2 = g_new0(gc_and_uid, 1);
- g2purple_account_get_connection() = gc;
+ g2->gc = gc;
g2->uid = uid;
msg1 = g_strdup_printf(_("You rejected %d's request"), uid);
@@ -224,7 +224,7 @@ void qq_add_buddy_with_gc_and_uid(gc_and
g_return_if_fail(g != NULL);
- gc = purple_account_get_connection(g);
+ gc = g->gc;
uid = g->uid;
g_return_if_fail(uid != 0);
@@ -241,7 +241,7 @@ void qq_block_buddy_with_gc_and_uid(gc_a
g_return_if_fail(g != NULL);
- gc = purple_account_get_connection(g);
+ gc = g->gc;
uid = g->uid;
g_return_if_fail(uid > 0);
@@ -262,7 +262,7 @@ void qq_process_add_buddy_auth_reply(gui
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
cursor = data;
@@ -293,7 +293,7 @@ void qq_process_remove_buddy_reply(guint
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
@@ -322,7 +322,7 @@ void qq_process_remove_self_reply(guint8
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
@@ -357,7 +357,7 @@ void qq_process_add_buddy_reply(guint8 *
g_return_if_fail(buf != NULL && buf_len != 0);
for_uid = 0;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
list = qd->add_buddy_request;
@@ -399,7 +399,7 @@ void qq_process_add_buddy_reply(guint8 *
if (b != NULL)
purple_blist_remove_buddy(b);
g = g_new0(gc_and_uid, 1);
- purple_account_get_connection(g) = gc;
+ g->gc = gc;
g->uid = for_uid;
msg = g_strdup_printf(_("User %d needs authentication"), for_uid);
purple_request_input(gc, NULL, msg,
@@ -453,7 +453,7 @@ PurpleBuddy *qq_add_buddy_by_recv_packet
gchar *name, *group_name;
a = purple_connection_get_account(gc);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
g_return_val_if_fail(a != NULL && uid != 0, NULL);
group_name = is_known ?
@@ -471,11 +471,11 @@ PurpleBuddy *qq_add_buddy_by_recv_packet
b = purple_buddy_new(a, name, NULL);
if (!create)
- b->proto_data = NULL;
+ purple_object_set_protocol_data(PURPLE_OBJECT(b),NULL);
else {
q_bud = g_new0(qq_buddy, 1);
q_bud->uid = uid;
- b->proto_data = q_bud;
+ purple_object_set_protocol_data(PURPLE_OBJECT(b),q_bud);
qd->buddies = g_list_append(qd->buddies, q_bud);
qq_send_packet_get_info(gc, q_bud->uid, FALSE);
qq_send_packet_get_buddies_online(gc, QQ_FRIENDS_ONLINE_POSITION_START);
@@ -500,7 +500,7 @@ void qq_add_buddy(PurpleConnection *gc,
guint32 uid;
PurpleBuddy *b;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (!qd->logged_in)
return; /* IMPORTANT ! */
@@ -525,7 +525,7 @@ void qq_remove_buddy(PurpleConnection *g
qq_buddy *q_bud;
guint32 uid;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
uid = purple_name_to_uid(buddy->name);
if (!qd->logged_in)
@@ -536,7 +536,7 @@ void qq_remove_buddy(PurpleConnection *g
b = purple_find_buddy(purple_connection_get_account(gc), buddy->name);
if (b != NULL) {
- q_bud = (qq_buddy *) b->proto_data;
+ q_bud = (qq_buddy *) purple_object_get_protocol_data(PURPLE_OBJECT(b));
if (q_bud != NULL)
qd->buddies = g_list_remove(qd->buddies, q_bud);
else
@@ -580,7 +580,7 @@ void qq_buddies_list_free(PurpleAccount
name = uid_to_purple_name(p->uid);
b = purple_find_buddy(account, name);
if(b != NULL)
- b->proto_data = NULL;
+ purple_object_set_protocol_data(PURPLE_OBJECT(b),NULL);
else
purple_debug(PURPLE_DEBUG_INFO, "QQ", "qq_buddy %s not found in purple proto_data\n", name);
g_free(name);
============================================================
--- libpurple/protocols/qq/buddy_status.c 563fcbf689e40fee9e830ceb38f025dd32298166
+++ libpurple/protocols/qq/buddy_status.c ea745b9efae1093afe8e535e9adfe12a953c6a7f
@@ -149,7 +149,7 @@ void qq_send_packet_change_status(Purple
account = purple_connection_get_account(gc);
presence = purple_account_get_presence(account);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (!qd->logged_in)
return;
@@ -191,7 +191,7 @@ void qq_process_change_status_reply(guin
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
@@ -205,7 +205,7 @@ void qq_process_change_status_reply(guin
name = uid_to_purple_name(qd->uid);
b = purple_find_buddy(purple_connection_get_account(gc), name);
g_free(name);
- q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
+ q_bud = (b == NULL) ? NULL : (qq_buddy *) purple_object_get_protocol_data(PURPLE_OBJECT(b));
qq_update_buddy_contact(gc, q_bud);
}
} else {
@@ -227,7 +227,7 @@ void qq_process_friend_change_status(gui
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
cursor = data;
@@ -253,7 +253,7 @@ void qq_process_friend_change_status(gui
name = uid_to_purple_name(s->uid);
b = purple_find_buddy(purple_connection_get_account(gc), name);
g_free(name);
- q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
+ q_bud = (b == NULL) ? NULL : (qq_buddy *) purple_object_get_protocol_data(PURPLE_OBJECT(b));
if (q_bud) {
purple_debug(PURPLE_DEBUG_INFO, "QQ", "s->uid = %d, q_bud->uid = %d\n", s->uid , q_bud->uid);
if(0 != *((guint32 *)s->ip)) {
============================================================
--- libpurple/protocols/qq/file_trans.c 1d64f5a5b3e082e9f73a750cdbe4b94e5b08ae32
+++ libpurple/protocols/qq/file_trans.c 4200265b1e94566cb2ee3170e49ff70c592f2396
@@ -260,7 +260,7 @@ static gint _qq_send_file(PurpleConnecti
qq_data *qd;
ft_info *info;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
g_return_val_if_fail(qd->session_key != NULL, -1);
info = (ft_info *) qd->xfer->data;
bytes = 0;
@@ -292,7 +292,7 @@ void qq_send_file_ctl_packet(PurpleConne
time_t now;
ft_info *info;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
info = (ft_info *) qd->xfer->data;
raw_data = g_new0 (guint8, 61);
@@ -397,7 +397,7 @@ static void _qq_send_file_data_packet(Pu
qq_data *qd;
ft_info *info;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
info = (ft_info *) qd->xfer->data;
filename = (gchar *) purple_xfer_get_filename(qd->xfer);
@@ -521,7 +521,7 @@ static void _qq_process_recv_file_ctl_pa
{
guint8 *decrypted_data;
gint decrypted_len;
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
guint16 packet_type;
guint16 seq;
guint8 hellobyte;
@@ -585,7 +585,7 @@ static void _qq_recv_file_progess(Purple
static void _qq_recv_file_progess(PurpleConnection *gc, guint8 *buffer, guint16 len, guint32 index, guint32 offset)
{
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurpleXfer *xfer = qd->xfer;
ft_info *info = (ft_info *) xfer->data;
guint32 mask;
@@ -628,7 +628,7 @@ static void _qq_send_file_progess(Purple
static void _qq_send_file_progess(PurpleConnection *gc)
{
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurpleXfer *xfer = qd->xfer;
ft_info *info = (ft_info *) xfer->data;
guint32 mask;
@@ -663,7 +663,7 @@ static void _qq_update_send_progess(Purp
guint32 mask;
guint8 *buffer;
gint readbytes;
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurpleXfer *xfer = qd->xfer;
ft_info *info = (ft_info *) xfer->data;
@@ -723,7 +723,7 @@ static void _qq_process_recv_file_data(P
guint32 fragment_index;
guint16 fragment_len;
guint32 fragment_offset;
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
ft_info *info = (ft_info *) qd->xfer->data;
cursor += 1; /* skip an unknown byte */
@@ -820,7 +820,7 @@ void qq_process_recv_file(PurpleConnecti
qq_file_header fh;
qq_data *qd;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
cursor = data;
_qq_get_file_header(data, &cursor, len, &fh);
============================================================
--- libpurple/protocols/qq/group.c 61f79d9f10bbb3d0ed52ac7e9425464d28f78b9f
+++ libpurple/protocols/qq/group.c 6ef21f9646792d181e99e56984cdbf6302d31699
@@ -49,7 +49,7 @@ static void _qq_group_search_cancel_call
{
qq_data *qd;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
purple_roomlist_set_in_progress(qd->roomlist, FALSE);
}
@@ -89,7 +89,7 @@ PurpleRoomlist *qq_roomlist_get_list(Pur
PurpleRoomlist *rl;
PurpleRoomlistField *f;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
fields = NULL;
rl = purple_roomlist_new(purple_connection_get_account(gc));
@@ -137,7 +137,7 @@ void qq_roomlist_cancel(PurpleRoomlist *
g_return_if_fail(list != NULL);
gc = purple_account_get_connection(list->account);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
purple_roomlist_set_in_progress(list, FALSE);
purple_roomlist_unref(list);
}
============================================================
--- libpurple/protocols/qq/group_conv.c 8b1eca3dc78407f91ff817f6706a1ae9615c61a7
+++ libpurple/protocols/qq/group_conv.c 846a3b3bd7518a25750006490b824226f7473c72
@@ -38,7 +38,7 @@ void qq_group_conv_show_window(PurpleCon
qq_data *qd;
g_return_if_fail(group != 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,
group->group_name_utf8, purple_connection_get_account(gc));
============================================================
--- libpurple/protocols/qq/group_find.c c6b6a73c90a5eb16cd29152b82f29401eaddf970
+++ libpurple/protocols/qq/group_find.c 2c5fd1ab3d0d55044487b6f76516d4868cd4e841
@@ -42,7 +42,7 @@ gboolean qq_group_find_internal_group_id
if (internal_group_id == NULL)
return FALSE;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
list = qd->group_packets;
while (list != NULL) {
@@ -109,7 +109,7 @@ qq_buddy *qq_group_find_or_add_member(Pu
member->uid = member_uid;
buddy = purple_find_buddy(purple_connection_get_account(gc), uid_to_purple_name(member_uid));
if (buddy != NULL) {
- q_bud = (qq_buddy *) buddy->proto_data;
+ q_bud = (qq_buddy *) purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
if (q_bud != NULL && q_bud->nickname != NULL)
member->nickname = g_strdup(q_bud->nickname);
else if (buddy->alias != NULL)
@@ -129,7 +129,7 @@ qq_group *qq_group_find_by_channel(Purpl
qq_group *group;
GList *list;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
conv = purple_find_chat(gc, channel);
g_return_val_if_fail(conv != NULL, NULL);
@@ -153,7 +153,7 @@ qq_group *qq_group_find_by_id(PurpleConn
qq_group *group;
qq_data *qd;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (qd->groups == NULL || id <= 0)
return NULL;
============================================================
--- libpurple/protocols/qq/group_im.c d97f7f3b833d4d553dada4443b323978eb52839c
+++ libpurple/protocols/qq/group_im.c 6fd36179298a5fd3bbd6c98ffd98e453856eb74e
@@ -127,7 +127,7 @@ void qq_process_recv_group_im_apply_join
reason = g_strdup_printf(_("Reason: %s"), reason_utf8);
g = g_new0(group_member_opt, 1);
- purple_account_get_connection(g) = gc;
+ g->gc = gc;
g->internal_group_id = internal_group_id;
g->member = user_uid;
@@ -321,7 +321,7 @@ void qq_process_recv_group_im(guint8 *da
gint skip_len;
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));
hex_dump = hex_dump_to_str(*cursor, data_len - (*cursor - data));
purple_debug(PURPLE_DEBUG_INFO, "QQ", "group im hex dump\n%s\n", hex_dump);
============================================================
--- libpurple/protocols/qq/group_info.c b0e6fd08f328520efd9dfa184bc538d7e0fb5796
+++ libpurple/protocols/qq/group_info.c d92fe48e8d14b0595d636dfdc59aa5ab7ee5cf34
@@ -173,7 +173,7 @@ void qq_process_group_cmd_get_group_info
guint8 unknown1;
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));
read_packet_dw(data, cursor, len, &(internal_group_id));
g_return_if_fail(internal_group_id > 0);
============================================================
--- libpurple/protocols/qq/group_internal.c 7557c6350e61dd1dc126cacd99c232e4bd820d8a
+++ libpurple/protocols/qq/group_internal.c cf882784691e88427008689428c413fd7ba758a8
@@ -79,7 +79,7 @@ qq_group *qq_group_create_internal_recor
qq_data *qd;
g_return_val_if_fail(internal_id > 0, NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
group = g_new0(qq_group, 1);
group->my_status = QQ_GROUP_MEMBER_STATUS_NOT_MEMBER;
@@ -149,7 +149,7 @@ qq_group *qq_group_from_hashtable(Purple
qq_group *group;
g_return_val_if_fail(data != NULL, NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
group = g_new0(qq_group, 1);
group->my_status =
============================================================
--- libpurple/protocols/qq/group_join.c c613bda8b0804154d337918ad301759da5983314
+++ libpurple/protocols/qq/group_join.c f6f35a40d257080ab44004ed6d2e806141c9453c
@@ -52,7 +52,7 @@ static void _qq_group_exit_with_gc_and_i
guint32 internal_group_id;
qq_group *group;
- gc = purple_account_get_connection(g);
+ gc = g->gc;
internal_group_id = g->uid;
group = qq_group_find_by_id(gc, internal_group_id, QQ_INTERNAL_ID);
@@ -107,7 +107,7 @@ static void _qq_group_join_auth_with_gc_
qq_group *group;
guint32 internal_group_id;
- gc = purple_account_get_connection(g);
+ gc = g->gc;
internal_group_id = g->uid;
group = qq_group_find_by_id(gc, internal_group_id, QQ_INTERNAL_ID);
@@ -130,7 +130,7 @@ static void _qq_group_join_auth(PurpleCo
msg = g_strdup_printf("Group \"%s\" needs authentication\n", group->group_name_utf8);
g = g_new0(gc_and_uid, 1);
- purple_account_get_connection(g) = gc;
+ g->gc = gc;
g->uid = group->internal_group_id;
purple_request_input(gc, NULL, msg,
_("Input request here"),
@@ -214,7 +214,7 @@ void qq_process_group_cmd_exit_group(gui
qq_data *qd;
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;
expected_bytes = 4;
@@ -245,7 +245,7 @@ void qq_process_group_cmd_join_group_aut
qq_data *qd;
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;
expected_bytes = 4;
@@ -318,7 +318,7 @@ void qq_group_join(PurpleConnection *gc,
qq_group *group;
g_return_if_fail(data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
external_group_id_ptr = g_hash_table_lookup(data, QQ_GROUP_KEY_EXTERNAL_ID);
g_return_if_fail(external_group_id_ptr != NULL);
@@ -353,7 +353,7 @@ void qq_group_exit(PurpleConnection *gc,
g_return_if_fail(internal_group_id > 0);
g = g_new0(gc_and_uid, 1);
- purple_account_get_connection(g) = gc;
+ g->gc = gc;
g->uid = internal_group_id;
purple_request_action(gc, _("QQ Qun Operation"),
============================================================
--- libpurple/protocols/qq/group_network.c af931a8ff18a0d840c3acc7855f65327af678ab6
+++ libpurple/protocols/qq/group_network.c ad517514449e002add77048388c7dcdac3262a2d
@@ -114,7 +114,7 @@ void qq_send_group_cmd(PurpleConnection
g_return_if_fail(raw_data != NULL && data_len > 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
qq_send_cmd(gc, QQ_CMD_GROUP_CMD, TRUE, 0, TRUE, raw_data, data_len);
@@ -140,7 +140,7 @@ void qq_process_group_cmd_reply(guint8 *
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
============================================================
--- libpurple/protocols/qq/group_opt.c e3e9557b9c936e98772823ea84f58af34e8d5dbf
+++ libpurple/protocols/qq/group_opt.c e667ca204f8c34b94d9ed029171b4bd0921e17e5
@@ -84,21 +84,21 @@ static void _qq_group_reject_application
static void _qq_group_reject_application_real(group_member_opt *g, gchar *msg_utf8)
{
qq_group *group;
- g_return_if_fail(g != NULL && purple_account_get_connection(g) != NULL && g->internal_group_id > 0 && g->member > 0);
- group = qq_group_find_by_id(purple_account_get_connection(g), g->internal_group_id, QQ_INTERNAL_ID);
+ g_return_if_fail(g != NULL && g->gc != NULL && g->internal_group_id > 0 && g->member > 0);
+ group = qq_group_find_by_id(g->gc, g->internal_group_id, QQ_INTERNAL_ID);
g_return_if_fail(group != NULL);
- qq_send_cmd_group_auth(purple_account_get_connection(g), group, QQ_GROUP_AUTH_REQUEST_REJECT, g->member, msg_utf8);
+ qq_send_cmd_group_auth(g->gc, group, QQ_GROUP_AUTH_REQUEST_REJECT, g->member, msg_utf8);
g_free(g);
}
void qq_group_search_application_with_struct(group_member_opt *g)
{
- g_return_if_fail(g != NULL && purple_account_get_connection(g) != NULL && g->member > 0);
+ g_return_if_fail(g != NULL && g->gc != NULL && g->member > 0);
- qq_send_packet_get_info(purple_account_get_connection(g), g->member, TRUE); /* we want to see window */
- purple_request_action(purple_account_get_connection(g), NULL, _("Do you want to approve the request?"), "",
+ qq_send_packet_get_info(g->gc, g->member, TRUE); /* we want to see window */
+ purple_request_action(g->gc, NULL, _("Do you want to approve the request?"), "",
PURPLE_DEFAULT_ACTION_NONE,
- purple_connection_get_account(purple_account_get_connection(g)), NULL, NULL,
+ 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));
@@ -107,18 +107,18 @@ void qq_group_reject_application_with_st
void qq_group_reject_application_with_struct(group_member_opt *g)
{
gchar *msg1, *msg2, *nombre;
- g_return_if_fail(g != NULL && purple_account_get_connection(g) != NULL && g->member > 0);
+ g_return_if_fail(g != NULL && g->gc != NULL && g->member > 0);
msg1 = g_strdup_printf(_("You rejected %d's request"), g->member);
msg2 = g_strdup(_("Enter your reason:"));
nombre = uid_to_purple_name(g->member);
- purple_request_input(purple_account_get_connection(g), /* title */ NULL, msg1, msg2,
+ purple_request_input(g->gc, /* title */ NULL, msg1, msg2,
_("Sorry, you are not my type..."), /* 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(purple_account_get_connection(g)), nombre, NULL,
+ purple_connection_get_account(g->gc), nombre, NULL,
g);
g_free(msg1);
@@ -129,11 +129,11 @@ void qq_group_approve_application_with_s
void qq_group_approve_application_with_struct(group_member_opt *g)
{
qq_group *group;
- g_return_if_fail(g != NULL && purple_account_get_connection(g) != NULL && g->internal_group_id > 0 && g->member > 0);
- group = qq_group_find_by_id(purple_account_get_connection(g), g->internal_group_id, QQ_INTERNAL_ID);
+ g_return_if_fail(g != NULL && g->gc != NULL && g->internal_group_id > 0 && g->member > 0);
+ group = qq_group_find_by_id(g->gc, g->internal_group_id, QQ_INTERNAL_ID);
g_return_if_fail(group != NULL);
- qq_send_cmd_group_auth(purple_account_get_connection(g), group, QQ_GROUP_AUTH_REQUEST_APPROVE, g->member, "");
- qq_group_find_or_add_member(purple_account_get_connection(g), group, g->member);
+ qq_send_cmd_group_auth(g->gc, group, QQ_GROUP_AUTH_REQUEST_APPROVE, g->member, "");
+ qq_group_find_or_add_member(g->gc, group, g->member);
g_free(g);
}
@@ -146,7 +146,7 @@ void qq_group_modify_members(PurpleConne
GList *list;
g_return_if_fail(group != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (new_members[0] == 0xffffffff)
return;
@@ -289,7 +289,7 @@ void qq_group_create_with_name(PurpleCon
qq_data *qd;
g_return_if_fail(name != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
data_len = 7 + 1 + strlen(name) + 2 + 1 + 1 + 4;
data = g_newa(guint8, data_len);
cursor = data;
@@ -325,13 +325,13 @@ static void qq_group_setup_with_gc_and_u
static void qq_group_setup_with_gc_and_uid(gc_and_uid *g)
{
qq_group *group;
- g_return_if_fail(g != NULL && purple_account_get_connection(g) != NULL && g->uid > 0);
+ g_return_if_fail(g != NULL && g->gc != NULL && g->uid > 0);
- group = qq_group_find_by_id(purple_account_get_connection(g), g->uid, QQ_INTERNAL_ID);
+ group = qq_group_find_by_id(g->gc, g->uid, QQ_INTERNAL_ID);
g_return_if_fail(group != NULL);
/* TODO insert UI code here */
- /* qq_group_detail_window_show(purple_account_get_connection(g), group); */
+ /* qq_group_detail_window_show(g->gc, group); */
g_free(g);
}
@@ -343,8 +343,8 @@ void qq_group_process_create_group_reply
qq_data *qd;
g_return_if_fail(data != NULL);
- g_return_if_fail(gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+ g_return_if_fail(qd != NULL);
read_packet_dw(data, cursor, len, &internal_group_id);
read_packet_dw(data, cursor, len, &external_group_id);
@@ -361,7 +361,7 @@ void qq_group_process_create_group_reply
purple_debug(PURPLE_DEBUG_INFO, "QQ", "Succeed in create Qun, external ID %d\n", group->external_group_id);
g = g_new0(gc_and_uid, 1);
- purple_account_get_connection(g) = gc;
+ g->gc = gc;
g->uid = internal_group_id;
purple_request_action(gc, _("QQ Qun Operation"),
============================================================
--- libpurple/protocols/qq/group_search.c b4f69ced65da509df03ead3dbe6676a664370eaf
+++ libpurple/protocols/qq/group_search.c 68518891a8f524c9c521024133d92cb22e8ea3a4
@@ -99,7 +99,7 @@ void qq_process_group_cmd_search_group(g
GSList *pending_id;
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));
read_packet_b(data, cursor, len, &search_type);
group = g_newa(qq_group, 1);
============================================================
--- libpurple/protocols/qq/im.c f3172af9eec258873d3a0bf9e7f2d36bbd742003
+++ libpurple/protocols/qq/im.c ce4191508a22b48223460bf1a7cbabd43cce671d
@@ -264,7 +264,7 @@ static void _qq_process_recv_normal_im_t
qq_recv_normal_im_text *im_text;
g_return_if_fail(common != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
/* now it is QQ_NORMAL_IM_TEXT */
if (*cursor >= (data + len - 1)) {
@@ -446,7 +446,7 @@ void qq_send_packet_im(PurpleConnection
gboolean is_bold = FALSE, is_italic = FALSE, is_underline = FALSE;
const gchar *start, *end, *last;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
client_tag = QQ_CLIENT;
normal_im_type = QQ_NORMAL_IM_TEXT;
@@ -564,7 +564,7 @@ void qq_process_send_im_reply(guint8 *bu
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = gc->proto_data;
+ qd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
@@ -593,7 +593,7 @@ void qq_process_recv_im(guint8 *buf, gin
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
============================================================
--- libpurple/protocols/qq/keep_alive.c 55d0b97bac55292da89f3d61fcce5bf9077144a1
+++ libpurple/protocols/qq/keep_alive.c f042bfe51cb66a5e5f7bf958e6ac4887ec7dd823
@@ -51,7 +51,7 @@ void qq_send_packet_keep_alive(PurpleCon
qq_data *qd;
guint8 *raw_data, *cursor;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
raw_data = g_newa(guint8, 4);
cursor = raw_data;
@@ -73,7 +73,7 @@ void qq_process_keep_alive_reply(guint8
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
@@ -108,7 +108,7 @@ void qq_refresh_all_buddy_status(PurpleC
qq_data *qd;
qq_buddy *q_bud;
- qd = (qq_data *) (gc->proto_data);
+ qd = (qq_data *) (purple_object_get_protocol_data(PURPLE_OBJECT(gc)));
now = time(NULL);
list = qd->buddies;
============================================================
--- libpurple/protocols/qq/login_logout.c 7ec25bb30f5ef7d1e393e506b3ac2d5491542186
+++ libpurple/protocols/qq/login_logout.c 11561a32f7b0b9bea598b90969a5407cfc722111
@@ -159,7 +159,7 @@ static gint _qq_process_login_ok(PurpleC
qq_data *qd;
qq_login_reply_ok_packet lrop;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
cursor = data;
bytes = 0;
@@ -252,7 +252,7 @@ static gint _qq_process_login_redirect(P
qq_data *qd;
qq_login_reply_redirect_packet lrrp;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
cursor = data;
bytes = 0;
/* 000-000: reply code */
@@ -303,7 +303,7 @@ void qq_send_packet_request_login_token(
guint16 seq_ret;
gint bytes;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
buf = g_newa(guint8, MAX_PACKET_SIZE);
cursor = buf;
@@ -328,7 +328,7 @@ static void qq_send_packet_login(PurpleC
gint encrypted_len, bytes;
gint pos;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
buf = g_newa(guint8, MAX_PACKET_SIZE);
raw_data = g_newa(guint8, QQ_LOGIN_DATA_LENGTH);
encrypted_data = g_newa(guint8, QQ_LOGIN_DATA_LENGTH + 16); /* 16 bytes more */
@@ -385,7 +385,7 @@ void qq_process_request_login_token_repl
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (buf[0] == QQ_REQUEST_LOGIN_TOKEN_REPLY_OK) {
if (buf[1] != buf_len-2) {
@@ -416,7 +416,7 @@ void qq_send_packet_logout(PurpleConnect
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, FALSE, 0xffff, FALSE, qd->pwkey, QQ_KEY_LENGTH);
@@ -433,7 +433,7 @@ void qq_process_login_reply(guint8 *buf,
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
============================================================
--- libpurple/protocols/qq/qq.c 0b0c5521a1c05602359616a6eda43dfa817cbb99
+++ libpurple/protocols/qq/qq.c b08aa069323d0007c12ab8c60f4f1ae6991983a3
@@ -103,11 +103,11 @@ static void _qq_login(PurpleAccount *acc
gc = purple_account_get_connection(account);
g_return_if_fail(gc != NULL);
- gc->flags |= PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_NO_BGCOLOR | PURPLE_CONNECTION_FLAGS_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);
- purple_account_get_connection(qd) = gc;
- gc->proto_data = qd;
+ qd->gc = gc;
+ purple_object_set_protocol_data(PURPLE_OBJECT(gc),qd);
qq_server = purple_account_get_string(account, "server", NULL);
qq_port = purple_account_get_string(account, "port", NULL);
@@ -160,7 +160,7 @@ static gchar *_qq_status_text(PurpleBudd
qq_buddy *q_bud;
GString *status;
- q_bud = (qq_buddy *) b->proto_data;
+ q_bud = (qq_buddy *) purple_object_get_protocol_data(PURPLE_OBJECT(b));
if (q_bud == NULL)
return NULL;
@@ -201,7 +201,7 @@ static void _qq_tooltip_text(PurpleBuddy
g_return_if_fail(b != NULL);
- q_bud = (qq_buddy *) b->proto_data;
+ q_bud = (qq_buddy *) purple_object_get_protocol_data(PURPLE_OBJECT(b));
g_return_if_fail(q_bud != NULL);
if (PURPLE_BUDDY_IS_ONLINE(b) && q_bud != NULL)
@@ -257,7 +257,7 @@ static const char *_qq_list_emblem(Purpl
{
/* each char** are refering to a filename in pixmaps/purple/status/default/ */
- qq_buddy *q_bud = b->proto_data;
+ qq_buddy *q_bud = purple_object_get_protocol_data(PURPLE_OBJECT(b));
if (q_bud) {
if (q_bud->comm_flag & QQ_COMM_FLAG_QQ_MEMBER)
@@ -318,7 +318,7 @@ static gint _qq_send_im(PurpleConnection
g_return_val_if_fail(who != NULL, -1);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
g_return_val_if_fail(strlen(message) <= QQ_MSG_IM_MAX, -E2BIG);
@@ -366,7 +366,7 @@ static void _qq_get_info(PurpleConnectio
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) {
@@ -385,7 +385,7 @@ static void _qq_menu_modify_my_info(Purp
PurpleConnection *gc = (PurpleConnection *) action->context;
qq_data *qd;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
qq_prepare_modify_info(gc);
}
@@ -415,7 +415,7 @@ static void _qq_menu_block_buddy(PurpleB
g_return_if_fail(uid > 0);
g = g_new0(gc_and_uid, 1);
- purple_account_get_connection(g) = gc;
+ g->gc = gc;
g->uid = uid;
purple_request_action(gc, _("Block Buddy"),
@@ -434,7 +434,7 @@ static void _qq_menu_show_login_info(Pur
qq_data *qd;
GString *info;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
info = g_string_new("<html><body>\n");
g_string_append_printf(info, _("<b>Current Online</b>: %d<br>\n"), qd->all_online);
@@ -515,7 +515,7 @@ static void _qq_menu_send_file(PurpleBli
g_return_if_fail (PURPLE_BLIST_NODE_IS_BUDDY (node));
buddy = (PurpleBuddy *) node;
- q_bud = (qq_buddy *) buddy->proto_data;
+ q_bud = (qq_buddy *) purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
/* if (is_online (q_bud->status)) { */
gc = purple_account_get_connection (buddy->account);
g_return_if_fail (gc != NULL && gc->proto_data != NULL);
@@ -600,7 +600,7 @@ static void _qq_keep_alive(PurpleConnect
qq_data *qd;
GList *list;
- if (NULL == (qd = (qq_data *) gc->proto_data))
+ if (NULL == (qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc))))
return;
list = qd->groups;
============================================================
--- libpurple/protocols/qq/qq_proxy.c 9f001b7aa0fb8a51d4921131fc2800cde744b216
+++ libpurple/protocols/qq/qq_proxy.c f4d8e094b74928fd8e008eaa31e6ee2e67bb73a4
@@ -134,15 +134,15 @@ static void _qq_got_login(gpointer data,
return;
}
- g_return_if_fail(gc != NULL && gc->proto_data != NULL);
+ g_return_if_fail(gc != NULL);
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+ g_return_if_fail(qd != NULL);
if (source < 0) { /* socket returns -1 */
purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message);
return;
}
- qd = (qq_data *) gc->proto_data;
-
/*
_qq_show_socket("Got login socket", source);
*/
@@ -160,7 +160,7 @@ static void _qq_got_login(gpointer data,
qd->pwkey = _gen_pwkey(passwd);
qd->sendqueue_timeout = purple_timeout_add(QQ_SENDQUEUE_TIMEOUT, qq_sendqueue_timeout_callback, gc);
- gc->inpa = purple_input_add(qd->fd, PURPLE_INPUT_READ, qq_input_pending, gc);
+ g_object_set(G_OBJECT(gc),"inpa",purple_input_add(qd->fd, PURPLE_INPUT_READ, qq_input_pending, gc),NULL);
/* Update the login progress status display */
buf = g_strdup_printf("Login as %d", qd->uid);
@@ -178,8 +178,9 @@ static void _qq_common_clean(PurpleConne
{
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);
/* finish all I/O */
if (qd->fd >= 0 && qd->logged_in)
@@ -191,9 +192,9 @@ static void _qq_common_clean(PurpleConne
qd->sendqueue_timeout = 0;
}
- if (gc->inpa > 0) {
- purple_input_remove(gc->inpa);
- gc->inpa = 0;
+ if (purple_object_get_int(PURPLE_OBJECT(gc),"inpa") > 0) {
+ purple_input_remove(purple_object_get_int(PURPLE_OBJECT(gc),"inpa"));
+ g_object_set(G_OBJECT(gc),"inpa",0,NULL);
}
qq_b4_packets_free(qd);
@@ -329,7 +330,7 @@ static void _qq_server_resolved(GSList *
{
struct PHB *phb = (struct PHB *) data;
PurpleConnection *gc = (PurpleConnection *) phb->data;
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct sockaddr_in addr;
gint addr_size, ret = -1;
@@ -378,7 +379,7 @@ static gint _qq_udp_proxy_connect(Purple
{
PurpleProxyInfo *info;
struct PHB *phb;
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
g_return_val_if_fail(gc != NULL && qd != NULL, -1);
@@ -416,7 +417,7 @@ static gint _proxy_connect_full (PurpleA
qq_data *qd;
gc = purple_account_get_connection(account);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
qd->server_ip = g_strdup(host);
qd->server_port = port;
@@ -438,12 +439,13 @@ gint qq_connect(PurpleAccount *account,
g_return_val_if_fail(port > 0, -1);
gc = purple_account_get_connection(account);
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -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);
if (is_redirect)
_qq_common_clean(gc);
- qd = (qq_data *) gc->proto_data;
qd->before_login_packets = g_queue_new();
return _proxy_connect_full(account, host, port, _qq_got_login, gc, use_tcp);
@@ -458,7 +460,7 @@ void qq_disconnect(PurpleConnection *gc)
_qq_common_clean(gc);
- qd = gc->proto_data;
+ qd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
g_free(qd->inikey);
g_free(qd->pwkey);
g_free(qd->session_key);
@@ -466,7 +468,7 @@ void qq_disconnect(PurpleConnection *gc)
g_free(qd->my_ip);
g_free(qd);
- gc->proto_data = NULL;
+ purple_object_set_protocol_data(PURPLE_OBJECT(gc),NULL);
}
/* send packet with proxy support */
@@ -495,7 +497,7 @@ gint qq_proxy_write(qq_data *qd, guint8
ret = send(qd->fd, data, len, 0);
}
if (ret == -1)
- purple_connection_error_reason(purple_account_get_connection(qd), PURPLE_CONNECTION_ERROR_NETWORK_ERROR, g_strerror(errno));
+ purple_connection_error_reason(qd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, g_strerror(errno));
return ret;
}
============================================================
--- libpurple/protocols/qq/recv_core.c c8890a830dc15d393d5a2d6c7c61fdd9baf6e4fe
+++ libpurple/protocols/qq/recv_core.c 20e67a75c9e44f4aca529355d39c220ab50b2966
@@ -65,7 +65,7 @@ static gboolean _qq_check_packet_set_win
qq_data *qd;
guint8 *byte, mask;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
byte = &(qd->window[seq / 8]);
mask = (1 << (seq % 8));
@@ -85,7 +85,7 @@ static void _qq_process_packet_default(g
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
msg_utf8 = NULL;
@@ -115,7 +115,7 @@ static void _qq_packet_process(guint8 *b
g_return_if_fail(buf != NULL && buf_len > 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
bytes_expected = qd->use_tcp ? QQ_TCP_HEADER_LENGTH : QQ_UDP_HEADER_LENGTH;
if (buf_len < bytes_expected) {
@@ -311,7 +311,7 @@ void qq_input_pending(gpointer data, gin
return;
}
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
buf = g_newa(guint8, MAX_PACKET_SIZE);
/* here we have UDP proxy suppport */
============================================================
--- libpurple/protocols/qq/send_core.c b3a719acc6a326b39b9b58f390ff429c64aa46dc
+++ libpurple/protocols/qq/send_core.c 0e1cd226f3cf4aef65b1194df12fc6cebf7dca9c
@@ -44,7 +44,7 @@ gint _create_packet_head_seq(guint8 *buf
g_return_val_if_fail(buf != NULL && cursor != NULL && *cursor != NULL, -1);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (is_auto_seq)
*seq = ++(qd->send_seq);
@@ -81,7 +81,7 @@ gint _qq_send_packet(PurpleConnection *g
gint bytes_sent;
guint8 *cursor;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (qd->use_tcp) {
if (len > MAX_PACKET_SIZE) {
@@ -123,7 +123,7 @@ gint qq_send_cmd(PurpleConnection *gc, g
guint16 seq_ret;
gint encrypted_len, bytes_written, bytes_expected, bytes_sent;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
g_return_val_if_fail(qd->session_key != NULL, -1);
buf = g_newa(guint8, MAX_PACKET_SIZE);
============================================================
--- libpurple/protocols/qq/send_file.c 295a7ac1310e9a996e8e413d9cf140cb8de5ad65
+++ libpurple/protocols/qq/send_file.c 17a1d6296bced82d12525024b2699d22d9f21fb4
@@ -438,7 +438,7 @@ static void _qq_send_packet_file_request
gint filename_len, filelen_strlen, packet_len, bytes;
ft_info *info;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
info = g_new0(ft_info, 1);
info->to_uid = to_uid;
@@ -494,7 +494,7 @@ static void _qq_send_packet_file_accept(
gint packet_len, bytes;
ft_info *info;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
info = (ft_info *) qd->xfer->data;
purple_debug(PURPLE_DEBUG_INFO, "QQ", "I've accepted the file transfer request from %d\n", to_uid);
@@ -532,7 +532,7 @@ static void _qq_send_packet_file_notifyi
guint8 *cursor, *raw_data;
gint packet_len, bytes;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
xfer = qd->xfer;
info = xfer->data;
@@ -564,7 +564,7 @@ static void _qq_send_packet_file_reject
gint packet_len, bytes;
purple_debug(PURPLE_DEBUG_INFO, "_qq_send_packet_file_reject", "start");
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
packet_len = 64;
raw_data = g_newa (guint8, packet_len);
@@ -590,7 +590,7 @@ static void _qq_send_packet_file_cancel
gint packet_len, bytes;
purple_debug(PURPLE_DEBUG_INFO, "_qq_send_packet_file_cancel", "start\n");
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
packet_len = 64;
raw_data = g_newa (guint8, packet_len);
@@ -695,7 +695,7 @@ void qq_process_recv_file_reject (guint8
qq_data *qd;
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));
g_return_if_fail (qd->xfer != NULL);
if (*cursor >= (data + data_len - 1)) {
@@ -722,7 +722,7 @@ void qq_process_recv_file_cancel (guint8
qq_data *qd;
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));
g_return_if_fail (qd->xfer != NULL
&& purple_xfer_get_filename(qd->xfer) != NULL);
@@ -752,7 +752,7 @@ void qq_process_recv_file_accept(guint8
PurpleXfer *xfer;
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));
xfer = qd->xfer;
if (*cursor >= (data + data_len - 1)) {
@@ -783,7 +783,7 @@ void qq_process_recv_file_request(guint8
qq_buddy *q_bud;
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 (*cursor >= (data + data_len - 1)) {
purple_debug (PURPLE_DEBUG_WARNING, "QQ",
@@ -812,7 +812,7 @@ void qq_process_recv_file_request(guint8
"Received a FACE ip detect from qq-%d, so he/she must be online :)\n", sender_uid);
b = purple_find_buddy(purple_connection_get_account(gc), sender_name);
- q_bud = (b == NULL) ? NULL : (qq_buddy *) b->proto_data;
+ q_bud = (b == NULL) ? NULL : (qq_buddy *) purple_object_get_protocol_data(PURPLE_OBJECT(b));
if (q_bud) {
if(0 != info->remote_real_ip) {
g_memmove(q_bud->ip, &info->remote_real_ip, 4);
@@ -888,7 +888,7 @@ void qq_process_recv_file_notify(guint8
PurpleXfer *xfer;
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 (*cursor >= (data + data_len - 1)) {
purple_debug (PURPLE_DEBUG_WARNING, "QQ",
@@ -920,7 +920,7 @@ void qq_send_file(PurpleConnection *gc,
qq_data *qd;
PurpleXfer *xfer;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
xfer = purple_xfer_new (purple_connection_get_account(gc), PURPLE_XFER_SEND,
who);
============================================================
--- libpurple/protocols/qq/sendqueue.c 1e1281845e07c668525c01370bf3510afe60757d
+++ libpurple/protocols/qq/sendqueue.c 98154580fd1556ff231886b574fd31f19eeda8dc
@@ -92,7 +92,7 @@ gboolean qq_sendqueue_timeout_callback(g
gint wait_time;
gc = (PurpleConnection *) data;
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
now = time(NULL);
list = qd->sendqueue;
============================================================
--- libpurple/protocols/qq/sys_msg.c 5e5a6c4c4f69d3ea3f2e6941bec6d2fd2b15a382
+++ libpurple/protocols/qq/sys_msg.c 0607893de1d55eeaa2654b4a25ddd3c89352ad1d
@@ -76,7 +76,7 @@ static void _qq_search_before_auth_with_
g_return_if_fail(g != NULL);
- gc = purple_account_get_connection(g);
+ gc = g->gc;
uid = g->uid;
g_return_if_fail(gc != 0 && uid != 0);
@@ -101,7 +101,7 @@ static void _qq_search_before_add_with_g
g_return_if_fail(g != NULL);
- gc = purple_account_get_connection(g);
+ gc = g->gc;
uid = g->uid;
g_return_if_fail(gc != 0 && uid != 0);
@@ -163,7 +163,7 @@ static void _qq_process_msg_sys_being_ad
if (b == NULL) { /* the person is not in my list */
g = g_new0(gc_and_uid, 1);
- purple_account_get_connection(g) = gc;
+ g->gc = gc;
g->uid = uid; /* only need to get value */
message = g_strdup_printf(_("You have been added by %s"), from);
_qq_sys_msg_log_write(gc, message, from);
@@ -209,7 +209,7 @@ static void _qq_process_msg_sys_add_cont
g_return_if_fail(from != NULL && to != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
qq_add_buddy_by_recv_packet(gc, strtol(from, NULL, 10), TRUE, TRUE);
message = g_strdup_printf(_("User %s approved your request"), from);
@@ -232,7 +232,7 @@ static void _qq_process_msg_sys_add_cont
uid = strtol(from, NULL, 10);
g = g_new0(gc_and_uid, 1);
- purple_account_get_connection(g) = gc;
+ g->gc = gc;
g->uid = uid;
name = uid_to_purple_name(uid);
@@ -259,7 +259,7 @@ static void _qq_process_msg_sys_add_cont
b = purple_find_buddy(purple_connection_get_account(gc), name);
if (b == NULL) { /* the person is not in my list */
g2 = g_new0(gc_and_uid, 1);
- g2purple_account_get_connection() = gc;
+ g2->gc = gc;
g2->uid = strtol(from, NULL, 10);
message = g_strdup_printf(_("%s is not in your buddy list"), from);
purple_request_action(gc, NULL, message,
@@ -284,7 +284,7 @@ void qq_process_msg_sys(guint8 *buf, gin
g_return_if_fail(buf != NULL && buf_len != 0);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
len = buf_len;
data = g_newa(guint8, len);
More information about the Commits
mailing list