[Telepathy-commits] [telepathy-gabble/master] gabbletest.py: add a stream that claims to implement Google extensions

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Feb 25 08:05:02 PST 2009


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

diff --git a/tests/twisted/gabbletest.py b/tests/twisted/gabbletest.py
index f0e1a08..bcead37 100644
--- a/tests/twisted/gabbletest.py
+++ b/tests/twisted/gabbletest.py
@@ -260,6 +260,24 @@ class JabberXmlStream(BaseXmlStream):
 class XmppXmlStream(BaseXmlStream):
     version = (1, 0)
 
+class GoogleXmlStream(BaseXmlStream):
+    # ???
+    version = (0, 9)
+
+    def _cb_disco_iq(self, iq):
+        if iq.getAttribute('to') == 'localhost':
+            nodes = xpath.queryForNodes(
+                "/iq/query[@xmlns='http://jabber.org/protocol/disco#info']",
+                iq)
+            query = nodes[0]
+            feature = query.addElement('feature')
+            feature['var'] = ns.GOOGLE_ROSTER
+            feature = query.addElement('feature')
+            feature['var'] = ns.GOOGLE_JINGLE_INFO
+
+            iq['type'] = 'result'
+            self.send(iq)
+
 def make_connection(bus, event_func, params=None):
     default_params = {
         'account': 'test at localhost/Resource',
-- 
1.5.6.5




More information about the telepathy-commits mailing list