[Room] Fix decrypt last message

This commit is contained in:
Christian Pauly 2020-03-13 12:18:24 +00:00
parent bc5a716b3f
commit 57bd600738
1 changed files with 6 additions and 1 deletions

View File

@ -211,13 +211,17 @@ class Room {
"/clients/${client.deviceID}/rooms/${this.id}/session_keys", "/clients/${client.deviceID}/rooms/${this.id}/session_keys",
json.encode(sessionKeys)); json.encode(sessionKeys));
} }
_tryAgainDecryptLastMessage();
onSessionKeyReceived.add(sessionId);
}
void _tryAgainDecryptLastMessage() {
if (getState("m.room.encrypted") != null) { if (getState("m.room.encrypted") != null) {
final Event decrypted = getState("m.room.encrypted").decrypted; final Event decrypted = getState("m.room.encrypted").decrypted;
if (decrypted.type != EventTypes.Encrypted) { if (decrypted.type != EventTypes.Encrypted) {
setState(decrypted); setState(decrypted);
} }
} }
onSessionKeyReceived.add(sessionId);
} }
/// Returns the [Event] for the given [typeKey] and optional [stateKey]. /// Returns the [Event] for the given [typeKey] and optional [stateKey].
@ -917,6 +921,7 @@ class Room {
await client.storeAPI?.setItem( await client.storeAPI?.setItem(
"/clients/${client.deviceID}/rooms/${this.id}/session_keys", "/clients/${client.deviceID}/rooms/${this.id}/session_keys",
json.encode(sessionKeys)); json.encode(sessionKeys));
_tryAgainDecryptLastMessage();
_fullyRestored = true; _fullyRestored = true;
} }