[telepathy-gabble/master] Parse caps after sanity-checking

Will Thompson will.thompson at collabora.co.uk
Wed May 6 08:50:19 PDT 2009


This avoids having to free the stuff we just unnecessarily parsed.
---
 src/presence-cache.c |   35 ++++++++++++++++-------------------
 1 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/presence-cache.c b/src/presence-cache.c
index be5d2bd..bd8278a 100644
--- a/src/presence-cache.c
+++ b/src/presence-cache.c
@@ -941,6 +941,22 @@ _caps_disco_cb (GabbleDisco *disco,
       return;
     }
 
+  handle = tp_handle_ensure (contact_repo, jid, NULL, NULL);
+
+  if (handle == 0)
+    {
+      DEBUG ("Ignoring presence from invalid JID %s", jid);
+      return;
+    }
+
+  waiter_self = find_matching_waiter (waiters, handle);
+
+  if (NULL == waiter_self)
+    {
+      DEBUG ("Ignoring non requested disco reply");
+      goto OUT;
+    }
+
   per_channel_manager_caps = g_hash_table_new (NULL, NULL);
 
   /* parsing for Connection.Interface.ContactCapabilities.DRAFT */
@@ -962,25 +978,6 @@ _caps_disco_cb (GabbleDisco *disco,
   /* parsing for Connection.Interface.Capabilities*/
   caps = capabilities_parse (query_result);
 
-  handle = tp_handle_ensure (contact_repo, jid, NULL, NULL);
-  if (handle == 0)
-    {
-      DEBUG ("Ignoring presence from invalid JID %s", jid);
-      gabble_presence_cache_free_cache_entry (per_channel_manager_caps);
-      per_channel_manager_caps = NULL;
-      goto OUT;
-    }
-
-  waiter_self = find_matching_waiter (waiters, handle);
-
-  if (NULL == waiter_self)
-    {
-      DEBUG ("Ignoring non requested disco reply");
-      gabble_presence_cache_free_cache_entry (per_channel_manager_caps);
-      per_channel_manager_caps = NULL;
-      goto OUT;
-    }
-
   /* Only 'sha-1' is mandatory to implement by XEP-0115. If the remote contact
    * uses another hash algorithm, don't check the hash and fallback to the old
    * method. The hash method is not included in the discovery request nor
-- 
1.5.6.5




More information about the telepathy-commits mailing list