# HG changeset patch # User andrew.victor@mxit.com # Date 1314386609 0 # Node ID dc4de0b08405ce41d3d29d4452e42e746a206d56 # Parent 7c65c7054905071af403ed2c8dff4cfee202f000 Convert the yahoo prpl to using the new API. diff -r 7c65c7054905 -r dc4de0b08405 libpurple/protocols/yahoo/yahoo_filexfer.c --- a/libpurple/protocols/yahoo/yahoo_filexfer.c Fri Aug 26 19:11:09 2011 +0000 +++ b/libpurple/protocols/yahoo/yahoo_filexfer.c Fri Aug 26 19:23:29 2011 +0000 @@ -123,7 +123,7 @@ int remaining, written; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); remaining = xd->txbuflen - xd->txbuf_written; written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); @@ -160,7 +160,7 @@ if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; if ((source < 0) || (xd->path == NULL) || (xd->host == NULL)) { purple_xfer_error(PURPLE_XFER_RECEIVE, purple_xfer_get_account(xfer), @@ -194,7 +194,7 @@ int written, remaining; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); remaining = xd->txbuflen - xd->txbuf_written; written = write(xfer->fd, xd->txbuf + xd->txbuf_written, remaining); @@ -239,7 +239,7 @@ if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; if (source < 0) { @@ -313,7 +313,7 @@ PurpleAccount *account; YahooData *yd; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); gc = xfer_data->gc; yd = gc->proto_data; account = purple_connection_get_account(gc); @@ -357,7 +357,7 @@ YahooData *yd; struct yahoo_packet *pkt; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); gc = xfer_data->gc; yd = gc->proto_data; account = purple_connection_get_account(gc); @@ -430,7 +430,7 @@ gchar *length; gchar *end; int filelen; - struct yahoo_xfer_data *xd = xfer->data; + struct yahoo_xfer_data *xd = purple_xfer_get_protocol_data(xfer); if (purple_xfer_get_type(xfer) != PURPLE_XFER_RECEIVE) { return 0; @@ -490,7 +490,7 @@ static gssize yahoo_xfer_write(const guchar *buffer, size_t size, PurpleXfer *xfer) { gssize len; - struct yahoo_xfer_data *xd = xfer->data; + struct yahoo_xfer_data *xd = purple_xfer_get_protocol_data(xfer); if (!xd) return -1; @@ -516,7 +516,7 @@ { struct yahoo_xfer_data *xfer_data; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) { @@ -556,14 +556,14 @@ if (xfer_data) yahoo_xfer_data_free(xfer_data); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } static void yahoo_xfer_cancel_recv(PurpleXfer *xfer) { struct yahoo_xfer_data *xfer_data; - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); if(purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL && xfer_data->version == 15) { @@ -603,7 +603,7 @@ if (xfer_data) yahoo_xfer_data_free(xfer_data); - xfer->data = NULL; + purple_xfer_set_protocol_data(xfer, NULL); } /* Send HTTP OK after receiving file */ @@ -633,7 +633,7 @@ PurpleConnection *gc; YahooData *yd; - xfer_data = xfer_old->data; + xfer_data = purple_xfer_get_protocol_data(xfer_old); if(xfer_data && xfer_data->version == 15 && purple_xfer_get_type(xfer_old) == PURPLE_XFER_RECEIVE && xfer_data->filename_list) { @@ -689,7 +689,7 @@ xfer_data->firstoflist = FALSE; /* Dereference xfer_data from old xfer */ - xfer_old->data = NULL; + purple_xfer_set_protocol_data(xfer_old, NULL); /* Build the file transfer handle. */ xfer = purple_xfer_new(gc->account, PURPLE_XFER_RECEIVE, xfer_old->who); @@ -702,7 +702,7 @@ g_free(utf8_filename); purple_xfer_set_size(xfer, filesize); - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Setup our I/O op functions */ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); @@ -726,8 +726,7 @@ } if (xfer_data) yahoo_xfer_data_free(xfer_data); - xfer_old->data = NULL; - + purple_xfer_set_protocol_data(xfer_old, NULL); } void yahoo_process_p2pfilexfer(PurpleConnection *gc, struct yahoo_packet *pkt) @@ -886,7 +885,7 @@ g_return_if_reached(); } - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Set the info about the incoming file. */ if (filename) { @@ -943,7 +942,7 @@ g_return_val_if_reached(NULL); } - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Setup our I/O op functions */ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init); @@ -993,7 +992,7 @@ if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; gc = xd->gc; account = purple_connection_get_account(gc); @@ -1086,7 +1085,7 @@ if( !g_hash_table_lookup(yd->peers, who) ) yahoo_send_p2p_pkt(gc, who, 0); - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); xfer_data->status_15 = STARTED; purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); xfer_data->version = 15; @@ -1114,7 +1113,7 @@ PurpleConnection *gc; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); account = purple_connection_get_account(xd->gc); gc = xd->gc; @@ -1167,7 +1166,7 @@ int remaining, written; xfer = data; - xd = xfer->data; + xd = purple_xfer_get_protocol_data(xfer); remaining = xd->txbuflen - xd->txbuf_written; written = write(source, xd->txbuf + xd->txbuf_written, remaining); @@ -1239,7 +1238,7 @@ if (!(xfer = data)) return; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; gc = xd->gc; account = purple_connection_get_account(gc); @@ -1373,7 +1372,7 @@ struct yahoo_xfer_data *xd; xfer = data; - if (!(xd = xfer->data)) { + if (!(xd = purple_xfer_get_protocol_data(xfer))) { purple_xfer_cancel_remote(xfer); return; } @@ -1396,7 +1395,7 @@ char *time_str; xfer = data; - if (!(xd = xfer->data)) { + if (!(xd = purple_xfer_get_protocol_data(xfer))) { purple_xfer_cancel_remote(xfer); return; } @@ -1458,7 +1457,7 @@ struct yahoo_xfer_data *xd; xfer = data; - if (!(xd = xfer->data)) { + if (!(xd = purple_xfer_get_protocol_data(xfer))) { purple_xfer_cancel_remote(xfer); return; } @@ -1500,7 +1499,7 @@ char *filename_without_spaces = NULL; xfer = data; - if (!(xd = xfer->data) || (listenfd == -1)) { + if (!(xd = purple_xfer_get_protocol_data(xfer)) || (listenfd == -1)) { purple_debug_warning("yahoo","p2p: error starting server for p2p file transfer\n"); purple_xfer_cancel_remote(xfer); return; @@ -1564,7 +1563,7 @@ gchar *filename; struct yahoo_p2p_data *p2p_data; - if (!(xd = xfer->data)) + if (!(xd = purple_xfer_get_protocol_data(xfer))) return; account = purple_connection_get_account(gc); @@ -1747,7 +1746,7 @@ g_free(utf8_filename); purple_xfer_set_size(xfer, filesize); - xfer->data = xfer_data; + purple_xfer_set_protocol_data(xfer, xfer_data); /* Setup our I/O op functions */ purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15); @@ -1837,7 +1836,7 @@ return; } - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); xfer_data->info_val_249 = val_249; xfer_data->xfer_idstring_for_relay = g_strdup(xfer_idstring_for_relay); @@ -1934,7 +1933,7 @@ return; } - xfer_data = xfer->data; + xfer_data = purple_xfer_get_protocol_data(xfer); if(url) purple_url_parse(url, &(xfer_data->host), &(xfer_data->port), &(xfer_data->path), NULL, NULL);