[empathy] got_added_members_cb: check if contact is already in the hash before adding it



commit f898afc1d4e7bfae0ee8e3c5e6b7a0a0427fd6e3
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Dec 14 12:25:34 2009 +0000

    got_added_members_cb: check if contact is already in the hash before adding it
    
    empathy_tp_contact_factory_get_from_handles is async, so if the contact has
    already been added when it returns the contact objects there is no point to
    try to re-add it twice.

 libempathy/empathy-tp-contact-list.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index 8b35f27..8cc1edc 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -397,6 +397,9 @@ got_added_members_cb (EmpathyTpContactFactory *factory,
 		EmpathyContact *contact = contacts[i];
 		TpHandle handle = empathy_contact_get_handle (contact);
 
+		if (g_hash_table_lookup (priv->members, GUINT_TO_POINTER (handle)))
+			continue;
+
 	/* Add to the list and emit signal */
 		g_hash_table_insert (priv->members, GUINT_TO_POINTER (handle),
 			     g_object_ref (contact));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]