[empathy] ft-handler: rely on the factory to prepare TP_CONNECTION_FEATURE_CAPABILITIES



commit 686b4e258c29a7adde96606474e81929d62976b1
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Aug 18 16:20:44 2011 +0200

    ft-handler: rely on the factory to prepare TP_CONNECTION_FEATURE_CAPABILITIES
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656831

 libempathy/empathy-ft-handler.c |   25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)
---
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index a1ca07d..99b6dc8 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -1083,26 +1083,24 @@ out:
 }
 
 static void
-conn_prepared_cb (GObject *conn,
-    GAsyncResult *result,
-    gpointer user_data)
+check_hashing (CallbacksData *data)
 {
-  CallbacksData *data = user_data;
   EmpathyFTHandler *handler = data->handler;
   EmpathyFTHandlerPriv *priv = GET_PRIV (handler);
   GError *myerr = NULL;
   TpCapabilities *caps;
   GPtrArray *classes;
+  TpConnection *conn;
 
-  if (!tp_proxy_prepare_finish (conn, result, &myerr))
-    {
-      DEBUG ("Failed to prepare connection: %s", myerr->message);
+  conn = empathy_contact_get_connection (priv->contact);
 
-      data->callback (handler, myerr, data->user_data);
+  caps = tp_connection_get_capabilities (conn);
+  if (caps == NULL)
+    {
+      data->callback (handler, NULL, data->user_data);
       goto out;
     }
 
-  caps = tp_connection_get_capabilities (TP_CONNECTION (conn));
   classes = tp_capabilities_get_channel_classes (caps);
 
   /* set whether we support hash and the type of it */
@@ -1202,14 +1200,7 @@ out:
   else
     {
       /* see if FT/hashing are allowed */
-      TpConnection *connection;
-      GQuark features[] = { TP_CONNECTION_FEATURE_CAPABILITIES, 0 };
-
-      connection = empathy_contact_get_connection (priv->contact);
-      g_assert (connection != NULL);
-
-      tp_proxy_prepare_async (connection, features,
-          conn_prepared_cb, cb_data);
+      check_hashing (cb_data);
     }
 }
 



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