gobjectification: d174cfdc: Fix compile errors from the propagation ...
sadrul at pidgin.im
sadrul at pidgin.im
Thu Sep 25 06:31:29 EDT 2008
-----------------------------------------------------------------
Revision: d174cfdc888b708aab448f33661a732aee66272b
Ancestor: 32169ec127a35a8d3f1b4227b51e08bade2cedb2
Author: sadrul at pidgin.im
Date: 2008-09-25T10:40:46
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/d174cfdc888b708aab448f33661a732aee66272b
Modified files:
finch/gntaccount.c libpurple/account.c
libpurple/connection.c libpurple/protocols/jabber/auth.c
libpurple/protocols/jabber/jabber.c
libpurple/protocols/jabber/message.c
libpurple/protocols/qq/buddy_info.c
libpurple/protocols/qq/buddy_list.c
libpurple/protocols/qq/group_conv.c
libpurple/protocols/qq/group_find.c
libpurple/protocols/qq/im.c libpurple/protocols/qq/qq_base.c
libpurple/protocols/qq/qq_network.c
libpurple/protocols/qq/qq_process.c
libpurple/protocols/qq/qq_trans.c
libpurple/protocols/qq/sys_msg.c
libpurple/protocols/yahoo/util.c
libpurple/protocols/yahoo/yahoo_aliases.c
pidgin/gtkaccount.c
ChangeLog:
Fix compile errors from the propagation from ipp.
I can connect on AIM, XMPP, MSN, IRC using Pidgin. I couldn't get it to
connect to my Yahoo account, but it doesn't show any error messages
either. I don't use any other services, so don't know if they still work
or not.
-------------- next part --------------
============================================================
--- finch/gntaccount.c f371d0b3daffcdcbff36edc11a0b63989f19e01c
+++ finch/gntaccount.c 57bdd074d2e7dad4d02768bbf01abe07ebd0a56c
@@ -680,7 +680,7 @@ account_toggled(GntWidget *widget, void
{
PurpleAccount *account = key;
- purple_account_set_enabled(account, FINCH_UI, gnt_tree_get_choice(GNT_TREE(widget), key));
+ purple_account_set_enabled(account, gnt_tree_get_choice(GNT_TREE(widget), key));
}
static gboolean
============================================================
--- libpurple/account.c b594a8919e2429bc530a7fb2cc451accf6650307
+++ libpurple/account.c 74d7a1858eb5a6b13dfba39741a539c292970fb3
@@ -2603,7 +2603,7 @@ purple_accounts_find(const char *name, c
for (l = purple_accounts_get_all(); l != NULL; l = l->next) {
account = (PurpleAccount *)l->data;
- if (protocol_id && strcmp(account->protocol_id, protocol_id))
+ if (protocol_id && strcmp(purple_account_get_protocol_id(account), protocol_id))
continue;
who = g_strdup(purple_normalize(account, name));
============================================================
--- libpurple/connection.c 9db8a438a8038fc3d8f3033a7d0f454bafbda717
+++ libpurple/connection.c a80dcbd9672c10feddce0218db2e90914373f013
@@ -765,6 +765,7 @@ purple_connection_dispose(GObject *obj)
buddies = g_slist_delete_link(buddies, buddies);
}
+ G_OBJECT_CLASS(parent_class)->dispose(obj);
}
static void
============================================================
--- libpurple/protocols/jabber/auth.c dba01698789f63240549f4060e5be444f0f38d83
+++ libpurple/protocols/jabber/auth.c ce0cb242417f21cbf5089e11267d38c3323d5931
@@ -665,7 +665,7 @@ static void auth_old_cb(JabberStream *js
PurpleCipher *hmac;
/* Calculate the MHAC-MD5 digest */
- challenge = xmlnode_get_attrib(x, "challenge");
+ challenge = xmlnode_get_attrib(xmlnode_get_child(query, "crammd5"), "challenge");
hmac = purple_hmac_cipher_new();
purple_cipher_set_hash(hmac, purple_md5_cipher_new());
purple_cipher_set_key(hmac, (guchar *)pw);
============================================================
--- libpurple/protocols/jabber/jabber.c 847b3aeea0ada1372d9ff8bc29b22640d26a7908
+++ libpurple/protocols/jabber/jabber.c 084b6b17e108483df4256bb9cefbc354fe5018e4
@@ -623,7 +623,7 @@ jabber_login(PurpleAccount *account)
JabberBuddy *my_jb = NULL;
purple_connection_set_flags(gc,
- purple_connection_get_flags(gc) | PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY);
+ purple_connection_get_flags(gc) | PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_ALLOW_CUSTOM_SMILEY);
purple_object_set_protocol_data(PURPLE_OBJECT(gc), js = g_new0(JabberStream, 1));
js->gc = gc;
js->fd = -1;
============================================================
--- libpurple/protocols/jabber/message.c 3f37085f3d9f6f7a285f375c737a37d8540df45d
+++ libpurple/protocols/jabber/message.c e8c57a530ffca3039990ffa6f9989c2b38252954
@@ -904,11 +904,11 @@ jabber_conv_support_custom_smileys(const
const PurpleConversation *conv,
const gchar *who)
{
- JabberStream *js = (JabberStream *) gc->proto_data;
+ JabberStream *js = (JabberStream *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
JabberBuddy *jb;
-
+
if (!js) {
- purple_debug_error("jabber",
+ purple_debug_error("jabber",
"jabber_conv_support_custom_smileys: could not find stream\n");
return FALSE;
}
============================================================
--- libpurple/protocols/qq/buddy_info.c 3ba0e15053ad633cb1a46f51acfbafc52d59f717
+++ libpurple/protocols/qq/buddy_info.c 96517a55dec2ead0dd6fcc0a6d6c4cde6baaa8ff
@@ -302,7 +302,7 @@ void qq_request_buddy_info(PurpleConnect
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(raw_data, sizeof(raw_data), "%d", uid);
qq_send_cmd_mess(gc, QQ_CMD_GET_BUDDY_INFO, (guint8 *) raw_data, strlen(raw_data),
update_class, ship32);
============================================================
--- libpurple/protocols/qq/buddy_list.c 6517aba2c11b479f693e0234f112f9379647fc42
+++ libpurple/protocols/qq/buddy_list.c e424710e57131b6fc128f01dc75cba74695303da
@@ -643,7 +643,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/group_conv.c 3453474c95bc40eef7fd94614add2cf479124393
+++ libpurple/protocols/qq/group_conv.c 66a07d54ff57ce3c40c850a6bcc9672b431f992e
@@ -40,7 +40,7 @@ PurpleConversation *qq_room_conv_create(
PurpleConversation *conv;
qq_data *qd;
- g_return_if_fail(group != NULL);
+ g_return_val_if_fail(group != NULL, NULL);
qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT,
============================================================
--- libpurple/protocols/qq/group_find.c 6f9650a4b16c07bb55346dcbba4194f8807b73d3
+++ libpurple/protocols/qq/group_find.c 00df67376e802737d7cafb61e38bd066e7d4fd4a
@@ -175,7 +175,7 @@ qq_group *qq_room_get_next(PurpleConnect
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 NULL;
@@ -209,7 +209,7 @@ qq_group *qq_room_get_next_conv(PurpleCo
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) {
============================================================
--- libpurple/protocols/qq/im.c a376a5587f1022e57157c52ddde33ca347d75ba6
+++ libpurple/protocols/qq/im.c 4195742ca566c022872ad0299115d1fb610b5b16
@@ -245,7 +245,7 @@ static void _qq_process_recv_news(guint8
static void _qq_process_recv_news(guint8 *data, gint data_len, PurpleConnection *gc)
{
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
gint bytes;
guint8 *temp;
guint8 temp_len;
============================================================
--- libpurple/protocols/qq/qq_base.c 3fd5cac4bed225fb19eeabb92072d290c20ec864
+++ libpurple/protocols/qq/qq_base.c 21b474eb38261de3747a07b45dde9eacee20b0ff
@@ -405,10 +405,12 @@ guint8 qq_process_login_reply( PurpleCon
guint8 ret = data[0];
gchar *server_reply, *server_reply_utf8;
gchar *error_msg;
+ PurpleAccount *account;
g_return_val_if_fail(data != NULL && data_len != 0, QQ_LOGIN_REPLY_ERR_MISC);
qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+ account = purple_connection_get_account(gc);
switch (ret) {
case QQ_LOGIN_REPLY_OK:
@@ -433,8 +435,8 @@ guint8 qq_process_login_reply( PurpleCon
g_free(server_reply);
g_free(server_reply_utf8);
- if (!purple_account_get_remember_password(gc->account)) {
- purple_account_set_password(gc->account, NULL);
+ if (!purple_account_get_remember_password(account)) {
+ purple_account_set_password(account, NULL);
}
purple_connection_error_reason(gc,
============================================================
--- libpurple/protocols/qq/qq_network.c acc9eb8a8d8abb8a7230923a29e51d949a2f69f2
+++ libpurple/protocols/qq/qq_network.c 3fdc79a9efe21abca4b8707ef4ef19f7890d8f08
@@ -152,8 +152,8 @@ static gboolean connect_check(gpointer d
PurpleConnection *gc = (PurpleConnection *) data;
qq_data *qd;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, FALSE);
if (qd->connect_watcher > 0) {
purple_timeout_remove(qd->connect_watcher);
@@ -180,8 +180,8 @@ gboolean qq_connect_later(gpointer data)
int port;
gchar **segments;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, FALSE);
if (qd->check_watcher > 0) {
purple_timeout_remove(qd->check_watcher);
@@ -247,7 +247,7 @@ static gboolean packet_process(PurpleCon
g_return_val_if_fail(buf != NULL && buf_len > 0, TRUE);
- qd = (qq_data *) gc->proto_data;
+ qd = (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
qd->net_stat.rcved++;
if (qd->net_stat.rcved <= 0) memset(&(qd->net_stat), 0, sizeof(qd->net_stat));
@@ -338,8 +338,8 @@ static void tcp_pending(gpointer data, g
guint8 *jump;
gint jump_len;
- g_return_if_fail(gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail(gc != NULL && qd != NULL);
if(cond != PURPLE_INPUT_READ) {
purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
@@ -464,8 +464,8 @@ static void udp_pending(gpointer data, g
gint buf_len;
gc = (PurpleConnection *) data;
- g_return_if_fail(gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail(gc != NULL && qd != NULL);
if(cond != PURPLE_INPUT_READ) {
purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
@@ -510,8 +510,8 @@ static gint udp_send_out(PurpleConnectio
g_return_val_if_fail(data != NULL && data_len > 0, -1);
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, -1);
#if 0
purple_debug_info("UDP_SEND_OUT", "Send %d bytes to socket %d\n", data_len, qd->fd);
@@ -538,8 +538,8 @@ static void tcp_can_write(gpointer data,
qq_connection *conn;
int ret, writelen;
- g_return_if_fail(gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail(gc != NULL && qd != NULL);
conn = connection_find(qd, source);
g_return_if_fail(conn != NULL);
@@ -574,8 +574,8 @@ static gint tcp_send_out(PurpleConnectio
g_return_val_if_fail(data != NULL && data_len > 0, -1);
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, -1);
conn = connection_find(qd, qd->fd);
g_return_val_if_fail(conn, -1);
@@ -624,8 +624,8 @@ static gboolean network_timeout(gpointer
qq_data *qd;
gboolean is_lost_conn;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, TRUE);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, TRUE);
is_lost_conn = qq_trans_scan(gc);
if (is_lost_conn) {
@@ -667,8 +667,8 @@ static void do_request_token(PurpleConne
/* _qq_show_socket("Got login socket", source); */
- g_return_if_fail(gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail(gc != NULL && qd != NULL);
/* QQ use random seq, to minimize duplicated packets */
srand(time(NULL));
@@ -708,9 +708,9 @@ static void connect_cb(gpointer data, gi
qq_connection *conn;
gc = (PurpleConnection *) data;
- g_return_if_fail(gc != NULL && gc->proto_data != NULL);
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail(gc != NULL && qd != NULL);
- qd = (qq_data *) gc->proto_data;
account = purple_connection_get_account(gc);
/* conn_data will be destoryed */
@@ -752,11 +752,9 @@ static void udp_can_write(gpointer data,
int error=0, ret;
gc = (PurpleConnection *) data;
- g_return_if_fail(gc != NULL && gc->proto_data != NULL);
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail(gc != NULL && qd != NULL);
- qd = (qq_data *) gc->proto_data;
-
-
purple_debug_info("proxy", "Connected.\n");
/*
@@ -801,10 +799,9 @@ static void udp_host_resolved(GSList *ho
int flags;
gc = (PurpleConnection *) data;
- g_return_if_fail(gc != NULL && gc->proto_data != NULL);
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail(gc != NULL && qd != NULL);
- qd = (qq_data *) gc->proto_data;
-
/* udp_query_data must be set as NULL.
* Otherwise purple_dnsquery_destroy in qq_disconnect cause glib double free error */
qd->udp_query_data = NULL;
@@ -886,9 +883,10 @@ gboolean connect_to_server(PurpleConnect
qq_data *qd;
gchar *conn_msg;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, FALSE);
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, FALSE);
+
account = purple_connection_get_account(gc);
- qd = (qq_data *) gc->proto_data;
if (server == NULL || strlen(server) == 0 || port == 0) {
purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
@@ -946,8 +944,8 @@ void qq_disconnect(PurpleConnection *gc)
{
qq_data *qd;
- g_return_if_fail(gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail(gc != NULL && qd != NULL);
purple_debug_info("QQ", "Disconnecting ...\n");
@@ -1000,7 +998,7 @@ void qq_disconnect(PurpleConnection *gc)
qq_group_free_all(qd);
qq_add_buddy_request_free(qd);
qq_info_query_free(qd);
- qq_buddies_list_free(gc->account, qd);
+ qq_buddies_list_free(purple_connection_get_account(gc), qd);
}
static gint packet_encap(qq_data *qd, guint8 *buf, gint maxlen, guint16 cmd, guint16 seq,
@@ -1042,10 +1040,11 @@ static gint packet_send_out(PurpleConnec
gint buf_len;
gint bytes_sent;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1);
- qd = (qq_data *)gc->proto_data;
g_return_val_if_fail(data != NULL && data_len > 0, -1);
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, -1);
+
buf = g_newa(guint8, MAX_PACKET_SIZE);
memset(buf, 0, MAX_PACKET_SIZE);
buf_len = packet_encap(qd, buf, MAX_PACKET_SIZE, cmd, seq, data, data_len);
@@ -1090,10 +1089,11 @@ static gint send_cmd_detail(PurpleConnec
gint encrypted_len;
gint bytes_sent;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1);
- qd = (qq_data *)gc->proto_data;
g_return_val_if_fail(data != NULL && data_len > 0, -1);
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, -1);
+
/* at most 16 bytes more */
encrypted_data = g_newa(guint8, data_len + 16);
encrypted_len = qq_encrypt(encrypted_data, data, data_len, qd->session_key);
@@ -1118,10 +1118,11 @@ gint qq_send_cmd_mess(PurpleConnection *
qq_data *qd;
guint16 seq;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1);
- qd = (qq_data *) gc->proto_data;
g_return_val_if_fail(data != NULL && data_len > 0, -1);
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, -1);
+
seq = ++qd->send_seq;
#if 1
purple_debug_info("QQ", "<== [%05d], %s(0x%04X), datalen %d\n",
@@ -1137,10 +1138,11 @@ gint qq_send_cmd(PurpleConnection *gc, g
guint16 seq;
gboolean is_save2trans;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1);
- qd = (qq_data *) gc->proto_data;
g_return_val_if_fail(data != NULL && data_len > 0, -1);
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, -1);
+
if (cmd != QQ_CMD_LOGOUT) {
seq = ++qd->send_seq;
is_save2trans = TRUE;
@@ -1163,10 +1165,11 @@ gint qq_send_server_reply(PurpleConnecti
gint encrypted_len;
gint bytes_sent;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1);
- qd = (qq_data *)gc->proto_data;
g_return_val_if_fail(data != NULL && data_len > 0, -1);
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, -1);
+
#if 1
purple_debug_info("QQ", "<== [SRV-%05d], %s(0x%04X), datalen %d\n",
seq, qq_get_cmd_desc(cmd), cmd, data_len);
@@ -1197,8 +1200,8 @@ static gint send_room_cmd(PurpleConnecti
gint bytes_sent;
guint16 seq;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, -1);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, -1);
buf = g_newa(guint8, MAX_PACKET_SIZE);
memset(buf, 0, MAX_PACKET_SIZE);
============================================================
--- libpurple/protocols/qq/qq_process.c 92d4fd7a3a8e5d7db7b46fcbac1d64024464831d
+++ libpurple/protocols/qq/qq_process.c 7e2c8241b1e30cea3c86d2aa40ef56a4e96e4f95
@@ -69,7 +69,7 @@ static void process_cmd_unknow(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,
@@ -90,8 +90,8 @@ 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;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail (gc != NULL && qd != NULL);
data = g_newa(guint8, rcved_len);
data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key);
@@ -153,8 +153,8 @@ void qq_update_room(PurpleConnection *gc
qq_group *group;
gint ret;
- g_return_if_fail (gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail (gc != NULL && qd != NULL);
group = qq_room_search_id(gc, room_id);
if (group == NULL && room_id <= 0) {
@@ -195,8 +195,8 @@ static void update_all_rooms(PurpleConne
gboolean is_new_turn = FALSE;
qq_group *next_group;
- g_return_if_fail (gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail (gc != NULL && qd != NULL);
next_group = qq_room_get_next(gc, room_id);
if (next_group == NULL && room_id <= 0) {
@@ -239,8 +239,8 @@ 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;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail (gc != NULL && qd != NULL);
switch (cmd) {
case 0:
@@ -275,8 +275,8 @@ static void update_all_rooms_online(Purp
qq_data *qd;
qq_group *next_group;
- g_return_if_fail (gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail (gc != NULL && qd != NULL);
next_group = qq_room_get_next_conv(gc, room_id);
if (next_group == NULL && room_id <= 0) {
@@ -328,8 +328,8 @@ void qq_proc_room_cmd(PurpleConnection *
gint bytes;
guint8 reply_cmd, reply;
- g_return_if_fail (gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail (gc != NULL && qd != NULL);
data = g_newa(guint8, rcved_len);
data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key);
@@ -472,8 +472,8 @@ void qq_proc_login_cmd(PurpleConnection
gint data_len;
guint ret_8;
- g_return_if_fail (gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail (gc != NULL && qd != NULL);
data = g_newa(guint8, rcved_len);
/* May use password_twice_md5 in the past version like QQ2005*/
@@ -500,7 +500,7 @@ void qq_proc_login_cmd(PurpleConnection
purple_debug_info("QQ", "Login repliess 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 */
@@ -531,8 +531,8 @@ void qq_proc_client_cmd(PurpleConnection
g_return_if_fail(rcved_len > 0);
- g_return_if_fail (gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail (gc != NULL && qd != NULL);
data = g_newa(guint8, rcved_len);
data_len = qq_decrypt(data, rcved, rcved_len, qd->session_key);
============================================================
--- libpurple/protocols/qq/qq_trans.c e34b93f6399a872a447715a13e8dc4e1b6866dd5
+++ libpurple/protocols/qq/qq_trans.c 7782cddf96c2e0b32afed2164e734fcd4fb959a7
@@ -112,8 +112,8 @@ static qq_transaction *trans_create(Purp
qq_data *qd;
qq_transaction *trans;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, NULL);
trans = g_new0(qq_transaction, 1);
@@ -137,10 +137,10 @@ static void trans_remove(PurpleConnectio
/* Remove a packet with seq from send trans */
static void trans_remove(PurpleConnection *gc, qq_transaction *trans)
{
- qq_data *qd = (qq_data *)gc->proto_data;
+ qq_data *qd;
- g_return_if_fail(gc != NULL && gc->proto_data != NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_if_fail(gc != NULL && qd != NULL);
g_return_if_fail(trans != NULL);
#if 0
@@ -162,8 +162,8 @@ static qq_transaction *trans_find(Purple
GList *list;
qq_transaction *trans;
- g_return_val_if_fail(gc != NULL && gc->proto_data != NULL, NULL);
- qd = (qq_data *) gc->proto_data;
+ qd = gc ? (qq_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc)) : NULL;
+ g_return_val_if_fail(gc != NULL && qd != NULL, NULL);
list = qd->transactions;
while (list != NULL) {
@@ -180,7 +180,7 @@ void qq_trans_add_client_cmd(PurpleConne
void qq_trans_add_client_cmd(PurpleConnection *gc,
guint16 cmd, guint16 seq, guint8 *data, gint data_len, gint update_class, guint32 ship32)
{
- qq_data *qd = (qq_data *)gc->proto_data;
+ qq_data *qd = (qq_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, data, data_len, update_class, ship32);
if (cmd == QQ_CMD_TOKEN || cmd == QQ_CMD_LOGIN || cmd == QQ_CMD_KEEP_ALIVE) {
@@ -220,7 +220,7 @@ void qq_trans_add_room_cmd(PurpleConnect
guint16 seq, guint8 room_cmd, guint32 room_id, guint8 *data, gint data_len,
gint update_class, guint32 ship32)
{
- qq_data *qd = (qq_data *)gc->proto_data;
+ qq_data *qd = (qq_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
qq_transaction *trans = trans_create(gc, qd->fd, QQ_CMD_ROOM, seq, data, data_len,
update_class, ship32);
@@ -237,7 +237,7 @@ void qq_trans_add_server_cmd(PurpleConne
void qq_trans_add_server_cmd(PurpleConnection *gc, guint16 cmd, guint16 seq,
guint8 *rcved, gint rcved_len)
{
- qq_data *qd = (qq_data *)gc->proto_data;
+ qq_data *qd = (qq_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, rcved, rcved_len, QQ_CMD_CLASS_NONE, 0);
trans->flag = QQ_TRANS_IS_SERVER;
@@ -274,7 +274,7 @@ void qq_trans_add_remain(PurpleConnectio
void qq_trans_add_remain(PurpleConnection *gc, guint16 cmd, guint16 seq,
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));
qq_transaction *trans = trans_create(gc, qd->fd, cmd, seq, data, data_len, QQ_CMD_CLASS_NONE, 0);
trans->flag = QQ_TRANS_IS_SERVER;
@@ -290,7 +290,7 @@ void qq_trans_process_remained(PurpleCon
void qq_trans_process_remained(PurpleConnection *gc)
{
- qq_data *qd = (qq_data *)gc->proto_data;
+ qq_data *qd = (qq_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GList *curr;
GList *next;
qq_transaction *trans;
@@ -327,7 +327,7 @@ gboolean qq_trans_scan(PurpleConnection
gboolean qq_trans_scan(PurpleConnection *gc)
{
- qq_data *qd = (qq_data *)gc->proto_data;
+ qq_data *qd = (qq_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GList *curr;
GList *next;
qq_transaction *trans;
@@ -395,7 +395,7 @@ void qq_trans_remove_all(PurpleConnectio
/* clean up send trans and free all contents */
void qq_trans_remove_all(PurpleConnection *gc)
{
- qq_data *qd = (qq_data *)gc->proto_data;
+ qq_data *qd = (qq_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
qq_transaction *trans;
gint count = 0;
============================================================
--- libpurple/protocols/qq/sys_msg.c 62671a0aeda0f8f0b86df8492848156f46a896fa
+++ libpurple/protocols/qq/sys_msg.c 72752159f1849aa76561dbd04174d9e73738887b
@@ -279,7 +279,7 @@ static void _qq_process_msg_sys_notice(P
static void _qq_process_msg_sys_notice(PurpleConnection *gc, gchar *from, gchar *to, gchar *msg_utf8)
{
- qq_data *qd = (qq_data *) gc->proto_data;
+ qq_data *qd = (qq_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
gchar *title, *content;
g_return_if_fail(from != NULL && to != NULL);
============================================================
--- libpurple/protocols/yahoo/util.c 2e659db9570b138c27277c33da7d2c3b8ca02841
+++ libpurple/protocols/yahoo/util.c d1c5cf502000cc37cd05d6e7f10c1672c166de22
@@ -35,7 +35,7 @@ yahoo_account_use_http_proxy(PurpleConne
gboolean
yahoo_account_use_http_proxy(PurpleConnection *conn)
{
- PurpleProxyInfo *ppi = purple_proxy_get_setup(conn->account);
+ PurpleProxyInfo *ppi = purple_proxy_get_setup(purple_connection_get_account(conn));
return (ppi->type == PURPLE_PROXY_HTTP || ppi->type == PURPLE_PROXY_USE_ENVVAR);
}
============================================================
--- libpurple/protocols/yahoo/yahoo_aliases.c d706bb35f8d2c5b29a091e0c9a6718c05edb637a
+++ libpurple/protocols/yahoo/yahoo_aliases.c 64b580fce31a137cf631c711ed7a284b199f67d2
@@ -265,6 +265,7 @@ yahoo_update_alias(PurpleConnection *gc,
YahooFriend *f;
/* use whole URL if using HTTP Proxy */
gboolean use_whole_url = yahoo_account_use_http_proxy(gc);
+ PurpleAccount *account;
g_return_if_fail(who != NULL);
g_return_if_fail(gc != NULL);
@@ -279,6 +280,7 @@ yahoo_update_alias(PurpleConnection *gc,
}
yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+ account = purple_connection_get_account(gc);
/* Using callback_data so I have access to gc in the callback function */
cb = g_new0(struct callback_data, 1);
============================================================
--- pidgin/gtkaccount.c bcdb87cb5c56df494620a782ae6aa48bd1d0a374
+++ pidgin/gtkaccount.c 4835ef5adbc810f9ab048b1bb6829d0ce66b725c
@@ -142,7 +142,7 @@ static GHashTable *account_pref_wins;
static AccountsWindow *accounts_window = NULL;
static GHashTable *account_pref_wins;
-static void add_account_to_liststore(PurpleAccountManager *manager, PurpleAccount *account, gpointer user_data);
+static void add_account_to_liststore(PurpleAccount *account, gpointer user_data);
static void set_account(GtkListStore *store, GtkTreeIter *iter,
PurpleAccount *account, GdkPixbuf *global_buddyicon);
@@ -2029,7 +2029,7 @@ static void
}
static void
-add_account_to_liststore(PurpleAccountManager *manager, PurpleAccount *account, gpointer user_data)
+add_account_to_liststore(PurpleAccount *account, gpointer user_data)
{
GtkTreeIter iter;
GdkPixbuf *global_buddyicon = user_data;
@@ -2065,7 +2065,7 @@ populate_accounts_list(AccountsWindow *d
for (l = purple_accounts_get_all(); l != NULL; l = l->next) {
ret = TRUE;
- add_account_to_liststore(NULL, (PurpleAccount *)l->data, global_buddyicon);
+ add_account_to_liststore(PURPLE_ACCOUNT(l->data), global_buddyicon);
}
if (global_buddyicon != NULL)
@@ -2597,8 +2597,10 @@ pidgin_account_init(void)
purple_signal_connect(purple_accounts_get_handle(), "account-removed",
pidgin_account_get_handle(),
PURPLE_CALLBACK(account_removed_cb), NULL);
+ g_signal_connect(purple_account_manager_get(), "account-added",
+ G_CALLBACK(add_account_to_liststore), NULL);
#else
- g_signal_connect(purple_account_manager_get(), "account-added",
+ purple_type_connect(PURPLE_TYPE_ACCOUNT, "new",
G_CALLBACK(add_account_to_liststore), NULL);
g_signal_connect(purple_account_manager_get(), "account-removed",
G_CALLBACK(account_removed_cb), NULL);
More information about the Commits
mailing list