MAM: Always reset state on reconnect

It was not reset if the previous MAM query was interrupted because of a disconnect
This commit is contained in:
Philipp Hörist 2019-05-15 20:12:41 +02:00
parent 03917eda66
commit ac4bde0447
2 changed files with 5 additions and 0 deletions

View File

@ -1346,6 +1346,7 @@ class Connection(CommonConnection, ConnectionHandlers):
self._discover_server()
self._set_send_timeouts()
self.get_module('Chatstate').enabled = True
self.get_module('MAM').reset_state()
def _set_send_timeouts(self):
if app.config.get_per('accounts', self.name, 'keep_alives_enabled'):

View File

@ -68,6 +68,10 @@ class MAM(BaseModule):
account=self._account,
feature=self.archiving_namespace))
def reset_state(self):
self._mam_query_ids.clear()
self._catch_up_finished.clear()
def _from_valid_archive(self, _stanza, properties):
if properties.type.is_groupchat:
expected_archive = properties.jid