diff options
-rw-r--r-- | lib/connection.cpp | 17 | ||||
-rw-r--r-- | lib/crypto/qolmsession.cpp | 5 |
2 files changed, 6 insertions, 16 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index b91a1a90..0c0bada6 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -109,8 +109,8 @@ public: #ifdef Quotient_E2EE_ENABLED std::unique_ptr<QOlmAccount> olmAccount; - //QScopedPointer<EncryptionManager> encryptionManager; bool isUploadingKeys = false; + QScopedPointer<EncryptionManager> encryptionManager; #endif // Quotient_E2EE_ENABLED QPointer<GetWellknownJob> resolverJob = nullptr; @@ -187,7 +187,6 @@ public: { qCWarning(E2EE) << "End-to-end encryption (E2EE) support is turned off."; return {}; - /* #ifndef Quotient_E2EE_ENABLED qCWarning(E2EE) << "End-to-end encryption (E2EE) support is turned off."; return {}; @@ -247,7 +246,6 @@ public: return std::move(decryptedEvent); #endif // Quotient_E2EE_ENABLED -*/ } }; @@ -761,7 +759,6 @@ void Connection::Private::consumePresenceData(Events&& presenceData) void Connection::Private::consumeToDeviceEvents(Events&& toDeviceEvents) { -/* #ifdef Quotient_E2EE_ENABLED // handling m.room_key to-device encrypted event visitEach(toDeviceEvents, [this](const EncryptedEvent& ee) { @@ -771,20 +768,15 @@ void Connection::Private::consumeToDeviceEvents(Events&& toDeviceEvents) return; } - // TODO: full maintaining of the device keys - // with device_lists sync extention and /keys/query - qCDebug(E2EE) << "Getting device keys for the m.room_key sender:" - << ee.senderId(); - // encryptionManager->updateDeviceKeys(); - visit(*sessionDecryptMessage(ee), [this, senderKey = ee.senderKey()](const RoomKeyEvent& roomKeyEvent) { - if (auto* detectedRoom = q->room(roomKeyEvent.roomId())) + if (auto* detectedRoom = q->room(roomKeyEvent.roomId())) { detectedRoom->handleRoomKeyEvent(roomKeyEvent, senderKey); - else + } else { qCDebug(E2EE) << "Encrypted event room id" << roomKeyEvent.roomId() << "is not found at the connection" << q->objectName(); + } }, [](const Event& evt) { qCDebug(E2EE) << "Skipping encrypted to_device event, type" @@ -792,7 +784,6 @@ void Connection::Private::consumeToDeviceEvents(Events&& toDeviceEvents) }); }); #endif -*/ } void Connection::stopSync() diff --git a/lib/crypto/qolmsession.cpp b/lib/crypto/qolmsession.cpp index a1f6ab71..2068a7d9 100644 --- a/lib/crypto/qolmsession.cpp +++ b/lib/crypto/qolmsession.cpp @@ -30,8 +30,7 @@ OlmSession* QOlmSession::create() std::variant<std::unique_ptr<QOlmSession>, QOlmError> QOlmSession::createInbound(QOlmAccount *account, const QOlmMessage &preKeyMessage, bool from, const QString &theirIdentityKey) { if (preKeyMessage.type() != QOlmMessage::PreKey) { - qCDebug(E2EE) << "The message is not a pre-key"; - throw BadMessageFormat; + qCCritical(E2EE) << "The message is not a pre-key in when creating inbound session" << BadMessageFormat; } const auto olmSession = create(); @@ -48,7 +47,7 @@ std::variant<std::unique_ptr<QOlmSession>, QOlmError> QOlmSession::createInbound if (error == olm_error()) { const auto lastErr = lastError(olmSession); if (lastErr == QOlmError::NotEnoughRandom) { - throw lastErr; + qCCritical(E2EE) << "Error when creating inbound session" << lastErr; } return lastErr; } |