[next] telepathy-glib: channel-contacts.c: reorder members-changed code

Xavier Claessens xclaesse at kemper.freedesktop.org
Thu May 10 07:14:05 PDT 2012


Module: telepathy-glib
Branch: next
Commit: 72befb28842a452cf3e1d6a354276c0a5416c187
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=72befb28842a452cf3e1d6a354276c0a5416c187

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Mon May  7 16:15:23 2012 +0200

channel-contacts.c: reorder members-changed code

Use the same order than in channel-group.c, it will be
important in a future change

https://bugs.freedesktop.org/show_bug.cgi?id=49371

---

 telepathy-glib/channel-contacts.c |   64 ++++++++++++++++++------------------
 1 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/telepathy-glib/channel-contacts.c b/telepathy-glib/channel-contacts.c
index 3e8cd50..344bd4a 100644
--- a/telepathy-glib/channel-contacts.c
+++ b/telepathy-glib/channel-contacts.c
@@ -508,38 +508,6 @@ members_changed_prepared_cb (GObject *object,
 
   _tp_channel_contacts_queue_prepare_finish (self, result, NULL, NULL);
 
-  /* For removed contacts, we have only handles because we are supposed to
-   * already know them. So we have to search them in our tables, construct an
-   * array of removed contacts and then remove them from our tables */
-  removed = g_ptr_array_new_full (data->removed->len, g_object_unref);
-  for (i = 0; i < data->removed->len; i++)
-    {
-      TpHandle handle = g_array_index (data->removed, TpHandle, i);
-      gpointer key = GUINT_TO_POINTER (handle);
-      TpContact *contact;
-
-      contact = g_hash_table_lookup (self->priv->group_members_contacts, key);
-      if (contact == NULL)
-          contact = g_hash_table_lookup (
-              self->priv->group_local_pending_contacts, key);
-      if (contact == NULL)
-          contact = g_hash_table_lookup (
-              self->priv->group_remote_pending_contacts, key);
-
-      if (contact == NULL)
-        {
-          DEBUG ("Handle %u removed but not found in our tables - broken CM",
-              handle);
-          continue;
-        }
-
-      g_ptr_array_add (removed, g_object_ref (contact));
-
-      g_hash_table_remove (self->priv->group_members_contacts, key);
-      g_hash_table_remove (self->priv->group_local_pending_contacts, key);
-      g_hash_table_remove (self->priv->group_remote_pending_contacts, key);
-    }
-
   for (i = 0; i < data->added->len; i++)
     {
       TpContact *contact = g_ptr_array_index (data->added, i);
@@ -582,6 +550,38 @@ members_changed_prepared_cb (GObject *object,
           g_object_ref (contact));
     }
 
+  /* For removed contacts, we have only handles because we are supposed to
+   * already know them. So we have to search them in our tables, construct an
+   * array of removed contacts and then remove them from our tables */
+  removed = g_ptr_array_new_full (data->removed->len, g_object_unref);
+  for (i = 0; i < data->removed->len; i++)
+    {
+      TpHandle handle = g_array_index (data->removed, TpHandle, i);
+      gpointer key = GUINT_TO_POINTER (handle);
+      TpContact *contact;
+
+      contact = g_hash_table_lookup (self->priv->group_members_contacts, key);
+      if (contact == NULL)
+          contact = g_hash_table_lookup (
+              self->priv->group_local_pending_contacts, key);
+      if (contact == NULL)
+          contact = g_hash_table_lookup (
+              self->priv->group_remote_pending_contacts, key);
+
+      if (contact == NULL)
+        {
+          DEBUG ("Handle %u removed but not found in our tables - broken CM",
+              handle);
+          continue;
+        }
+
+      g_ptr_array_add (removed, g_object_ref (contact));
+
+      g_hash_table_remove (self->priv->group_members_contacts, key);
+      g_hash_table_remove (self->priv->group_local_pending_contacts, key);
+      g_hash_table_remove (self->priv->group_remote_pending_contacts, key);
+    }
+
   g_signal_emit_by_name (self, "group-contacts-changed", data->added,
       removed, data->local_pending, data->remote_pending, data->actor,
       data->details);



More information about the telepathy-commits mailing list