diff sat_frontends/quick_frontend/quick_chat.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 559a625a236b
children 4b5c77673015
line wrap: on
line diff
--- a/sat_frontends/quick_frontend/quick_chat.py	Fri Feb 14 15:18:52 2020 +0100
+++ b/sat_frontends/quick_frontend/quick_chat.py	Tue Feb 18 18:13:17 2020 +0100
@@ -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 collections import OrderedDict
 from sat_frontends.tools import jid
 import time
+
+
 log = getLogger(__name__)
 
 try:
@@ -44,11 +45,12 @@
 # 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 @@
             #     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