pidgin: 9b0e784a: Delete buddy pounces when removing a bud...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Thu Apr 7 21:45:53 EDT 2011


----------------------------------------------------------------------
Revision: 9b0e784ac3a47eb05dd2a6e58588e1ebb7cb5044
Parent:   037b30bab7e06407c7e3d514775b75df2f044e91
Author:   kartikmohta at gmail.com
Date:     04/07/11 21:12:37
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/9b0e784ac3a47eb05dd2a6e58588e1ebb7cb5044

Changelog: 

Delete buddy pounces when removing a buddy.  Fixes #1131.

Changes against parent 037b30bab7e06407c7e3d514775b75df2f044e91

  patched  libpurple/blist.c
  patched  libpurple/pounce.c
  patched  libpurple/pounce.h

-------------- next part --------------
============================================================
--- libpurple/pounce.c	d82d02a6e5157e83bf37b24527ff8cfbd6dfc353
+++ libpurple/pounce.c	0d8f82beab6a75843f750fd55694a513fd648c68
@@ -695,6 +695,28 @@ void
 }
 
 void
+purple_pounce_destroy_all_by_buddy(PurpleBuddy *buddy)
+{
+	const char *pouncee;
+	PurpleAccount *pouncer;
+	PurplePounce *pounce;
+	GList *l, *l_next;
+
+	g_return_if_fail(buddy != NULL);
+
+	for (l = purple_pounces_get_all(); l != NULL; l = l_next) {
+		pounce = (PurplePounce *)l->data;
+		l_next = l->next;
+
+		pouncer = purple_pounce_get_pouncer(pounce);
+		pouncee = purple_pounce_get_pouncee(pounce);
+
+		if ( (pouncer == buddy->account) && (strcmp(pouncee, buddy->name) == 0) )
+			purple_pounce_destroy(pounce);
+	}
+}
+
+void
 purple_pounce_set_events(PurplePounce *pounce, PurplePounceEvent events)
 {
 	g_return_if_fail(pounce != NULL);
============================================================
--- libpurple/pounce.h	30ca302bed4447e9ecbf40ff1ef1f8861f26f155
+++ libpurple/pounce.h	02e83d22b0cd46ec88f4384654dfe7d5a6866b49
@@ -123,6 +123,13 @@ void purple_pounce_destroy_all_by_accoun
 void purple_pounce_destroy_all_by_account(PurpleAccount *account);
 
 /**
+ * Destroys all buddy pounces for a buddy
+ *
+ * @param buddy The buddy whose pounces are to be removed
+ */
+void purple_pounce_destroy_all_by_buddy(PurpleBuddy *buddy);
+
+/**
  * Sets the events a pounce should watch for.
  *
  * @param pounce The buddy pounce.
============================================================
--- libpurple/blist.c	2ca4596c2ca7f986298bd6037d31425976a2a5b2
+++ libpurple/blist.c	71f3f20f4dc18df0687cbe3dd252093700d81a99
@@ -28,6 +28,7 @@
 #include "dbus-maybe.h"
 #include "debug.h"
 #include "notify.h"
+#include "pounce.h"
 #include "prefs.h"
 #include "privacy.h"
 #include "prpl.h"
@@ -2184,6 +2185,9 @@ void purple_blist_remove_buddy(PurpleBud
 	if (ops && ops->remove_node)
 		ops->remove_node(node);
 
+	/* Remove this buddy's pounces */
+	purple_pounce_destroy_all_by_buddy(buddy);
+
 	/* Signal that the buddy has been removed before freeing the memory for it */
 	purple_signal_emit(purple_blist_get_handle(), "buddy-removed", buddy);
 


More information about the Commits mailing list