[telepathy-python/master] tube-stream-private: don't offer tube right away so Gabble has time to get contact's capabilities

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Jun 12 03:49:57 PDT 2009


---
 examples/tube-stream-private.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/examples/tube-stream-private.py b/examples/tube-stream-private.py
index 83459ee..9a02c0b 100644
--- a/examples/tube-stream-private.py
+++ b/examples/tube-stream-private.py
@@ -3,6 +3,7 @@ import dbus
 from telepathy.client import (Connection, Channel)
 from telepathy.interfaces import (CONN_INTERFACE, CHANNEL_TYPE_TUBES)
 from telepathy.constants import (CONNECTION_HANDLE_TYPE_CONTACT)
+import time
 
 from stream_tube_client import StreamTubeJoinerClient, \
         StreamTubeInitiatorClient
@@ -14,6 +15,11 @@ class StreamTubeInitiatorPrivateClient(StreamTubeInitiatorClient):
     def ready_cb(self, conn):
         StreamTubeInitiatorClient.ready_cb(self, conn)
 
+        # Gabble will refuse to create the tube if it didn't receive contact's
+        # capability yet (to ensure that he supports tubes). Ideally we should
+        # use the ContactCapability interface to determine when we can offer
+        # the tube. As this API is still a DRAFT, we just add a delay for now.
+        time.sleep(5)
         self.create_tube(CONNECTION_HANDLE_TYPE_CONTACT, self.contact_id)
 
 class StreamTubeJoinerPrivateClient(StreamTubeJoinerClient):
-- 
1.5.6.5




More information about the telepathy-commits mailing list