[Telepathy-commits] [telepathy-gabble/master] GabbleTubeStream implements the o.f.T.Channel.Interfaces property correctly

Alban Crequy alban.crequy at collabora.co.uk
Tue Oct 28 05:57:43 PDT 2008


---
 src/tube-stream.c                    |   19 +++++++++++++++++++
 tests/twisted/tubes/test-si-tubes.py |    5 +++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/tube-stream.c b/src/tube-stream.c
index c79ff51..47eefc4 100644
--- a/src/tube-stream.c
+++ b/src/tube-stream.c
@@ -110,6 +110,7 @@ enum
   PROP_OBJECT_PATH = 1,
   PROP_CHANNEL_TYPE,
   PROP_CONNECTION,
+  PROP_INTERFACES,
   PROP_HANDLE,
   PROP_HANDLE_TYPE,
   PROP_SELF_HANDLE,
@@ -987,6 +988,18 @@ gabble_tube_stream_get_property (GObject *object,
       case PROP_CONNECTION:
         g_value_set_object (value, priv->conn);
         break;
+      case PROP_INTERFACES:
+        if (priv->handle_type == TP_HANDLE_TYPE_CONTACT)
+          {
+            /* 1-1 tubes - omit the Group interface */
+            g_value_set_boxed (value, gabble_tube_stream_interfaces + 1);
+          }
+        else
+          {
+            /* MUC tubes */
+            g_value_set_boxed (value, gabble_tube_stream_interfaces);
+          }
+        break;
       case PROP_HANDLE:
         g_value_set_uint (value, priv->handle);
         break;
@@ -1364,6 +1377,12 @@ gabble_tube_stream_class_init (GabbleTubeStreamClass *gabble_tube_stream_class)
   g_object_class_install_property (object_class, PROP_ACCESS_CONTROL_PARAM,
       param_spec);
 
+  param_spec = g_param_spec_boxed ("interfaces", "Extra D-Bus interfaces",
+      "Additional Channel.Interface.* interfaces",
+      G_TYPE_STRV,
+      G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
+  g_object_class_install_property (object_class, PROP_INTERFACES, param_spec);
+
   param_spec = g_param_spec_string ("target-id", "Target JID",
       "The string obtained by inspecting the target handle",
       NULL,
diff --git a/tests/twisted/tubes/test-si-tubes.py b/tests/twisted/tubes/test-si-tubes.py
index a55e180..b87eaef 100644
--- a/tests/twisted/tubes/test-si-tubes.py
+++ b/tests/twisted/tubes/test-si-tubes.py
@@ -112,6 +112,7 @@ def check_channel_properties(q, bus, conn, stream, channel, channel_type,
 
     if channel_type == "Tubes":
         assert state is None
+        assert len(channel_props['Interfaces']) == 0, channel_props['Interfaces']
     else:
         assert state is not None
         tube_props = channel.GetAll(
@@ -120,6 +121,10 @@ def check_channel_properties(q, bus, conn, stream, channel, channel_type,
         assert tube_props['Status'] == state
         # no strict check but at least check the properties exist
         assert tube_props['Parameters'] is not None
+        assert channel_props['Interfaces'] == \
+            dbus.Array(['org.freedesktop.Telepathy.Channel.Interface.Tube.DRAFT'],
+                    signature='s'), \
+            channel_props['Interfaces']
 
 def check_NewChannel_signal(old_sig, channel_type, chan_path, contact_handle):
     assert old_sig[0] == chan_path
-- 
1.5.6.5




More information about the Telepathy-commits mailing list