Mercurial > libervia-backend
diff sat/plugins/plugin_xep_0313.py @ 3011:93da7c6f8e0c
plugin XEP-0198: retrieve missing messages + send buffered ones on hot reconnection:
Missing one2one messages are now retrieved with MAM on hot reconnection, and buffered ones
(which have most probably not been received by the server) are resent at the end of the
reconnection workflow. IQ results are not re-sent on hot reconnection, as they don't make
sense anymore with a new session.
fix 330
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 17 Jul 2019 09:28:35 +0200 |
parents | 32b6893240e0 |
children | 1f74cd0f22c3 |
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0313.py Wed Jul 17 09:28:34 2019 +0200 +++ b/sat/plugins/plugin_xep_0313.py Wed Jul 17 09:28:35 2019 +0200 @@ -73,7 +73,8 @@ async=True) @defer.inlineCallbacks - def profileConnected(self, client): + def resume(self, client): + """Retrieve one2one messages received since the last we have in local storage""" stanza_id_data = yield self.host.memory.storage.getPrivates( mam.NS_MAM, [KEY_LAST_STANZA_ID], profile=client.profile) stanza_id = stanza_id_data.get(KEY_LAST_STANZA_ID) @@ -142,6 +143,9 @@ log.info(_(u"We have received {num_mess} message(s) while offline.") .format(num_mess=count)) + def profileConnected(self, client): + return self.resume(client) + def getHandler(self, client): mam_client = client._mam = SatMAMClient(self) return mam_client