[telepathy-gabble/telepathy-gabble-0.8] Add compatibility bundles to the cache

Will Thompson will.thompson at collabora.co.uk
Mon Oct 5 08:44:04 PDT 2009


---
 src/capabilities.c                  |    9 +++++++++
 tests/twisted/caps/trust-thyself.py |   15 +++++++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/capabilities.c b/src/capabilities.c
index a2e245b..066e0f8 100644
--- a/src/capabilities.c
+++ b/src/capabilities.c
@@ -216,6 +216,15 @@ capabilities_fill_cache (GabblePresenceCache *cache)
   GOOGLE_BUNDLE ("camera-v1", 0);
 
 #undef GOOGLE_BUNDLE
+
+  /* We should also cache the ext='' bundles Gabble advertises: older Gabbles
+   * advertise these and don't support hashed caps, and we shouldn't need to
+   * disco them.
+   */
+  gabble_presence_cache_add_bundle_caps (cache,
+      NS_GABBLE_CAPS "#" BUNDLE_VOICE_V1, PRESENCE_CAP_GOOGLE_VOICE);
+  gabble_presence_cache_add_bundle_caps (cache,
+      NS_GABBLE_CAPS "#" BUNDLE_VIDEO_V1, PRESENCE_CAP_GOOGLE_VIDEO);
 }
 
 GabblePresenceCapabilities
diff --git a/tests/twisted/caps/trust-thyself.py b/tests/twisted/caps/trust-thyself.py
index 8732dc5..55bdd97 100644
--- a/tests/twisted/caps/trust-thyself.py
+++ b/tests/twisted/caps/trust-thyself.py
@@ -1,6 +1,6 @@
 """
 Test that we cache our own capabilities, so that we don't disco other people
-with the same caps hash.
+with the same caps hash or ext='' bundles.
 """
 from twisted.words.xish import xpath
 
@@ -22,12 +22,19 @@ def test(q, bus, conn, stream):
              })
     stream.send(p)
 
-    uri = c['node'] + '#' + c['ver']
     q.forbid_events([
-        EventPattern('stream-iq', to=jid, query_ns=ns.DISCO_INFO,
-            query_node=uri)
+        EventPattern('stream-iq', to=jid, query_ns=ns.DISCO_INFO),
     ])
     sync_stream(q, stream)
 
+    p = make_presence(jid,
+        caps={'node': c['node'],
+              'ver':  c['ver'],
+              # omitting hash='' so Gabble doesn't ignore ext=''
+              'ext':  'voice-v1 video-v1',
+            })
+    stream.send(p)
+    sync_stream(q, stream)
+
 if __name__ == '__main__':
     exec_test(test)
-- 
1.5.6.5




More information about the telepathy-commits mailing list