diff libpurple/pounce.c @ 31907:4076f53cdd84

Delete buddy pounces when removing a buddy. Fixes #1131. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author kartikmohta@gmail.com
date Fri, 08 Apr 2011 01:12:37 +0000
parents 32a707746454
children d7be95afe03a
line wrap: on
line diff
--- a/libpurple/pounce.c	Fri Apr 08 00:53:11 2011 +0000
+++ b/libpurple/pounce.c	Fri Apr 08 01:12:37 2011 +0000
@@ -695,6 +695,28 @@
 }
 
 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);