[Telepathy-commits] [telepathy-gabble/master] Don't include unoffered DTubes in ListTubes()
Will Thompson
will.thompson at collabora.co.uk
Tue Feb 3 03:37:05 PST 2009
---
src/tubes-channel.c | 13 +++++++++++--
tests/twisted/tubes/offer-private-dbus-tube-ibb.py | 8 +++++++-
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/tubes-channel.c b/src/tubes-channel.c
index 26389d1..a76af97 100644
--- a/src/tubes-channel.c
+++ b/src/tubes-channel.c
@@ -980,17 +980,26 @@ copy_tube_in_ptr_array (gpointer key,
TpHandle initiator;
gchar *service;
GHashTable *parameters;
- TpTubeState state;
+ GabbleTubeChannelState state;
TpTubeType type;
GPtrArray *array = (GPtrArray *) user_data;
GValue entry = {0,};
g_object_get (tube,
+ "state", &state,
+ NULL);
+
+ /* The old interface has no way to represent unoffered tubes, so they
+ * shouldn't appear in the result of ListTubes()
+ */
+ if (state == GABBLE_TUBE_CHANNEL_STATE_NOT_OFFERED)
+ return;
+
+ g_object_get (tube,
"type", &type,
"initiator-handle", &initiator,
"service", &service,
"parameters", ¶meters,
- "state", &state,
NULL);
g_value_init (&entry, TP_STRUCT_TYPE_TUBE_INFO);
diff --git a/tests/twisted/tubes/offer-private-dbus-tube-ibb.py b/tests/twisted/tubes/offer-private-dbus-tube-ibb.py
index 3e61b65..2220f8f 100644
--- a/tests/twisted/tubes/offer-private-dbus-tube-ibb.py
+++ b/tests/twisted/tubes/offer-private-dbus-tube-ibb.py
@@ -269,10 +269,16 @@ def test(q, bus, conn, stream):
assert tube_props[tp_name_prefix + '.Channel.InitiatorID'] \
== "test at localhost"
assert tube_props[tp_name_prefix + '.Channel.Interface.Tube.DRAFT.Parameters'] == sample_parameters
- assert tube_props[tp_name_prefix + '.Channel.Interface.Tube.DRAFT.Status'] == 3 # not offered
+ assert tube_props[tp_name_prefix + '.Channel.Interface.Tube.DRAFT.Status'] == TUBE_CHANNEL_STATE_NOT_OFFERED
event = q.expect('dbus-signal', signal='NewChannels')
+ # The tube's not offered, so it shouldn't be shown on the old interface.
+ # FIXME: actually the old proxy shouldn't still work here, given that we
+ # closed it a while ago.
+ tubes = tubes_iface.ListTubes(byte_arrays=True)
+ assert len(tubes) == 0, tubes
+
tube_chan = bus.get_object(conn.bus_name, tube_path)
tube_chan_iface = dbus.Interface(tube_chan, tp_name_prefix + '.Channel')
--
1.5.6.5
More information about the telepathy-commits
mailing list