RoomEvent: eventId property, which is now mainKey

This commit is contained in:
miruka 2019-05-14 19:39:31 -04:00
parent 40a19bf570
commit 0b32bf2738
2 changed files with 9 additions and 2 deletions

View File

@ -43,9 +43,10 @@ class Room(ListItem):
# ----------
class RoomEvent(ListItem):
_required_init_values = {"type", "dict", "dateTime"}
_required_init_values = {"eventId", "type", "dict", "dateTime"}
_constant = {"type"}
eventId: str = ""
type: str = ""
dict: Dict[str, Any] = {}
dateTime: QDateTime = QDateTime()

View File

@ -299,7 +299,12 @@ class SignalManager(QObject):
model = self.backend.roomEvents[room_id]
date_time = QDateTime\
.fromMSecsSinceEpoch(edict["server_timestamp"])
new_event = RoomEvent(type=etype, dateTime=date_time, dict=edict)
new_event = RoomEvent(
eventId = edict["event_id"],
type = etype,
dateTime = date_time,
dict = edict,
)
event_is_our_profile_changed = (
etype == "RoomMemberEvent" and
@ -387,6 +392,7 @@ class SignalManager(QObject):
"content": content,
})
event = RoomEvent(
eventId = f"localEcho.{self._events_in_transfer + 1}",
type = type(nio_event).__name__,
dict = nio_event.__dict__,
dateTime = date_time,