From 63bcce28deff6d6afe1d685a922d171b30a048e1 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Mon, 24 Feb 2020 09:10:35 +0100 Subject: [PATCH] [Room] Fix last message when encrypted --- lib/src/room.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/src/room.dart b/lib/src/room.dart index 6bfdfba..c2975b2 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -181,6 +181,12 @@ class Room { "/clients/${client.deviceID}/rooms/${this.id}/session_keys", json.encode(sessionKeys)); } + if (getState("m.room.encrypted") != null) { + final Event decrypted = getState("m.room.encrypted").decrypted; + if (decrypted.type != EventTypes.Encrypted) { + setState(decrypted); + } + } onSessionKeyReceived.add(sessionId); } @@ -210,6 +216,10 @@ class Room { clearOutboundGroupSession(); } } + if ((getState(state.typeKey)?.time?.millisecondsSinceEpoch ?? 0) > + state.time.millisecondsSinceEpoch) { + return; + } if (!states.states.containsKey(state.typeKey)) { states.states[state.typeKey] = {}; }