[Telepathy-commits] [telepathy-gabble/master] add caps_helper.make_caps_disco_reply

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Mar 6 07:58:41 PST 2009


---
 tests/twisted/caps_helper.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/tests/twisted/caps_helper.py b/tests/twisted/caps_helper.py
index d142caa..a299a58 100644
--- a/tests/twisted/caps_helper.py
+++ b/tests/twisted/caps_helper.py
@@ -1,6 +1,9 @@
 import hashlib
 import base64
 
+from twisted.words.xish import domish
+from gabbletest import make_result_iq
+
 def compute_caps_hash(identities, features, dataforms):
     S = ''
 
@@ -16,6 +19,17 @@ def compute_caps_hash(identities, features, dataforms):
     m.update(S)
     return base64.b64encode(m.digest())
 
+def make_caps_disco_reply(stream, req, features):
+    iq = make_result_iq(stream, req)
+    query = iq.firstChildElement()
+
+    for f in features:
+        el = domish.Element((None, 'feature'))
+        el['var'] = f
+        query.addChild(el)
+
+    return iq
+
 if __name__ == '__main__':
     # example from XEP-0115
     assert compute_caps_hash(['client/pc//Exodus 0.9.1'],
-- 
1.5.6.5




More information about the telepathy-commits mailing list