/soc/2013/ankitkv/gobjectification: 2df7191f56ea: Removed IO ops...
Ankit Vani
a at nevitus.org
Thu Sep 5 17:42:54 EDT 2013
Changeset: 2df7191f56ea0497fa73ca19b4e0fb5cc032effa
Author: Ankit Vani <a at nevitus.org>
Date: 2013-09-06 03:12 +0530
Branch: soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/2df7191f56ea
Description:
Removed IO ops from protocols
diffstat:
libpurple/protocols/bonjour/bonjour_ft.c | 35 ++++----------------
libpurple/protocols/irc/dcc_send.c | 39 ++++++----------------
libpurple/protocols/jabber/oob.c | 20 +++--------
libpurple/protocols/jabber/si.c | 39 +++++-----------------
libpurple/protocols/msn/msn.c | 17 +--------
libpurple/protocols/msn/slp.c | 8 +--
libpurple/protocols/msn/slpcall.c | 19 ++--------
libpurple/protocols/mxit/filexfer.c | 44 +++++++------------------
libpurple/protocols/oscar/oscar.c | 18 ++--------
libpurple/protocols/oscar/peer.c | 19 ++--------
libpurple/protocols/sametime/sametime.c | 37 ++++-----------------
libpurple/protocols/silc/ft.c | 54 ++++---------------------------
12 files changed, 80 insertions(+), 269 deletions(-)
diffs (truncated from 670 to 300 lines):
diff --git a/libpurple/protocols/bonjour/bonjour_ft.c b/libpurple/protocols/bonjour/bonjour_ft.c
--- a/libpurple/protocols/bonjour/bonjour_ft.c
+++ b/libpurple/protocols/bonjour/bonjour_ft.c
@@ -339,19 +339,6 @@ bonjour_free_xfer(PurpleXfer *xfer)
purple_debug_misc("bonjour", "Need close socket.\n");
}
-static PurpleXferIoOps send_ops =
-{
- bonjour_xfer_init, /* init */
- NULL, /* request_denied */
- NULL, /* start */
- bonjour_xfer_end, /* end */
- bonjour_xfer_cancel_send, /* cancel_send */
- NULL, /* cancel_recv */
- NULL, /* read */
- NULL, /* write */
- NULL, /* ack */
-};
-
PurpleXfer *
bonjour_new_xfer(PurpleConnection *gc, const char *who)
{
@@ -380,7 +367,9 @@ bonjour_new_xfer(PurpleConnection *gc, c
xep_xfer->mode = XEP_BYTESTREAMS;
xep_xfer->sid = NULL;
- purple_xfer_set_io_ops(xfer, &send_ops);
+ purple_xfer_set_init_fnc(xfer, bonjour_xfer_init);
+ purple_xfer_set_cancel_send_fnc(xfer, bonjour_xfer_cancel_send);
+ purple_xfer_set_end_fnc(xfer, bonjour_xfer_end);
bd->xfer_lists = g_slist_append(bd->xfer_lists, xfer);
@@ -754,19 +743,6 @@ xep_bytestreams_parse(PurpleConnection *
xep_ft_si_reject(bd, iq_id, purple_xfer_get_remote_user(xfer), "404", "cancel");
}
-static PurpleXferIoOps recieve_ops =
-{
- bonjour_xfer_init, /* init */
- bonjour_xfer_request_denied, /* request_denied */
- NULL, /* start */
- bonjour_xfer_end, /* end */
- NULL, /* cancel_send */
- bonjour_xfer_cancel_recv, /* cancel_recv */
- NULL, /* read */
- NULL, /* write */
- NULL, /* ack */
-};
-
static void
bonjour_xfer_receive(PurpleConnection *pc, const char *id, const char *sid, const char *from,
const goffset filesize, const char *filename, int option)
@@ -795,7 +771,10 @@ bonjour_xfer_receive(PurpleConnection *p
if(filesize > 0)
purple_xfer_set_size(xfer, filesize);
- purple_xfer_set_io_ops(xfer, &recieve_ops);
+ purple_xfer_set_init_fnc(xfer, bonjour_xfer_init);
+ purple_xfer_set_request_denied_fnc(xfer, bonjour_xfer_request_denied);
+ purple_xfer_set_cancel_recv_fnc(xfer, bonjour_xfer_cancel_recv);
+ purple_xfer_set_end_fnc(xfer, bonjour_xfer_end);
bd->xfer_lists = g_slist_append(bd->xfer_lists, xfer);
diff --git a/libpurple/protocols/irc/dcc_send.c b/libpurple/protocols/irc/dcc_send.c
--- a/libpurple/protocols/irc/dcc_send.c
+++ b/libpurple/protocols/irc/dcc_send.c
@@ -70,19 +70,6 @@ static void irc_dccsend_recv_init(Purple
xd->ip = NULL;
}
-static PurpleXferIoOps recieve_ops =
-{
- irc_dccsend_recv_init, /* init */
- irc_dccsend_recv_destroy, /* request_denied */
- NULL, /* start */
- irc_dccsend_recv_destroy, /* end */
- NULL, /* cancel_send */
- irc_dccsend_recv_destroy, /* cancel_recv */
- NULL, /* read */
- NULL, /* write */
- irc_dccsend_recv_ack, /* ack */
-};
-
/* This function makes the necessary arrangements for receiving files */
void irc_dccsend_recv(struct irc_conn *irc, const char *from, const char *msg) {
PurpleXfer *xfer;
@@ -144,7 +131,12 @@ void irc_dccsend_recv(struct irc_conn *i
filename->str, xd->ip);
purple_xfer_set_size(xfer, token[i+2] ? atoi(token[i+2]) : 0);
- purple_xfer_set_io_ops(xfer, &recieve_ops);
+ purple_xfer_set_init_fnc(xfer, irc_dccsend_recv_init);
+ purple_xfer_set_ack_fnc(xfer, irc_dccsend_recv_ack);
+
+ purple_xfer_set_end_fnc(xfer, irc_dccsend_recv_destroy);
+ purple_xfer_set_request_denied_fnc(xfer, irc_dccsend_recv_destroy);
+ purple_xfer_set_cancel_recv_fnc(xfer, irc_dccsend_recv_destroy);
purple_xfer_request(xfer);
}
@@ -358,19 +350,6 @@ static void irc_dccsend_send_init(Purple
}
-static PurpleXferIoOps send_ops =
-{
- irc_dccsend_send_init, /* init */
- irc_dccsend_send_destroy, /* request_denied */
- NULL, /* start */
- irc_dccsend_send_destroy, /* end */
- irc_dccsend_send_destroy, /* cancel_send */
- NULL, /* cancel_recv */
- NULL, /* read */
- irc_dccsend_send_write, /* write */
- NULL, /* ack */
-};
-
PurpleXfer *irc_dccsend_new_xfer(PurpleConnection *gc, const char *who) {
PurpleXfer *xfer;
struct irc_xfer_send_data *xd;
@@ -384,7 +363,11 @@ PurpleXfer *irc_dccsend_new_xfer(PurpleC
purple_xfer_set_protocol_data(xfer, xd);
/* Setup our I/O op functions */
- purple_xfer_set_io_ops(xfer, &send_ops);
+ purple_xfer_set_init_fnc(xfer, irc_dccsend_send_init);
+ purple_xfer_set_write_fnc(xfer, irc_dccsend_send_write);
+ purple_xfer_set_end_fnc(xfer, irc_dccsend_send_destroy);
+ purple_xfer_set_request_denied_fnc(xfer, irc_dccsend_send_destroy);
+ purple_xfer_set_cancel_send_fnc(xfer, irc_dccsend_send_destroy);
}
return xfer;
diff --git a/libpurple/protocols/jabber/oob.c b/libpurple/protocols/jabber/oob.c
--- a/libpurple/protocols/jabber/oob.c
+++ b/libpurple/protocols/jabber/oob.c
@@ -168,19 +168,6 @@ static void jabber_oob_xfer_recv_cancell
jabber_oob_xfer_recv_error(xfer, "404");
}
-static PurpleXferIoOps recieve_ops =
-{
- jabber_oob_xfer_init, /* init */
- jabber_oob_xfer_recv_denied, /* request_denied */
- jabber_oob_xfer_start, /* start */
- jabber_oob_xfer_end, /* end */
- NULL, /* cancel_send */
- jabber_oob_xfer_recv_cancelled, /* cancel_recv */
- NULL, /* read */
- NULL, /* write */
- NULL, /* ack */
-};
-
void jabber_oob_parse(JabberStream *js, const char *from, JabberIqType type,
const char *id, xmlnode *querynode) {
JabberOOBXfer *jox;
@@ -221,7 +208,12 @@ void jabber_oob_parse(JabberStream *js,
else
filename = slash + 1;
purple_xfer_set_filename(xfer, filename);
- purple_xfer_set_io_ops(xfer, &recieve_ops);
+
+ purple_xfer_set_init_fnc(xfer, jabber_oob_xfer_init);
+ purple_xfer_set_end_fnc(xfer, jabber_oob_xfer_end);
+ purple_xfer_set_request_denied_fnc(xfer, jabber_oob_xfer_recv_denied);
+ purple_xfer_set_cancel_recv_fnc(xfer, jabber_oob_xfer_recv_cancelled);
+ purple_xfer_set_start_fnc(xfer, jabber_oob_xfer_start);
js->oob_file_transfers = g_list_append(js->oob_file_transfers, xfer);
diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c
--- a/libpurple/protocols/jabber/si.c
+++ b/libpurple/protocols/jabber/si.c
@@ -1072,7 +1072,7 @@ jabber_si_xfer_ibb_open_cb(JabberStream
purple_circular_buffer_new(jabber_ibb_session_get_block_size(sess));
/* set up read function */
- purple_xfer_get_io_ops(xfer)->read = jabber_si_xfer_ibb_read;
+ purple_xfer_set_read_fnc(xfer, jabber_si_xfer_ibb_read);
/* start the transfer */
purple_xfer_start(xfer, -1, NULL, 0);
@@ -1154,7 +1154,7 @@ jabber_si_xfer_ibb_send_init(JabberStrea
jabber_ibb_session_set_error_callback(jsx->ibb_session,
jabber_si_xfer_ibb_error_cb);
- purple_xfer_get_io_ops(xfer)->write = jabber_si_xfer_ibb_write;
+ purple_xfer_set_write_fnc(xfer, jabber_si_xfer_ibb_write);
jsx->ibb_buffer =
purple_circular_buffer_new(jabber_ibb_session_get_max_data_size(jsx->ibb_session));
@@ -1616,19 +1616,6 @@ static void jabber_si_xfer_init(PurpleXf
}
}
-static PurpleXferIoOps send_ops =
-{
- jabber_si_xfer_init, /* init */
- NULL, /* request_denied */
- NULL, /* start */
- jabber_si_xfer_end, /* end */
- jabber_si_xfer_cancel_send, /* cancel_send */
- NULL, /* cancel_recv */
- NULL, /* read */
- NULL, /* write */
- NULL, /* ack */
-};
-
PurpleXfer *jabber_si_new_xfer(PurpleConnection *gc, const char *who)
{
JabberStream *js;
@@ -1648,7 +1635,9 @@ PurpleXfer *jabber_si_new_xfer(PurpleCon
jsx->ibb_session = NULL;
- purple_xfer_set_io_ops(xfer, &send_ops);
+ purple_xfer_set_init_fnc(xfer, jabber_si_xfer_init);
+ purple_xfer_set_cancel_send_fnc(xfer, jabber_si_xfer_cancel_send);
+ purple_xfer_set_end_fnc(xfer, jabber_si_xfer_end);
js->file_transfers = g_list_append(js->file_transfers, xfer);
}
@@ -1685,19 +1674,6 @@ jabber_si_thumbnail_cb(JabberData *data,
}
#endif
-static PurpleXferIoOps recieve_ops =
-{
- jabber_si_xfer_init, /* init */
- jabber_si_xfer_request_denied, /* request_denied */
- NULL, /* start */
- jabber_si_xfer_end, /* end */
- NULL, /* cancel_send */
- jabber_si_xfer_cancel_recv, /* cancel_recv */
- NULL, /* read */
- NULL, /* write */
- NULL, /* ack */
-};
-
void jabber_si_parse(JabberStream *js, const char *from, JabberIqType type,
const char *id, xmlnode *si)
{
@@ -1784,7 +1760,10 @@ void jabber_si_parse(JabberStream *js, c
if(filesize > 0)
purple_xfer_set_size(xfer, filesize);
- purple_xfer_set_io_ops(xfer, &recieve_ops);
+ purple_xfer_set_init_fnc(xfer, jabber_si_xfer_init);
+ purple_xfer_set_request_denied_fnc(xfer, jabber_si_xfer_request_denied);
+ purple_xfer_set_cancel_recv_fnc(xfer, jabber_si_xfer_cancel_recv);
+ purple_xfer_set_end_fnc(xfer, jabber_si_xfer_end);
js->file_transfers = g_list_append(js->file_transfers, xfer);
diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c
--- a/libpurple/protocols/msn/msn.c
+++ b/libpurple/protocols/msn/msn.c
@@ -875,19 +875,6 @@ t_msn_xfer_cancel_send(PurpleXfer *xfer)
msn_slplink_unref(slplink);
}
-static PurpleXferIoOps send_ops =
-{
- t_msn_xfer_init, /* init */
- NULL, /* request_denied */
- NULL, /* start */
- NULL, /* end */
- t_msn_xfer_cancel_send, /* cancel_send */
- NULL, /* cancel_recv */
- NULL, /* read */
- NULL, /* write */
- NULL, /* ack */
-};
-
static PurpleXfer*
msn_new_xfer(PurpleConnection *gc, const char *who)
{
@@ -901,7 +888,9 @@ msn_new_xfer(PurpleConnection *gc, const
g_return_val_if_fail(xfer != NULL, NULL);
purple_xfer_set_protocol_data(xfer, msn_slplink_ref(msn_session_get_slplink(session, who)));
- purple_xfer_set_io_ops(xfer, &send_ops);
+
+ purple_xfer_set_init_fnc(xfer, t_msn_xfer_init);
+ purple_xfer_set_cancel_send_fnc(xfer, t_msn_xfer_cancel_send);
return xfer;
}
diff --git a/libpurple/protocols/msn/slp.c b/libpurple/protocols/msn/slp.c
--- a/libpurple/protocols/msn/slp.c
+++ b/libpurple/protocols/msn/slp.c
@@ -369,13 +369,11 @@ msn_request_ft(PurpleXfer *xfer)
char *context;
const char *fn;
const char *fp;
- PurpleXferIoOps *io_ops;
More information about the Commits
mailing list