From 916416a019c398a484b6a436ee908808780263f9 Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 8 May 2014 01:37:52 +0200 Subject: Add an ugly fix to avoid endless disco#info queries with each message (with receipts) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to check if the remote entity supports 0184, but if it doesn’t support disco#info, then we will get an iq type="error" and nothing will be cached, leading to disco#info queries being sent each time. Keep a cache valid 2 hours of the JIDs which replied with an error. TODO: check that this the kind of time period we want. --- src/connection.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/connection.py') diff --git a/src/connection.py b/src/connection.py index a0e9a395..b06a013b 100644 --- a/src/connection.py +++ b/src/connection.py @@ -16,12 +16,17 @@ log = logging.getLogger(__name__) import getpass import sleekxmpp from sleekxmpp.plugins.xep_0184 import XEP_0184 +from sleekxmpp.plugins.xep_0030 import StaticDisco +from sleekxmpp.plugins.xep_0115 import StaticCaps import common import fixes from common import safeJID from config import config, options +StaticDisco.supports = fixes.xep_30_supports +StaticCaps.supports = fixes.xep_115_supports + class Connection(sleekxmpp.ClientXMPP): """ Receives everything from Jabber and emits the @@ -72,8 +77,6 @@ class Connection(sleekxmpp.ClientXMPP): self.whitespace_keepalive_interval = int(interval) else: self.whitespace_keepalive_interval = 300 - # Hack to check the sleekxmpp version - # TODO: Remove that when a sufficient time has passed since the move self.register_plugin('xep_0004') self.register_plugin('xep_0012') self.register_plugin('xep_0030') -- cgit v1.2.3