summary refs log tree commit diff
path: root/src/DeviceVerificationFlow.cpp
diff options
context:
space:
mode:
authorCH Chethan Reddy <40890937+Chethan2k1@users.noreply.github.com>2020-08-29 13:37:51 +0530
committerCH Chethan Reddy <40890937+Chethan2k1@users.noreply.github.com>2020-08-29 13:37:51 +0530
commit0d1dd29b19a3f4459b036bd63f03c518e000d71f (patch)
tree5e7e400d497fec0326413ac22f12903bce91b019 /src/DeviceVerificationFlow.cpp
parentVerify signatures and find trusted devices (diff)
downloadnheko-0d1dd29b19a3f4459b036bd63f03c518e000d71f.tar.xz
Small Fixes
Diffstat (limited to 'src/DeviceVerificationFlow.cpp')
-rw-r--r--src/DeviceVerificationFlow.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/DeviceVerificationFlow.cpp b/src/DeviceVerificationFlow.cpp

index 8c230887..dd828421 100644 --- a/src/DeviceVerificationFlow.cpp +++ b/src/DeviceVerificationFlow.cpp
@@ -7,6 +7,7 @@ #include <QDateTime> #include <QTimer> +#include <iostream> static constexpr int TIMEOUT = 2 * 60 * 1000; // 2 minutes @@ -75,7 +76,14 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *, DeviceVerificationFlow::Error::UnknownMethod); return; } - this->canonical_json = nlohmann::json(msg); + if (!sender) + this->canonical_json = nlohmann::json(msg); + else { + if (utils::localUser().toStdString() < + this->toClient.to_string()) { + this->canonical_json = nlohmann::json(msg); + } + } this->acceptVerificationRequest(); } else { this->cancelVerification(DeviceVerificationFlow::Error::UnknownMethod); @@ -124,6 +132,7 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *, if (msg.relates_to.value().event_id != this->relation.event_id) return; } + this->deleteLater(); emit verificationCanceled(); }); @@ -226,6 +235,11 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *, &ChatPage::recievedDeviceVerificationReady, this, [this](const mtx::events::msg::KeyVerificationReady &msg) { + if (!sender) { + this->deleteLater(); + emit verificationCanceled(); + return; + } if (msg.transaction_id.has_value()) { if (msg.transaction_id.value() != this->transaction_id) return;