]> git.0d.be Git - empathy.git/commitdiff
ft-handler: rely on the factory to prepare TP_CONNECTION_FEATURE_CAPABILITIES
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 18 Aug 2011 14:20:44 +0000 (16:20 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 19 Aug 2011 07:26:26 +0000 (09:26 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=656831

libempathy/empathy-ft-handler.c

index a1ca07d8b0582e9dd02701c82f4d024eb654755b..99b6dc85ffd78eeab5c245c9a998b5accf8923c8 100644 (file)
@@ -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);
     }
 }