pidgin: 112b6b39: Convert myspace prpl to use accessor fun...
andrew.victor at mxit.com
andrew.victor at mxit.com
Mon Aug 29 18:50:48 EDT 2011
----------------------------------------------------------------------
Revision: 112b6b396236acf13610cd6d5f3a3cfc769d897a
Parent: 4f74b7315e986477bcdb8baaef0509d9dc76596b
Author: andrew.victor at mxit.com
Date: 08/29/11 18:08:01
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/112b6b396236acf13610cd6d5f3a3cfc769d897a
Changelog:
Convert myspace prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Changes against parent 4f74b7315e986477bcdb8baaef0509d9dc76596b
patched libpurple/protocols/myspace/myspace.c
patched libpurple/protocols/myspace/user.c
patched libpurple/protocols/myspace/zap.c
-------------- next part --------------
============================================================
--- libpurple/protocols/myspace/myspace.c 221d71caa590465e2d792c9bbd09d8ccfcea99c8
+++ libpurple/protocols/myspace/myspace.c 8613a72d1608121a24049851be0e8a98bc4f35fe
@@ -429,12 +429,10 @@ msim_tooltip_text(PurpleBuddy *buddy, Pu
user = msim_get_user_from_buddy(buddy, TRUE);
if (PURPLE_BUDDY_IS_ONLINE(buddy)) {
- MsimSession *session;
PurpleAccount *account = purple_buddy_get_account(buddy);
PurpleConnection *gc = purple_account_get_connection(account);
+ MsimSession *session = purple_connection_get_protocol_data(gc);
- session = (MsimSession *)gc->proto_data;
-
/* TODO: if (full), do something different? */
/* TODO: request information? have to figure out how to do
@@ -2022,7 +2020,7 @@ msim_input_cb(gpointer gc_uncasted, gint
g_return_if_fail(source >= 0); /* Note: 0 is a valid fd */
gc = (PurpleConnection *)(gc_uncasted);
- session = gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
/* libpurple/eventloop.h only defines these two */
if (cond != PURPLE_INPUT_READ && cond != PURPLE_INPUT_WRITE) {
@@ -2157,7 +2155,7 @@ msim_connect_cb(gpointer data, gint sour
g_return_if_fail(data != NULL);
gc = (PurpleConnection *)data;
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
if (source < 0) {
gchar *tmp = g_strdup_printf(_("Unable to connect: %s"),
@@ -2191,7 +2189,7 @@ msim_login(PurpleAccount *acct)
purple_debug_info("msim", "logging in %s\n", acct->username);
gc = purple_account_get_connection(acct);
- gc->proto_data = msim_session_new(acct);
+ purple_connection_set_protocol_data(gc, msim_session_new(acct));
gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC;
/*
@@ -2259,11 +2257,11 @@ msim_close(PurpleConnection *gc)
buddies = g_slist_delete_link(buddies, buddies);
}
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
if (session == NULL)
return;
- gc->proto_data = NULL;
+ purple_connection_set_protocol_data(gc, NULL);
if (session->gc->inpa) {
purple_input_remove(session->gc->inpa);
@@ -2304,7 +2302,7 @@ msim_send_im(PurpleConnection *gc, const
/* 'flags' has many options, not used here. */
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
message_msim = html_to_msim_markup(session, message);
@@ -2344,7 +2342,7 @@ msim_send_typing(PurpleConnection *gc, c
g_return_val_if_fail(gc != NULL, 0);
g_return_val_if_fail(name != NULL, 0);
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
switch (state) {
case PURPLE_TYPING:
@@ -2430,7 +2428,7 @@ msim_get_info(PurpleConnection *gc, cons
g_return_if_fail(gc != NULL);
g_return_if_fail(username != NULL);
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
/* Obtain uid of buddy. */
user = msim_find_user(session, username);
@@ -2487,6 +2485,7 @@ msim_set_status(PurpleAccount *account,
static void
msim_set_status(PurpleAccount *account, PurpleStatus *status)
{
+ PurpleConnection *gc = purple_account_get_connection(account);
PurpleStatusType *type;
PurplePresence *pres;
MsimSession *session;
@@ -2495,7 +2494,7 @@ msim_set_status(PurpleAccount *account,
gchar *stripped;
gchar *unrecognized_msg;
- session = (MsimSession *)account->gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
type = purple_status_get_type(status);
pres = purple_status_get_presence(status);
@@ -2558,7 +2557,7 @@ msim_set_idle(PurpleConnection *gc, int
g_return_if_fail(gc != NULL);
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
status = purple_account_get_active_status(session->account);
@@ -2636,7 +2635,7 @@ msim_add_buddy(PurpleConnection *gc, Pur
MsimMessage *body;
const char *name, *gname;
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
name = purple_buddy_get_name(buddy);
gname = group ? purple_group_get_name(group) : NULL;
@@ -2709,7 +2708,7 @@ msim_remove_buddy(PurpleConnection *gc,
MsimMessage *persist_msg;
const char *name;
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
name = purple_buddy_get_name(buddy);
delbuddy_msg = msim_msg_new(
@@ -2766,7 +2765,7 @@ msim_add_deny(PurpleConnection *gc, cons
MsimSession *session;
MsimMessage *msg, *body;
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
/* Remove from buddy list */
msg = msim_msg_new(
@@ -2818,7 +2817,7 @@ msim_rem_deny(PurpleConnection *gc, cons
MsimSession *session;
MsimMessage *msg, *body;
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
/*
* Remove from our list of blocked contacts, so we know they
@@ -2948,7 +2947,7 @@ msim_send_really_raw(PurpleConnection *g
g_return_val_if_fail(buf != NULL, -1);
g_return_val_if_fail(total_bytes >= 0, -1);
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
/* Loop until all data is sent, or a failure occurs. */
total_bytes_sent = 0;
@@ -3151,7 +3150,7 @@ static void msim_import_friends(PurplePl
gchar *group_name;
gc = (PurpleConnection *)action->context;
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
group_name = "MySpace Friends";
@@ -3530,6 +3529,7 @@ msim_uri_handler(const gchar *proto, con
msim_uri_handler(const gchar *proto, const gchar *cmd, GHashTable *params)
{
PurpleAccount *account;
+ PurpleConnection *gc;
MsimSession *session;
GList *l;
gchar *uid_str, *cid_str;
@@ -3578,7 +3578,8 @@ msim_uri_handler(const gchar *proto, con
return FALSE;
}
- session = (MsimSession *)account->gc->proto_data;
+ gc = purple_account_get_connection(account);
+ session = purple_connection_get_protocol_data(gc);
g_return_val_if_fail(session != NULL, FALSE);
/* Lookup userid to username. TODO: push this down, to IM sending/contact
============================================================
--- libpurple/protocols/myspace/zap.c 619464474f8424bd70787c8d0040c58905051546
+++ libpurple/protocols/myspace/zap.c aa407ae973da2b8f08cb39fc63986ed5b8143213
@@ -132,7 +132,7 @@ msim_send_attention(PurpleConnection *gc
PurpleAttentionType *attn;
PurpleBuddy *buddy;
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
/* Look for this attention type, by the code index given. */
types = msim_attention_types(gc->account);
@@ -175,7 +175,7 @@ msim_send_zap_from_menu(PurpleBlistNode
/* Find the session */
account = purple_buddy_get_account(buddy);
gc = purple_account_get_connection(account);
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
zap = GPOINTER_TO_INT(zap_num_ptr);
============================================================
--- libpurple/protocols/myspace/user.c 94ed54c3d0cfff30e4bbee1cf2482495502081f2
+++ libpurple/protocols/myspace/user.c ee102a4ba38de61bc622e88ef32118fb659a5184
@@ -758,7 +758,7 @@ static void msim_set_username_confirmed_
g_return_if_fail(gc != NULL);
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
user_msg = msim_msg_new(
"user", MSIM_TYPE_STRING, g_strdup(msim_username_to_set),
@@ -851,7 +851,7 @@ static void msim_check_username_availabi
g_return_if_fail(gc != NULL);
- session = (MsimSession *)gc->proto_data;
+ session = purple_connection_get_protocol_data(gc);
purple_debug_info("msim_check_username_availability_cb", "Checking username: %s\n", username_to_check);
More information about the Commits
mailing list