aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-12-11 23:09:09 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-31 16:39:40 +0800
commit8957694686f44c0bad99b2fc4995f198795597ef (patch)
tree2836ccca130e67851b7d4829f3ab99c41045d10a /libempathy
parente403541be39943e428b65f8615352eddea7cece8 (diff)
downloadgsoc2013-empathy-8957694686f44c0bad99b2fc4995f198795597ef.tar
gsoc2013-empathy-8957694686f44c0bad99b2fc4995f198795597ef.tar.gz
gsoc2013-empathy-8957694686f44c0bad99b2fc4995f198795597ef.tar.bz2
gsoc2013-empathy-8957694686f44c0bad99b2fc4995f198795597ef.tar.lz
gsoc2013-empathy-8957694686f44c0bad99b2fc4995f198795597ef.tar.xz
gsoc2013-empathy-8957694686f44c0bad99b2fc4995f198795597ef.tar.zst
gsoc2013-empathy-8957694686f44c0bad99b2fc4995f198795597ef.zip
factor out add_to_members
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-tp-contact-list.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index d595745c7..8d88e00d5 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -373,6 +373,24 @@ tp_contact_list_group_add (EmpathyTpContactList *list,
}
static void
+add_to_members (EmpathyTpContactList *list,
+ EmpathyContact *contact)
+{
+ EmpathyTpContactListPriv *priv = GET_PRIV (list);
+ TpHandle handle;
+
+ handle = empathy_contact_get_handle (contact);
+ if (g_hash_table_lookup (priv->members, GUINT_TO_POINTER (handle)))
+ return;
+
+ /* Add to the list and emit signal */
+ g_hash_table_insert (priv->members, GUINT_TO_POINTER (handle),
+ g_object_ref (contact));
+ g_signal_emit_by_name (list, "members-changed", contact,
+ 0, 0, NULL, TRUE);
+}
+
+static void
tp_contact_list_got_added_members_cb (EmpathyTpContactFactory *factory,
guint n_contacts,
EmpathyContact * const * contacts,
@@ -394,16 +412,9 @@ tp_contact_list_got_added_members_cb (EmpathyTpContactFactory *factory,
EmpathyContact *contact = contacts[i];
TpHandle handle;
- 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));
- g_signal_emit_by_name (list, "members-changed", contact,
- 0, 0, NULL, TRUE);
+ add_to_members (EMPATHY_TP_CONTACT_LIST (list), contact);
+ handle = empathy_contact_get_handle (contact);
/* This contact is now member, implicitly accept pending. */
if (g_hash_table_lookup (priv->pendings, GUINT_TO_POINTER (handle))) {
GArray handles = {(gchar *) &handle, 1};