diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-09-26 13:52:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-26 13:52:22 +0200 |
commit | 15b840d82d4794358fbf1271ea76e446b47db7e5 (patch) | |
tree | aa5fdaa81234a21c6919fac4958f84d7c26cd397 | |
parent | 72e14cb1bdff68dfe0fb61fff0defd6c50dff43c (diff) | |
parent | 5904a61c59f0eef00aef07ef998658fd791ff139 (diff) | |
download | libquotient-15b840d82d4794358fbf1271ea76e446b47db7e5.tar.gz libquotient-15b840d82d4794358fbf1271ea76e446b47db7e5.zip |
Merge branch 'dev' into kitsune/unify-olm-errors
-rw-r--r-- | lib/connection.cpp | 3 | ||||
-rw-r--r-- | lib/events/encryptedevent.cpp | 18 | ||||
-rw-r--r-- | lib/keyverificationsession.cpp | 2 | ||||
-rw-r--r-- | lib/mxcreply.cpp | 9 |
4 files changed, 17 insertions, 15 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index 51c2062f..4547474a 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -1002,6 +1002,9 @@ bool Connection::Private::processIfVerificationEvent(const Event& evt, emit q->newKeyVerificationSession(*sessionIter); return true; }, + [](const KeyVerificationDoneEvent&) { + return true; + }, [this](const KeyVerificationEvent& kvEvt) { if (auto* const session = verificationSessions.value(kvEvt.transactionId())) { diff --git a/lib/events/encryptedevent.cpp b/lib/events/encryptedevent.cpp index 114addb5..540594d1 100644 --- a/lib/events/encryptedevent.cpp +++ b/lib/events/encryptedevent.cpp @@ -9,21 +9,19 @@ using namespace Quotient; EncryptedEvent::EncryptedEvent(const QJsonObject& ciphertexts, const QString& senderKey) - : RoomEvent({ { AlgorithmKeyL, OlmV1Curve25519AesSha2AlgoKey }, - { CiphertextKeyL, ciphertexts }, - { SenderKeyKeyL, senderKey } }) + : RoomEvent(basicJson(TypeId, { { AlgorithmKeyL, OlmV1Curve25519AesSha2AlgoKey }, + { CiphertextKeyL, ciphertexts }, + { SenderKeyKeyL, senderKey } })) {} EncryptedEvent::EncryptedEvent(const QByteArray& ciphertext, const QString& senderKey, const QString& deviceId, const QString& sessionId) - : RoomEvent({ - { AlgorithmKeyL, MegolmV1AesSha2AlgoKey }, - { CiphertextKeyL, QString(ciphertext) }, - { DeviceIdKeyL, deviceId }, - { SenderKeyKeyL, senderKey }, - { SessionIdKeyL, sessionId }, - }) + : RoomEvent(basicJson(TypeId, { { AlgorithmKeyL, MegolmV1AesSha2AlgoKey }, + { CiphertextKeyL, QString(ciphertext) }, + { DeviceIdKeyL, deviceId }, + { SenderKeyKeyL, senderKey }, + { SessionIdKeyL, sessionId } })) {} EncryptedEvent::EncryptedEvent(const QJsonObject& obj) diff --git a/lib/keyverificationsession.cpp b/lib/keyverificationsession.cpp index 171596c0..4c61964c 100644 --- a/lib/keyverificationsession.cpp +++ b/lib/keyverificationsession.cpp @@ -119,7 +119,7 @@ void KeyVerificationSession::handleEvent(const KeyVerificationEvent& baseEvent) return true; }, [this](const KeyVerificationMacEvent& event) { - if (state() != WAITINGFORMAC) + if (state() != WAITINGFORMAC && state() != WAITINGFORVERIFICATION) return false; handleMac(event); return true; diff --git a/lib/mxcreply.cpp b/lib/mxcreply.cpp index c7547be8..ce833b98 100644 --- a/lib/mxcreply.cpp +++ b/lib/mxcreply.cpp @@ -63,10 +63,11 @@ MxcReply::MxcReply(QNetworkReply* reply, Room* room, const QString &eventId) #ifdef Quotient_E2EE_ENABLED auto eventIt = room->findInTimeline(eventId); if(eventIt != room->historyEdge()) { - auto event = eventIt->viewAs<RoomMessageEvent>(); - if (auto* efm = std::get_if<EncryptedFileMetadata>( - &event->content()->fileInfo()->source)) - d->m_encryptedFile = *efm; + if (auto event = eventIt->viewAs<RoomMessageEvent>()) { + if (auto* efm = std::get_if<EncryptedFileMetadata>( + &event->content()->fileInfo()->source)) + d->m_encryptedFile = *efm; + } } #endif } |