From 729bed7aec6030facc7940dfbbcd37409d2e628e Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 21 Jul 2015 18:02:37 +0200 Subject: [PATCH] Always register the handlers for carbon, and only once The handlers are always there, but we only get carbons events when the server sends them to us, which is only when we enabled them. fix #3104 --- src/core/core.py | 3 +++ src/core/handlers.py | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/core.py b/src/core/core.py index bd0b8bde..e55a6503 100644 --- a/src/core/core.py +++ b/src/core/core.py @@ -249,6 +249,9 @@ class Core(object): self.xmpp.add_event_handler("attention", self.on_attention) self.xmpp.add_event_handler("ssl_cert", self.validate_ssl) self.xmpp.add_event_handler("ssl_invalid_chain", self.ssl_invalid_chain) + self.xmpp.add_event_handler('carbon_received', self.on_carbon_received) + self.xmpp.add_event_handler('carbon_sent', self.on_carbon_sent) + self.all_stanzas = Callback('custom matcher', connection.MatchAll(None), self.incoming_stanza) diff --git a/src/core/handlers.py b/src/core/handlers.py index 56ff7b42..6572bca4 100644 --- a/src/core/handlers.py +++ b/src/core/handlers.py @@ -103,8 +103,6 @@ def on_session_start_features(self, _): if (config.get('enable_carbons') and 'urn:xmpp:carbons:2' in features): self.xmpp.plugin['xep_0280'].enable() - self.xmpp.add_event_handler('carbon_received', self.on_carbon_received) - self.xmpp.add_event_handler('carbon_sent', self.on_carbon_sent) self.check_bookmark_storage(features) self.xmpp.plugin['xep_0030'].get_info(jid=self.xmpp.boundjid.domain,