diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-11-29 16:04:25 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-12-01 10:39:49 +0000 |
commit | eac912829c1da66f7081dc0833fcc9cd0b57cd6e (patch) | |
tree | b9e438590f800f4c004435fac199ae4b9058b3cf | |
parent | d5b9d27a7ad7e2b35b3018cc7d55ca07959680d2 (diff) | |
download | telepathy-haze-eac912829c1da66f7081dc0833fcc9cd0b57cd6e.tar.gz |
haze_contact_list_remove_from_group: don't error if already absent
-rw-r--r-- | src/contact-list.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/contact-list.c b/src/contact-list.c index ba1273f..348f4bd 100644 --- a/src/contact-list.c +++ b/src/contact-list.c @@ -1149,11 +1149,14 @@ haze_contact_list_remove_from_group (HazeContactList *self, haze_connection_handle_inspect (conn, TP_HANDLE_TYPE_CONTACT, handle); GSList *buddies; GSList *l; + gboolean is_in = FALSE; gboolean orphaned = TRUE; gboolean ret = TRUE; PurpleGroup *group = purple_find_group (group_name); - g_return_val_if_fail (group != NULL, FALSE); + /* no such group? that was easy, we "already removed them" */ + if (group == NULL) + return TRUE; buddies = purple_find_buddies (account, bname); @@ -1161,13 +1164,16 @@ haze_contact_list_remove_from_group (HazeContactList *self, { PurpleGroup *their_group = purple_buddy_get_group (l->data); - if (their_group != group) - { - orphaned = FALSE; - break; - } + if (their_group == group) + is_in = TRUE; + else + orphaned = FALSE; } + /* not in the group? that was easy, we "already removed them" */ + if (!is_in) + return TRUE; + if (orphaned) { /* the contact needs to be copied to the default group first */ |