core: use serialised dict for extra in messageNew and historyGet

This commit is contained in:
Goffi 2020-02-18 18:13:17 +01:00
commit 6a7d247754

View file

@ -590,10 +590,19 @@ class Memory(object):
def addToHistory(self, client, data):
return self.storage.addToHistory(data, client.profile)
def _historyGetSerialise(self, history_data):
return [
(uid, timestamp, from_jid, to_jid, message, subject, mess_type,
data_format.serialise(extra)) for uid, timestamp, from_jid, to_jid, message,
subject, mess_type, extra in history_data
]
def _historyGet(self, from_jid_s, to_jid_s, limit=C.HISTORY_LIMIT_NONE, between=True,
filters=None, profile=C.PROF_KEY_NONE):
return self.historyGet(jid.JID(from_jid_s), jid.JID(to_jid_s), limit, between,
d = self.historyGet(jid.JID(from_jid_s), jid.JID(to_jid_s), limit, between,
filters, profile)
d.addCallback(self._historyGetSerialise)
return d
def historyGet(self, from_jid, to_jid, limit=C.HISTORY_LIMIT_NONE, between=True,
filters=None, profile=C.PROF_KEY_NONE):