pidgin: b8478e7e: Convert irc prpl to use accessor functio...
andrew.victor at mxit.com
andrew.victor at mxit.com
Tue Aug 30 18:26:51 EDT 2011
----------------------------------------------------------------------
Revision: b8478e7e4b5b23e993200435bc3381a77d0ef30e
Parent: 33650d60f151201be89ae16eeaddd1d807650c18
Author: andrew.victor at mxit.com
Date: 08/30/11 14:34:11
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b8478e7e4b5b23e993200435bc3381a77d0ef30e
Changelog:
Convert irc prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Changes against parent 33650d60f151201be89ae16eeaddd1d807650c18
patched libpurple/protocols/irc/dcc_send.c
patched libpurple/protocols/irc/irc.c
patched libpurple/protocols/irc/parse.c
-------------- next part --------------
============================================================
--- libpurple/protocols/irc/irc.c 38d815e25fb1c718ca7f71867f199971dd4759c3
+++ libpurple/protocols/irc/irc.c 6b53eb96b2fb5fc5c21dacedadd712a59db12581
@@ -70,11 +70,11 @@ static void irc_view_motd(PurplePluginAc
struct irc_conn *irc;
char *title;
- if (gc == NULL || gc->proto_data == NULL) {
+ if (gc == NULL || purple_connection_get_protocol_data(gc) == NULL) {
purple_debug(PURPLE_DEBUG_ERROR, "irc", "got MOTD request for NULL gc\n");
return;
}
- irc = gc->proto_data;
+ irc = purple_connection_get_protocol_data(gc);
if (irc->motd == NULL) {
purple_notify_error(gc, _("Error displaying MOTD"), _("No MOTD available"),
_("There is no MOTD associated with this connection."));
@@ -100,7 +100,7 @@ static int irc_send_raw(PurpleConnection
static int irc_send_raw(PurpleConnection *gc, const char *buf, int len)
{
- struct irc_conn *irc = (struct irc_conn*)gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
if (len == -1) {
len = strlen(buf);
}
@@ -365,7 +365,8 @@ static void irc_login(PurpleAccount *acc
return;
}
- gc->proto_data = irc = g_new0(struct irc_conn, 1);
+ irc = g_new0(struct irc_conn, 1);
+ purple_connection_set_protocol_data(gc, irc);
irc->fd = -1;
irc->account = account;
irc->outbuf = purple_circ_buffer_new(512);
@@ -415,7 +416,7 @@ static gboolean do_login(PurpleConnectio
char *buf, *tmp = NULL;
char *server;
const char *username, *realname;
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
const char *pass = purple_connection_get_password(gc);
if (pass && *pass) {
@@ -485,7 +486,7 @@ static void irc_login_cb(gpointer data,
static void irc_login_cb(gpointer data, gint source, const gchar *error_message)
{
PurpleConnection *gc = data;
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
if (source < 0) {
gchar *tmp = g_strdup_printf(_("Unable to connect: %s"),
@@ -508,7 +509,7 @@ irc_ssl_connect_failure(PurpleSslConnect
gpointer data)
{
PurpleConnection *gc = data;
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
irc->gsc = NULL;
@@ -517,7 +518,7 @@ static void irc_close(PurpleConnection *
static void irc_close(PurpleConnection *gc)
{
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
if (irc == NULL)
return;
@@ -558,7 +559,7 @@ static int irc_im_send(PurpleConnection
static int irc_im_send(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags)
{
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
char *plain;
const char *args[2];
@@ -574,7 +575,7 @@ static void irc_get_info(PurpleConnectio
static void irc_get_info(PurpleConnection *gc, const char *who)
{
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
const char *args[2];
args[0] = who;
args[1] = NULL;
@@ -589,7 +590,7 @@ static void irc_set_status(PurpleAccount
const char *status_id = purple_status_get_id(status);
g_return_if_fail(gc != NULL);
- irc = gc->proto_data;
+ irc = purple_connection_get_protocol_data(gc);
if (!purple_status_is_active(status))
return;
@@ -608,7 +609,7 @@ static void irc_add_buddy(PurpleConnecti
static void irc_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
{
- struct irc_conn *irc = (struct irc_conn *)gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
struct irc_buddy *ib;
const char *bname = purple_buddy_get_name(buddy);
@@ -633,7 +634,7 @@ static void irc_remove_buddy(PurpleConne
static void irc_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
{
- struct irc_conn *irc = (struct irc_conn *)gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
struct irc_buddy *ib;
ib = g_hash_table_lookup(irc->buddies, purple_buddy_get_name(buddy));
@@ -678,7 +679,7 @@ static void irc_input_cb_ssl(gpointer da
{
PurpleConnection *gc = data;
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
int len;
if(!g_list_find(purple_connections_get_all(), gc)) {
@@ -716,7 +717,7 @@ static void irc_input_cb(gpointer data,
static void irc_input_cb(gpointer data, gint source, PurpleInputCondition cond)
{
PurpleConnection *gc = data;
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
int len;
if (irc->inbuflen < irc->inbufused + IRC_INITIAL_BUFSIZE) {
@@ -746,7 +747,7 @@ static void irc_chat_join (PurpleConnect
static void irc_chat_join (PurpleConnection *gc, GHashTable *data)
{
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
const char *args[2];
args[0] = g_hash_table_lookup(data, "channel");
@@ -760,7 +761,7 @@ static void irc_chat_invite(PurpleConnec
static void irc_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name)
{
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
PurpleConversation *convo = purple_find_chat(gc, id);
const char *args[2];
@@ -776,7 +777,7 @@ static void irc_chat_leave (PurpleConnec
static void irc_chat_leave (PurpleConnection *gc, int id)
{
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
PurpleConversation *convo = purple_find_chat(gc, id);
const char *args[2];
@@ -791,7 +792,7 @@ static int irc_chat_send(PurpleConnectio
static int irc_chat_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags)
{
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
PurpleConversation *convo = purple_find_chat(gc, id);
const char *args[2];
char *tmp;
@@ -845,7 +846,7 @@ static void irc_chat_set_topic(PurpleCon
const char *name = NULL;
struct irc_conn *irc;
- irc = gc->proto_data;
+ irc = purple_connection_get_protocol_data(gc);
name = purple_conversation_get_name(purple_find_chat(gc, id));
if (name == NULL)
@@ -863,7 +864,7 @@ static PurpleRoomlist *irc_roomlist_get_
PurpleRoomlistField *f;
char *buf;
- irc = gc->proto_data;
+ irc = purple_connection_get_protocol_data(gc);
if (irc->roomlist)
purple_roomlist_unref(irc->roomlist);
@@ -897,7 +898,7 @@ static void irc_roomlist_cancel(PurpleRo
if (gc == NULL)
return;
- irc = gc->proto_data;
+ irc = purple_connection_get_protocol_data(gc);
purple_roomlist_set_in_progress(list, FALSE);
@@ -909,7 +910,7 @@ static void irc_keepalive(PurpleConnecti
static void irc_keepalive(PurpleConnection *gc)
{
- struct irc_conn *irc = gc->proto_data;
+ struct irc_conn *irc = purple_connection_get_protocol_data(gc);
if ((time(NULL) - irc->recv_time) > PING_TIMEOUT)
irc_cmd_ping(irc, NULL, NULL, NULL);
}
============================================================
--- libpurple/protocols/irc/parse.c 96e4f4e12e436c0db7935c1d11fbd1a424982935
+++ libpurple/protocols/irc/parse.c 94a125bd6c15800d099bad47db538084eb7d25e6
@@ -175,7 +175,7 @@ static PurpleCmdRet irc_parse_purple_cmd
if (!gc)
return PURPLE_CMD_RET_FAILED;
- irc = gc->proto_data;
+ irc = purple_connection_get_protocol_data(gc);
if ((cmdent = g_hash_table_lookup(irc->cmds, cmd)) == NULL)
return PURPLE_CMD_RET_FAILED;
============================================================
--- libpurple/protocols/irc/dcc_send.c 215a98c25398c35a0b5b19083f81b449ad2da89f
+++ libpurple/protocols/irc/dcc_send.c bc593f4f73dcb10ebd3fa54015f76ed3042432b3
@@ -297,7 +297,7 @@ irc_dccsend_network_listen_cb(int sock,
xd = purple_xfer_get_protocol_data(xfer);
gc = purple_account_get_connection(purple_xfer_get_account(xfer));
- irc = gc->proto_data;
+ irc = purple_connection_get_protocol_data(gc);
purple_xfer_unref(xfer);
@@ -323,7 +323,7 @@ irc_dccsend_network_listen_cb(int sock,
purple_xfer_get_filename(xfer), ntohl(addr.s_addr),
port, purple_xfer_get_size(xfer));
- irc_cmd_privmsg(gc->proto_data, "msg", NULL, arg);
+ irc_cmd_privmsg(purple_connection_get_protocol_data(gc), "msg", NULL, arg);
g_free(tmp);
}
More information about the Commits
mailing list