aboutsummaryrefslogtreecommitdiff
path: root/lib/room.cpp
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-02-27 14:26:00 +0100
committerGitHub <noreply@github.com>2022-02-27 14:26:00 +0100
commit4768823708fe42140d23fbb828d2d5f438bb3787 (patch)
treee7f7d33d81b55e6669f542017f175db665eee9b0 /lib/room.cpp
parent8871fd723382d1a19e8e29b2877f70151bf8e8a1 (diff)
parent6e092bd322f52bde1b037d600a7ce71f5b30f2e4 (diff)
downloadlibquotient-4768823708fe42140d23fbb828d2d5f438bb3787.tar.gz
libquotient-4768823708fe42140d23fbb828d2d5f438bb3787.zip
Merge pull request #537 from TobiasFella/decryptcheckroom
Diffstat (limited to 'lib/room.cpp')
-rw-r--r--lib/room.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index ea9915c3..6197b3a2 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -1487,7 +1487,12 @@ RoomEventPtr Room::decryptMessage(const EncryptedEvent& encryptedEvent)
// qCWarning(E2EE) << "Encrypted message is empty";
return {};
}
- return encryptedEvent.createDecrypted(decrypted);
+ auto decryptedEvent = encryptedEvent.createDecrypted(decrypted);
+ if (decryptedEvent->roomId() == id()) {
+ return decryptedEvent;
+ }
+ qCWarning(E2EE) << "Decrypted event" << encryptedEvent.id() << "not for this room; discarding.";
+ return {};
#endif // Quotient_E2EE_ENABLED
}