pidgin: 571d5bf2: We have a prpl function "buddy_free" tha...

markdoliner at markdoliner at
Wed Dec 17 21:05:42 EST 2008

Revision: 571d5bf2fff9e937663ef53a174ae141999d6de2
Ancestor: 0bb430874c7ebe013414d3b52b6d7166a3a1c4d0
Author: markdoliner at
Date: 2008-12-18T02:03:20
Branch: im.pidgin.pidgin

Modified files:


We have a prpl function "buddy_free" that I don't think any of our
in-tree prpls use, and it wasn't called from anywhere.  But the facebook
prpl uses it to free data associated with each buddy.  I think it
makes sense to call this function.  In the future it would probably be
cleaner to have prpls attach to a signal or something.

-------------- next part --------------
--- libpurple/blist.c	8f1b91cf2a8d7b96138086a2e62a9f63381a31d7
+++ libpurple/blist.c	4e627c53cafca716623b20e2c337918ee225ee7c
@@ -1810,6 +1810,8 @@ void purple_blist_remove_buddy(PurpleBud
 	PurpleContact *contact;
 	PurpleGroup *group;
 	struct _purple_hbuddy hb;
+	PurplePlugin *prpl;
+	PurplePluginProtocolInfo *prpl_info;
 	g_return_if_fail(buddy != NULL);
@@ -1865,6 +1867,15 @@ void purple_blist_remove_buddy(PurpleBud
 	/* Signal that the buddy has been removed before freeing the memory for it */
 	purple_signal_emit(purple_blist_get_handle(), "buddy-removed", buddy);
+	/*
+	 * Tell the owner PRPL that we're about to free the buddy so it
+	 * can free proto_data
+	 */
+	prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account));
+	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+	if (prpl_info && prpl_info->buddy_free)
+		prpl_info->buddy_free(buddy);
 	/* Delete the node */

More information about the Commits mailing list