gobjectification: 9991626f: compile yahoo
sadrul at pidgin.im
sadrul at pidgin.im
Thu Mar 13 04:38:57 EDT 2008
-----------------------------------------------------------------
Revision: 9991626f286220a92a8b9d84acb970aedf9a6355
Ancestor: cc7d4695c0ff557f5a2de4d3f22a6f1228570c03
Author: sadrul at pidgin.im
Date: 2008-03-13T04:39:01
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/9991626f286220a92a8b9d84acb970aedf9a6355
Modified files:
libpurple/protocols/yahoo/util.c
libpurple/protocols/yahoo/yahoo.c
libpurple/protocols/yahoo/yahoo_aliases.c
libpurple/protocols/yahoo/yahoo_doodle.c
libpurple/protocols/yahoo/yahoo_filexfer.c
libpurple/protocols/yahoo/yahoo_friend.c
libpurple/protocols/yahoo/yahoo_packet.c
libpurple/protocols/yahoo/yahoo_picture.c
libpurple/protocols/yahoo/yahoo_profile.c
libpurple/protocols/yahoo/yahoochat.c
libpurple/protocols/yahoo/ycht.c
ChangeLog:
compile yahoo
-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/util.c 6a72fcc2054413ee7791e5c5cc62b6b18f4bcce0
+++ libpurple/protocols/yahoo/util.c d8a9793db48ed4c9a0fb8ad8b612dddd0f4abadc
@@ -45,7 +45,7 @@ gchar* yahoo_get_cookies(PurpleConnectio
gchar *t1,*t2,*t3;
GSList *tmp;
GSList *cookies;
- cookies = ((struct yahoo_data*)(gc->proto_data))->cookies;
+ cookies = ((struct yahoo_data*)(purple_object_get_protocol_data(PURPLE_OBJECT(gc))))->cookies;
tmp = cookies;
while(tmp)
{
@@ -110,7 +110,7 @@ char *yahoo_string_encode(PurpleConnecti
*/
char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
char *ret;
const char *to_codeset;
@@ -142,7 +142,7 @@ char *yahoo_string_decode(PurpleConnecti
*/
char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
char *ret;
const char *from_codeset;
============================================================
--- libpurple/protocols/yahoo/yahoo.c 949f85346e8369b47b2f3e64b2daae65056c388d
+++ libpurple/protocols/yahoo/yahoo.c a5ac479db61fcbdcef8d39a8aaecfc343974d057
@@ -142,7 +142,7 @@ static void yahoo_process_status(PurpleC
static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt)
{
PurpleAccount *account = purple_connection_get_account(gc);
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GSList *l = pkt->hash;
YahooFriend *f = NULL;
char *name = NULL;
@@ -463,7 +463,7 @@ static void yahoo_process_list_15(Purple
GSList *l = pkt->hash;
PurpleAccount *account = purple_connection_get_account(gc);
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GHashTable *ht;
char *norm_bud = NULL;
YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */
@@ -557,7 +557,7 @@ static void yahoo_process_list(PurpleCon
PurpleGroup *g;
YahooFriend *f = NULL;
PurpleAccount *account = purple_connection_get_account(gc);
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GHashTable *ht;
char **lines;
@@ -762,7 +762,7 @@ static void yahoo_process_message(Purple
static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt)
{
PurpleAccount *account;
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GSList *l = pkt->hash;
GSList *list = NULL;
struct _yahoo_im *im = NULL;
@@ -828,7 +828,7 @@ static void yahoo_process_message(Purple
{
doodle_session *ds;
wb = purple_whiteboard_create(account, im->from, DOODLE_STATE_REQUESTED);
- ds = wb->proto_data;
+ ds = purple_object_get_protocol_data(PURPLE_OBJECT(wb));
ds->imv_key = g_strdup(imv);
yahoo_doodle_command_send_request(gc, im->from, imv);
@@ -932,7 +932,7 @@ yahoo_buddy_add_authorize_cb(gpointer da
{
struct yahoo_add_request *add_req = data;
struct yahoo_packet *pkt;
- struct yahoo_data *yd = add_purple_account_get_connection(req)->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(add_req->gc));
pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, 0);
yahoo_packet_hash(pkt, "ssiii",
@@ -951,13 +951,13 @@ yahoo_buddy_add_deny_cb(struct yahoo_add
static void
yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg)
{
- struct yahoo_data *yd = add_purple_account_get_connection(req)->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(add_req->gc));
struct yahoo_packet *pkt;
char *encoded_msg = NULL;
- PurpleAccount *account = purple_connection_get_account(add_purple_account_get_connection(req));
+ PurpleAccount *account = purple_connection_get_account(add_req->gc);
if (msg && *msg)
- encoded_msg = yahoo_string_encode(add_purple_account_get_connection(req), msg, NULL);
+ encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL);
pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15,
YAHOO_STATUS_AVAILABLE, 0);
@@ -988,18 +988,18 @@ yahoo_buddy_add_deny_reason_cb(gpointer
static void
yahoo_buddy_add_deny_reason_cb(gpointer data) {
struct yahoo_add_request *add_req = data;
- purple_request_input(add_purple_account_get_connection(req), NULL, _("Authorization denied message:"),
+ purple_request_input(add_req->gc, NULL, _("Authorization denied message:"),
NULL, _("No reason given."), TRUE, FALSE, NULL,
_("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb),
_("Cancel"), G_CALLBACK(yahoo_buddy_add_deny_noreason_cb),
- purple_connection_get_account(add_purple_account_get_connection(req)), add_req->who, NULL,
+ purple_connection_get_account(add_req->gc), add_req->who, NULL,
add_req);
}
static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason)
{
char *notify_msg;
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (who == NULL)
return;
@@ -1063,7 +1063,7 @@ static void yahoo_buddy_auth_req_15(Purp
const char *firstname = NULL, *lastname = NULL;
add_req = g_new0(struct yahoo_add_request, 1);
- add_purple_account_get_connection(req) = gc;
+ add_req->gc = gc;
while (l) {
struct yahoo_pair *pair = l->data;
@@ -1144,7 +1144,7 @@ static void yahoo_buddy_added_us(PurpleC
account = purple_connection_get_account(gc);
add_req = g_new0(struct yahoo_add_request, 1);
- add_purple_account_get_connection(req) = gc;
+ add_req->gc = gc;
while (l) {
struct yahoo_pair *pair = l->data;
@@ -1291,7 +1291,7 @@ static void yahoo_process_mail(PurpleCon
static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt)
{
PurpleAccount *account = purple_connection_get_account(gc);
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
const char *who = NULL;
const char *email = NULL;
const char *subj = NULL;
@@ -1371,7 +1371,7 @@ static void yahoo_process_auth_old(Purpl
PurpleAccount *account = purple_connection_get_account(gc);
const char *name = purple_normalize(account, purple_account_get_username(account));
const char *pass = purple_connection_get_password(gc);
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
/* So, Yahoo has stopped supporting its older clients in India, and undoubtedly
* will soon do so in the rest of the world.
@@ -1502,7 +1502,7 @@ static void yahoo_process_auth_new(Purpl
const char *name = purple_normalize(account, purple_account_get_username(account));
const char *pass = purple_connection_get_password(gc);
char *enc_pass;
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurpleCipher *md5_cipher;
guchar md5_digest[16];
@@ -2094,7 +2094,7 @@ static void yahoo_process_authresp(Purpl
static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt)
{
#ifdef TRY_WEBMESSENGER_LOGIN
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
#endif
GSList *l = pkt->hash;
int err = 0;
@@ -2127,8 +2127,8 @@ static void yahoo_process_authresp(Purpl
yd->wm = TRUE;
if (yd->fd >= 0)
close(yd->fd);
- if (gc->inpa)
- purple_input_remove(gc->inpa);
+ if (purple_object_get_int(PURPLE_OBJECT(gc),"inpa"))
+ purple_input_remove(purple_object_get_int(PURPLE_OBJECT(gc),"inpa"));
url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE,
"Purple/" VERSION, FALSE, yahoo_login_page_cb, gc);
if (url_data != NULL)
@@ -2475,7 +2475,7 @@ static void yahoo_pending(gpointer data,
static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond)
{
PurpleConnection *gc = data;
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
char buf[1024];
int len;
@@ -2498,7 +2498,10 @@ static void yahoo_pending(gpointer data,
_("Server closed the connection."));
return;
}
+#warning FIXME: uncomment!!
+#if 0
gc->last_received = time(NULL);
+#endif
yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen);
memcpy(yd->rxqueue + yd->rxlen, buf, len);
yd->rxlen += len;
@@ -2591,7 +2594,7 @@ static void yahoo_got_connected(gpointer
return;
}
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
yd->fd = source;
pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, 0);
@@ -2599,7 +2602,7 @@ static void yahoo_got_connected(gpointer
yahoo_packet_hash_str(pkt, 1, purple_normalize(purple_connection_get_account(gc), purple_account_get_username(purple_connection_get_account(gc))));
yahoo_packet_send_and_free(pkt, yd);
- gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc);
+ g_object_set(G_OBJECT(gc),"inpa",purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc),NULL);
}
#ifdef TRY_WEBMESSENGER_LOGIN
@@ -2623,7 +2626,7 @@ static void yahoo_got_web_connected(gpoi
return;
}
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
yd->fd = source;
pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0);
@@ -2635,14 +2638,14 @@ static void yahoo_got_web_connected(gpoi
yahoo_packet_send_and_free(pkt, yd);
g_free(yd->auth);
- gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc);
+ g_object_set(G_OBJECT(gc),"inpa",purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc),NULL);
}
static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond)
{
PurpleConnection *gc = data;
PurpleAccount *account = purple_connection_get_account(gc);
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
char bufread[2048], *i = bufread, *buf = bufread;
int len;
GString *s;
@@ -2698,7 +2701,7 @@ static void yahoo_web_pending(gpointer d
}
yd->auth = g_string_free(s, FALSE);
- purple_input_remove(gc->inpa);
+ purple_input_remove(purple_object_get_int(PURPLE_OBJECT(gc),"inpa"));
close(source);
g_free(yd->rxqueue);
yd->rxqueue = NULL;
@@ -2720,7 +2723,7 @@ static void yahoo_got_cookies_send_cb(gp
int written, remaining;
gc = data;
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
remaining = strlen(yd->auth) - yd->auth_written;
written = write(source, yd->auth + yd->auth_written, remaining);
@@ -2731,9 +2734,9 @@ static void yahoo_got_cookies_send_cb(gp
gchar *tmp;
g_free(yd->auth);
yd->auth = NULL;
- if (gc->inpa)
- purple_input_remove(gc->inpa);
- gc->inpa = 0;
+ if (purple_object_get_int(PURPLE_OBJECT(gc),"inpa"))
+ purple_input_remove(purple_object_get_int(PURPLE_OBJECT(gc),"inpa"));
+ g_object_set(G_OBJECT(gc),"inpa",0,NULL);
tmp = g_strdup_printf(_("Lost connection with %s:\n%s"),
"login.yahoo.com:80", g_strerror(errno));
purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
@@ -2749,8 +2752,8 @@ static void yahoo_got_cookies_send_cb(gp
g_free(yd->auth);
yd->auth = NULL;
yd->auth_written = 0;
- purple_input_remove(gc->inpa);
- gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc);
+ purple_input_remove(purple_object_get_int(PURPLE_OBJECT(gc),"inpa"));
+ g_object_set(G_OBJECT(gc),"inpa",purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc),NULL);
}
static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_message)
@@ -2766,9 +2769,9 @@ static void yahoo_got_cookies(gpointer d
return;
}
- if (gc->inpa == 0)
+ if (purple_object_get_int(PURPLE_OBJECT(gc),"inpa") == 0)
{
- gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE,
+ purple_object_get_int(PURPLE_OBJECT(gc),"inpa") = purple_input_add(source, PURPLE_INPUT_WRITE,
yahoo_got_cookies_send_cb, gc);
yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE);
}
@@ -2830,7 +2833,7 @@ yahoo_login_page_cb(PurpleUtilFetchUrlDa
{
PurpleConnection *gc = (PurpleConnection *)user_data;
PurpleAccount *account = purple_connection_get_account(gc);
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
const char *sn = purple_account_get_username(account);
const char *pass = purple_connection_get_password(gc);
GHashTable *hash = yahoo_login_page_hash(url_text, len);
@@ -2970,10 +2973,14 @@ static void yahoo_login(PurpleAccount *a
static void yahoo_login(PurpleAccount *account) {
PurpleConnection *gc = purple_account_get_connection(account);
- struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1);
+ struct yahoo_data *yd;
PurpleStatus *status = purple_account_get_active_status(account);
- gc->flags |= PURPLE_CONNECTION_FLAGS_HTML | PURPLE_CONNECTION_FLAGS_NO_BGCOLOR | PURPLE_CONNECTION_FLAGS_NO_URLDESC;
+ purple_object_set_protocol_data(PURPLE_OBJECT(gc), yd = g_new0(struct yahoo_data, 1));
+ purple_connection_set_flags(gc,
+ purple_connection_get_flags(gc) | PURPLE_CONNECTION_FLAGS_HTML |
+ PURPLE_CONNECTION_FLAGS_NO_BGCOLOR | PURPLE_CONNECTION_FLAGS_NO_URLDESC);
+
purple_connection_update_progress(gc, _("Connecting"), 1, 2);
purple_connection_set_display_name(gc, purple_account_get_username(account));
@@ -3019,11 +3026,11 @@ static void yahoo_close(PurpleConnection
}
static void yahoo_close(PurpleConnection *gc) {
- struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
+ struct yahoo_data *yd = (struct yahoo_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GSList *l;
- if (gc->inpa)
- purple_input_remove(gc->inpa);
+ if (purple_object_get_int(PURPLE_OBJECT(gc),"inpa"))
+ purple_input_remove(purple_object_get_int(PURPLE_OBJECT(gc),"inpa"));
while (yd->url_datas) {
purple_util_fetch_url_cancel(yd->url_datas->data);
@@ -3084,7 +3091,7 @@ static void yahoo_close(PurpleConnection
g_free(yd->current_list15_grp);
g_free(yd);
- gc->proto_data = NULL;
+ purple_object_set_protocol_data(PURPLE_OBJECT(gc),NULL);
}
static const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b)
@@ -3101,7 +3108,7 @@ static const char *yahoo_list_emblem(Pur
PurplePresence *presence;
if (!b || !(account = b->account) || !(gc = purple_account_get_connection(account)) ||
- !(yd = gc->proto_data))
+ !(yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc))))
return NULL;
f = yahoo_friend_find(gc, b->name);
@@ -3165,7 +3172,7 @@ static void yahoo_initiate_conference(Pu
buddy = (PurpleBuddy *) node;
gc = purple_account_get_connection(buddy->account);
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
id = yd->conf_id;
components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
@@ -3206,7 +3213,7 @@ static void yahoo_game(PurpleBlistNode *
buddy = (PurpleBuddy *) node;
gc = purple_account_get_connection(buddy->account);
- yd = (struct yahoo_data *) gc->proto_data;
+ yd = (struct yahoo_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
f = yahoo_friend_find(gc, buddy->name);
if (!f)
@@ -3334,7 +3341,7 @@ static GList *build_presence_submenu(Yah
static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) {
GList *m = NULL;
PurpleMenuAction *act;
- struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data;
+ struct yahoo_data *yd = (struct yahoo_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
if (f->presence != YAHOO_PRESENCE_ONLINE) {
@@ -3383,7 +3390,7 @@ static GList *yahoo_buddy_menu(PurpleBud
PurpleMenuAction *act;
PurpleConnection *gc = purple_account_get_connection(buddy->account);
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
static char buf2[1024];
YahooFriend *f;
@@ -3461,7 +3468,7 @@ static void yahoo_act_id(PurpleConnectio
static void yahoo_act_id(PurpleConnection *gc, const char *entry)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0);
yahoo_packet_hash_str(pkt, 3, entry);
@@ -3493,7 +3500,7 @@ yahoo_get_inbox_token_cb(PurpleUtilFetch
}
if (!set_cookie) {
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
purple_debug_error("yahoo", "No mail login token; forwarding to login screen.\n");
url = g_strdup(yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL);
}
@@ -3511,7 +3518,7 @@ static void yahoo_show_inbox(PurplePlugi
/* XXX I have no idea how this will work with Yahoo! Japan. */
PurpleConnection *gc = action->context;
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurpleUtilFetchUrlData *url_data;
const char* base_url = "http://login.yahoo.com";
@@ -3588,7 +3595,7 @@ static int yahoo_send_im(PurpleConnectio
static int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0);
char *msg = yahoo_html_to_codes(what);
char *msg2;
@@ -3655,7 +3662,7 @@ static unsigned int yahoo_send_typing(Pu
static unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0);
yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc),
14, " ", 13, state == PURPLE_TYPING ? "1" : "0",
@@ -3690,7 +3697,7 @@ static void yahoo_set_status(PurpleAccou
gc = purple_account_get_connection(account);
presence = purple_status_get_presence(status);
- yd = (struct yahoo_data *)gc->proto_data;
+ yd = (struct yahoo_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
old_status = yd->current_status;
yd->current_status = get_yahoo_status_from_purple_status(status);
@@ -3752,7 +3759,7 @@ static void yahoo_set_idle(PurpleConnect
static void yahoo_set_idle(PurpleConnection *gc, int idle)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt = NULL;
char *msg = NULL, *msg2 = NULL;
PurpleStatus *status = NULL;
@@ -3855,7 +3862,7 @@ static void yahoo_keepalive(PurpleConnec
static void yahoo_keepalive(PurpleConnection *gc)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, 0);
yahoo_packet_send_and_free(pkt, yd);
@@ -3874,7 +3881,7 @@ static void yahoo_add_buddy(PurpleConnec
static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g)
{
- struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
+ struct yahoo_data *yd = (struct yahoo_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
const char *group = NULL;
char *group2;
@@ -3917,7 +3924,7 @@ static void yahoo_remove_buddy(PurpleCon
static void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
{
- struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
+ struct yahoo_data *yd = (struct yahoo_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
GSList *buddies, *l;
PurpleGroup *g;
@@ -3950,7 +3957,7 @@ static void yahoo_add_deny(PurpleConnect
}
static void yahoo_add_deny(PurpleConnection *gc, const char *who) {
- struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
+ struct yahoo_data *yd = (struct yahoo_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
if (!yd->logged_in)
@@ -3966,7 +3973,7 @@ static void yahoo_rem_deny(PurpleConnect
}
static void yahoo_rem_deny(PurpleConnection *gc, const char *who) {
- struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
+ struct yahoo_data *yd = (struct yahoo_data *)purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
if (!yd->logged_in)
@@ -4014,7 +4021,7 @@ static void yahoo_change_buddys_group(Pu
static void yahoo_change_buddys_group(PurpleConnection *gc, const char *who,
const char *old_group, const char *new_group)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
char *gpn, *gpo;
@@ -4049,7 +4056,7 @@ static void yahoo_rename_group(PurpleCon
static void yahoo_rename_group(PurpleConnection *gc, const char *old_name,
PurpleGroup *group, GList *moved_buddies)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
char *gpn, *gpo;
@@ -4098,7 +4105,7 @@ yahoopurple_cmd_chat_join(PurpleConversa
return PURPLE_CMD_RET_FAILED;
gc = purple_conversation_get_gc(conv);
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
id = yd->conf_id;
purple_debug(PURPLE_DEBUG_INFO, "yahoo",
"Trying to join %s \n", args[0]);
============================================================
--- libpurple/protocols/yahoo/yahoo_aliases.c de5e88c14a1c7fbe35ac24f4b12d8c5b3ed6e62f
+++ libpurple/protocols/yahoo/yahoo_aliases.c 68a272ea045b351480e465a0597b91ecdc9876f4
@@ -59,8 +59,8 @@ yahoo_fetch_aliases_cb(PurpleUtilFetchUr
yahoo_fetch_aliases_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,const gchar *url_text, size_t len, const gchar *error_message)
{
struct callback_data *cb = user_data;
- PurpleConnection *gc = purple_account_get_connection(cb);
- struct yahoo_data *yd = gc->proto_data;
+ PurpleConnection *gc = cb->gc;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
yd->url_datas = g_slist_remove(yd->url_datas, url_data);
@@ -106,7 +106,7 @@ yahoo_fetch_aliases_cb(PurpleUtilFetchUr
alias = NULL; /* No nickname, first name or last name, then you get no alias !! */
/* Find the local buddy that matches */
- b = purple_find_buddy(purple_account_get_connection(cb)->account, yid);
+ b = purple_find_buddy(purple_connection_get_account(cb->gc), yid);
/* If we don't find a matching buddy, ignore the alias !! */
if (b != NULL) {
@@ -117,15 +117,15 @@ yahoo_fetch_aliases_cb(PurpleUtilFetchUr
yu->firstname = g_strdup(fn);
yu->lastname = g_strdup(ln);
yu->nickname = g_strdup(nn);
- b->proto_data=yu;
+ purple_object_set_protocol_data(PURPLE_OBJECT(b),yu);
/* Finally, if we received an alias, we better update the buddy list */
if (alias != NULL) {
- serv_got_alias(purple_account_get_connection(cb), yid, alias);
+ serv_got_alias(cb->gc, yid, alias);
purple_debug_info("yahoo","Fetched alias '%s' (%s)\n",alias,id);
} else if (b->alias != alias && strcmp(b->alias, "") != 0) {
/* Or if we have an alias that Yahoo doesn't, send it up */
- yahoo_update_alias(purple_account_get_connection(cb), yid, b->alias);
+ yahoo_update_alias(cb->gc, yid, b->alias);
purple_debug_info("yahoo","Sent alias '%s'\n", b->alias);
}
} else {
@@ -142,7 +142,7 @@ yahoo_fetch_aliases(PurpleConnection *gc
void
yahoo_fetch_aliases(PurpleConnection *gc)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct callback_data *cb;
const char *url;
char *request, *webpage, *webaddress;
@@ -156,7 +156,7 @@ yahoo_fetch_aliases(PurpleConnection *gc
/* Using callback_data so I have access to gc in the callback function */
cb = g_new0(struct callback_data, 1);
- purple_account_get_connection(cb) = gc;
+ cb->gc = gc;
/* Build all the info to make the web request */
url = yd->jp ? YAHOOJP_ALIAS_FETCH_URL : YAHOO_ALIAS_FETCH_URL;
@@ -188,10 +188,10 @@ yahoo_update_alias_cb(PurpleUtilFetchUrl
{
xmlnode *node, *result;
struct callback_data *cb = user_data;
- PurpleConnection *gc = purple_account_get_connection(cb);
+ PurpleConnection *gc = cb->gc;
struct yahoo_data *yd;
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
yd->url_datas = g_slist_remove(yd->url_datas, url_data);
if (len == 0 || error_message != NULL) {
@@ -256,13 +256,13 @@ yahoo_update_alias(PurpleConnection *gc,
return;
}
- yd = gc->proto_data;
- yu = buddy->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+ yu = purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
/* Using callback_data so I have access to gc in the callback function */
cb = g_new0(struct callback_data, 1);
cb->id = g_strdup(yu->id);
- purple_account_get_connection(cb) = gc;
+ cb->gc = gc;
/* Build all the info to make the web request */
url = yd->jp? YAHOOJP_ALIAS_UPDATE_URL: YAHOO_ALIAS_UPDATE_URL;
@@ -273,7 +273,7 @@ yahoo_update_alias(PurpleConnection *gc,
converted_alias_jp = yahoo_convert_to_numeric(alias_jp);
content = g_strdup_printf("<ab k=\"%s\" cc=\"1\">\n"
"<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n",
- purple_account_get_username(purple_connection_get_account(gc)), who, yu->id, converted_alias_jp);
+ purple_connection_get_account(gc)->username, who, yu->id, converted_alias_jp);
free(converted_alias_jp);
g_free(alias_jp);
}
@@ -281,7 +281,7 @@ yahoo_update_alias(PurpleConnection *gc,
escaped_alias = g_markup_escape_text(alias, strlen(alias));
content = g_strdup_printf("<?xml version=\"1.0\" encoding=\"utf-8\"?><ab k=\"%s\" cc=\"1\">\n"
"<ct e=\"1\" yi='%s' id='%s' nn='%s' pr='0' />\n</ab>\r\n",
- purple_account_get_username(purple_connection_get_account(gc)), who, yu->id, escaped_alias);
+ purple_connection_get_account(gc)->username, who, yu->id, escaped_alias);
g_free(escaped_alias);
}
============================================================
--- libpurple/protocols/yahoo/yahoo_doodle.c 144192b316911fe476ddbd0aafeac646f7588db6
+++ libpurple/protocols/yahoo/yahoo_doodle.c a3b93bbd914688dd46bd1f1dd4b1bf8a15d76201
@@ -162,7 +162,7 @@ static void yahoo_doodle_command_got_req
*/
wb = purple_whiteboard_create(account, from, DOODLE_STATE_REQUESTED);
- ds = wb->proto_data;
+ ds = purple_object_get_protocol_data(PURPLE_OBJECT(wb));
ds->imv_key = g_strdup(imv_key);
yahoo_doodle_command_send_ready(gc, from, imv_key);
@@ -192,7 +192,7 @@ static void yahoo_doodle_command_got_rea
if(wb->state == DOODLE_STATE_REQUESTING)
{
- doodle_session *ds = wb->proto_data;
+ doodle_session *ds = purple_object_get_protocol_data(PURPLE_OBJECT(wb));
purple_whiteboard_start(wb);
wb->state = DOODLE_STATE_ESTABLISHED;
@@ -390,7 +390,7 @@ static void yahoo_doodle_command_send_ge
purple_debug_info("yahoo", "doodle: Sent %s (%s)\n", type, to);
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
/* Make and send an acknowledge (ready) Doodle packet */
pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0);
@@ -451,13 +451,13 @@ void yahoo_doodle_start(PurpleWhiteboard
ds->brush_size = DOODLE_BRUSH_SMALL;
ds->brush_color = DOODLE_COLOR_RED;
- wb->proto_data = ds;
+ purple_object_set_protocol_data(PURPLE_OBJECT(wb),ds);
}
void yahoo_doodle_end(PurpleWhiteboard *wb)
{
PurpleConnection *gc = purple_account_get_connection(wb->account);
- doodle_session *ds = wb->proto_data;
+ doodle_session *ds = purple_object_get_protocol_data(PURPLE_OBJECT(wb));
/* g_debug_debug("yahoo", "doodle: yahoo_doodle_end()\n"); */
@@ -465,7 +465,7 @@ void yahoo_doodle_end(PurpleWhiteboard *
yahoo_doodle_command_send_shutdown(gc, wb->who);
g_free(ds->imv_key);
- g_free(wb->proto_data);
+ g_free(purple_object_get_protocol_data(PURPLE_OBJECT(wb)));
}
void yahoo_doodle_get_dimensions(const PurpleWhiteboard *wb, int *width, int *height)
@@ -495,7 +495,7 @@ void yahoo_doodle_send_draw_list(PurpleW
void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list)
{
- doodle_session *ds = wb->proto_data;
+ doodle_session *ds = purple_object_get_protocol_data(PURPLE_OBJECT(wb));
char *message;
g_return_if_fail(draw_list != NULL);
@@ -507,7 +507,7 @@ void yahoo_doodle_clear(PurpleWhiteboard
void yahoo_doodle_clear(PurpleWhiteboard *wb)
{
- doodle_session *ds = wb->proto_data;
+ doodle_session *ds = purple_object_get_protocol_data(PURPLE_OBJECT(wb));
yahoo_doodle_command_send_clear(purple_account_get_connection(wb->account), wb->who, ds->imv_key);
}
@@ -561,14 +561,14 @@ void yahoo_doodle_get_brush(const Purple
void yahoo_doodle_get_brush(const PurpleWhiteboard *wb, int *size, int *color)
{
- doodle_session *ds = wb->proto_data;
+ doodle_session *ds = purple_object_get_protocol_data(PURPLE_OBJECT(wb));
*size = ds->brush_size;
*color = ds->brush_color;
}
void yahoo_doodle_set_brush(PurpleWhiteboard *wb, int size, int color)
{
- doodle_session *ds = wb->proto_data;
+ doodle_session *ds = purple_object_get_protocol_data(PURPLE_OBJECT(wb));
ds->brush_size = size;
ds->brush_color = color;
============================================================
--- libpurple/protocols/yahoo/yahoo_filexfer.c 704b56a7f89aac373b4315ebdacef99c03323b00
+++ libpurple/protocols/yahoo/yahoo_filexfer.c 1dd0d40454bd3279b9c38171639e47fb863f0f50
@@ -75,8 +75,8 @@ static void yahoo_xfer_data_free(struct
PurpleXfer *xfer;
GSList *l;
- gc = purple_account_get_connection(xd);
- yd = gc->proto_data;
+ gc = xd->gc;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
/*remove entry from map*/
if(xd->xfer_peer_idstring) {
@@ -243,9 +243,9 @@ static void yahoo_sendfile_connected(gpo
xfer->fd = source;
/* Assemble the tx buffer */
- gc = purple_account_get_connection(xd);
+ gc = xd->gc;
account = purple_connection_get_account(gc);
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER,
YAHOO_STATUS_AVAILABLE, yd->session_id);
@@ -305,8 +305,8 @@ static void yahoo_xfer_init(PurpleXfer *
struct yahoo_data *yd;
xfer_data = xfer->data;
- gc = xfer_purple_account_get_connection(data);
- yd = gc->proto_data;
+ gc = xfer_data->gc;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
account = purple_connection_get_account(gc);
if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) {
@@ -349,8 +349,8 @@ static void yahoo_xfer_init_15(PurpleXfe
struct yahoo_packet *pkt;
xfer_data = xfer->data;
- gc = xfer_purple_account_get_connection(data);
- yd = gc->proto_data;
+ gc = xfer_data->gc;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
account = purple_connection_get_account(gc);
if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) {
@@ -519,8 +519,8 @@ static void yahoo_xfer_cancel_send(Purpl
struct yahoo_data *yd;
struct yahoo_packet *pkt;
- gc = xfer_purple_account_get_connection(data);
- yd = gc->proto_data;
+ gc = xfer_data->gc;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
account = purple_connection_get_account(gc);
if(xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */
{
@@ -567,8 +567,8 @@ static void yahoo_xfer_cancel_recv(Purpl
struct yahoo_data *yd;
struct yahoo_packet *pkt;
- gc = xfer_purple_account_get_connection(data);
- yd = gc->proto_data;
+ gc = xfer_data->gc;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
account = purple_connection_get_account(gc);
if(!xfer_data->xfer_idstring_for_relay) /* hack to see if file trans acc/info packet has been received */
{
@@ -631,8 +631,8 @@ static void yahoo_xfer_end(PurpleXfer *x
filename = xfer_data->filename_list->data;
filesize = atol( xfer_data->size_list->data );
- gc = xfer_purple_account_get_connection(data);
- yd = gc->proto_data;
+ gc = xfer_data->gc;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
/* setting up xfer_data for next file's tranfer */
g_free(xfer_data->host);
@@ -776,7 +776,7 @@ void yahoo_process_filetransfer(PurpleCo
unsigned long filesize = 0L;
GSList *l;
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
for (l = pkt->hash; l; l = l->next) {
struct yahoo_pair *pair = l->data;
@@ -840,7 +840,7 @@ void yahoo_process_filetransfer(PurpleCo
/* Setup the Yahoo-specific file transfer data */
xfer_data = g_new0(struct yahoo_xfer_data, 1);
- xfer_purple_account_get_connection(data) = gc;
+ xfer_data->gc = gc;
if (!purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL)) {
g_free(xfer_data);
return;
@@ -901,7 +901,7 @@ PurpleXfer *yahoo_new_xfer(PurpleConnect
g_return_val_if_fail(who != NULL, NULL);
xfer_data = g_new0(struct yahoo_xfer_data, 1);
- xfer_purple_account_get_connection(data) = gc;
+ xfer_data->gc = gc;
/* Build the file transfer handle. */
xfer = purple_xfer_new(purple_connection_get_account(gc), PURPLE_XFER_SEND, who);
@@ -960,9 +960,9 @@ static void yahoo_xfer_dns_connected_15(
return;
if (!(xd = xfer->data))
return;
- gc = purple_account_get_connection(xd);
+ gc = xd->gc;
account = purple_connection_get_account(gc);
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if(!hosts)
{
@@ -1033,7 +1033,7 @@ void yahoo_send_file(PurpleConnection *g
void yahoo_send_file(PurpleConnection *gc, const char *who, const char *file)
{
struct yahoo_xfer_data *xfer_data;
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
int ver = 0;
PurpleXfer *xfer = yahoo_new_xfer(gc, who);
YahooFriend *yf = yahoo_friend_find(gc, who);
@@ -1074,8 +1074,8 @@ static void yahoo_xfer_recv_cb_15(gpoint
xfer = data;
xd = xfer->data;
- account = purple_connection_get_account(purple_account_get_connection(xd));
- gc = purple_account_get_connection(xd);
+ account = purple_connection_get_account(xd->gc);
+ gc = xd->gc;
buf=g_strnfill(1000, 0);
while((did = read(source, buf, 998)) > 0)
@@ -1187,8 +1187,8 @@ static void yahoo_xfer_connected_15(gpoi
return;
if (!(xd = xfer->data))
return;
- yd = purple_account_get_connection(xd)->proto_data;
- account = purple_connection_get_account(purple_account_get_connection(xd));
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(xd->gc));
+ account = purple_connection_get_account(xd->gc);
if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) {
purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer),
xfer->who, _("Unable to connect."));
@@ -1199,7 +1199,7 @@ static void yahoo_xfer_connected_15(gpoi
if (xd->txbuflen == 0)
{
gchar* cookies;
- cookies = yahoo_get_cookies(purple_account_get_connection(xd));
+ cookies = yahoo_get_cookies(xd->gc);
if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND && xd->status_15 == ACCEPTED)
{
xd->txbuf = g_strdup_printf("POST /relay?token=%s&sender=%s&recver=%s HTTP/1.1\r\nCookie:%s\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\nHost: %s\r\nContent-Length: %ld\r\nCache-Control: no-cache\r\n\r\n",
@@ -1265,7 +1265,7 @@ void yahoo_process_filetrans_15(PurpleCo
GSList *size_list = NULL;
int nooffiles = 0;
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
for (l = pkt->hash; l; l = l->next) {
struct yahoo_pair *pair = l->data;
@@ -1370,7 +1370,7 @@ void yahoo_process_filetrans_15(PurpleCo
xfer_data = g_new0(struct yahoo_xfer_data, 1);
xfer_data->version = 15;
xfer_data->firstoflist = TRUE;
- xfer_purple_account_get_connection(data) = gc;
+ xfer_data->gc = gc;
xfer_data->xfer_peer_idstring = g_strdup(xfer_peer_idstring);
xfer_data->filename_list = filename_list;
xfer_data->size_list = size_list;
@@ -1432,7 +1432,7 @@ void yahoo_process_filetrans_info_15(Pur
struct yahoo_packet *pkt_to_send;
PurpleAccount *account;
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
for (l = pkt->hash; l; l = l->next) {
struct yahoo_pair *pair = l->data;
@@ -1493,7 +1493,7 @@ void yahoo_process_filetrans_info_15(Pur
return;
}
- account = purple_connection_get_account(xfer_purple_account_get_connection(data));
+ account = purple_connection_get_account(xfer_data->gc);
pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_FILETRANS_ACC_15,
YAHOO_STATUS_AVAILABLE, yd->session_id);
@@ -1528,7 +1528,7 @@ void yahoo_process_filetrans_acc_15(Purp
PurpleAccount *account;
long val_66 = 0;
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
for (l = pkt->hash; l; l = l->next) {
struct yahoo_pair *pair = l->data;
============================================================
--- libpurple/protocols/yahoo/yahoo_friend.c d2fa02e486c9cf3033c3860faa81ad977a391fc8
+++ libpurple/protocols/yahoo/yahoo_friend.c 59787186241da2b0b8833a5c90e2f5dceed60eab
@@ -45,9 +45,10 @@ YahooFriend *yahoo_friend_find(PurpleCon
const char *norm;
g_return_val_if_fail(gc != NULL, NULL);
- g_return_val_if_fail(gc->proto_data != NULL, NULL);
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+ g_return_val_if_fail(yd != NULL, NULL);
+
norm = purple_normalize(purple_connection_get_account(gc), name);
return g_hash_table_lookup(yd->friends, norm);
@@ -60,9 +61,10 @@ YahooFriend *yahoo_friend_find_or_new(Pu
const char *norm;
g_return_val_if_fail(gc != NULL, NULL);
- g_return_val_if_fail(gc->proto_data != NULL, NULL);
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
+ g_return_val_if_fail(yd != NULL, NULL);
+
norm = purple_normalize(purple_connection_get_account(gc), name);
f = g_hash_table_lookup(yd->friends, norm);
@@ -193,7 +195,7 @@ void yahoo_friend_update_presence(Purple
void yahoo_friend_update_presence(PurpleConnection *gc, const char *name,
YahooPresenceVisibility presence)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt = NULL;
YahooFriend *f;
const char *thirtyone, *thirteen;
============================================================
--- libpurple/protocols/yahoo/yahoo_packet.c fc9caa4c3dfef18a68daa2c063bb20a737093bf2
+++ libpurple/protocols/yahoo/yahoo_packet.c 1054e522508747778369adbb833ec8b14312f8aa
@@ -303,7 +303,7 @@ yahoo_packet_send_can_write(gpointer dat
return;
else if (ret < 0) {
/* TODO: what to do here - do we really have to disconnect? */
- purple_connection_error_reason(purple_account_get_connection(yd), PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+ purple_connection_error_reason(yd->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
_("Write Error"));
return;
}
============================================================
--- libpurple/protocols/yahoo/yahoo_picture.c 1b4751b08fff5b90b46ded85a9f8867be257dc2a
+++ libpurple/protocols/yahoo/yahoo_picture.c 624dfc56e710945f0a58c3520e5ba92fc23797d9
@@ -51,7 +51,7 @@ yahoo_fetch_picture_cb(PurpleUtilFetchUr
struct yahoo_data *yd;
d = user_data;
- yd = purple_account_get_connection(d)->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(d->gc));
yd->url_datas = g_slist_remove(yd->url_datas, url_data);
if (error_message != NULL) {
@@ -60,7 +60,7 @@ yahoo_fetch_picture_cb(PurpleUtilFetchUr
purple_debug_error("yahoo", "Fetched an icon with length 0. Strange.\n");
} else {
char *checksum = g_strdup_printf("%i", d->checksum);
- purple_buddy_icons_set_for_user(purple_connection_get_account(purple_account_get_connection(d)), d->who, g_memdup(pic_data, len), len, checksum);
+ purple_buddy_icons_set_for_user(purple_connection_get_account(d->gc), d->who, g_memdup(pic_data, len), len, checksum);
g_free(checksum);
}
@@ -128,14 +128,14 @@ void yahoo_process_picture(PurpleConnect
return;
data = g_new0(struct yahoo_fetch_picture_data, 1);
- purple_account_get_connection(data) = gc;
+ data->gc = gc;
data->who = g_strdup(who);
data->checksum = checksum;
url_data = purple_util_fetch_url(url, use_whole_url,
"Mozilla/4.0 (compatible; MSIE 5.0)", FALSE,
yahoo_fetch_picture_cb, data);
if (url_data != NULL) {
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
} else {
g_free(data->who);
@@ -224,7 +224,7 @@ void yahoo_process_picture_upload(Purple
void yahoo_process_picture_upload(PurpleConnection *gc, struct yahoo_packet *pkt)
{
PurpleAccount *account = purple_connection_get_account(gc);
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GSList *l = pkt->hash;
char *url = NULL;
@@ -300,7 +300,7 @@ void yahoo_send_picture_info(PurpleConne
void yahoo_send_picture_info(PurpleConnection *gc, const char *who)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
if (!yd->picture_url) {
@@ -317,7 +317,7 @@ void yahoo_send_picture_request(PurpleCo
void yahoo_send_picture_request(PurpleConnection *gc, const char *who)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, 0);
@@ -329,7 +329,7 @@ void yahoo_send_picture_checksum(PurpleC
void yahoo_send_picture_checksum(PurpleConnection *gc)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, 0);
@@ -340,7 +340,7 @@ void yahoo_send_picture_update_to_user(P
void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_UPDATE, YAHOO_STATUS_AVAILABLE, 0);
@@ -360,12 +360,12 @@ static void yahoo_send_picture_update_fo
struct yspufe *d = data;
if (f->status != YAHOO_STATUS_OFFLINE)
- yahoo_send_picture_update_to_user(purple_account_get_connection(d), who, d->type);
+ yahoo_send_picture_update_to_user(d->gc, who, d->type);
}
void yahoo_send_picture_update(PurpleConnection *gc, int type)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yspufe data;
data.gc = gc;
@@ -392,7 +392,7 @@ static void yahoo_buddy_icon_upload_read
static void yahoo_buddy_icon_upload_reading(gpointer data, gint source, PurpleInputCondition condition)
{
struct yahoo_buddy_icon_upload_data *d = data;
- PurpleConnection *gc = purple_account_get_connection(d);
+ PurpleConnection *gc = d->gc;
char buf[1024];
int ret;
@@ -412,7 +412,7 @@ static void yahoo_buddy_icon_upload_pend
static void yahoo_buddy_icon_upload_pending(gpointer data, gint source, PurpleInputCondition condition)
{
struct yahoo_buddy_icon_upload_data *d = data;
- PurpleConnection *gc = purple_account_get_connection(d);
+ PurpleConnection *gc = d->gc;
ssize_t wrote;
if (!PURPLE_CONNECTION_IS_VALID(gc)) {
@@ -448,9 +448,9 @@ static void yahoo_buddy_icon_upload_conn
PurpleAccount *account;
struct yahoo_data *yd;
- gc = purple_account_get_connection(d);
+ gc = d->gc;
account = purple_connection_get_account(gc);
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
/* Buddy icon connect is now complete; clear the PurpleProxyConnectData */
yd->buddy_icon_connect_data = NULL;
@@ -507,7 +507,7 @@ void yahoo_buddy_icon_upload(PurpleConne
void yahoo_buddy_icon_upload(PurpleConnection *gc, struct yahoo_buddy_icon_upload_data *d)
{
PurpleAccount *account = purple_connection_get_account(gc);
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (yd->buddy_icon_connect_data != NULL) {
/* Cancel any in-progress buddy icon upload */
@@ -530,7 +530,7 @@ void yahoo_set_buddy_icon(PurpleConnecti
void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurpleAccount *account = purple_connection_get_account(gc);
if (img == NULL) {
@@ -574,7 +574,7 @@ void yahoo_set_buddy_icon(PurpleConnecti
/* We use this solely for sending a filename to the server */
iconfile = g_strdup(purple_imgstore_get_filename(img));
d = g_new0(struct yahoo_buddy_icon_upload_data, 1);
- purple_account_get_connection(d) = gc;
+ d->gc = gc;
d->str = s;
d->fd = -1;
d->filename = iconfile;
============================================================
--- libpurple/protocols/yahoo/yahoo_profile.c e3f1b6fc004cb0816865161a40916d21c6051159
+++ libpurple/protocols/yahoo/yahoo_profile.c 5868fdbe4000d5f01e99c132b97fc05651af9401
@@ -695,7 +695,7 @@ static void yahoo_extract_user_info_text
PurpleBuddy *b;
YahooFriend *f;
- b = purple_find_buddy(purple_connection_get_account(info_purple_account_get_connection(data)),
+ b = purple_find_buddy(purple_connection_get_account(info_data->gc),
info_data->name);
if (b) {
@@ -715,7 +715,7 @@ static void yahoo_extract_user_info_text
/* Add the normal tooltip pairs */
yahoo_tooltip_text(b, user_info, TRUE);
- if ((f = yahoo_friend_find(info_purple_account_get_connection(data), b->name))) {
+ if ((f = yahoo_friend_find(info_data->gc, b->name))) {
const char *ip;
if ((ip = yahoo_friend_get_ip(f)))
purple_notify_user_info_add_pair(user_info, _("IP Address"), ip);
@@ -789,7 +789,7 @@ static void yahoo_got_info(PurpleUtilFet
purple_debug_info("yahoo", "In yahoo_got_info\n");
- yd = info_purple_account_get_connection(data)->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(info_data->gc));
yd->url_datas = g_slist_remove(yd->url_datas, url_data);
user_info = purple_notify_user_info_new();
@@ -806,7 +806,7 @@ static void yahoo_got_info(PurpleUtilFet
*/
if (error_message != NULL || url_text == NULL || strcmp(url_text, "") == 0) {
purple_notify_user_info_add_pair(user_info, _("Error retrieving profile"), NULL);
- purple_notify_userinfo(info_purple_account_get_connection(data), info_data->name,
+ purple_notify_userinfo(info_data->gc, info_data->name,
user_info, NULL, NULL);
purple_notify_user_info_destroy(user_info);
g_free(profile_url_text);
@@ -843,7 +843,7 @@ static void yahoo_got_info(PurpleUtilFet
purple_notify_user_info_add_pair(user_info, NULL, tmp);
g_free(tmp);
- purple_notify_userinfo(info_purple_account_get_connection(data), info_data->name,
+ purple_notify_userinfo(info_data->gc, info_data->name,
user_info, NULL, NULL);
g_free(profile_url_text);
@@ -935,7 +935,8 @@ static void yahoo_got_info(PurpleUtilFet
gboolean use_whole_url = FALSE;
/* use whole URL if using HTTP Proxy */
- if ((info_purple_account_get_connection(data)->account->proxy_info) && (info_purple_account_get_connection(data)->account->proxy_info->type == PURPLE_PROXY_HTTP))
+ if ((purple_connection_get_account(info_data->gc)->proxy_info) &&
+ (purple_connection_get_account(info_data->gc)->proxy_info->type == PURPLE_PROXY_HTTP))
use_whole_url = TRUE;
/* User-uploaded photos use a different server that requires the Host
@@ -991,7 +992,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *
/* in to purple_markup_strip_html*/
char *fudged_buffer;
- yd = info_purple_account_get_connection(data)->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(info_data->gc));
yd->url_datas = g_slist_remove(yd->url_datas, url_data);
fudged_buffer = purple_strcasereplace(url_buffer, "</dd>", "</dd><br>");
@@ -1213,7 +1214,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *
} else if (profile_state == PROFILE_STATE_NOT_FOUND) {
PurpleBuddy *b = purple_find_buddy
- (purple_connection_get_account(info_purple_account_get_connection(data)),
+ (purple_connection_get_account(info_data->gc),
info_data->name);
YahooFriend *f = NULL;
if (b) {
@@ -1249,7 +1250,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *
g_free(stripped);
/* show it to the user */
- purple_notify_userinfo(info_purple_account_get_connection(data), info_data->name,
+ purple_notify_userinfo(info_data->gc, info_data->name,
user_info, NULL, NULL);
purple_notify_user_info_destroy(user_info);
@@ -1270,13 +1271,13 @@ void yahoo_get_info(PurpleConnection *gc
void yahoo_get_info(PurpleConnection *gc, const char *name)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
YahooGetInfoData *data;
char *url;
PurpleUtilFetchUrlData *url_data;
data = g_new0(YahooGetInfoData, 1);
- purple_account_get_connection(data) = gc;
+ data->gc = gc;
data->name = g_strdup(name);
url = g_strdup_printf("%s%s",
============================================================
--- libpurple/protocols/yahoo/yahoochat.c 2de205f18f17c44cf99f049c589abfa3d1fb38d9
+++ libpurple/protocols/yahoo/yahoochat.c 4c019fafd50a9d51e012c539e404bc8a58df4b38
@@ -53,7 +53,7 @@ static void yahoo_chat_online(PurpleConn
/* special function to log us on to the yahoo chat service */
static void yahoo_chat_online(PurpleConnection *gc)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
const char *rll;
@@ -101,7 +101,7 @@ static PurpleConversation *yahoo_find_co
struct yahoo_data *yd;
GSList *l;
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
for (l = yd->confs; l; l = l->next) {
PurpleConversation *c = l->data;
@@ -338,7 +338,7 @@ static void yahoo_chat_join(PurpleConnec
static void yahoo_chat_join(PurpleConnection *gc, const char *dn, const char *room, const char *topic, const char *id)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
char *room2;
gboolean utf8 = TRUE;
@@ -366,7 +366,7 @@ void yahoo_process_chat_online(PurpleCon
/* this is a confirmation of yahoo_chat_online(); */
void yahoo_process_chat_online(PurpleConnection *gc, struct yahoo_packet *pkt)
{
- struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data;
+ struct yahoo_data *yd = (struct yahoo_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (pkt->status == 1) {
yd->chat_online = 1;
@@ -398,7 +398,7 @@ void yahoo_process_chat_logout(PurpleCon
/* this is basicly the opposite of chat_online */
void yahoo_process_chat_logout(PurpleConnection *gc, struct yahoo_packet *pkt)
{
- struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data;
+ struct yahoo_data *yd = (struct yahoo_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
GSList *l;
for (l = pkt->hash; l; l = l->next) {
@@ -428,7 +428,7 @@ void yahoo_process_chat_join(PurpleConne
void yahoo_process_chat_join(PurpleConnection *gc, struct yahoo_packet *pkt)
{
PurpleAccount *account = purple_connection_get_account(gc);
- struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data;
+ struct yahoo_data *yd = (struct yahoo_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurpleConversation *c = NULL;
GSList *l;
GList *members = NULL;
@@ -585,7 +585,7 @@ void yahoo_process_chat_exit(PurpleConne
GSList *l;
struct yahoo_data *yd;
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
for (l = pkt->hash; l; l = l->next) {
struct yahoo_pair *pair = l->data;
@@ -756,7 +756,7 @@ static int yahoo_conf_send(PurpleConnect
static int yahoo_conf_send(PurpleConnection *gc, const char *dn, const char *room,
GList *members, const char *what)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
GList *who;
char *msg, *msg2;
@@ -813,7 +813,7 @@ static void yahoo_conf_invite(PurpleConn
static void yahoo_conf_invite(PurpleConnection *gc, PurpleConversation *c,
const char *dn, const char *buddy, const char *room, const char *msg)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
GList *members;
char *msg2 = NULL;
@@ -843,7 +843,7 @@ static void yahoo_chat_leave(PurpleConne
static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
PurpleConversation *c;
@@ -895,7 +895,7 @@ static int yahoo_chat_send(PurpleConnect
static int yahoo_chat_send(PurpleConnection *gc, const char *dn, const char *room, const char *what, PurpleMessageFlags flags)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
int me = 0;
char *msg1, *msg2, *room2;
@@ -940,7 +940,7 @@ static void yahoo_chat_invite(PurpleConn
static void yahoo_chat_invite(PurpleConnection *gc, const char *dn, const char *buddy,
const char *room, const char *msg)
{
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
struct yahoo_packet *pkt;
char *room2, *msg2 = NULL;
gboolean utf8 = TRUE;
@@ -968,7 +968,7 @@ void yahoo_chat_goto(PurpleConnection *g
struct yahoo_data *yd;
struct yahoo_packet *pkt;
- yd = gc->proto_data;
+ yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (yd->wm) {
g_return_if_fail(yd->ycht != NULL);
@@ -1000,7 +1000,7 @@ void yahoo_c_leave(PurpleConnection *gc,
void yahoo_c_leave(PurpleConnection *gc, int id)
{
- struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data;
+ struct yahoo_data *yd = (struct yahoo_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurpleConversation *c;
if (!yd)
@@ -1027,7 +1027,7 @@ int yahoo_c_send(PurpleConnection *gc, i
int ret;
struct yahoo_data *yd;
- yd = (struct yahoo_data *) gc->proto_data;
+ yd = (struct yahoo_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (!yd)
return -1;
@@ -1085,7 +1085,7 @@ void yahoo_c_join(PurpleConnection *gc,
char *room, *topic, *type;
PurpleConversation *c;
- yd = (struct yahoo_data *) gc->proto_data;
+ yd = (struct yahoo_data *) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (!yd)
return;
@@ -1346,7 +1346,7 @@ static void yahoo_roomlist_cleanup(Purpl
purple_roomlist_set_in_progress(list, FALSE);
if (yrl) {
- list->proto_data = g_list_remove(list->proto_data, yrl);
+ purple_object_set_protocol_data(PURPLE_OBJECT(list),g_list_remove(purple_object_get_protocol_data(PURPLE_OBJECT(list)), yrl));
yahoo_roomlist_destroy(yrl);
}
@@ -1445,7 +1445,7 @@ static void yahoo_roomlist_got_connected
{
struct yahoo_roomlist *yrl = data;
PurpleRoomlist *list = yrl->list;
- struct yahoo_data *yd = purple_account_get_connection(list->account)->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(list->account)));
if (source < 0) {
purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed."));
@@ -1527,7 +1527,7 @@ PurpleRoomlist *yahoo_roomlist_get_list(
return NULL;
}
- rl->proto_data = g_list_append(rl->proto_data, yrl);
+ purple_object_set_protocol_data(PURPLE_OBJECT(rl),g_list_append(purple_object_get_protocol_data(PURPLE_OBJECT(rl)), yrl));
purple_roomlist_set_in_progress(rl, TRUE);
return rl;
@@ -1537,8 +1537,8 @@ void yahoo_roomlist_cancel(PurpleRoomlis
{
GList *l, *k;
- k = l = list->proto_data;
- list->proto_data = NULL;
+ k = l = purple_object_get_protocol_data(PURPLE_OBJECT(list));
+ purple_object_set_protocol_data(PURPLE_OBJECT(list),NULL);
purple_roomlist_set_in_progress(list, FALSE);
@@ -1580,7 +1580,7 @@ void yahoo_roomlist_expand_category(Purp
yrl = g_new0(struct yahoo_roomlist, 1);
yrl->list = list;
yrl->cat = category;
- list->proto_data = g_list_append(list->proto_data, yrl);
+ purple_object_set_protocol_data(PURPLE_OBJECT(list),g_list_append(purple_object_get_protocol_data(PURPLE_OBJECT(list)), yrl));
purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL);
g_free(url);
============================================================
--- libpurple/protocols/yahoo/ycht.c 0bc804b4f405d5b0988f2f22c7b1e497a3792c48
+++ libpurple/protocols/yahoo/ycht.c 9f0737adfaf3765c54a6a712ffba260100d31de3
@@ -54,8 +54,8 @@ static void ycht_process_login(YchtConn
************************************************************************************/
static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt)
{
- PurpleConnection *gc = purple_account_get_connection(ycht);
- struct yahoo_data *yd = gc->proto_data;
+ PurpleConnection *gc = ycht->gc;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (ycht->logged_in)
return;
@@ -69,8 +69,8 @@ static void ycht_process_logout(YchtConn
static void ycht_process_logout(YchtConn *ycht, YchtPkt *pkt)
{
- PurpleConnection *gc = purple_account_get_connection(ycht);
- struct yahoo_data *yd = gc->proto_data;
+ PurpleConnection *gc = ycht->gc;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
yd->chat_online = FALSE;
ycht->logged_in = FALSE;
@@ -79,7 +79,7 @@ static void ycht_process_chatjoin(YchtCo
static void ycht_process_chatjoin(YchtConn *ycht, YchtPkt *pkt)
{
char *room, *topic;
- PurpleConnection *gc = purple_account_get_connection(ycht);
+ PurpleConnection *gc = ycht->gc;
PurpleConversation *c = NULL;
gboolean new_room = FALSE;
char **members;
@@ -115,7 +115,7 @@ static void ycht_process_chatjoin(YchtCo
for (i = 0; members[i]; i++) {
if (new_room) {
- /*if (!strcmp(members[i], purple_connection_get_display_name(purple_account_get_connection(ycht))))
+ /*if (!strcmp(members[i], purple_connection_get_display_name(ycht->gc)))
continue;*/
purple_conv_chat_add_user(PURPLE_CONV_CHAT(c), members[i], NULL, PURPLE_CBFLAGS_NONE, TRUE);
} else {
@@ -134,7 +134,7 @@ static void ycht_process_chatpart(YchtCo
who = g_list_nth_data(pkt->data, 1);
if (who && room) {
- PurpleConversation *c = purple_find_chat(purple_account_get_connection(ycht), YAHOO_CHAT_ID);
+ PurpleConversation *c = purple_find_chat(ycht->gc, YAHOO_CHAT_ID);
if (c && !purple_utf8_strcasecmp(purple_conversation_get_name(c), room))
purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c), who, NULL);
@@ -145,7 +145,7 @@ static void ycht_progress_chatmsg(YchtCo
{
char *who, *what, *msg;
PurpleConversation *c;
- PurpleConnection *gc = purple_account_get_connection(ycht);
+ PurpleConnection *gc = ycht->gc;
who = g_list_nth_data(pkt->data, 1);
what = g_list_nth_data(pkt->data, 2);
@@ -174,8 +174,8 @@ static void ycht_progress_online_friends
static void ycht_progress_online_friends(YchtConn *ycht, YchtPkt *pkt)
{
#if 0
- PurpleConnection *gc = purple_account_get_connection(ycht);
- struct yahoo_data *yd = gc->proto_data;
+ PurpleConnection *gc = ycht->gc;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
if (ycht->logged_in)
return;
@@ -429,7 +429,7 @@ void ycht_connection_close(YchtConn *ych
void ycht_connection_close(YchtConn *ycht)
{
- struct yahoo_data *yd = purple_account_get_connection(ycht)->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(ycht->gc));
if (yd) {
yd->ycht = NULL;
@@ -454,7 +454,7 @@ static void ycht_connection_error(YchtCo
static void ycht_connection_error(YchtConn *ycht, const gchar *error)
{
- purple_notify_info(purple_account_get_connection(ycht), NULL, _("Connection problem with the YCHT server."), error);
+ purple_notify_info(ycht->gc, NULL, _("Connection problem with the YCHT server."), error);
ycht_connection_close(ycht);
}
@@ -541,8 +541,8 @@ static void ycht_got_connected(gpointer
static void ycht_got_connected(gpointer data, gint source, const gchar *error_message)
{
YchtConn *ycht = data;
- PurpleConnection *gc = purple_account_get_connection(ycht);
- struct yahoo_data *yd = gc->proto_data;
+ PurpleConnection *gc = ycht->gc;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
YchtPkt *pkt;
char *buf;
@@ -569,11 +569,11 @@ void ycht_connection_open(PurpleConnecti
void ycht_connection_open(PurpleConnection *gc)
{
YchtConn *ycht;
- struct yahoo_data *yd = gc->proto_data;
+ struct yahoo_data *yd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
PurpleAccount *account = purple_connection_get_account(gc);
ycht = g_new0(YchtConn, 1);
- purple_account_get_connection(ycht) = gc;
+ ycht->gc = gc;
ycht->fd = -1;
yd->ycht = ycht;
@@ -622,7 +622,7 @@ int ycht_chat_send(YchtConn *ycht, const
pkt = ycht_packet_new(YCHT_VERSION, YCHT_SERVICE_CHATMSG, 0);
msg1 = yahoo_html_to_codes(what);
- msg2 = yahoo_string_encode(purple_account_get_connection(ycht), msg1, NULL);
+ msg2 = yahoo_string_encode(ycht->gc, msg1, NULL);
g_free(msg1);
buf = g_strdup_printf("%s\001%s", ycht->room, msg2);
More information about the Commits
mailing list