[Telepathy-commits] [telepathy-gabble/master] GabbleImFactory: don't implement TpChannelFactoryIface

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Aug 20 10:41:50 PDT 2008


20080731184212-53eee-b35a39ea359b36507b0b2d9b6338c879d38a4bfc.gz
---
 src/im-factory.c |   73 ++---------------------------------------------------
 1 files changed, 3 insertions(+), 70 deletions(-)

diff --git a/src/im-factory.c b/src/im-factory.c
index 2249c51..0213979 100644
--- a/src/im-factory.c
+++ b/src/im-factory.c
@@ -27,7 +27,6 @@
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
 #include <loudmouth/loudmouth.h>
-#include <telepathy-glib/channel-factory-iface.h>
 #include <telepathy-glib/dbus.h>
 #include <telepathy-glib/interfaces.h>
 
@@ -40,14 +39,11 @@
 #include "im-channel.h"
 #include "text-mixin.h"
 
-static void gabble_im_factory_iface_init (gpointer, gpointer);
 static void channel_manager_iface_init (gpointer, gpointer);
 
 G_DEFINE_TYPE_WITH_CODE (GabbleImFactory, gabble_im_factory, G_TYPE_OBJECT,
     G_IMPLEMENT_INTERFACE (GABBLE_TYPE_CHANNEL_MANAGER,
-      channel_manager_iface_init);
-    G_IMPLEMENT_INTERFACE (TP_TYPE_CHANNEL_FACTORY_IFACE,
-      gabble_im_factory_iface_init));
+      channel_manager_iface_init));
 
 /* properties */
 enum
@@ -341,8 +337,6 @@ im_channel_closed_cb (GabbleIMChannel *chan, gpointer user_data)
 
           DEBUG ("reopening channel with handle %u due to pending messages",
               contact_handle);
-          tp_channel_factory_iface_emit_new_channel (self,
-              (TpChannelIface *) chan, NULL);
           gabble_channel_manager_emit_new_channel (self,
               (GabbleExportableChannel *) chan, NULL);
         }
@@ -383,15 +377,12 @@ new_im_channel (GabbleImFactory *fac,
 
   DEBUG ("object path %s", object_path);
 
+  g_free (object_path);
+
   g_signal_connect (chan, "closed", (GCallback) im_channel_closed_cb, fac);
 
   g_hash_table_insert (priv->channels, GINT_TO_POINTER (handle), chan);
 
-  tp_channel_factory_iface_emit_new_channel (fac, (TpChannelIface *) chan,
-      NULL);
-
-  g_free (object_path);
-
   if (request_token != NULL)
     request_tokens = g_slist_prepend (NULL, request_token);
   else
@@ -489,47 +480,6 @@ gabble_im_factory_foreach_channel (GabbleChannelManager *manager,
 }
 
 
-static TpChannelFactoryRequestStatus
-gabble_im_factory_iface_request (TpChannelFactoryIface *iface,
-                                 const gchar *chan_type,
-                                 TpHandleType handle_type,
-                                 guint handle,
-                                 gpointer request,
-                                 TpChannelIface **ret,
-                                 GError **error)
-{
-  GabbleImFactory *fac = GABBLE_IM_FACTORY (iface);
-  GabbleImFactoryPrivate *priv = GABBLE_IM_FACTORY_GET_PRIVATE (fac);
-  TpBaseConnection *base_conn = (TpBaseConnection *) priv->conn;
-  TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
-      base_conn, TP_HANDLE_TYPE_CONTACT);
-  GabbleIMChannel *chan;
-  TpChannelFactoryRequestStatus status;
-
-  if (strcmp (chan_type, TP_IFACE_CHANNEL_TYPE_TEXT))
-    return TP_CHANNEL_FACTORY_REQUEST_STATUS_NOT_IMPLEMENTED;
-
-  if (handle_type != TP_HANDLE_TYPE_CONTACT)
-    return TP_CHANNEL_FACTORY_REQUEST_STATUS_NOT_AVAILABLE;
-
-  if (!tp_handle_is_valid (contact_repo, handle, error))
-    return TP_CHANNEL_FACTORY_REQUEST_STATUS_ERROR;
-
-  chan = g_hash_table_lookup (priv->channels, GINT_TO_POINTER (handle));
-
-  status = TP_CHANNEL_FACTORY_REQUEST_STATUS_EXISTING;
-  if (!chan)
-    {
-      status = TP_CHANNEL_FACTORY_REQUEST_STATUS_CREATED;
-      chan = new_im_channel (fac, handle, base_conn->self_handle, request);
-    }
-
-  g_assert (chan);
-  *ret = TP_CHANNEL_IFACE (chan);
-  return status;
-}
-
-
 static const gchar * const im_channel_required_properties[] = {
     TP_IFACE_CHANNEL ".TargetHandle",
     NULL
@@ -647,23 +597,6 @@ gabble_im_factory_request_channel (GabbleChannelManager *manager,
 
 
 static void
-gabble_im_factory_iface_init (gpointer g_iface,
-                              gpointer iface_data)
-{
-  TpChannelFactoryIfaceClass *klass = (TpChannelFactoryIfaceClass *) g_iface;
-
-  klass->close_all =
-      (TpChannelFactoryIfaceProc) gabble_im_factory_close_all;
-  klass->request = gabble_im_factory_iface_request;
-
-  /* this function is basically the same for channel factory and channel
-   * manager, but with differently-typed pointers */
-  klass->foreach = (TpChannelFactoryIfaceForeachImpl)
-    gabble_im_factory_foreach_channel;
-}
-
-
-static void
 channel_manager_iface_init (gpointer g_iface,
                             gpointer iface_data)
 {
-- 
1.5.6.3




More information about the Telepathy-commits mailing list