]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-client-factory.c
Merge branch 'master' into call1
[empathy.git] / libempathy / empathy-client-factory.c
index 3794ef60d237d375e25861160e14807664630e92..2a85594410daeae3c557fceda61484c3e4410193 100644 (file)
 #include "empathy-tp-chat.h"
 #include "empathy-utils.h"
 
-#include <telepathy-yell/telepathy-yell.h>
-
 G_DEFINE_TYPE (EmpathyClientFactory, empathy_client_factory,
     TP_TYPE_AUTOMATIC_CLIENT_FACTORY)
 
 #define chainup ((TpSimpleClientFactoryClass *) \
     empathy_client_factory_parent_class)
 
-/* FIXME: move to yell */
-static TpyCallChannel *
-call_channel_new_with_factory (TpSimpleClientFactory *factory,
-    TpConnection *conn,
-    const gchar *object_path,
-    const GHashTable *immutable_properties,
-    GError **error)
-{
-  TpProxy *conn_proxy = (TpProxy *) conn;
-
-  g_return_val_if_fail (TP_IS_CONNECTION (conn), NULL);
-  g_return_val_if_fail (object_path != NULL, NULL);
-  g_return_val_if_fail (immutable_properties != NULL, NULL);
-
-  if (!tp_dbus_check_valid_object_path (object_path, error))
-    return NULL;
-
-  return g_object_new (TPY_TYPE_CALL_CHANNEL,
-      "factory", factory,
-      "connection", conn,
-      "dbus-daemon", conn_proxy->dbus_daemon,
-      "bus-name", conn_proxy->bus_name,
-      "object-path", object_path,
-      "handle-type", (guint) TP_UNKNOWN_HANDLE_TYPE,
-      "channel-properties", immutable_properties,
-      NULL);
-}
-
 static TpChannel *
 empathy_client_factory_create_channel (TpSimpleClientFactory *factory,
     TpConnection *conn,
@@ -83,11 +53,6 @@ empathy_client_factory_create_channel (TpSimpleClientFactory *factory,
             TP_SIMPLE_CLIENT_FACTORY (factory), account, conn, path,
             properties));
     }
-  else if (!tp_strdiff (chan_type, TPY_IFACE_CHANNEL_TYPE_CALL))
-    {
-      return TP_CHANNEL (call_channel_new_with_factory (
-            TP_SIMPLE_CLIENT_FACTORY (factory), conn, path, properties, error));
-    }
 
   return chainup->create_channel (factory, conn, path, properties, error);
 }
@@ -152,6 +117,39 @@ empathy_client_factory_dup_connection_features (TpSimpleClientFactory *factory,
   feature = TP_CONNECTION_FEATURE_BALANCE;
   g_array_append_val (features, feature);
 
+  feature = TP_CONNECTION_FEATURE_CONTACT_BLOCKING;
+  g_array_append_val (features, feature);
+
+  /* Most empathy-* may allow user to add a contact to his contact list. We
+   * need this property to check if the connection allows it. It's cheap to
+   * prepare anyway as it will just call GetAll() on the ContactList iface. */
+  feature = TP_CONNECTION_FEATURE_CONTACT_LIST_PROPERTIES;
+  g_array_append_val (features, feature);
+
+  return features;
+}
+
+static GArray *
+empathy_client_factory_dup_contact_features (TpSimpleClientFactory *factory,
+        TpConnection *connection)
+{
+  GArray *features;
+  TpContactFeature extra_features[] = {
+      TP_CONTACT_FEATURE_ALIAS,
+      TP_CONTACT_FEATURE_PRESENCE,
+      TP_CONTACT_FEATURE_AVATAR_TOKEN,
+      TP_CONTACT_FEATURE_AVATAR_DATA,
+      TP_CONTACT_FEATURE_CAPABILITIES,
+      /* Needed by empathy_individual_add_menu_item_new to check if a contact
+       * is already in the contact list. This feature is pretty cheap to
+       * prepare as it doesn't prepare the full roster. */
+      TP_CONTACT_FEATURE_SUBSCRIPTION_STATES,
+  };
+
+  features = chainup->dup_contact_features (factory, connection);
+
+  g_array_append_vals (features, extra_features, G_N_ELEMENTS (extra_features));
+
   return features;
 }
 
@@ -169,6 +167,9 @@ empathy_client_factory_class_init (EmpathyClientFactoryClass *cls)
 
   simple_class->dup_connection_features =
     empathy_client_factory_dup_connection_features;
+
+  simple_class->dup_contact_features =
+    empathy_client_factory_dup_contact_features;
 }
 
 static void