XEP-0198: unset end_session_on_disconnect on resume/enable

This commit is contained in:
Georg Lukas 2020-03-28 20:58:21 +01:00
parent efe316dc8c
commit 6c28b49e7f

View file

@ -83,10 +83,6 @@ class XEP_0198(BasePlugin):
self.xmpp.register_stanza(stanza.Ack) self.xmpp.register_stanza(stanza.Ack)
self.xmpp.register_stanza(stanza.RequestAck) self.xmpp.register_stanza(stanza.RequestAck)
# Only end the session when a </stream> element is sent,
# not just because the connection has died.
self.xmpp.end_session_on_disconnect = False
# Register the feature twice because it may be ordered two # Register the feature twice because it may be ordered two
# different ways: enabling after binding and resumption # different ways: enabling after binding and resumption
# before binding. # before binding.
@ -246,6 +242,7 @@ class XEP_0198(BasePlugin):
self.enabled_in = True self.enabled_in = True
self.handled = 0 self.handled = 0
self.xmpp.event('sm_enabled', stanza) self.xmpp.event('sm_enabled', stanza)
self.xmpp.end_session_on_disconnect = False
def _handle_resumed(self, stanza): def _handle_resumed(self, stanza):
"""Finish resuming a stream by resending unacked stanzas. """Finish resuming a stream by resending unacked stanzas.
@ -258,6 +255,7 @@ class XEP_0198(BasePlugin):
for id, stanza in self.unacked_queue: for id, stanza in self.unacked_queue:
self.xmpp.send(stanza, use_filters=False) self.xmpp.send(stanza, use_filters=False)
self.xmpp.event('session_resumed', stanza) self.xmpp.event('session_resumed', stanza)
self.xmpp.end_session_on_disconnect = False
def _handle_failed(self, stanza): def _handle_failed(self, stanza):
""" """