[telepathy-gabble/master] setup_local_socket: implement TP_SOCKET_ADDRESS_TYPE_IPV4

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Apr 3 09:26:27 PDT 2009


---
 src/ft-channel.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/src/ft-channel.c b/src/ft-channel.c
index 52dccd7..0dec244 100644
--- a/src/ft-channel.c
+++ b/src/ft-channel.c
@@ -46,6 +46,7 @@
 #include "util.h"
 
 #include <telepathy-glib/channel-iface.h>
+#include <telepathy-glib/gtypes.h>
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/dbus.h>
 #include <telepathy-glib/gtypes.h>
@@ -1662,6 +1663,30 @@ setup_local_socket (GabbleFileTransferChannel *self,
       DEBUG ("local socket %s", path);
       g_free (path);
     }
+  else if (address_type == TP_SOCKET_ADDRESS_TYPE_IPV4)
+    {
+      int ret;
+
+      ret = gibber_listener_listen_tcp_loopback_af (self->priv->listener, 0,
+          GIBBER_AF_IPV4, &error);
+      if (!ret)
+        {
+          DEBUG ("Error listening on socket: %s", error->message);
+          g_error_free (error);
+          return FALSE;
+        }
+
+      self->priv->socket_address = tp_g_value_slice_new (
+          TP_STRUCT_TYPE_SOCKET_ADDRESS_IPV4);
+      g_value_take_boxed (self->priv->socket_address,
+          dbus_g_type_specialized_construct (
+              TP_STRUCT_TYPE_SOCKET_ADDRESS_IPV4));
+
+      dbus_g_type_struct_set (self->priv->socket_address,
+          0, "127.0.0.1",
+          1, gibber_listener_get_port (self->priv->listener),
+          G_MAXUINT);
+    }
   else
     {
       g_assert_not_reached ();
-- 
1.5.6.5




More information about the telepathy-commits mailing list