From 4bd66f9ad6d937a4012fdada269ef9956ea0e2b6 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Thu, 12 Jul 2012 12:48:55 +0100 Subject: [PATCH] base-contact-list: don't announce Group channels twice Signed-off-by: Jonny Lamb --- telepathy-glib/base-contact-list.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/telepathy-glib/base-contact-list.c b/telepathy-glib/base-contact-list.c index 7e62753..670b70f 100644 --- a/telepathy-glib/base-contact-list.c +++ b/telepathy-glib/base-contact-list.c @@ -308,6 +308,9 @@ struct _TpBaseContactListPrivate /* TRUE if the contact list must be downloaded at connection. Default is * TRUE. */ gboolean download_at_connection; + + /* TRUE if we're in the set_list_received function, otherwise FALSE. */ + gboolean in_set_list_received; }; struct _TpBaseContactListClassPrivate @@ -563,6 +566,10 @@ tp_base_contact_list_fail_channel_requests (TpBaseContactList *self, requests = g_slist_reverse (requests); + /* our list of requests can include NULL, which isn't a valid request + * token; get rid of it/them */ + requests = g_slist_remove_all (requests, NULL); + for (slist = requests; slist != NULL; slist = slist->next) { tp_channel_manager_emit_request_failed (self, @@ -2011,6 +2018,9 @@ tp_base_contact_list_set_list_received (TpBaseContactList *self) GHashTableIter h_iter; gpointer channel; + /* Set this so groups_created knows we're about to announce all + * the group channels anyway. */ + self->priv->in_set_list_received = TRUE; tp_base_contact_list_groups_created (self, (const gchar * const *) groups, -1); @@ -2024,6 +2034,8 @@ tp_base_contact_list_set_list_received (TpBaseContactList *self) tp_handle_set_destroy (members); } + self->priv->in_set_list_received = FALSE; + g_hash_table_iter_init (&h_iter, self->priv->groups); while (g_hash_table_iter_next (&h_iter, NULL, &channel)) @@ -3727,7 +3739,11 @@ tp_base_contact_list_groups_created (TpBaseContactList *self, g_ptr_array_add (actually_created, (gchar *) tp_handle_inspect ( self->priv->group_repo, handle)); - tp_base_contact_list_announce_channel (self, c, NULL); + /* only announce the channel if we're not in the middle + * of a _set_list_received call, otherwise we'll be + * announcing the channel twice. */ + if (!self->priv->in_set_list_received) + tp_base_contact_list_announce_channel (self, c, NULL); } } } -- 1.7.10