[Telepathy-commits] [telepathy-sofiasip/master] Moved incoming INVITE and MESSAGE handlers to their respective factories

Mikhail Zabaluev mikhail.zabaluev at nokia.com
Sat Oct 18 01:41:44 PDT 2008


---
 src/media-factory.c          |  100 +++++++++++++++----
 src/media-factory.h          |    7 --
 src/sip-connection-helpers.c |   25 +++++
 src/sip-connection-helpers.h |    3 +
 src/sip-connection.c         |  232 ------------------------------------------
 src/text-factory.c           |  202 ++++++++++++++++++++++++++++++++-----
 src/text-factory.h           |    6 -
 7 files changed, 286 insertions(+), 289 deletions(-)

diff --git a/src/media-factory.c b/src/media-factory.c
index ca01b3a..0c98c16 100644
--- a/src/media-factory.c
+++ b/src/media-factory.c
@@ -18,11 +18,17 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "media-factory.h"
+
+#include <string.h>
+
 #include <telepathy-glib/svc-connection.h>
 #include <telepathy-glib/interfaces.h>
-#include <string.h>
-#include "media-factory.h"
+
 #include "sip-connection.h"
+#include "sip-connection-helpers.h"
+
+#include <sofia-sip/sip_status.h>
 
 #define DEBUG_FLAG TPSIP_DEBUG_CONNECTION
 #include "debug.h"
@@ -198,21 +204,6 @@ tpsip_media_factory_close_all (TpChannelFactoryIface *iface)
     }
 }
 
-static void
-tpsip_media_factory_connecting (TpChannelFactoryIface *iface)
-{
-}
-
-static void
-tpsip_media_factory_connected (TpChannelFactoryIface *iface)
-{
-}
-
-static void
-tpsip_media_factory_disconnected (TpChannelFactoryIface *iface)
-{
-}
-
 struct _ForeachData
 {
   TpChannelFunc foreach;
@@ -265,7 +256,7 @@ channel_closed (TpsipMediaChannel *chan, gpointer user_data)
  *
  * Creates a new empty TpsipMediaChannel.
  */
-TpsipMediaChannel *
+static TpsipMediaChannel *
 tpsip_media_factory_new_channel (TpsipMediaFactory *fac,
                                  gpointer request,
                                  TpHandleType handle_type,
@@ -397,6 +388,78 @@ tpsip_media_factory_request (TpChannelFactoryIface *iface,
   return status;
 }
 
+static gboolean
+tpsip_nua_i_invite_cb (TpBaseConnection    *conn,
+                       const TpsipNuaEvent *ev,
+                       tagi_t               tags[],
+                       TpsipMediaFactory   *fac)
+{
+  TpsipMediaChannel *channel;
+  TpHandleRepoIface *contact_repo;
+  TpHandle handle;
+  GError *error = NULL;
+
+  /* figure out a handle for the identity */
+
+  contact_repo = tp_base_connection_get_handles (conn, TP_HANDLE_TYPE_CONTACT);
+
+  handle = tpsip_handle_parse_from (contact_repo, ev->sip);
+  if (!handle)
+    {
+      g_message ("incoming INVITE with invalid sender information");
+      nua_respond (ev->nua_handle, 400, "Invalid From address", TAG_END());
+      return TRUE;
+    }
+
+  DEBUG("Got incoming invite from <%s>",
+        tp_handle_inspect (contact_repo, handle));
+
+  channel = tpsip_media_factory_new_channel (
+                fac,
+                NULL,
+                TP_HANDLE_TYPE_CONTACT,
+                handle,
+                handle,
+                &error);
+  if (channel)
+    {
+      tpsip_media_channel_receive_invite (channel, ev->nua_handle);
+    }
+  else
+    {
+      g_warning ("creation of SIP media channel failed: %s", error->message);
+      g_error_free (error);
+      nua_respond (ev->nua_handle, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
+    }
+
+  tp_handle_unref (contact_repo, handle);
+
+  return TRUE;
+}
+
+static void
+tpsip_media_factory_connected (TpChannelFactoryIface *iface)
+{
+  TpsipMediaFactory *fac = TPSIP_MEDIA_FACTORY (iface);
+  TpsipMediaFactoryPrivate *priv = TPSIP_MEDIA_FACTORY_GET_PRIVATE (fac);
+
+  g_signal_connect (priv->conn,
+       "nua-event::nua_i_invite",
+       G_CALLBACK (tpsip_nua_i_invite_cb),
+       fac);
+}
+
+static void
+tpsip_media_factory_disconnected (TpChannelFactoryIface *iface)
+{
+  TpsipMediaFactory *fac = TPSIP_MEDIA_FACTORY (iface);
+  TpsipMediaFactoryPrivate *priv = TPSIP_MEDIA_FACTORY_GET_PRIVATE (fac);
+
+  g_signal_handlers_disconnect_by_func (priv->conn,
+       G_CALLBACK (tpsip_nua_i_invite_cb),
+       fac);
+}
+
 static void
 factory_iface_init (gpointer g_iface, gpointer iface_data)
 {
@@ -406,7 +469,6 @@ factory_iface_init (gpointer g_iface, gpointer iface_data)
   IMPLEMENT(close_all);
   IMPLEMENT(foreach);
   IMPLEMENT(request);
-  IMPLEMENT(connecting);
   IMPLEMENT(connected);
   IMPLEMENT(disconnected);
 #undef IMPLEMENT
diff --git a/src/media-factory.h b/src/media-factory.h
index b670659..fbcd752 100644
--- a/src/media-factory.h
+++ b/src/media-factory.h
@@ -54,13 +54,6 @@ GType tpsip_media_factory_get_type(void);
 #define TPSIP_MEDIA_FACTORY_GET_CLASS(obj) \
   (G_TYPE_INSTANCE_GET_CLASS ((obj), TPSIP_TYPE_MEDIA_FACTORY, TpsipMediaFactoryClass))
 
-TpsipMediaChannel *tpsip_media_factory_new_channel (TpsipMediaFactory *fac,
-                                                    gpointer request,
-                                                    TpHandleType handle_type,
-                                                    TpHandle handle,
-                                                    TpHandle creator,
-                                                    GError **error);
-
 G_END_DECLS
 
 #endif
diff --git a/src/sip-connection-helpers.c b/src/sip-connection-helpers.c
index 591b247..e60d5f3 100644
--- a/src/sip-connection-helpers.c
+++ b/src/sip-connection-helpers.c
@@ -890,3 +890,28 @@ tpsip_conn_get_contact_url (TpsipConnection *self,
 
   return url;
 }
+
+TpHandle
+tpsip_handle_parse_from (TpHandleRepoIface *contact_repo,
+                         const sip_t *sip)
+{
+  TpHandle handle = 0;
+  gchar *url_str;
+
+  g_return_val_if_fail (sip != NULL, 0);
+
+  if (sip->sip_from)
+    {
+      su_home_t tmphome[1] = { SU_HOME_INIT(tmphome) };
+
+      url_str = url_as_string (tmphome, sip->sip_from->a_url);
+
+      handle = tp_handle_ensure (contact_repo, url_str, NULL, NULL);
+
+      /* TODO: set qdata for the display name */
+
+      su_home_deinit (tmphome);
+    }
+
+  return handle;
+}
diff --git a/src/sip-connection-helpers.h b/src/sip-connection-helpers.h
index ad85c08..b256364 100644
--- a/src/sip-connection-helpers.h
+++ b/src/sip-connection-helpers.h
@@ -69,6 +69,9 @@ gchar * tpsip_handle_normalize (TpHandleRepoIface *repo,
 const url_t* tpsip_conn_get_contact_url (TpsipConnection *conn,
                                          TpHandle handle);
 
+TpHandle tpsip_handle_parse_from (TpHandleRepoIface *contact_repo,
+                                  const sip_t *sip);
+
 G_END_DECLS
 
 #endif /* #ifndef __TPSIP_CONNECTION_HELPERS_H__*/
diff --git a/src/sip-connection.c b/src/sip-connection.c
index 1d2767a..95233b9 100644
--- a/src/sip-connection.c
+++ b/src/sip-connection.c
@@ -48,7 +48,6 @@
 #include "sip-connection-sofia.h"
 
 #include <sofia-sip/msg_header.h>
-#include <sofia-sip/sip_status.h>
 
 #define DEBUG_FLAG TPSIP_DEBUG_CONNECTION
 #include "debug.h"
@@ -132,31 +131,6 @@ priv_url_from_string_value (su_home_t *home, const GValue *value)
   return (url_str)? url_make (home, url_str) : NULL;
 }
 
-static TpHandle
-priv_handle_parse_from (const sip_t *sip,
-                        TpHandleRepoIface *contact_repo)
-{
-  TpHandle handle = 0;
-  gchar *url_str;
-
-  g_return_val_if_fail (sip != NULL, 0);
-
-  if (sip->sip_from)
-    {
-      su_home_t tmphome[1] = { SU_HOME_INIT(tmphome) };
-
-      url_str = url_as_string (tmphome, sip->sip_from->a_url);
-
-      handle = tp_handle_ensure (contact_repo, url_str, NULL, NULL);
-
-      /* TODO: set qdata for the display name */
-
-      su_home_deinit (tmphome);
-    }
-
-  return handle;
-}
-
 static void
 tpsip_create_handle_repos (TpBaseConnection *conn,
                            TpHandleRepoIface *repos[NUM_TP_HANDLE_TYPES])
@@ -773,204 +747,6 @@ tpsip_connection_nua_r_register_cb (TpsipConnection     *self,
   return TRUE;
 }
 
-static gboolean
-tpsip_connection_nua_i_invite_cb (TpsipConnection   *self,
-                                  const TpsipNuaEvent  *ev,
-                                  tagi_t             tags[],
-                                  gpointer           foo)
-{
-  TpsipConnectionPrivate *priv = TPSIP_CONNECTION_GET_PRIVATE (self);
-  TpsipMediaChannel *channel;
-  TpHandleRepoIface *contact_repo;
-  TpHandle handle;
-  GError *error = NULL;
-
-  /* figure out a handle for the identity */
-
-  contact_repo = tp_base_connection_get_handles ((TpBaseConnection *)self,
-                                                 TP_HANDLE_TYPE_CONTACT);
-
-  handle = priv_handle_parse_from (ev->sip, contact_repo);
-  if (!handle)
-    {
-      g_message ("incoming INVITE with invalid sender information");
-      nua_respond (ev->nua_handle, 400, "Invalid From address", TAG_END());
-      return TRUE;
-    }
-
-  DEBUG("Got incoming invite from <%s>", 
-        tp_handle_inspect (contact_repo, handle));
-
-  channel = tpsip_media_factory_new_channel (
-                TPSIP_MEDIA_FACTORY (priv->media_factory),
-                NULL,
-                TP_HANDLE_TYPE_CONTACT,
-                handle,
-                handle,
-                &error);
-  if (channel)
-    {
-      tpsip_media_channel_receive_invite (channel, ev->nua_handle);
-    }
-  else
-    {
-      g_warning ("creation of SIP media channel failed: %s", error->message);
-      g_error_free (error);
-      nua_respond (ev->nua_handle, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
-    }
-
-  tp_handle_unref (contact_repo, handle);
-
-  return TRUE;
-}
-
-static gboolean
-tpsip_connection_nua_i_message_cb (TpsipConnection   *self,
-                                   const TpsipNuaEvent  *ev,
-                                   tagi_t             tags[],
-                                   gpointer           foo)
-{
-  TpsipConnectionPrivate *priv = TPSIP_CONNECTION_GET_PRIVATE (self);
-  TpsipTextChannel *channel;
-  TpHandleRepoIface *contact_repo;
-  TpHandle handle;
-  const sip_t *sip = ev->sip;
-  const char *text = "";
-  gsize len = 0;
-  gboolean own_text = FALSE;
-
-  /* Block anything else except text/plain messages (like isComposings) */
-  if (sip->sip_content_type
-      && (g_ascii_strcasecmp ("text/plain", sip->sip_content_type->c_type)))
-    {
-      nua_respond (ev->nua_handle,
-                   SIP_415_UNSUPPORTED_MEDIA,
-                   SIPTAG_ACCEPT_STR("text/plain"),
-                   NUTAG_WITH_THIS(ev->nua),
-                   TAG_END());
-      goto end;
-    }
-
-  /* If there is some text, assure it's in UTF-8 encoding */
-  if (sip->sip_payload && sip->sip_payload->pl_len > 0)
-    {
-      const char *charset = NULL;
-      if (sip->sip_content_type)
-        {
-          charset = msg_header_find_param (sip->sip_content_type->c_common,
-              "charset");
-        }
-
-      /* Default charset is UTF-8, we only need to convert if it's a different one */
-      if (charset && g_ascii_strcasecmp (charset, "UTF-8"))
-        {
-          GError *error;
-          gsize in_len;
-          text = g_convert (sip->sip_payload->pl_data, sip->sip_payload->pl_len,
-              "UTF-8", charset, &in_len, &len, &error);
-
-          if (text == NULL)
-            {
-              gint status;
-              const char *message = NULL;
-
-              g_message ("character set conversion failed for the message body: %s", error->message);
-              g_error_free (error);
-
-              if (error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE)
-                {
-                  status = 400;
-                  message = "Invalid character sequence in the message body";
-                }
-              else
-                {
-                  status = 500;
-                  message = "Character set conversion failed for the message body";
-                }
-              nua_respond (ev->nua_handle,
-                           status, message,
-                           NUTAG_WITH_THIS(ev->nua),
-                           TAG_END());
-
-              goto end;
-            }
-
-          own_text = TRUE;
-
-          if (in_len != sip->sip_payload->pl_len)
-            {
-              nua_respond (ev->nua_handle,
-                           400, "Incomplete character sequence at the "
-                                "end of the message body",
-                           NUTAG_WITH_THIS(ev->nua),
-                           TAG_END());
-              goto end;
-            }
-        }
-      else
-        {
-          if (!g_utf8_validate (sip->sip_payload->pl_data,
-                                sip->sip_payload->pl_len,
-                                NULL))
-            {
-              nua_respond (ev->nua_handle,
-                           400, "Invalid character sequence in the message body",
-                           NUTAG_WITH_THIS(ev->nua),
-                           TAG_END());
-              goto end;
-            }
-          text = sip->sip_payload->pl_data;
-          len = (gsize) sip->sip_payload->pl_len;
-        }
-    }
-
-  contact_repo = tp_base_connection_get_handles (
-      (TpBaseConnection *)self, TP_HANDLE_TYPE_CONTACT);
-
-  handle = priv_handle_parse_from (sip, contact_repo);
-
-  if (handle)
-    {
-      nua_saved_event_t event[1];
-
-      DEBUG("Got incoming message from <%s>", 
-            tp_handle_inspect (contact_repo, handle));
-
-      channel = tpsip_text_factory_lookup_channel (priv->text_factory, handle);
-
-      if (!channel)
-        channel = tpsip_text_factory_new_channel (priv->text_factory,
-            handle, handle, NULL);
-
-      nua_save_event (ev->nua, event);
-
-      /* Return a provisional response to quench retransmissions.
-       * The acknowledgement will be signalled later with 200 OK */
-      nua_respond (ev->nua_handle,
-                   SIP_182_QUEUED,
-                   NUTAG_WITH_SAVED(event),
-                   TAG_END());
-
-      tpsip_text_channel_receive (channel,
-          ev->nua_handle, event, handle, text, len);
-
-      tp_handle_unref (contact_repo, handle);
-    }
-  else
-    {
-      nua_respond (ev->nua_handle,
-                   400, "Invalid From address",
-                   NUTAG_WITH_THIS(ev->nua),
-                   TAG_END());
-    }
-
-end:
-  if (own_text)
-    g_free ((gpointer) text);
-
-  return TRUE;
-}
-
 static void
 tpsip_connection_shut_down (TpBaseConnection *base)
 {
@@ -1139,14 +915,6 @@ tpsip_connection_start_connecting (TpBaseConnection *base,
   nua_get_params (priv->sofia_nua, TAG_ANY(), TAG_NULL());
 
   g_signal_connect (self,
-                    "nua-event::nua_i_invite",
-                    G_CALLBACK (tpsip_connection_nua_i_invite_cb),
-                    NULL);
-  g_signal_connect (self,
-                    "nua-event::nua_i_message",
-                    G_CALLBACK (tpsip_connection_nua_i_message_cb),
-                    NULL);
-  g_signal_connect (self,
                     "nua-event::nua_r_register",
                     G_CALLBACK (tpsip_connection_nua_r_register_cb),
                     NULL);
diff --git a/src/text-factory.c b/src/text-factory.c
index 88e5976..0259ad6 100644
--- a/src/text-factory.c
+++ b/src/text-factory.c
@@ -26,6 +26,11 @@
 #include <telepathy-glib/interfaces.h>
 
 #include "sip-connection.h"
+#include "sip-connection-helpers.h"
+
+#include <sofia-sip/msg_header.h>
+#include <sofia-sip/sip_tag.h>
+#include <sofia-sip/sip_status.h>
 
 #define DEBUG_FLAG TPSIP_DEBUG_IM
 #include "debug.h"
@@ -169,21 +174,6 @@ tpsip_text_factory_close_all (TpChannelFactoryIface *iface)
   g_hash_table_foreach_remove (channels, tpsip_text_factory_close_one, NULL);
 }
 
-static void
-tpsip_text_factory_connecting (TpChannelFactoryIface *iface)
-{
-}
-
-static void
-tpsip_text_factory_connected (TpChannelFactoryIface *iface)
-{
-}
-
-static void
-tpsip_text_factory_disconnected (TpChannelFactoryIface *iface)
-{
-}
-
 struct _ForeachData
 {
   TpChannelFunc foreach;
@@ -236,20 +226,17 @@ channel_closed (TpsipTextChannel *chan, gpointer user_data)
  *
  * Creates a new empty TpsipTextChannel.
  */
-TpsipTextChannel *
-tpsip_text_factory_new_channel (TpChannelFactoryIface *iface,
+static TpsipTextChannel *
+tpsip_text_factory_new_channel (TpsipTextFactory *fac,
                                 TpHandle handle,
                                 TpHandle initiator,
                                 gpointer request)
 {
-  TpsipTextFactory *fac = TPSIP_TEXT_FACTORY (iface);
   TpsipTextFactoryPrivate *priv;
   TpsipTextChannel *chan;
   gchar *object_path;
   TpBaseConnection *conn;
 
-  g_assert (TPSIP_IS_TEXT_FACTORY (fac));
-
   priv = TPSIP_TEXT_FACTORY_GET_PRIVATE (fac);
   conn = (TpBaseConnection *)(priv->conn);
 
@@ -277,11 +264,10 @@ tpsip_text_factory_new_channel (TpChannelFactoryIface *iface,
   return chan;
 }
 
-TpsipTextChannel *
-tpsip_text_factory_lookup_channel (TpChannelFactoryIface *iface,
+static inline TpsipTextChannel *
+tpsip_text_factory_lookup_channel (TpsipTextFactory *fac,
                                    TpHandle handle)
 {
-  TpsipTextFactory *fac = TPSIP_TEXT_FACTORY (iface);
   TpsipTextFactoryPrivate *priv = TPSIP_TEXT_FACTORY_GET_PRIVATE (fac);
 
   return (TpsipTextChannel *)g_hash_table_lookup (priv->channels,
@@ -318,7 +304,7 @@ tpsip_text_factory_request (TpChannelFactoryIface *iface,
     {
       TpBaseConnection *base_conn = (TpBaseConnection *) priv->conn; 
 
-      chan = (TpChannelIface *)tpsip_text_factory_new_channel (iface,
+      chan = (TpChannelIface *)tpsip_text_factory_new_channel (fac,
           handle, base_conn->self_handle, request);
 
       status = TP_CHANNEL_FACTORY_REQUEST_STATUS_CREATED;
@@ -327,6 +313,173 @@ tpsip_text_factory_request (TpChannelFactoryIface *iface,
   return status;
 }
 
+static gboolean
+tpsip_nua_i_message_cb (TpBaseConnection    *conn,
+                        const TpsipNuaEvent *ev,
+                        tagi_t               tags[],
+                        TpsipTextFactory    *fac)
+{
+  TpsipTextChannel *channel;
+  TpHandleRepoIface *contact_repo;
+  TpHandle handle;
+  const sip_t *sip = ev->sip;
+  const char *text = "";
+  gsize len = 0;
+  gboolean own_text = FALSE;
+  nua_saved_event_t event[1];
+
+  /* Block anything else except text/plain messages (like isComposings) */
+  if (sip->sip_content_type
+      && (g_ascii_strcasecmp ("text/plain", sip->sip_content_type->c_type)))
+    {
+      nua_respond (ev->nua_handle,
+                   SIP_415_UNSUPPORTED_MEDIA,
+                   SIPTAG_ACCEPT_STR("text/plain"),
+                   NUTAG_WITH_THIS(ev->nua),
+                   TAG_END());
+      goto end;
+    }
+
+  /* If there is some text, assure it's in UTF-8 encoding */
+  if (sip->sip_payload && sip->sip_payload->pl_len > 0)
+    {
+      const char *charset = NULL;
+      if (sip->sip_content_type)
+        {
+          charset = msg_header_find_param (
+              (msg_common_t *) sip->sip_content_type, "charset");
+        }
+
+      /* Default charset is UTF-8, we only need to convert if it's a different one */
+      if (charset && g_ascii_strcasecmp (charset, "UTF-8"))
+        {
+          GError *error;
+          gsize in_len;
+          text = g_convert (sip->sip_payload->pl_data, sip->sip_payload->pl_len,
+              "UTF-8", charset, &in_len, &len, &error);
+
+          if (text == NULL)
+            {
+              gint status;
+              const char *message = NULL;
+
+              g_message ("character set conversion failed for the message body: %s", error->message);
+              g_error_free (error);
+
+              if (error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE)
+                {
+                  status = 400;
+                  message = "Invalid character sequence in the message body";
+                }
+              else
+                {
+                  status = 500;
+                  message = "Character set conversion failed for the message body";
+                }
+              nua_respond (ev->nua_handle,
+                           status, message,
+                           NUTAG_WITH_THIS(ev->nua),
+                           TAG_END());
+
+              goto end;
+            }
+
+          own_text = TRUE;
+
+          if (in_len != sip->sip_payload->pl_len)
+            {
+              nua_respond (ev->nua_handle,
+                           400, "Incomplete character sequence at the "
+                                "end of the message body",
+                           NUTAG_WITH_THIS(ev->nua),
+                           TAG_END());
+              goto end;
+            }
+        }
+      else
+        {
+          if (!g_utf8_validate (sip->sip_payload->pl_data,
+                                sip->sip_payload->pl_len,
+                                NULL))
+            {
+              nua_respond (ev->nua_handle,
+                           400, "Invalid character sequence in the message body",
+                           NUTAG_WITH_THIS(ev->nua),
+                           TAG_END());
+              goto end;
+            }
+          text = sip->sip_payload->pl_data;
+          len = (gsize) sip->sip_payload->pl_len;
+        }
+    }
+
+  contact_repo = tp_base_connection_get_handles (
+      conn, TP_HANDLE_TYPE_CONTACT);
+
+  handle = tpsip_handle_parse_from (contact_repo, sip);
+
+  if (!handle)
+    {
+      nua_respond (ev->nua_handle,
+                   400, "Invalid From address",
+                   NUTAG_WITH_THIS(ev->nua),
+                   TAG_END());
+      goto end;
+    }
+
+  DEBUG("Got incoming message from <%s>",
+        tp_handle_inspect (contact_repo, handle));
+
+  channel = tpsip_text_factory_lookup_channel (fac, handle);
+
+  if (!channel)
+      channel = tpsip_text_factory_new_channel (fac,
+          handle, handle, NULL);
+
+  nua_save_event (ev->nua, event);
+
+  /* Return a provisional response to quench retransmissions.
+   * The acknowledgement will be signalled later with 200 OK */
+  nua_respond (ev->nua_handle,
+               SIP_182_QUEUED,
+               NUTAG_WITH_SAVED(event),
+               TAG_END());
+
+  tpsip_text_channel_receive (channel,
+      ev->nua_handle, event, handle, text, len);
+
+  tp_handle_unref (contact_repo, handle);
+
+end:
+  if (own_text)
+    g_free ((gpointer) text);
+
+  return TRUE;
+}
+
+static void
+tpsip_text_factory_connected (TpChannelFactoryIface *iface)
+{
+  TpsipTextFactory *fac = TPSIP_TEXT_FACTORY (iface);
+  TpsipTextFactoryPrivate *priv = TPSIP_TEXT_FACTORY_GET_PRIVATE (fac);
+
+  g_signal_connect (priv->conn,
+       "nua-event::nua_i_message",
+       G_CALLBACK (tpsip_nua_i_message_cb),
+       fac);
+}
+
+static void
+tpsip_text_factory_disconnected (TpChannelFactoryIface *iface)
+{
+  TpsipTextFactory *fac = TPSIP_TEXT_FACTORY (iface);
+  TpsipTextFactoryPrivate *priv = TPSIP_TEXT_FACTORY_GET_PRIVATE (fac);
+
+  g_signal_handlers_disconnect_by_func (priv->conn,
+       G_CALLBACK (tpsip_nua_i_message_cb),
+       fac);
+}
+
 static void
 factory_iface_init (gpointer g_iface, gpointer iface_data)
 {
@@ -336,7 +489,6 @@ factory_iface_init (gpointer g_iface, gpointer iface_data)
   IMPLEMENT(close_all);
   IMPLEMENT(foreach);
   IMPLEMENT(request);
-  IMPLEMENT(connecting);
   IMPLEMENT(connected);
   IMPLEMENT(disconnected);
 #undef IMPLEMENT
diff --git a/src/text-factory.h b/src/text-factory.h
index 79d00d8..ea0c013 100644
--- a/src/text-factory.h
+++ b/src/text-factory.h
@@ -54,12 +54,6 @@ GType tpsip_text_factory_get_type(void);
 #define TPSIP_TEXT_FACTORY_GET_CLASS(obj) \
   (G_TYPE_INSTANCE_GET_CLASS ((obj), TPSIP_TYPE_TEXT_FACTORY, TpsipTextFactoryClass))
 
-TpsipTextChannel *tpsip_text_factory_lookup_channel (TpChannelFactoryIface *iface,
-    TpHandle handle);
-
-TpsipTextChannel *tpsip_text_factory_new_channel (TpChannelFactoryIface *iface,
-    TpHandle handle, TpHandle initiator, gpointer request);
-
 G_END_DECLS
 
 #endif
-- 
1.5.6.5




More information about the Telepathy-commits mailing list