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
This commit is contained in:
Goffi 2011-02-08 00:01:53 +01:00
commit 2a135dc3be

View file

@ -261,7 +261,9 @@ class SatFallbackHandler(generic.FallbackHandler):
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 @@ class RegisteringAuthenticator(xmlstream.ConnectAuthenticator):
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 @@ class SAT(service.Service):
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)