[Telepathy-commits] [telepathy-gabble/master] Add support StreamTube properties. Complex type properties as parameters still TBD.

Alban Crequy alban.crequy at collabora.co.uk
Mon Nov 3 11:20:56 PST 2008


---
 src/tube-stream.c                    |   14 ++++++++++++++
 tests/twisted/tubes/test-si-tubes.py |   16 ++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/src/tube-stream.c b/src/tube-stream.c
index cb52aeb..e24f9d9 100644
--- a/src/tube-stream.c
+++ b/src/tube-stream.c
@@ -69,6 +69,8 @@ G_DEFINE_TYPE_WITH_CODE (GabbleTubeStream, gabble_tube_stream, G_TYPE_OBJECT,
     G_IMPLEMENT_INTERFACE (GABBLE_TYPE_TUBE_IFACE, tube_iface_init);
     G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_CHANNEL_TYPE_STREAM_TUBE,
       streamtube_iface_init);
+    G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_CHANNEL_INTERFACE_TUBE,
+      NULL);
     G_IMPLEMENT_INTERFACE (TP_TYPE_SVC_CHANNEL_INTERFACE_GROUP,
         tp_external_group_mixin_iface_init);
     G_IMPLEMENT_INTERFACE (GABBLE_TYPE_EXPORTABLE_CHANNEL, NULL);
@@ -1191,6 +1193,13 @@ gabble_tube_stream_class_init (GabbleTubeStreamClass *gabble_tube_stream_class)
   };
   static TpDBusPropertiesMixinPropImpl stream_tube_props[] = {
       { "Service", "service", NULL },
+      /*{ "AvailableStreamTubeTypes", NULL, NULL },*/
+      { NULL }
+  };
+  static TpDBusPropertiesMixinPropImpl tube_iface_props[] = {
+      { "Initiator", "initiator", NULL },
+      /*{ "Parameters", "parameters", NULL },*/
+      { "Status", "state", NULL },
       { NULL }
   };
   static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = {
@@ -1209,6 +1218,11 @@ gabble_tube_stream_class_init (GabbleTubeStreamClass *gabble_tube_stream_class)
         NULL,
         stream_tube_props,
       },
+      { GABBLE_IFACE_CHANNEL_INTERFACE_TUBE,
+        tp_dbus_properties_mixin_getter_gobject_properties,
+        NULL,
+        tube_iface_props,
+      },
       { NULL }
   };
   GObjectClass *object_class = G_OBJECT_CLASS (gabble_tube_stream_class);
diff --git a/tests/twisted/tubes/test-si-tubes.py b/tests/twisted/tubes/test-si-tubes.py
index 072489d..23371a6 100644
--- a/tests/twisted/tubes/test-si-tubes.py
+++ b/tests/twisted/tubes/test-si-tubes.py
@@ -225,10 +225,22 @@ def test(q, bus, conn, stream):
     tube_iface = dbus.Interface(tubes_chan,
         tp_name_prefix + '.Channel.Type.StreamTube.DRAFT')
 
-    tube_props = tube_chan.GetAll(
+    stream_tube_props = tube_chan.GetAll(
             'org.freedesktop.Telepathy.Channel.Type.StreamTube.DRAFT',
             dbus_interface='org.freedesktop.DBus.Properties')
-    assert tube_props.get("Service") == "echo"
+    assert stream_tube_props.get("Service") == "echo"
+
+    tube_props = tube_chan.GetAll(
+            'org.freedesktop.Telepathy.Channel.Interface.Tube.DRAFT',
+            dbus_interface='org.freedesktop.DBus.Properties')
+    assert tube_props.get("Initiator") == self_handle
+    #print str(tube_props.get("Parameters"))
+    #assert tube_props.get("Parameters") == {'ay': ('bytes', 'aGVsbG8='),
+    #                  's': ('str', 'hello'),
+    #                  'i': ('int', '-123'),
+    #                  'u': ('uint', '123'),
+    #                 }
+    assert tube_props.get("Status") == 1 # Tube_Channel_State_Remote_Pending
 
     # The CM is the server, so fake a client wanting to talk to it
     iq = IQ(stream, 'set')
-- 
1.5.6.5




More information about the Telepathy-commits mailing list