pidgin: 8d8c5e96: Convert the jabber prpl to use the new A...
andrew.victor at mxit.com
andrew.victor at mxit.com
Fri Aug 26 17:30:56 EDT 2011
----------------------------------------------------------------------
Revision: 8d8c5e967f417b9f69f7ab7479301cd227f909ca
Parent: b09159d6058e5a29e69edb3a922d6968ca034409
Author: andrew.victor at mxit.com
Date: 08/26/11 15:06:02
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8d8c5e967f417b9f69f7ab7479301cd227f909ca
Changelog:
Convert the jabber prpl to use the new API.
Changes against parent b09159d6058e5a29e69edb3a922d6968ca034409
patched libpurple/protocols/jabber/oob.c
patched libpurple/protocols/jabber/si.c
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/oob.c 21febd77dcfc1b208d841290a68bf8c206b7ccf8
+++ libpurple/protocols/jabber/oob.c 8bee69b4c0478cc9561ba0b5b8b4eb233ddeaa8b
@@ -48,13 +48,13 @@ static void jabber_oob_xfer_init(PurpleX
static void jabber_oob_xfer_init(PurpleXfer *xfer)
{
- JabberOOBXfer *jox = xfer->data;
+ JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer);
purple_xfer_start(xfer, -1, jox->address, jox->port);
}
static void jabber_oob_xfer_free(PurpleXfer *xfer)
{
- JabberOOBXfer *jox = xfer->data;
+ JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer);
jox->js->oob_file_transfers = g_list_remove(jox->js->oob_file_transfers,
xfer);
@@ -67,12 +67,12 @@ static void jabber_oob_xfer_free(PurpleX
purple_input_remove(jox->writeh);
g_free(jox);
- xfer->data = NULL;
+ purple_xfer_set_protocol_data(xfer, NULL);
}
static void jabber_oob_xfer_end(PurpleXfer *xfer)
{
- JabberOOBXfer *jox = xfer->data;
+ JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer);
JabberIq *iq;
iq = jabber_iq_new(jox->js, JABBER_IQ_RESULT);
@@ -86,7 +86,7 @@ static void jabber_oob_xfer_request_send
static void jabber_oob_xfer_request_send(gpointer data, gint source, PurpleInputCondition cond) {
PurpleXfer *xfer = data;
- JabberOOBXfer *jox = xfer->data;
+ JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer);
int len, total_len = strlen(jox->write_buffer);
len = write(xfer->fd, jox->write_buffer + jox->written_len,
@@ -110,7 +110,7 @@ static void jabber_oob_xfer_start(Purple
static void jabber_oob_xfer_start(PurpleXfer *xfer)
{
- JabberOOBXfer *jox = xfer->data;
+ JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer);
if(jox->write_buffer == NULL) {
jox->write_buffer = g_strdup_printf(
@@ -126,7 +126,7 @@ static gssize jabber_oob_xfer_read(gucha
}
static gssize jabber_oob_xfer_read(guchar **buffer, PurpleXfer *xfer) {
- JabberOOBXfer *jox = xfer->data;
+ JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer);
char test[2048];
char *tmp, *lenstr;
int len;
@@ -158,7 +158,7 @@ static void jabber_oob_xfer_recv_error(P
}
static void jabber_oob_xfer_recv_error(PurpleXfer *xfer, const char *code) {
- JabberOOBXfer *jox = xfer->data;
+ JabberOOBXfer *jox = purple_xfer_get_protocol_data(xfer);
JabberIq *iq;
xmlnode *y, *z;
@@ -221,7 +221,7 @@ void jabber_oob_parse(JabberStream *js,
xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from);
if (xfer)
{
- xfer->data = jox;
+ purple_xfer_set_protocol_data(xfer, jox);
if(!(filename = g_strdup(g_strrstr(jox->page, "/"))))
filename = g_strdup(jox->page);
============================================================
--- libpurple/protocols/jabber/si.c 5d124c72109c805345b052ce8684de5d2b782f0f
+++ libpurple/protocols/jabber/si.c d5354598668135f0c78d9335a6e6f4f6c76a33a6
@@ -87,7 +87,7 @@ jabber_si_xfer_find(JabberStream *js, co
for(xfers = js->file_transfers; xfers; xfers = xfers->next) {
PurpleXfer *xfer = xfers->data;
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
if(jsx->stream_id && xfer->who &&
!strcmp(jsx->stream_id, sid) && !strcmp(xfer->who, from))
return xfer;
@@ -118,7 +118,7 @@ jabber_si_bytestreams_connect_cb(gpointe
jabber_si_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message)
{
PurpleXfer *xfer = data;
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
JabberIq *iq;
xmlnode *query, *su;
JabberBytestreamsStreamhost *streamhost = jsx->streamhosts->data;
@@ -174,7 +174,7 @@ connect_timeout_cb(gpointer data)
connect_timeout_cb(gpointer data)
{
PurpleXfer *xfer = data;
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
purple_debug_info("jabber", "Streamhost connection timeout of %d seconds exceeded.\n", STREAMHOST_CONNECT_TIMEOUT);
@@ -203,7 +203,7 @@ jabber_si_bytestreams_ibb_timeout_cb(gpo
jabber_si_bytestreams_ibb_timeout_cb(gpointer data)
{
PurpleXfer *xfer = (PurpleXfer *) data;
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
if (jsx && !jsx->ibb_session) {
purple_debug_info("jabber",
@@ -218,7 +218,7 @@ static void jabber_si_bytestreams_attemp
static void jabber_si_bytestreams_attempt_connect(PurpleXfer *xfer)
{
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
JabberBytestreamsStreamhost *streamhost;
JabberID *dstjid;
@@ -337,7 +337,7 @@ void jabber_bytestreams_parse(JabberStre
if(!(xfer = jabber_si_xfer_find(js, sid, from)))
return;
- jsx = xfer->data;
+ jsx = purple_xfer_get_protocol_data(xfer);
if(!jsx->accepted)
return;
@@ -375,7 +375,7 @@ jabber_si_xfer_bytestreams_send_read_aga
PurpleInputCondition cond)
{
PurpleXfer *xfer = data;
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
int len;
len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen);
@@ -412,7 +412,7 @@ jabber_si_xfer_bytestreams_send_read_aga
PurpleInputCondition cond)
{
PurpleXfer *xfer = data;
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
char buffer[42]; /* 40 for DST.ADDR + 2 bytes for port number*/
int len;
char *dstaddr, *hash;
@@ -527,7 +527,7 @@ jabber_si_xfer_bytestreams_send_read_res
PurpleInputCondition cond)
{
PurpleXfer *xfer = data;
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
int len;
len = write(source, jsx->rxqueue + jsx->rxlen, jsx->rxmaxlen - jsx->rxlen);
@@ -568,7 +568,7 @@ jabber_si_xfer_bytestreams_send_read_cb(
PurpleInputCondition cond)
{
PurpleXfer *xfer = data;
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
int i;
int len;
char buffer[256];
@@ -680,7 +680,7 @@ jabber_si_xfer_bytestreams_send_connecte
PurpleInputCondition cond)
{
PurpleXfer *xfer = data;
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
int acceptfd, flags;
purple_debug_info("jabber", "in jabber_si_xfer_bytestreams_send_connected_cb\n");
@@ -727,12 +727,12 @@ jabber_si_connect_proxy_cb(JabberStream
return;
}
+ jsx = purple_xfer_get_protocol_data(xfer);
+
/* In the case of a direct file transfer, this is expected to return */
- if(!xfer->data)
+ if(!jsx)
return;
- jsx = xfer->data;
-
if(type != JABBER_IQ_RESULT) {
purple_debug_info("jabber",
"jabber_si_xfer_connect_proxy_cb: type = error\n");
@@ -835,7 +835,7 @@ jabber_si_xfer_bytestreams_listen_cb(int
JabberBytestreamsStreamhost *sh, *sh2;
int streamhost_count = 0;
- jsx = xfer->data;
+ jsx = purple_xfer_get_protocol_data(xfer);
jsx->listen_data = NULL;
/* I'm not sure under which conditions this can happen
@@ -969,7 +969,7 @@ jabber_si_xfer_bytestreams_send_init(Pur
purple_xfer_ref(xfer);
- jsx = xfer->data;
+ jsx = purple_xfer_get_protocol_data(xfer);
/* TODO: This should probably be done with an account option instead of
* piggy-backing on the TOR proxy type. */
@@ -1017,7 +1017,7 @@ jabber_si_xfer_ibb_recv_data_cb(JabberIB
gsize size)
{
PurpleXfer *xfer = (PurpleXfer *) jabber_ibb_session_get_user_data(sess);
- JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
if (size <= purple_xfer_get_bytes_remaining(xfer)) {
purple_debug_info("jabber", "about to write %" G_GSIZE_FORMAT " bytes from IBB stream\n",
@@ -1037,7 +1037,7 @@ jabber_si_xfer_ibb_read(guchar **out_buf
static gssize
jabber_si_xfer_ibb_read(guchar **out_buffer, PurpleXfer *xfer)
{
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
guchar *buffer;
gsize size;
gsize tmp;
@@ -1060,7 +1060,7 @@ jabber_si_xfer_ibb_open_cb(JabberStream
const gchar *sid = xmlnode_get_attrib(open, "sid");
PurpleXfer *xfer = jabber_si_xfer_find(js, sid, who);
if (xfer) {
- JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
JabberIBBSession *sess =
jabber_ibb_session_create_from_xmlnode(js, who, id, open, xfer);
@@ -1105,7 +1105,7 @@ jabber_si_xfer_ibb_write(const guchar *b
static gssize
jabber_si_xfer_ibb_write(const guchar *buffer, size_t len, PurpleXfer *xfer)
{
- JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
JabberIBBSession *sess = jsx->ibb_session;
gsize packet_size = len < jabber_ibb_session_get_max_data_size(sess) ?
len : jabber_ibb_session_get_max_data_size(sess);
@@ -1149,7 +1149,7 @@ jabber_si_xfer_ibb_send_init(JabberStrea
static void
jabber_si_xfer_ibb_send_init(JabberStream *js, PurpleXfer *xfer)
{
- JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
jsx->ibb_session = jabber_ibb_session_create(js, jsx->stream_id,
purple_xfer_get_remote_user(xfer), xfer);
@@ -1206,7 +1206,7 @@ static void jabber_si_xfer_send_method_c
for(field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) {
const char *var = xmlnode_get_attrib(field, "var");
- JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
if(var && !strcmp(var, "stream-method")) {
if((value = xmlnode_get_child(field, "value"))) {
@@ -1237,7 +1237,7 @@ static void jabber_si_xfer_send_request(
static void jabber_si_xfer_send_request(PurpleXfer *xfer)
{
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
JabberIq *iq;
xmlnode *si, *file, *feature, *x, *field, *option, *value;
char buf[32];
@@ -1309,7 +1309,7 @@ static void jabber_si_xfer_free(PurpleXf
static void jabber_si_xfer_free(PurpleXfer *xfer)
{
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
if (jsx) {
JabberStream *js = jsx->js;
@@ -1356,7 +1356,7 @@ static void jabber_si_xfer_free(PurpleXf
/* XXX: free other stuff */
g_free(jsx->rxqueue);
g_free(jsx);
- xfer->data = NULL;
+ purple_xfer_set_protocol_data(xfer, NULL);
}
}
@@ -1367,7 +1367,7 @@ static void jabber_si_xfer_cancel_send(P
*/
static void jabber_si_xfer_cancel_send(PurpleXfer *xfer)
{
- JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
/* if there is an IBB session active, send close on that */
if (jsx->ibb_session) {
@@ -1380,7 +1380,7 @@ static void jabber_si_xfer_request_denie
static void jabber_si_xfer_request_denied(PurpleXfer *xfer)
{
- JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
JabberStream *js = jsx->js;
/*
@@ -1412,7 +1412,7 @@ static void jabber_si_xfer_cancel_recv(P
static void jabber_si_xfer_cancel_recv(PurpleXfer *xfer)
{
- JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
/* if there is an IBB session active, send close */
if (jsx->ibb_session) {
jabber_ibb_session_close(jsx->ibb_session);
@@ -1432,7 +1432,7 @@ static void jabber_si_xfer_send_disco_cb
JabberCapabilities capabilities, gpointer data)
{
PurpleXfer *xfer = (PurpleXfer *) data;
- JabberSIXfer *jsx = (JabberSIXfer *) xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
if (capabilities & JABBER_CAP_IBB) {
purple_debug_info("jabber",
@@ -1458,7 +1458,7 @@ static void do_transfer_send(PurpleXfer
static void do_transfer_send(PurpleXfer *xfer, const char *resource)
{
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
char **who_v = g_strsplit(xfer->who, "/", 2);
char *who;
JabberBuddy *jb;
@@ -1508,7 +1508,7 @@ static void jabber_si_xfer_init(PurpleXf
static void jabber_si_xfer_init(PurpleXfer *xfer)
{
- JabberSIXfer *jsx = xfer->data;
+ JabberSIXfer *jsx = purple_xfer_get_protocol_data(xfer);
JabberIq *iq;
if(purple_xfer_get_type(xfer) == PURPLE_XFER_SEND) {
JabberBuddy *jb;
@@ -1641,7 +1641,8 @@ PurpleXfer *jabber_si_new_xfer(PurpleCon
xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who);
if (xfer)
{
- xfer->data = jsx = g_new0(JabberSIXfer, 1);
+ jsx = g_new0(JabberSIXfer, 1);
+ purple_xfer_set_protocol_data(xfer, jsx);
jsx->js = js;
jsx->local_streamhost_fd = -1;
@@ -1777,7 +1778,7 @@ void jabber_si_parse(JabberStream *js, c
xfer = purple_xfer_new(js->gc->account, PURPLE_XFER_RECEIVE, from);
g_return_if_fail(xfer != NULL);
- xfer->data = jsx;
+ purple_xfer_set_protocol_data(xfer, jsx);
purple_xfer_set_filename(xfer, filename);
if(filesize > 0)
More information about the Commits
mailing list