pidgin: 451d799d: Convert the bonjour prpl to use the new ...

andrew.victor at mxit.com andrew.victor at mxit.com
Fri Aug 26 17:30:53 EDT 2011


----------------------------------------------------------------------
Revision: 451d799d8eee6dc228515497c12ad5d521e1c62b
Parent:   b2c53d769ce87b56feb15d90826152e4855960f1
Author:   andrew.victor at mxit.com
Date:     08/26/11 14:20:25
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/451d799d8eee6dc228515497c12ad5d521e1c62b

Changelog: 

Convert the bonjour prpl to use the new API.


Changes against parent b2c53d769ce87b56feb15d90826152e4855960f1

  patched  libpurple/protocols/bonjour/bonjour_ft.c

-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/bonjour_ft.c	32fa3fc9eaffd055c9bf7faee6d2f643cbd28349
+++ libpurple/protocols/bonjour/bonjour_ft.c	94c46fde60d77f35adc3e566a1d27d8ed281ea37
@@ -90,7 +90,7 @@ static void bonjour_xfer_request_denied(
 
 static void bonjour_xfer_request_denied(PurpleXfer *xfer)
 {
-	XepXfer *xf = xfer->data;
+	XepXfer *xf = purple_xfer_get_protocol_data(xfer);
 
 	purple_debug_info("bonjour", "Bonjour-xfer-request-denied.\n");
 
@@ -162,7 +162,7 @@ bonjour_si_xfer_find(BonjourData *bd, co
 		xfer = xfers->data;
 		if(xfer == NULL)
 			break;
-		xf = xfer->data;
+		xf = purple_xfer_get_protocol_data(xfer);
 		if(xf == NULL)
 			break;
 		if(xf->sid && xfer->who && !strcmp(xf->sid, sid) &&
@@ -180,7 +180,7 @@ xep_ft_si_offer(PurpleXfer *xfer, const 
 {
 	xmlnode *si_node, *feature, *field, *file, *x;
 	XepIq *iq;
-	XepXfer *xf = xfer->data;
+	XepXfer *xf = purple_xfer_get_protocol_data(xfer);
 	BonjourData *bd = NULL;
 	char buf[32];
 
@@ -249,7 +249,7 @@ xep_ft_si_result(PurpleXfer *xfer, char 
 
 	if(!to || !xfer)
 		return;
-	xf = xfer->data;
+	xf = purple_xfer_get_protocol_data(xfer);
 	if(!xf)
 		return;
 
@@ -292,7 +292,7 @@ bonjour_free_xfer(PurpleXfer *xfer)
 
 	purple_debug_info("bonjour", "bonjour-free-xfer-%p.\n", xfer);
 
-	xf = (XepXfer*)xfer->data;
+	xf = purple_xfer_get_protocol_data(xfer);
 	if(xf != NULL) {
 		BonjourData *bd = (BonjourData*)xf->data;
 		if(bd != NULL) {
@@ -311,7 +311,7 @@ bonjour_free_xfer(PurpleXfer *xfer)
 		g_free(xf->buddy_ip);
 		g_free(xf->sid);
 		g_free(xf);
-		xfer->data = NULL;
+		purple_xfer_set_protocol_data(xfer, NULL);
 	}
 
 	purple_debug_info("bonjour", "Need close socket=%d.\n", xfer->fd);
@@ -334,7 +334,8 @@ bonjour_new_xfer(PurpleConnection *gc, c
 
 	/* Build the file transfer handle */
 	xfer = purple_xfer_new(gc->account, PURPLE_XFER_SEND, who);
-	xfer->data = xep_xfer = g_new0(XepXfer, 1);
+	xep_xfer = g_new0(XepXfer, 1);
+	purple_xfer_set_protocol_data(xfer, xep_xfer);
 	xep_xfer->data = bd;
 
 	purple_debug_info("bonjour", "Bonjour-new-xfer bd=%p data=%p.\n", bd, xep_xfer->data);
@@ -379,7 +380,7 @@ bonjour_xfer_init(PurpleXfer *xfer)
 	BonjourBuddy *bb;
 	XepXfer *xf;
 
-	xf = (XepXfer*)xfer->data;
+	xf = purple_xfer_get_protocol_data(xfer);
 	if(xf == NULL)
 		return;
 
@@ -530,7 +531,7 @@ xep_bytestreams_parse(PurpleConnection *
 				int portnum;
 				XepXfer *xf = NULL;
 
-				xf = (XepXfer*)xfer->data;
+				xf = purple_xfer_get_protocol_data(xfer);
 				for(streamhost = xmlnode_get_child(query, "streamhost");
 						streamhost;
 						streamhost = xmlnode_get_next_twin(streamhost)) {
@@ -592,7 +593,8 @@ bonjour_xfer_receive(PurpleConnection *p
 
 	/* Build the file transfer handle */
 	xfer = purple_xfer_new(pc->account, PURPLE_XFER_RECEIVE, from);
-	xfer->data = xf = g_new0(XepXfer, 1);
+	xf = g_new0(XepXfer, 1);
+	purple_xfer_set_protocol_data(xfer, xf);
 	xf->data = bd;
 	purple_xfer_set_filename(xfer, filename);
 	xf->iq_id = g_strdup(id);
@@ -614,7 +616,7 @@ bonjour_sock5_request_cb(gpointer data, 
 bonjour_sock5_request_cb(gpointer data, gint source, PurpleInputCondition cond)
 {
 	PurpleXfer *xfer = data;
-	XepXfer *xf = xfer->data;
+	XepXfer *xf = purple_xfer_get_protocol_data(xfer);
 	int acceptfd;
 	int len = 0;
 
@@ -759,7 +761,7 @@ bonjour_bytestreams_listen(int sock, gpo
 
 	xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ,
 					 bonjour_sock5_request_cb, xfer);
-	xf = (XepXfer*)xfer->data;
+	xf = purple_xfer_get_protocol_data(xfer);
 	xf->listen_data = NULL;
 
 	bd = xf->data;
@@ -797,7 +799,7 @@ bonjour_bytestreams_init(PurpleXfer *xfe
 		return;
 
 	purple_debug_info("bonjour", "Bonjour-bytestreams-init.\n");
-	xf = xfer->data;
+	xf = purple_xfer_get_protocol_data(xfer);
 
 	purple_network_listen_map_external(FALSE);
 	xf->listen_data = purple_network_listen_range(0, 0, SOCK_STREAM,
@@ -813,7 +815,7 @@ bonjour_bytestreams_connect_cb(gpointer 
 bonjour_bytestreams_connect_cb(gpointer data, gint source, const gchar *error_message)
 {
 	PurpleXfer *xfer = data;
-	XepXfer *xf = xfer->data;
+	XepXfer *xf = purple_xfer_get_protocol_data(xfer);
 	XepIq *iq;
 	xmlnode *q_node, *tmp_node;
 	BonjourData *bd;
@@ -862,7 +864,7 @@ bonjour_bytestreams_connect(PurpleXfer *
 
 	purple_debug_info("bonjour", "bonjour-bytestreams-connect.\n");
 
-	xf = (XepXfer*)xfer->data;
+	xf = purple_xfer_get_protocol_data(xfer);
 	if(!xf)
 		return;
 


More information about the Commits mailing list