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

@ -1,7 +1,6 @@
#!/usr/bin/env python3
# helper class for making a SAT frontend
# helper class for making a SàT frontend
# Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org)
# This program is free software: you can redistribute it and/or modify
@ -26,6 +25,8 @@ from sat_frontends.quick_frontend.constants import Const as C
from collections import OrderedDict
from sat_frontends.tools import jid
import time
log = getLogger(__name__)
try:
@ -44,11 +45,12 @@ ROOM_USER_MOVED = (ROOM_USER_JOINED, ROOM_USER_LEFT)
# FIXME: day_format need to be settable (i18n)
class Message(object):
class Message:
"""Message metadata"""
def __init__(self, parent, uid, timestamp, from_jid, to_jid, msg, subject, type_,
extra, profile):
def __init__(
self, parent, uid, timestamp, from_jid, to_jid, msg, subject, type_, extra,
profile):
self.parent = parent
self.profile = profile
self.uid = uid
@ -628,9 +630,10 @@ class QuickChat(quick_widgets.QuickWidget):
# self.printDayChange(message_day)
# previous_day = message_day
for data in history:
uid, timestamp, from_jid, to_jid, message, subject, type_, extra = data
uid, timestamp, from_jid, to_jid, message, subject, type_, extra_s = data
from_jid = jid.JID(from_jid)
to_jid = jid.JID(to_jid)
extra = data_format.deserialise(extra_s)
# if ((self.type == C.CHAT_GROUP and type_ != C.MESS_TYPE_GROUPCHAT) or
# (self.type == C.CHAT_ONE2ONE and type_ == C.MESS_TYPE_GROUPCHAT)):
# continue