gobjectification: cc7d4695: --enable-compile for bonjour.

sadrul at pidgin.im sadrul at pidgin.im
Thu Mar 13 04:39:54 EDT 2008


-----------------------------------------------------------------
Revision: cc7d4695c0ff557f5a2de4d3f22a6f1228570c03
Ancestor: 1ab80b449e1be746113c2c6d8871b4b8a73f33ea
Author: sadrul at pidgin.im
Date: 2008-03-13T03:04:47
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/cc7d4695c0ff557f5a2de4d3f22a6f1228570c03

Modified files:
        libpurple/protocols/bonjour/bonjour.c
        libpurple/protocols/bonjour/bonjour_ft.c
        libpurple/protocols/bonjour/buddy.c
        libpurple/protocols/bonjour/jabber.c
        libpurple/protocols/bonjour/mdns_avahi.c
        libpurple/protocols/bonjour/mdns_win32.c

ChangeLog: 

--enable-compile for bonjour.

-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/bonjour.c	2ebf62770c3aba4a0ce3bcffab88402dc224c100
+++ libpurple/protocols/bonjour/bonjour.c	264ad6bfdab4f5ba4b76939b4ff9d8e5a5de6372
@@ -105,8 +105,8 @@ bonjour_login(PurpleAccount *account)
 	}
 #endif
 
-	gc->flags |= PURPLE_CONNECTION_FLAGS_HTML;
-	gc->proto_data = bd = g_new0(BonjourData, 1);
+	purple_connection_set_flags(gc, purple_connection_get_flags(gc) | PURPLE_CONNECTION_FLAGS_HTML);
+	purple_object_set_protocol_data(PURPLE_OBJECT(gc),bd = g_new0(BonjourData, 1));
 
 	/* Start waiting for jabber connections (iChat style) */
 	bd->jabber_data = g_new0(BonjourJabber, 1);
@@ -162,7 +162,7 @@ bonjour_close(PurpleConnection *connecti
 bonjour_close(PurpleConnection *connection)
 {
 	PurpleGroup *bonjour_group;
-	BonjourData *bd = connection->proto_data;
+	BonjourData *bd = purple_object_get_protocol_data(PURPLE_OBJECT(connection));
 
 	/* Remove all the bonjour buddies */
 	bonjour_removeallfromlocal(connection);
@@ -192,7 +192,7 @@ bonjour_close(PurpleConnection *connecti
 	}
 
 	g_free(bd);
-	connection->proto_data = NULL;
+	purple_object_set_protocol_data(PURPLE_OBJECT(connection),NULL);
 }
 
 static const char *
@@ -207,7 +207,7 @@ bonjour_send_im(PurpleConnection *connec
 	if(!to || !msg)
 		return 0;
 
-	return bonjour_jabber_send_message(((BonjourData*)(connection->proto_data))->jabber_data, to, msg);
+	return bonjour_jabber_send_message(((BonjourData*)(purple_object_get_protocol_data(PURPLE_OBJECT(connection))))->jabber_data, to, msg);
 }
 
 static void
@@ -223,7 +223,7 @@ bonjour_set_status(PurpleAccount *accoun
 	gchar *stripped;
 
 	gc = purple_account_get_connection(account);
-	bd = gc->proto_data;
+	bd = purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	disconnected = purple_account_is_disconnected(account);
 	type = purple_status_get_type(status);
 	primitive = purple_status_type_get_primitive(type);
@@ -272,9 +272,9 @@ static void bonjour_remove_buddy(PurpleC
 
 
 static void bonjour_remove_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) {
-	if (buddy->proto_data) {
-		bonjour_buddy_delete(buddy->proto_data);
-		buddy->proto_data = NULL;
+	if (purple_object_get_protocol_data(PURPLE_OBJECT(buddy))) {
+		bonjour_buddy_delete(purple_object_get_protocol_data(PURPLE_OBJECT(buddy)));
+		purple_object_set_protocol_data(PURPLE_OBJECT(buddy),NULL);
 	}
 }
 
@@ -311,7 +311,7 @@ bonjour_convo_closed(PurpleConnection *c
 static void
 bonjour_convo_closed(PurpleConnection *connection, const char *who)
 {
-	PurpleBuddy *buddy = purple_find_buddy(connection->account, who);
+	PurpleBuddy *buddy = purple_find_buddy(purple_connection_get_account(connection), who);
 	BonjourBuddy *bb;
 
 	if (buddy == NULL || buddy->proto_data == NULL)
@@ -323,7 +323,7 @@ bonjour_convo_closed(PurpleConnection *c
 		return;
 	}
 
-	bb = buddy->proto_data;
+	bb = purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
 	bonjour_jabber_close_conversation(bb->conversation);
 	bb->conversation = NULL;
 }
@@ -331,7 +331,7 @@ void bonjour_set_buddy_icon(PurpleConnec
 static
 void bonjour_set_buddy_icon(PurpleConnection *conn, PurpleStoredImage *img)
 {
-	BonjourData *bd = conn->proto_data;
+	BonjourData *bd = purple_object_get_protocol_data(PURPLE_OBJECT(conn));
 	bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data);
 }
 
@@ -362,7 +362,7 @@ bonjour_tooltip_text(PurpleBuddy *buddy,
 {
 	PurplePresence *presence;
 	PurpleStatus *status;
-	BonjourBuddy *bb = buddy->proto_data;
+	BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
 	const char *status_description;
 	const char *message;
 
============================================================
--- libpurple/protocols/bonjour/bonjour_ft.c	8653bec6764145acedd450fb7194c0919f178e9b
+++ libpurple/protocols/bonjour/bonjour_ft.c	7d6ec03f0ed1f2c15a16312839ecc216aa41c77a
@@ -339,7 +339,7 @@ bonjour_new_xfer(PurpleConnection *gc, c
 		return NULL;
 
 	purple_debug_info("bonjour", "Bonjour-new-xfer to %s.\n", who);
-	bd = (BonjourData*) gc->proto_data;
+	bd = (BonjourData*) purple_object_get_protocol_data(PURPLE_OBJECT(gc));
 	if(bd == NULL)
 		return NULL;
 
@@ -401,7 +401,7 @@ bonjour_xfer_init(PurpleXfer *xfer)
 	if (buddy == NULL)
 		return;
 
-	bb = (BonjourBuddy *)buddy->proto_data;
+	bb = (BonjourBuddy *)purple_object_get_protocol_data(PURPLE_OBJECT(buddy));
 	/* Assume it is the first IP. We could do something like keep track of which one is in use or something. */
 	if (bb->ips)
 		xf->buddy_ip = g_strdup(bb->ips->data);
@@ -425,7 +425,7 @@ xep_si_parse(PurpleConnection *pc, xmlno
 
 	if(pc == NULL || packet == NULL || pb == NULL)
 		return;
-	bd = (BonjourData*) pc->proto_data;
+	bd = (BonjourData*) purple_object_get_protocol_data(PURPLE_OBJECT(pc));
 	if(bd == NULL)
 		return;
 
@@ -465,7 +465,7 @@ xep_si_parse(PurpleConnection *pc, xmlno
 
 			if (!parsed_receive) {
 				purple_debug_info("bonjour", "rejecting unrecognized si SET offer.\n");
-				xep_ft_si_reject((BonjourData *)pc->proto_data, id, pb->name, "403", "cancel");
+				xep_ft_si_reject((BonjourData *)purple_object_get_protocol_data(PURPLE_OBJECT(pc)), id, pb->name, "403", "cancel");
 				/*TODO: Send Cancel (501) */
 			}
 		} else if(!strcmp(type, "result")) {
@@ -475,7 +475,7 @@ xep_si_parse(PurpleConnection *pc, xmlno
 
 			if(xfer == NULL) {
 				purple_debug_info("bonjour", "xfer find fail.\n");
-				xep_ft_si_reject((BonjourData *)pc->proto_data, id, pb->name, "403", "cancel");
+				xep_ft_si_reject((BonjourData *)purple_object_get_protocol_data(PURPLE_OBJECT(pc)), id, pb->name, "403", "cancel");
 			} else
 				bonjour_bytestreams_init(xfer);
 
@@ -506,7 +506,7 @@ xep_bytestreams_parse(PurpleConnection *
 	if(pc == NULL || packet == NULL || pb == NULL)
 		return;
 
-	bd = (BonjourData*) pc->proto_data;
+	bd = (BonjourData*) purple_object_get_protocol_data(PURPLE_OBJECT(pc));
 	if(bd == NULL)
 		return;
 
@@ -584,14 +584,14 @@ bonjour_xfer_receive(PurpleConnection *p
 	if(pc == NULL || id == NULL || from == NULL)
 		return;
 
-	bd = (BonjourData*) pc->proto_data;
+	bd = (BonjourData*) purple_object_get_protocol_data(PURPLE_OBJECT(pc));
 	if(bd == NULL)
 		return;
 
 	purple_debug_info("bonjour", "bonjour-xfer-receive.\n");
 
 	/* Build the file transfer handle */
-	xfer = purple_xfer_new(pc->account, PURPLE_XFER_RECEIVE, from);
+	xfer = purple_xfer_new(purple_connection_get_account(pc), PURPLE_XFER_RECEIVE, from);
 	xfer->data = xf = g_new0(XepXfer, 1);
 	xf->data = bd;
 	purple_xfer_set_filename(xfer, filename);
============================================================
--- libpurple/protocols/bonjour/buddy.c	f82aa1b7dc08a09471bba9385e18212cb9db74d5
+++ libpurple/protocols/bonjour/buddy.c	0994d33cbed51d325335a69c45e5507b1a4eca20
@@ -153,7 +153,7 @@ bonjour_buddy_add_to_purple(BonjourBuddy
 
 	if (buddy == NULL) {
 		buddy = purple_buddy_new(account, bonjour_buddy->name, NULL);
-		buddy->proto_data = bonjour_buddy;
+		purple_object_set_protocol_data(PURPLE_OBJECT(buddy),bonjour_buddy);
 		purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE);
 		purple_blist_add_buddy(buddy, NULL, group, NULL);
 	}
============================================================
--- libpurple/protocols/bonjour/jabber.c	b595d378db05e3cc5c244b296c0c1bc07d664355
+++ libpurple/protocols/bonjour/jabber.c	2103eff511335c7888c70e7630ccbfb60652dd7c
@@ -225,7 +225,7 @@ _match_buddies_by_address(gpointer key, 
 	if (mbba->jdata->account == pb->account && pb->proto_data != NULL)
 	{
 		const char *ip;
-		BonjourBuddy *bb = pb->proto_data;
+		BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(pb));
 		GSList *tmp = bb->ips;
 
 		while(tmp) {
@@ -243,7 +243,7 @@ _send_data_write_cb(gpointer data, gint 
 _send_data_write_cb(gpointer data, gint source, PurpleInputCondition cond)
 {
 	PurpleBuddy *pb = data;
-	BonjourBuddy *bb = pb->proto_data;
+	BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(pb));
 	BonjourJabberConversation *bconv = bb->conversation;
 	int ret, writelen;
 
@@ -285,7 +285,7 @@ _send_data(PurpleBuddy *pb, char *messag
 {
 	gint ret;
 	int len = strlen(message);
-	BonjourBuddy *bb = pb->proto_data;
+	BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(pb));
 	BonjourJabberConversation *bconv = bb->conversation;
 
 	/* If we're not ready to actually send, append it to the buffer */
@@ -362,7 +362,7 @@ _client_socket_handler(gpointer data, gi
 
 			bonjour_jabber_close_conversation(bconv);
 			if (bconv->pb != NULL) {
-				BonjourBuddy *bb = bconv->pb->proto_data;
+				BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(bconv->pb));
 				bb->conversation = NULL;
 			}
 
@@ -398,7 +398,7 @@ void bonjour_jabber_stream_ended(Bonjour
 		BonjourBuddy *bb = NULL;
 
 		if(bconv->pb != NULL)
-			bb = bconv->pb->proto_data;
+			bb = purple_object_get_protocol_data(PURPLE_OBJECT(bconv->pb));
 #if 0
 		if(bconv->pb != NULL) {
 			PurpleConversation *conv;
@@ -444,7 +444,7 @@ _start_stream(gpointer data, gint source
 		BonjourBuddy *bb = NULL;
 
 		if(bconv->pb) {
-			bb = bconv->pb->proto_data;
+			bb = purple_object_get_protocol_data(PURPLE_OBJECT(bconv->pb));
 			bname = purple_buddy_get_name(bconv->pb);
 		}
 
@@ -728,7 +728,7 @@ _connected_to_buddy(gpointer data, gint 
 _connected_to_buddy(gpointer data, gint source, const gchar *error)
 {
 	PurpleBuddy *pb = data;
-	BonjourBuddy *bb = pb->proto_data;
+	BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(pb));
 
 	bb->conversation->connect_data = NULL;
 
@@ -782,8 +782,8 @@ bonjour_jabber_conv_match_by_name(Bonjou
 	g_return_if_fail(bconv->pb == NULL);
 
 	pb = purple_find_buddy(bconv->account, bconv->buddy_name);
-	if (pb && pb->proto_data) {
-		BonjourBuddy *bb = pb->proto_data;
+	if (pb && purple_object_get_protocol_data(PURPLE_OBJECT(pb))) {
+		BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(pb));
 		const char *ip;
 		GSList *tmp = bb->ips;
 
@@ -794,7 +794,7 @@ bonjour_jabber_conv_match_by_name(Bonjou
 		while(tmp) {
 			ip = tmp->data;
 			if (ip != NULL && g_ascii_strcasecmp(ip, bconv->ip) == 0) {
-				BonjourJabber *jdata = ((BonjourData*) purple_account_get_connection(bconv->account)->proto_data)->jabber_data;
+				BonjourJabber *jdata = ((BonjourData*) purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(bconv->account))))->jabber_data;
 
 				purple_debug_info("bonjour", "Matched buddy %s to incoming conversation \"from\" attrib and IP (%s)\n",
 					purple_buddy_get_name(pb), bconv->ip);
@@ -827,7 +827,7 @@ bonjour_jabber_conv_match_by_ip(BonjourJ
 
 void
 bonjour_jabber_conv_match_by_ip(BonjourJabberConversation *bconv) {
-	BonjourJabber *jdata = ((BonjourData*) purple_account_get_connection(bconv->account)->proto_data)->jabber_data;
+	BonjourJabber *jdata = ((BonjourData*) purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(bconv->account))))->jabber_data;
 	struct _match_buddies_by_address_t *mbba;
 
 	mbba = g_new0(struct _match_buddies_by_address_t, 1);
@@ -841,7 +841,7 @@ bonjour_jabber_conv_match_by_ip(BonjourJ
 			purple_debug_error("bonjour", "More than one buddy matched for ip %s.\n", bconv->ip);
 		else {
 			PurpleBuddy *pb = mbba->matched_buddies->data;
-			BonjourBuddy *bb = pb->proto_data;
+			BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(pb));
 
 			purple_debug_info("bonjour", "Matched buddy %s to incoming conversation using IP (%s)\n",
 				purple_buddy_get_name(pb), bconv->ip);
@@ -885,7 +885,7 @@ _find_or_start_conversation(BonjourJabbe
 		/* You can not send a message to an offline buddy */
 		return NULL;
 
-	bb = (BonjourBuddy *) pb->proto_data;
+	bb = (BonjourBuddy *) purple_object_get_protocol_data(PURPLE_OBJECT(pb));
 
 	/* Check if there is a previously open conversation */
 	if (bb->conversation == NULL)
@@ -939,7 +939,7 @@ bonjour_jabber_send_message(BonjourJabbe
 		return -10000;
 	}
 
-	bb = pb->proto_data;
+	bb = purple_object_get_protocol_data(PURPLE_OBJECT(pb));
 
 	message_node = xmlnode_new("message");
 	xmlnode_set_attrib(message_node, "to", bb->name);
@@ -984,13 +984,13 @@ async_bonjour_jabber_close_conversation(
 
 void
 async_bonjour_jabber_close_conversation(BonjourJabberConversation *bconv) {
-	BonjourJabber *jdata = ((BonjourData*) purple_account_get_connection(bconv->account)->proto_data)->jabber_data;
+	BonjourJabber *jdata = ((BonjourData*) purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(bconv->account))))->jabber_data;
 
 	jdata->pending_conversations = g_slist_remove(jdata->pending_conversations, bconv);
 
 	/* Disconnect this conv. from the buddy here so it can't be disposed of twice.*/
 	if(bconv->pb != NULL) {
-		BonjourBuddy *bb = bconv->pb->proto_data;
+		BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(bconv->pb));
 		if (bb->conversation == bconv)
 			bb->conversation = NULL;
 	}
@@ -1005,7 +1005,7 @@ bonjour_jabber_close_conversation(Bonjou
 		BonjourData *bd = NULL;
 
 		if(PURPLE_CONNECTION_IS_VALID(purple_account_get_connection(bconv->account))) {
-			bd = purple_account_get_connection(bconv->account)->proto_data;
+			bd = purple_object_get_protocol_data(PURPLE_OBJECT(purple_account_get_connection(bconv->account)));
 			bd->jabber_data->pending_conversations = g_slist_remove(bd->jabber_data->pending_conversations, bconv);
 		}
 
@@ -1078,7 +1078,7 @@ bonjour_jabber_stop(BonjourJabber *jdata
 
 		buddies = purple_find_buddies(jdata->account, NULL);
 		for (l = buddies; l; l = l->next) {
-			BonjourBuddy *bb = ((PurpleBuddy*) l->data)->proto_data;
+			BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(l->data));
 			bonjour_jabber_close_conversation(bb->conversation);
 			bb->conversation = NULL;
 		}
@@ -1167,7 +1167,7 @@ xep_iq_parse(xmlnode *packet, PurpleConn
 
 	if(connection == NULL) {
 		if(pb->account != NULL)
-			connection = (pb->account)purple_account_get_connection();
+			connection = purple_account_get_connection(pb->account);
 	}
 
 	if(check_if_blocked(pb))
============================================================
--- libpurple/protocols/bonjour/mdns_avahi.c	ec06a91f17f229a73e022cb56823a06f3e14ff3b
+++ libpurple/protocols/bonjour/mdns_avahi.c	443e87c4ee324d9a6272a686b085d864e4557b0f
@@ -255,7 +255,7 @@ _browser_callback(AvahiServiceBrowser *b
 			purple_debug_info("bonjour", "_browser_callback - Remove service\n");
 			pb = purple_find_buddy(account, name);
 			if (pb != NULL) {
-				BonjourBuddy *bb = pb->proto_data;
+				BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(pb));
 				AvahiBuddyImplData *b_impl;
 				GSList *l;
 				AvahiSvcResolverData *rd_search;
@@ -603,7 +603,7 @@ void _mdns_retrieve_buddy_icon(BonjourBu
 
 void _mdns_retrieve_buddy_icon(BonjourBuddy* buddy) {
 	PurpleConnection *conn = purple_account_get_connection(buddy->account);
-	BonjourData *bd = conn->proto_data;
+	BonjourData *bd = purple_object_get_protocol_data(PURPLE_OBJECT(conn));
 	AvahiSessionImplData *session_idata = bd->dns_sd_data->mdns_impl_data;
 	AvahiBuddyImplData *idata = buddy->mdns_impl_data;
 	gchar *name;
============================================================
--- libpurple/protocols/bonjour/mdns_win32.c	f864ab47547852210288ab6a2b0161fb7f26a454
+++ libpurple/protocols/bonjour/mdns_win32.c	1bfa0012468daf4b92c2dbba948f5dc8a1e78f26
@@ -338,7 +338,7 @@ _mdns_service_browse_callback(DNSService
 
 				/* Is there an existing buddy? */
 				if ((pb = purple_find_buddy(account, serviceName)))
-					bb = pb->proto_data;
+					bb = purple_object_get_protocol_data(PURPLE_OBJECT(pb));
 				/* Is there a pending buddy? */
 				else {
 					while (tmp) {
@@ -358,7 +358,7 @@ _mdns_service_browse_callback(DNSService
 					if (pb == NULL)
 						pending_buddies = g_slist_prepend(pending_buddies, bb);
 					else
-						pb->proto_data = bb;
+						purple_object_set_protocol_data(PURPLE_OBJECT(pb),bb);
 				}
 
 				rd = g_new0(Win32SvcResolverData, 1);
@@ -398,7 +398,7 @@ _mdns_service_browse_callback(DNSService
 			GSList *l;
 			/* There may be multiple presences, we should only get rid of this one */
 			Win32SvcResolverData *rd_search;
-			BonjourBuddy *bb = pb->proto_data;
+			BonjourBuddy *bb = purple_object_get_protocol_data(PURPLE_OBJECT(pb));
 			Win32BuddyImplData *idata;
 
 			g_return_if_fail(bb != NULL);


More information about the Commits mailing list