From 2a135dc3be1b4f52578f8742269ddad76b49ff6a Mon Sep 17 00:00:00 2001 From: Goffi Date: Tue, 8 Feb 2011 00:01:53 +0100 Subject: [PATCH] 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 --- src/sat.tac | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/sat.tac b/src/sat.tac index 669907b2..0e9d1934 100644 --- a/src/sat.tac +++ b/src/sat.tac @@ -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)