Mercurial > libervia-backend
comparison sat/memory/memory.py @ 3170:39d7327583e1
core: use serialised dict for `extra` in messageNew and historyGet
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 18 Feb 2020 18:13:17 +0100 |
parents | d10b2368684e |
children | ae09989e9feb |
comparison
equal
deleted
inserted
replaced
3169:560642ab1c10 | 3170:39d7327583e1 |
---|---|
588 ## History ## | 588 ## History ## |
589 | 589 |
590 def addToHistory(self, client, data): | 590 def addToHistory(self, client, data): |
591 return self.storage.addToHistory(data, client.profile) | 591 return self.storage.addToHistory(data, client.profile) |
592 | 592 |
593 def _historyGetSerialise(self, history_data): | |
594 return [ | |
595 (uid, timestamp, from_jid, to_jid, message, subject, mess_type, | |
596 data_format.serialise(extra)) for uid, timestamp, from_jid, to_jid, message, | |
597 subject, mess_type, extra in history_data | |
598 ] | |
599 | |
593 def _historyGet(self, from_jid_s, to_jid_s, limit=C.HISTORY_LIMIT_NONE, between=True, | 600 def _historyGet(self, from_jid_s, to_jid_s, limit=C.HISTORY_LIMIT_NONE, between=True, |
594 filters=None, profile=C.PROF_KEY_NONE): | 601 filters=None, profile=C.PROF_KEY_NONE): |
595 return self.historyGet(jid.JID(from_jid_s), jid.JID(to_jid_s), limit, between, | 602 d = self.historyGet(jid.JID(from_jid_s), jid.JID(to_jid_s), limit, between, |
596 filters, profile) | 603 filters, profile) |
604 d.addCallback(self._historyGetSerialise) | |
605 return d | |
597 | 606 |
598 def historyGet(self, from_jid, to_jid, limit=C.HISTORY_LIMIT_NONE, between=True, | 607 def historyGet(self, from_jid, to_jid, limit=C.HISTORY_LIMIT_NONE, between=True, |
599 filters=None, profile=C.PROF_KEY_NONE): | 608 filters=None, profile=C.PROF_KEY_NONE): |
600 """Retrieve messages in history | 609 """Retrieve messages in history |
601 | 610 |