[telepathy-gabble/master] sync to latest tube API draft

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Wed Apr 29 07:00:18 PDT 2009


org.freedesktop.Telepathy.Channel.Type.StreamTube.DRAFT.Offer() doesn't
have a access_control_param any more.
---
 extensions/Channel_Type_Stream_Tube.xml          |   20 ++++++++++++++------
 src/tube-stream.c                                |   12 +++++++-----
 tests/twisted/tubes/offer-muc-stream-tube.py     |    7 +++----
 tests/twisted/tubes/offer-no-caps.py             |    2 +-
 tests/twisted/tubes/offer-private-stream-tube.py |    9 ++++-----
 5 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/extensions/Channel_Type_Stream_Tube.xml b/extensions/Channel_Type_Stream_Tube.xml
index a655ece..a495515 100644
--- a/extensions/Channel_Type_Stream_Tube.xml
+++ b/extensions/Channel_Type_Stream_Tube.xml
@@ -60,12 +60,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
           when it connects.
         </tp:docstring>
       </arg>
-      <arg direction="in" name="access_control_param" type="v">
-        <tp:docstring>
-          A parameter for the access control type, to be interpreted as
-          specified in the documentation for the Socket_Access_Control enum.
-        </tp:docstring>
-      </arg>
       <arg direction="in" name="parameters" type="a{sv}"
         tp:type="String_Variant_Map">
         <tp:docstring>
@@ -148,6 +142,20 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
           The handle of the participant who opened the new connection
         </tp:docstring>
       </arg>
+      <arg name="access_control_param" type="v">
+        <tp:docstring>
+          <p>A parameter for the access control type, to be interpreted as
+          specified in the documentation for the Socket_Access_Control
+          enum.</p>
+
+          <p>This parameter can be used by the listening process to identify
+          the connection. Note that this parameter has a meaningful value
+          only in the Socket_Access_Control_Port and
+          Socket_Access_Control_Credentials cases. If a different
+          Socket_Access_Control has been choosed when offering the tube, this
+          parameter should be ignored.</p>
+        </tp:docstring>
+      </arg>
     </signal>
 
     <property name="Service" type="s" access="read"
diff --git a/src/tube-stream.c b/src/tube-stream.c
index f6ea49a..bd4c3cf 100644
--- a/src/tube-stream.c
+++ b/src/tube-stream.c
@@ -1951,8 +1951,13 @@ stream_unix_tube_new_connection_cb (GabbleTubeStream *self,
                                     guint contact,
                                     gpointer user_data)
 {
+  GValue v = {0,};
+
+  /* FIXME */
+  g_value_init (&v, G_TYPE_STRING);
+  g_value_set_string (&v, "");
   gabble_svc_channel_type_stream_tube_emit_new_connection (self,
-      contact);
+      contact, &v);
 }
 
 
@@ -1967,7 +1972,6 @@ gabble_tube_stream_offer_async (GabbleSvcChannelTypeStreamTube *iface,
     guint address_type,
     const GValue *address,
     guint access_control,
-    const GValue *access_control_param,
     GHashTable *parameters,
     DBusGMethodInvocation *context)
 {
@@ -1985,7 +1989,7 @@ gabble_tube_stream_offer_async (GabbleSvcChannelTypeStreamTube *iface,
     }
 
   if (!gabble_tube_stream_check_params (address_type, address,
-        access_control, access_control_param, &error))
+        access_control, NULL, &error))
     {
       dbus_g_method_return_error (context, error);
       g_error_free (error);
@@ -2000,8 +2004,6 @@ gabble_tube_stream_offer_async (GabbleSvcChannelTypeStreamTube *iface,
   priv->address = tp_g_value_slice_dup (address);
   g_assert (priv->access_control == TP_SOCKET_ACCESS_CONTROL_LOCALHOST);
   priv->access_control = access_control;
-  g_assert (priv->access_control_param == NULL);
-  priv->access_control_param = tp_g_value_slice_dup (access_control_param);
 
   g_object_set (self, "parameters", parameters, NULL);
 
diff --git a/tests/twisted/tubes/offer-muc-stream-tube.py b/tests/twisted/tubes/offer-muc-stream-tube.py
index 3e84fd6..1426866 100644
--- a/tests/twisted/tubes/offer-muc-stream-tube.py
+++ b/tests/twisted/tubes/offer-muc-stream-tube.py
@@ -265,9 +265,7 @@ def test(q, bus, conn, stream, bytestream_cls,
     assert tube_props['State'] == cs.TUBE_CHANNEL_STATE_NOT_OFFERED
 
     # offer the tube
-    call_async(q, stream_tube_iface, 'Offer',
-        address_type, address, access_control, access_control_param,
-        {'foo': 'bar'})
+    call_async(q, stream_tube_iface, 'Offer', address_type, address, access_control, {'foo': 'bar'})
 
     new_tube_event, stream_event, _, status_event = q.expect_many(
         EventPattern('dbus-signal', signal='NewTube'),
@@ -324,7 +322,8 @@ def test(q, bus, conn, stream, bytestream_cls,
         EventPattern('dbus-signal', signal='NewConnection',
             interface=cs.CHANNEL_TYPE_STREAM_TUBE))
 
-    assert conn_event.args == [bob_handle]
+    handle, access = conn_event.args
+    assert handle == bob_handle
 
     protocol = socket_event.protocol
 
diff --git a/tests/twisted/tubes/offer-no-caps.py b/tests/twisted/tubes/offer-no-caps.py
index 7ee6de5..9ac365a 100644
--- a/tests/twisted/tubes/offer-no-caps.py
+++ b/tests/twisted/tubes/offer-no-caps.py
@@ -95,7 +95,7 @@ def test(q, bus, conn, stream):
     st_chan = bus.get_object(conn.bus_name, st_path)
     st = dbus.Interface(st_chan, cs.CHANNEL_TYPE_STREAM_TUBE)
     call_async(q, st, 'Offer', cs.SOCKET_ADDRESS_TYPE_UNIX,
-        address, cs.SOCKET_ACCESS_CONTROL_LOCALHOST, "", {})
+        address, cs.SOCKET_ACCESS_CONTROL_LOCALHOST, {})
     e = q.expect('dbus-error', method='Offer').error
     assert e.get_dbus_name() == cs.NOT_AVAILABLE, e.get_dbus_name()
 
diff --git a/tests/twisted/tubes/offer-private-stream-tube.py b/tests/twisted/tubes/offer-private-stream-tube.py
index 6d91293..92b6092 100644
--- a/tests/twisted/tubes/offer-private-stream-tube.py
+++ b/tests/twisted/tubes/offer-private-stream-tube.py
@@ -260,9 +260,7 @@ def test(q, bus, conn, stream, bytestream_cls,
             cs.TUBE_CHANNEL_STATE_REMOTE_PENDING)
 
     # Offer the first tube created (new API)
-    call_async(q, new_tube_iface, 'Offer',
-        address_type, address2, access_control,
-        access_control_param, new_sample_parameters)
+    call_async(q, new_tube_iface, 'Offer', address_type, address2, access_control, new_sample_parameters)
 
     msg_event, new_tube_sig, state_event = q.expect_many(
         EventPattern('stream-message'),
@@ -366,8 +364,9 @@ def test(q, bus, conn, stream, bytestream_cls,
         si_reply_event.stanza)
     assert len(tube) == 1
 
-    q.expect('dbus-signal', signal='NewConnection',
-        args=[bob_handle])
+    e = q.expect('dbus-signal', signal='NewConnection')
+    handle, access = e.args
+    assert handle == bob_handle
 
     expected_tube = (new_stream_tube_id, self_handle, cs.TUBE_TYPE_STREAM,
         'newecho', new_sample_parameters, cs.TUBE_STATE_OPEN)
-- 
1.5.6.5




More information about the telepathy-commits mailing list