pidgin: 1a0eddcf: Convert yahoo prpl to use accessor funct...
andrew.victor at mxit.com
andrew.victor at mxit.com
Tue Aug 30 18:26:02 EDT 2011
----------------------------------------------------------------------
Revision: 1a0eddcf7811c7861cb174dfec535099de940b7d
Parent: 6c3b40d10cfdd7ae069810d596532c52a8c58fb0
Author: andrew.victor at mxit.com
Date: 08/30/11 16:03:11
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1a0eddcf7811c7861cb174dfec535099de940b7d
Changelog:
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
Changes against parent 6c3b40d10cfdd7ae069810d596532c52a8c58fb0
patched libpurple/protocols/yahoo/libymsg.c
patched libpurple/protocols/yahoo/util.c
patched libpurple/protocols/yahoo/yahoo_aliases.c
patched libpurple/protocols/yahoo/yahoo_doodle.c
patched libpurple/protocols/yahoo/yahoo_filexfer.c
patched libpurple/protocols/yahoo/yahoo_friend.c
patched libpurple/protocols/yahoo/yahoo_picture.c
patched libpurple/protocols/yahoo/yahoo_profile.c
patched libpurple/protocols/yahoo/yahoochat.c
patched libpurple/protocols/yahoo/ycht.c
-------------- next part --------------
============================================================
--- libpurple/protocols/yahoo/libymsg.c 75d3e1b021db1b40a78a28e1000061180dcd65e7
+++ libpurple/protocols/yahoo/libymsg.c 856d97927e7a317deb7093bfbc5cc0cf76d10d1b
@@ -496,7 +496,7 @@ static void yahoo_process_list_15(Purple
GSList *l = pkt->hash;
PurpleAccount *account = purple_connection_get_account(gc);
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
GHashTable *ht;
char *norm_bud = NULL;
char *temp = NULL;
@@ -638,7 +638,7 @@ static void yahoo_process_list(PurpleCon
gboolean got_serv_list = FALSE;
YahooFriend *f = NULL;
PurpleAccount *account = purple_connection_get_account(gc);
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
GHashTable *ht;
char **lines;
@@ -787,7 +787,7 @@ static void yahoo_process_notify(PurpleC
YahooFriend *f = NULL;
GSList *l = pkt->hash;
gint val_11 = 0;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
YahooFederation fed = YAHOO_FEDERATION_NONE;
account = purple_connection_get_account(gc);
@@ -899,7 +899,7 @@ static void yahoo_process_sms_message(Pu
char *server_msg = NULL;
char *m;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
account = purple_connection_get_account(gc);
while (l != NULL) {
@@ -960,7 +960,7 @@ static void yahoo_process_message(Purple
static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type)
{
PurpleAccount *account;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
GSList *l = pkt->hash;
GSList *list = NULL;
struct _yahoo_im *im = NULL;
@@ -1202,7 +1202,7 @@ yahoo_buddy_add_authorize_cb(gpointer da
{
struct yahoo_add_request *add_req = data;
struct yahoo_packet *pkt;
- YahooData *yd = add_req->gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(add_req->gc);
const char *who = add_req->who;
pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, yd->session_id);
@@ -1233,7 +1233,7 @@ yahoo_buddy_add_deny_cb(struct yahoo_add
static void
yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg)
{
- YahooData *yd = add_req->gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(add_req->gc);
struct yahoo_packet *pkt;
char *encoded_msg = NULL;
const char *who = add_req->who;
@@ -1295,7 +1295,7 @@ static void yahoo_buddy_denied_our_add(P
static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason)
{
char *notify_msg;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
if (who == NULL)
return;
@@ -1625,7 +1625,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);
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
const char *who = NULL;
const char *email = NULL;
const char *subj = NULL;
@@ -1709,7 +1709,7 @@ static void yahoo_auth16_stage3(PurpleCo
static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
PurpleAccount *account = purple_connection_get_account(gc);
const char *name = purple_normalize(account, purple_account_get_username(account));
PurpleCipher *md5_cipher;
@@ -2207,7 +2207,7 @@ static void yahoo_process_authresp(Purpl
static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt)
{
#ifdef TRY_WEBMESSENGER_LOGIN
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
#endif /* TRY_WEBMESSENGER_LOGIN */
GSList *l = pkt->hash;
int err = 0;
@@ -2300,7 +2300,7 @@ static void yahoo_process_addbuddy(Purpl
char *buf;
YahooFriend *f;
GSList *l = pkt->hash;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
YahooFederation fed = YAHOO_FEDERATION_NONE;
while (l) {
@@ -2394,7 +2394,7 @@ static void yahoo_p2p_keepalive_cb(gpoin
PurpleConnection *gc = user_data;
struct yahoo_packet *pkt_to_send;
PurpleAccount *account;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
account = purple_connection_get_account(gc);
@@ -2413,7 +2413,7 @@ static gboolean yahoo_p2p_keepalive(gpoi
static gboolean yahoo_p2p_keepalive(gpointer data)
{
PurpleConnection *gc = data;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
g_hash_table_foreach(yd->peers, yahoo_p2p_keepalive_cb, gc);
@@ -2460,7 +2460,7 @@ static void yahoo_p2p_process_p2pfilexfe
if(!(p2p_data = data))
return ;
- yd = p2p_data->gc->proto_data;
+ yd = purple_connection_get_protocol_data(p2p_data->gc);
/* lets see whats in the packet */
while (l) {
@@ -2545,7 +2545,7 @@ static void yahoo_p2p_read_pkt_cb(gpoint
if(!(p2p_data = data))
return ;
- yd = p2p_data->gc->proto_data;
+ yd = purple_connection_get_protocol_data(p2p_data->gc);
len = read(source, buf, sizeof(buf));
if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK)))
@@ -2617,7 +2617,7 @@ static void yahoo_p2p_server_send_connec
if(!(p2p_data = data))
return ;
- yd = p2p_data->gc->proto_data;
+ yd = purple_connection_get_protocol_data(p2p_data->gc);
acceptfd = accept(source, NULL, 0);
if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK))
@@ -2657,7 +2657,7 @@ static gboolean yahoo_cancel_p2p_server_
if(!(p2p_data = data))
return FALSE;
- yd = p2p_data->gc->proto_data;
+ yd = purple_connection_get_protocol_data(p2p_data->gc);
purple_debug_warning("yahoo","yahoo p2p server timeout, peer failed to connect\n");
yahoo_p2p_disconnect_destroy_data(data);
@@ -2678,7 +2678,7 @@ static void yahoo_p2p_server_listen_cb(i
if(!(p2p_data = data))
return ;
- yd = p2p_data->gc->proto_data;
+ yd = purple_connection_get_protocol_data(p2p_data->gc);
yd->listen_data = NULL;
if(listenfd == -1) {
@@ -2706,7 +2706,7 @@ void yahoo_send_p2p_pkt(PurpleConnection
YahooFriend *f;
struct yahoo_packet *pkt;
PurpleAccount *account;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_p2p_data *p2p_data;
const char *norm_username;
@@ -2787,7 +2787,7 @@ static void yahoo_p2p_init_cb(gpointer d
YahooData *yd;
p2p_data = data;
- yd = p2p_data->gc->proto_data;
+ yd = purple_connection_get_protocol_data(p2p_data->gc);
if(error_message != NULL) {
purple_debug_warning("yahoo","p2p: %s\n",error_message);
@@ -3132,7 +3132,7 @@ static void yahoo_pending(gpointer data,
static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond)
{
PurpleConnection *gc = data;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
char buf[1024];
int len;
@@ -3240,7 +3240,7 @@ static void yahoo_got_connected(gpointer
return;
}
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
yd->fd = source;
pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, yd->session_id);
@@ -3266,7 +3266,7 @@ static void yahoo_got_web_connected(gpoi
return;
}
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
yd->fd = source;
pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, yd->session_id);
@@ -3285,7 +3285,7 @@ static void yahoo_web_pending(gpointer d
{
PurpleConnection *gc = data;
PurpleAccount *account = purple_connection_get_account(gc);
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
char bufread[2048], *i = bufread, *buf = bufread;
int len;
GString *s;
@@ -3364,7 +3364,7 @@ static void yahoo_got_cookies_send_cb(gp
int written, remaining;
gc = data;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
remaining = strlen(yd->auth) - yd->auth_written;
written = write(source, yd->auth + yd->auth_written, remaining);
@@ -3474,7 +3474,7 @@ yahoo_login_page_cb(PurpleUtilFetchUrlDa
{
PurpleConnection *gc = (PurpleConnection *)user_data;
PurpleAccount *account = purple_connection_get_account(gc);
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(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);
@@ -3671,12 +3671,13 @@ void yahoo_login(PurpleAccount *account)
void yahoo_login(PurpleAccount *account) {
PurpleConnection *gc = purple_account_get_connection(account);
- YahooData *yd = gc->proto_data = g_new0(YahooData, 1);
+ YahooData *yd = g_new0(YahooData, 1);
PurpleStatus *status = purple_account_get_active_status(account);
gboolean use_whole_url = yahoo_account_use_http_proxy(gc);
gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE);
PurpleUtilFetchUrlData *url_data;
+ purple_connection_set_protocol_data(gc, yd);
gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC;
purple_connection_update_progress(gc, _("Connecting"), 1, 2);
@@ -3721,7 +3722,7 @@ void yahoo_close(PurpleConnection *gc) {
}
void yahoo_close(PurpleConnection *gc) {
- YahooData *yd = (YahooData *)gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
GSList *l;
if (gc->inpa)
@@ -3810,7 +3811,7 @@ void yahoo_close(PurpleConnection *gc) {
g_free(yd->current_list15_grp);
g_free(yd);
- gc->proto_data = NULL;
+ purple_connection_set_protocol_data(gc, NULL);
}
const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b)
@@ -3827,7 +3828,7 @@ const char *yahoo_list_emblem(PurpleBudd
if (!b || !(account = purple_buddy_get_account(b)) ||
!(gc = purple_account_get_connection(account)) ||
- !gc->proto_data)
+ !purple_connection_get_protocol_data(gc))
return NULL;
f = yahoo_friend_find(gc, purple_buddy_get_name(b));
@@ -3892,7 +3893,7 @@ static void yahoo_initiate_conference(Pu
buddy = (PurpleBuddy *) node;
gc = purple_account_get_connection(purple_buddy_get_account(buddy));
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
id = yd->conf_id;
components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
@@ -4075,7 +4076,7 @@ static GList *build_presence_submenu(Yah
static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) {
GList *m = NULL;
PurpleMenuAction *act;
- YahooData *yd = (YahooData *) gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
if (f->presence != YAHOO_PRESENCE_ONLINE) {
@@ -4135,7 +4136,7 @@ static GList *yahoo_buddy_menu(PurpleBud
PurpleMenuAction *act;
PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy));
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
static char buf2[1024];
YahooFriend *f;
@@ -4218,7 +4219,7 @@ static void yahoo_act_id(PurpleConnectio
static void yahoo_act_id(PurpleConnection *gc, PurpleRequestFields *fields)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
const char *name = yd->profiles[purple_request_fields_get_choice(fields, "id")];
struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, yd->session_id);
@@ -4235,7 +4236,7 @@ yahoo_get_inbox_token_cb(PurpleUtilFetch
PurpleConnection *gc = user_data;
gboolean set_cookie = FALSE;
gchar *url;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
@@ -4271,7 +4272,7 @@ static void yahoo_show_inbox(PurplePlugi
/* XXX I have no idea how this will work with Yahoo! Japan. */
PurpleConnection *gc = action->context;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
PurpleUtilFetchUrlData *url_data;
const char* base_url = "http://login.yahoo.com";
@@ -4385,7 +4386,7 @@ static void yahoo_get_sms_carrier_cb(Pur
{
struct yahoo_sms_carrier_cb_data *sms_cb_data = user_data;
PurpleConnection *gc = sms_cb_data->gc;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
char *status = NULL;
char *carrier = NULL;
PurpleAccount *account = purple_connection_get_account(gc);
@@ -4440,7 +4441,7 @@ static void yahoo_get_sms_carrier(Purple
static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
PurpleUtilFetchUrlData *url_data;
struct yahoo_sms_carrier_cb_data *sms_cb_data;
char *validate_request_str = NULL;
@@ -4500,7 +4501,7 @@ int yahoo_send_im(PurpleConnection *gc,
int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt = NULL;
char *msg = yahoo_html_to_codes(what);
char *msg2;
@@ -4657,7 +4658,7 @@ unsigned int yahoo_send_typing(PurpleCon
unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_p2p_data *p2p_data;
YahooFederation fed = YAHOO_FEDERATION_NONE;
struct yahoo_packet *pkt = NULL;
@@ -4728,7 +4729,7 @@ void yahoo_set_status(PurpleAccount *acc
gc = purple_account_get_connection(account);
presence = purple_status_get_presence(status);
- yd = (YahooData *)gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
old_status = yd->current_status;
yd->current_status = get_yahoo_status_from_purple_status(status);
@@ -4794,7 +4795,7 @@ void yahoo_set_idle(PurpleConnection *gc
void yahoo_set_idle(PurpleConnection *gc, int idle)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt = NULL;
char *msg = NULL, *msg2 = NULL;
PurpleStatus *status = NULL;
@@ -4913,7 +4914,7 @@ void yahoo_keepalive(PurpleConnection *g
void yahoo_keepalive(PurpleConnection *gc)
{
struct yahoo_packet *pkt;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
time_t now = time(NULL);
/* We're only allowed to send a ping once an hour or the servers will boot us */
@@ -4946,7 +4947,7 @@ void yahoo_add_buddy(PurpleConnection *g
void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g)
{
- YahooData *yd = (YahooData *)gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
const char *group = NULL;
char *group2;
@@ -5009,7 +5010,7 @@ void yahoo_remove_buddy(PurpleConnection
void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
{
- YahooData *yd = (YahooData *)gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
GSList *buddies, *l;
PurpleGroup *g;
@@ -5065,7 +5066,7 @@ void yahoo_add_deny(PurpleConnection *gc
}
void yahoo_add_deny(PurpleConnection *gc, const char *who) {
- YahooData *yd = (YahooData *)gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
YahooFederation fed = YAHOO_FEDERATION_NONE;
@@ -5088,7 +5089,7 @@ void yahoo_rem_deny(PurpleConnection *gc
}
void yahoo_rem_deny(PurpleConnection *gc, const char *who) {
- YahooData *yd = (YahooData *)gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
YahooFederation fed = YAHOO_FEDERATION_NONE;
@@ -5136,7 +5137,7 @@ void yahoo_change_buddys_group(PurpleCon
void yahoo_change_buddys_group(PurpleConnection *gc, const char *who,
const char *old_group, const char *new_group)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
char *gpn, *gpo;
YahooFriend *f = yahoo_friend_find(gc, who);
@@ -5183,7 +5184,7 @@ void yahoo_rename_group(PurpleConnection
void yahoo_rename_group(PurpleConnection *gc, const char *old_name,
PurpleGroup *group, GList *moved_buddies)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
char *gpn, *gpo;
============================================================
--- libpurple/protocols/yahoo/util.c f8b28029aa4f0ff84c9b09af3801de7d849d27b8
+++ libpurple/protocols/yahoo/util.c 2b68a8b18e8bdd2209612d25306e00c0a677512b
@@ -63,8 +63,9 @@ gchar* yahoo_get_cookies(PurpleConnectio
char firstflag = 1;
gchar *t1,*t2,*t3;
GSList *tmp;
- GSList *cookies;
- cookies = ((YahooData*)(gc->proto_data))->cookies;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
+ GSList *cookies = yd->cookies;
+
tmp = cookies;
while(tmp)
{
@@ -129,7 +130,7 @@ char *yahoo_string_encode(PurpleConnecti
*/
char *yahoo_string_encode(PurpleConnection *gc, const char *str, gboolean *utf8)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
char *ret;
const char *to_codeset;
@@ -158,7 +159,7 @@ char *yahoo_string_decode(PurpleConnecti
*/
char *yahoo_string_decode(PurpleConnection *gc, const char *str, gboolean utf8)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
char *ret;
const char *from_codeset;
============================================================
--- libpurple/protocols/yahoo/yahoochat.c 41dca2f605b046ea8821bb30e1d6f37c67100f20
+++ libpurple/protocols/yahoo/yahoochat.c 5195a1edf6c4ae7b6c694151ff1063cb0853bcee
@@ -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)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
const char *rll;
@@ -101,7 +101,7 @@ static PurpleConversation *yahoo_find_co
YahooData *yd;
GSList *l;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
for (l = yd->confs; l; l = l->next) {
PurpleConversation *c = l->data;
@@ -372,7 +372,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)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
char *room2;
gboolean utf8 = TRUE;
@@ -400,7 +400,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)
{
- YahooData *yd = (YahooData *) gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
if (pkt->status == 1) {
yd->chat_online = TRUE;
@@ -432,7 +432,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)
{
- YahooData *yd = (YahooData *) gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
GSList *l;
for (l = pkt->hash; l; l = l->next) {
@@ -462,7 +462,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);
- YahooData *yd = (YahooData *) gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
PurpleConversation *c = NULL;
GSList *l;
GList *members = NULL;
@@ -786,7 +786,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)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
GList *who;
char *msg, *msg2;
@@ -843,7 +843,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)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
GList *members;
char *msg2 = NULL;
@@ -873,7 +873,7 @@ static void yahoo_chat_leave(PurpleConne
static void yahoo_chat_leave(PurpleConnection *gc, const char *room, const char *dn, gboolean logout)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
char *eroom;
@@ -924,7 +924,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)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
int me = 0;
char *msg1, *msg2, *room2;
@@ -969,7 +969,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)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
char *room2, *msg2 = NULL;
gboolean utf8 = TRUE;
@@ -997,7 +997,7 @@ void yahoo_chat_goto(PurpleConnection *g
YahooData *yd;
struct yahoo_packet *pkt;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
if (yd->wm) {
g_return_if_fail(yd->ycht != NULL);
@@ -1029,7 +1029,7 @@ void yahoo_c_leave(PurpleConnection *gc,
void yahoo_c_leave(PurpleConnection *gc, int id)
{
- YahooData *yd = (YahooData *) gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
PurpleConversation *c;
if (!yd)
@@ -1056,7 +1056,7 @@ int yahoo_c_send(PurpleConnection *gc, i
int ret;
YahooData *yd;
- yd = (YahooData *) gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
if (!yd)
return -1;
@@ -1114,7 +1114,7 @@ void yahoo_c_join(PurpleConnection *gc,
char *room, *topic, *type;
PurpleConversation *c;
- yd = (YahooData *) gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
if (!yd)
return;
@@ -1478,7 +1478,7 @@ static void yahoo_roomlist_got_connected
PurpleRoomlist *list = yrl->list;
PurpleAccount *account = purple_roomlist_get_account(list);
PurpleConnection *pc = purple_account_get_connection(account);
- YahooData *yd = pc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(pc);
if (source < 0) {
purple_notify_error(pc, NULL, _("Unable to connect"), _("Fetching the room list failed."));
============================================================
--- libpurple/protocols/yahoo/yahoo_filexfer.c 93706dbe2ba51824260589958f2e1919d4cac0d3
+++ libpurple/protocols/yahoo/yahoo_filexfer.c e7a192c3d00d3ace0e85a8bec3b40d3c0b7ce71e
@@ -85,7 +85,7 @@ static void yahoo_xfer_data_free(struct
GSList *l;
gc = xd->gc;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
/* remove entry from map */
if(xd->xfer_peer_idstring) {
@@ -255,7 +255,7 @@ static void yahoo_sendfile_connected(gpo
/* Assemble the tx buffer */
gc = xd->gc;
account = purple_connection_get_account(gc);
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
pkt = yahoo_packet_new(YAHOO_SERVICE_FILETRANSFER,
YAHOO_STATUS_AVAILABLE, yd->session_id);
@@ -316,7 +316,7 @@ static void yahoo_xfer_init(PurpleXfer *
xfer_data = purple_xfer_get_protocol_data(xfer);
gc = xfer_data->gc;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
account = purple_connection_get_account(gc);
if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) {
@@ -360,7 +360,7 @@ static void yahoo_xfer_init_15(PurpleXfe
xfer_data = purple_xfer_get_protocol_data(xfer);
gc = xfer_data->gc;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
account = purple_connection_get_account(gc);
if (purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) {
@@ -527,7 +527,7 @@ static void yahoo_xfer_cancel_send(Purpl
struct yahoo_packet *pkt;
gc = xfer_data->gc;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(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 */
{
@@ -575,7 +575,7 @@ static void yahoo_xfer_cancel_recv(Purpl
struct yahoo_packet *pkt;
gc = xfer_data->gc;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(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 */
{
@@ -662,7 +662,7 @@ static void yahoo_xfer_end(PurpleXfer *x
filesize = atol( xfer_data->size_list->data );
gc = xfer_data->gc;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
/* setting up xfer_data for next file's tranfer */
g_free(xfer_data->host);
@@ -805,7 +805,7 @@ void yahoo_process_filetransfer(PurpleCo
unsigned long filesize = 0L;
GSList *l;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
for (l = pkt->hash; l; l = l->next) {
struct yahoo_pair *pair = l->data;
@@ -996,7 +996,7 @@ static void yahoo_xfer_dns_connected_15(
return;
gc = xd->gc;
account = purple_connection_get_account(gc);
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
if(!hosts)
{
@@ -1076,7 +1076,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;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
PurpleXfer *xfer = yahoo_new_xfer(gc, who);
g_return_if_fail(xfer != NULL);
@@ -1249,7 +1249,7 @@ static void yahoo_xfer_connected_15(gpoi
{
gchar* cookies;
gchar* initial_buffer;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
/* cookies = yahoo_get_cookies(gc);
* This doesn't seem to be working. The function is returning NULL, which yahoo servers don't like
@@ -1505,7 +1505,7 @@ static void yahoo_p2p_ft_server_listen_c
}
if( (purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE) || (xd->status_15 != P2P_HEAD_REPLIED) ) {
- yd = xd->gc->proto_data;
+ yd = purple_connection_get_protocol_data(xd->gc);
account = purple_connection_get_account(xd->gc);
local_ip = purple_network_get_my_ip(listenfd);
xd->yahoo_local_p2p_ft_server_port = purple_network_get_port_from_fd(listenfd);
@@ -1566,7 +1566,7 @@ static void yahoo_p2p_client_send_ft_inf
return;
account = purple_connection_get_account(gc);
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
p2p_data = g_hash_table_lookup(yd->peers, purple_xfer_get_remote_user(xfer));
if( p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER )
@@ -1607,7 +1607,7 @@ void yahoo_process_filetrans_15(PurpleCo
GSList *size_list = NULL;
int nooffiles = 0;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
for (l = pkt->hash; l; l = l->next) {
struct yahoo_pair *pair = l->data;
@@ -1786,7 +1786,7 @@ void yahoo_process_filetrans_info_15(Pur
struct yahoo_packet *pkt_to_send;
struct yahoo_p2p_data *p2p_data;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
for (l = pkt->hash; l; l = l->next) {
struct yahoo_pair *pair = l->data;
@@ -1892,7 +1892,7 @@ void yahoo_process_filetrans_acc_15(Purp
gchar *url = NULL;
int val_249 = 0;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
for (l = pkt->hash; l; l = l->next) {
struct yahoo_pair *pair = l->data;
============================================================
--- libpurple/protocols/yahoo/yahoo_profile.c 45c4628e0fe695b04377da2061a22c473636f724
+++ libpurple/protocols/yahoo/yahoo_profile.c d6982b7d8cbb97e927c924be84bf7e3eb9f228b2
@@ -789,7 +789,7 @@ static void yahoo_got_info(PurpleUtilFet
purple_debug_info("yahoo", "In yahoo_got_info\n");
- yd = info_data->gc->proto_data;
+ yd = purple_connection_get_protocol_data(info_data->gc);
yd->url_datas = g_slist_remove(yd->url_datas, url_data);
user_info = purple_notify_user_info_new();
@@ -983,7 +983,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData *
/* in to purple_markup_strip_html*/
char *fudged_buffer;
- yd = info_data->gc->proto_data;
+ yd = purple_connection_get_protocol_data(info_data->gc);
yd->url_datas = g_slist_remove(yd->url_datas, url_data);
fudged_buffer = purple_strcasereplace(url_buffer, "</dd>", "</dd><br>");
@@ -1262,7 +1262,7 @@ void yahoo_get_info(PurpleConnection *gc
void yahoo_get_info(PurpleConnection *gc, const char *name)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
YahooGetInfoData *data;
char *url;
PurpleUtilFetchUrlData *url_data;
============================================================
--- libpurple/protocols/yahoo/yahoo_friend.c 647746bd3f6dd25f368d44ebca8e14fea66c9ee1
+++ libpurple/protocols/yahoo/yahoo_friend.c e7262f9a39ad9bb7f95018a259ba9b4858432408
@@ -46,9 +46,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_connection_get_protocol_data(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);
@@ -61,9 +62,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_connection_get_protocol_data(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);
@@ -225,7 +227,7 @@ void yahoo_friend_update_presence(Purple
void yahoo_friend_update_presence(PurpleConnection *gc, const char *name,
YahooPresenceVisibility presence)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt = NULL;
YahooFriend *f;
const char *thirtyone, *thirteen;
============================================================
--- libpurple/protocols/yahoo/yahoo_picture.c 07dd300f6c6820faad574d4567ebd8b7480022e0
+++ libpurple/protocols/yahoo/yahoo_picture.c 691c3f643bf248a5dd8d6b615e75f61f762ec008
@@ -52,7 +52,7 @@ yahoo_fetch_picture_cb(PurpleUtilFetchUr
YahooData *yd;
d = user_data;
- yd = d->gc->proto_data;
+ yd = purple_connection_get_protocol_data(d->gc);
yd->url_datas = g_slist_remove(yd->url_datas, url_data);
if (error_message != NULL) {
@@ -142,7 +142,7 @@ void yahoo_process_picture(PurpleConnect
"Mozilla/4.0 (compatible; MSIE 5.5)", FALSE,
yahoo_fetch_picture_cb, data);
if (url_data != NULL) {
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
} else {
g_free(data->who);
@@ -192,7 +192,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);
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
GSList *l = pkt->hash;
char *url = NULL;
@@ -268,7 +268,7 @@ void yahoo_send_picture_info(PurpleConne
void yahoo_send_picture_info(PurpleConnection *gc, const char *who)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
if (!yd->picture_url) {
@@ -285,7 +285,7 @@ void yahoo_send_picture_request(PurpleCo
void yahoo_send_picture_request(PurpleConnection *gc, const char *who)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE, YAHOO_STATUS_AVAILABLE, yd->session_id);
@@ -297,7 +297,7 @@ void yahoo_send_picture_checksum(PurpleC
void yahoo_send_picture_checksum(PurpleConnection *gc)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
pkt = yahoo_packet_new(YAHOO_SERVICE_PICTURE_CHECKSUM, YAHOO_STATUS_AVAILABLE, yd->session_id);
@@ -308,7 +308,7 @@ void yahoo_send_picture_update_to_user(P
void yahoo_send_picture_update_to_user(PurpleConnection *gc, const char *who, int type)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yahoo_packet *pkt;
pkt = yahoo_packet_new(YAHOO_SERVICE_AVATAR_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id);
@@ -333,7 +333,7 @@ void yahoo_send_picture_update(PurpleCon
void yahoo_send_picture_update(PurpleConnection *gc, int type)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
struct yspufe data;
data.gc = gc;
@@ -432,7 +432,7 @@ static void yahoo_buddy_icon_upload_conn
gboolean use_whole_url = yahoo_account_use_http_proxy(gc);
account = purple_connection_get_account(gc);
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
/* Buddy icon connect is now complete; clear the PurpleProxyConnectData */
yd->buddy_icon_connect_data = NULL;
@@ -497,7 +497,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);
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
if (yd->buddy_icon_connect_data != NULL) {
/* Cancel any in-progress buddy icon upload */
@@ -542,7 +542,7 @@ void yahoo_set_buddy_icon(PurpleConnecti
void yahoo_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
PurpleAccount *account = gc->account;
if (img == NULL) {
============================================================
--- libpurple/protocols/yahoo/ycht.c e592a3fe8e9efab5c47868008397a15eb021f889
+++ libpurple/protocols/yahoo/ycht.c 7bd032eb05f1bde61084dc0daf43a08171d9317d
@@ -53,7 +53,7 @@ static void ycht_process_login(YchtConn
static void ycht_process_login(YchtConn *ycht, YchtPkt *pkt)
{
PurpleConnection *gc = ycht->gc;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
if (ycht->logged_in)
return;
@@ -68,7 +68,7 @@ static void ycht_process_logout(YchtConn
static void ycht_process_logout(YchtConn *ycht, YchtPkt *pkt)
{
PurpleConnection *gc = ycht->gc;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
yd->chat_online = FALSE;
ycht->logged_in = FALSE;
@@ -173,7 +173,7 @@ static void ycht_progress_online_friends
{
#if 0
PurpleConnection *gc = ycht->gc;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
if (ycht->logged_in)
return;
@@ -429,7 +429,7 @@ void ycht_connection_close(YchtConn *ych
void ycht_connection_close(YchtConn *ycht)
{
- YahooData *yd = ycht->gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(ycht->gc);
if (yd) {
yd->ycht = NULL;
@@ -541,7 +541,7 @@ static void ycht_got_connected(gpointer
{
YchtConn *ycht = data;
PurpleConnection *gc = ycht->gc;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
YchtPkt *pkt;
char *buf;
@@ -568,7 +568,7 @@ void ycht_connection_open(PurpleConnecti
void ycht_connection_open(PurpleConnection *gc)
{
YchtConn *ycht;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
PurpleAccount *account = purple_connection_get_account(gc);
ycht = g_new0(YchtConn, 1);
============================================================
--- libpurple/protocols/yahoo/yahoo_doodle.c d75e8392b7b33f3ad4a3070f844f6b11bd2f97ff
+++ libpurple/protocols/yahoo/yahoo_doodle.c ed0a4695020d83ba6334739310332530da92f3e9
@@ -389,7 +389,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_connection_get_protocol_data(gc);
/* Make and send an acknowledge (ready) Doodle packet */
pkt = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id);
============================================================
--- libpurple/protocols/yahoo/yahoo_aliases.c 6712e727d06848af814aa979d4cca5bcc2e09580
+++ libpurple/protocols/yahoo/yahoo_aliases.c 9d5f453e385f3abec2e675acbcc48015945b5db9
@@ -74,7 +74,7 @@ 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)
{
PurpleConnection *gc = user_data;
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
yd->url_datas = g_slist_remove(yd->url_datas, url_data);
@@ -186,7 +186,7 @@ yahoo_fetch_aliases(PurpleConnection *gc
void
yahoo_fetch_aliases(PurpleConnection *gc)
{
- YahooData *yd = gc->proto_data;
+ YahooData *yd = purple_connection_get_protocol_data(gc);
const char *url;
gchar *request, *webpage, *webaddress;
PurpleUtilFetchUrlData *url_data;
@@ -230,7 +230,7 @@ yahoo_update_alias_cb(PurpleUtilFetchUrl
PurpleConnection *gc = cb->gc;
YahooData *yd;
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
yd->url_datas = g_slist_remove(yd->url_datas, url_data);
if (len == 0 || error_message != NULL) {
@@ -310,7 +310,7 @@ yahoo_update_alias(PurpleConnection *gc,
return;
}
- yd = gc->proto_data;
+ yd = purple_connection_get_protocol_data(gc);
/* Using callback_data so I have access to gc in the callback function */
cb = g_new0(struct callback_data, 1);
More information about the Commits
mailing list