Mercurial > pidgin.yaz
changeset 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 | 15581933dc31 |
children | d7be95afe03a |
files | libpurple/blist.c libpurple/pounce.c libpurple/pounce.h |
diffstat | 3 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/blist.c Fri Apr 08 00:53:11 2011 +0000 +++ b/libpurple/blist.c Fri Apr 08 01:12:37 2011 +0000 @@ -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 @@ 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);
--- 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);
--- a/libpurple/pounce.h Fri Apr 08 00:53:11 2011 +0000 +++ b/libpurple/pounce.h Fri Apr 08 01:12:37 2011 +0000 @@ -123,6 +123,13 @@ 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.