changeset 292:f7bd973bba5a

core: wokkel behavious work around on VersionHandler to avoid XEP-0115 issue with ejabberd (see comments for details) iq fallback trace not shown anymore when iq is actually handled
author Goffi <goffi@goffi.org>
date Tue, 08 Feb 2011 00:01:53 +0100
parents 7c79d4a8c9e6
children 42438e43104a
files src/sat.tac
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/sat.tac	Sun Feb 06 23:49:27 2011 +0100
+++ b/src/sat.tac	Tue Feb 08 00:01:53 2011 +0100
@@ -261,7 +261,9 @@
         generic.FallbackHandler.__init__(self)
 
     def iqFallback(self, iq):
-        debug (u"iqFallback: xml = [%s], handled=%s" % (iq.toXml(), "True" if iq.handled else "False"))
+        if iq.handled == True:
+            return
+        debug (u"iqFallback: xml = [%s]" % (iq.toXml()))
         generic.FallbackHandler.iqFallback(self, iq)
 
 class RegisteringAuthenticator(xmlstream.ConnectAuthenticator):
@@ -309,7 +311,16 @@
             answer_data={"message":_("Registration failed (%s)") % str(failure.value.condition)}
         self.host.bridge.actionResult(answer_type, self.answer_id, answer_data)
         self.xmlstream.sendFooter()
-        
+
+class SatVersionHandler(generic.VersionHandler):
+
+    def getDiscoInfo(self, requestor, target, node):
+        #XXX: We need to work around wokkel's behavious (namespace not added if there is a
+        # node) as it cause issues with XEP-0115 & PEP (XEP-0163): there is a node when server
+        # ask for disco info, and not when we generate the key, so the hash is used with different
+        # disco features, and when the server (seen on ejabberd) generate its own hash for security check
+        # it reject our features (resulting in e.g. no notification on PEP)
+        return generic.VersionHandler.getDiscoInfo(self, requestor, target, None)
 
 class SAT(service.Service):
    
@@ -453,7 +464,7 @@
         current.fallBack = SatFallbackHandler(self)
         current.fallBack.setHandlerParent(current)
 
-        current.versionHandler = generic.VersionHandler(self.get_const('client_name'),
+        current.versionHandler = SatVersionHandler(self.get_const('client_name'),
                                                      self.get_const('client_version'))
         current.versionHandler.setHandlerParent(current)