diff options
author | Tobias Fella <fella@posteo.de> | 2021-11-10 16:29:11 +0100 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2021-12-01 21:56:59 +0100 |
commit | 82cffec29937e4449a75040485d5188f429b7b1e (patch) | |
tree | 73aadea3adc5528efde6bafcdc6f25676f5f0ecf | |
parent | f42b91eb52ea408c6aedd4954cac7eb02e7b0df4 (diff) | |
download | libquotient-82cffec29937e4449a75040485d5188f429b7b1e.tar.gz libquotient-82cffec29937e4449a75040485d5188f429b7b1e.zip |
Try decrypting existing messages when a new key is added
-rw-r--r-- | lib/room.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index 688ba5d4..6c5a9d33 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -1596,6 +1596,14 @@ void Room::handleRoomKeyEvent(const RoomKeyEvent& roomKeyEvent, roomKeyEvent.sessionKey())) { qCWarning(E2EE) << "added new inboundGroupSession:" << d->groupSessions.size(); + for (unsigned long int i = 0; i < d->timeline.size(); i++) { + if (auto encryptedEvent = d->timeline[i].viewAs<EncryptedEvent>()) { + auto decrypted = decryptMessage(*encryptedEvent); + if(decrypted) { + d->timeline[i].replaceEvent(std::move(decrypted)); + } + } + } } #endif // Quotient_E2EE_ENABLED } |