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
This commit is contained in:
Florent Le Coz 2015-07-21 18:02:37 +02:00
parent 1d74d67c1e
commit 729bed7aec
2 changed files with 3 additions and 2 deletions

View file

@ -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)

View file

@ -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,