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-30 22:27:14 +0530
committerCH Chethan Reddy <40890937+Chethan2k1@users.noreply.github.com>2020-08-30 22:27:14 +0530
commitb174bd938084a60fde5030dfc4dd0067a39f5a3f (patch)
tree6f2bb24fb2ba01adb2957aea67aecda501aa41ac /src/DeviceVerificationFlow.cpp
parentChange the tag for mtxclient (diff)
parentMerge pull request #265 from trilene/voip (diff)
downloadnheko-b174bd938084a60fde5030dfc4dd0067a39f5a3f.tar.xz
Merge remote-tracking branch 'upstream/master' into device-verification
Diffstat (limited to 'src/DeviceVerificationFlow.cpp')
-rw-r--r--src/DeviceVerificationFlow.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/DeviceVerificationFlow.cpp b/src/DeviceVerificationFlow.cpp

index dd828421..00c9602c 100644 --- a/src/DeviceVerificationFlow.cpp +++ b/src/DeviceVerificationFlow.cpp
@@ -165,6 +165,7 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *, } if (this->method == DeviceVerificationFlow::Method::Emoji) { + std::cout<<info<<std::endl; this->sasList = this->sas->generate_bytes_emoji(info); } else if (this->method == DeviceVerificationFlow::Method::Decimal) { this->sasList = this->sas->generate_bytes_decimal(info); @@ -235,7 +236,7 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *, &ChatPage::recievedDeviceVerificationReady, this, [this](const mtx::events::msg::KeyVerificationReady &msg) { - if (!sender) { + if (!sender && msg.from_device != http::client()->device_id()) { this->deleteLater(); emit verificationCanceled(); return; @@ -243,7 +244,7 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *, if (msg.transaction_id.has_value()) { if (msg.transaction_id.value() != this->transaction_id) return; - } else if (msg.relates_to.has_value()) { + } else if ((msg.relates_to.has_value() && sender)) { if (msg.relates_to.value().event_id != this->relation.event_id) return; else { @@ -405,7 +406,7 @@ DeviceVerificationFlow::acceptVerificationRequest() }); } else if (this->type == DeviceVerificationFlow::Type::RoomMsg && model_) { req.relates_to = this->relation; - (model_)->sendMessage(req); + (model_)->sendMessageEvent(req, mtx::events::EventType::KeyVerificationAccept); } } //! responds verification request @@ -432,7 +433,7 @@ DeviceVerificationFlow::sendVerificationReady() }); } else if (this->type == DeviceVerificationFlow::Type::RoomMsg && model_) { req.relates_to = this->relation; - (model_)->sendMessage(req); + (model_)->sendMessageEvent(req, mtx::events::EventType::KeyVerificationReady); } } //! accepts a verification @@ -456,7 +457,7 @@ DeviceVerificationFlow::sendVerificationDone() }); } else if (this->type == DeviceVerificationFlow::Type::RoomMsg && model_) { req.relates_to = this->relation; - (model_)->sendMessage(req); + (model_)->sendMessageEvent(req, mtx::events::EventType::KeyVerificationDone); } } //! starts the verification flow @@ -489,7 +490,7 @@ DeviceVerificationFlow::startVerificationRequest() } else if (this->type == DeviceVerificationFlow::Type::RoomMsg && model_) { req.relates_to = this->relation; this->canonical_json = nlohmann::json(req); - (model_)->sendMessage(req); + (model_)->sendMessageEvent(req, mtx::events::EventType::KeyVerificationStart); } } //! sends a verification request @@ -525,7 +526,7 @@ DeviceVerificationFlow::sendVerificationRequest() req.body = "User is requesting to verify keys with you. However, your client does " "not support this method, so you will need to use the legacy method of " "key verification."; - (model_)->sendMessage(req); + (model_)->sendMessageEvent(req, mtx::events::EventType::KeyVerificationRequest); } } //! cancels a verification flow @@ -573,7 +574,7 @@ DeviceVerificationFlow::cancelVerification(DeviceVerificationFlow::Error error_c }); } else if (this->type == DeviceVerificationFlow::Type::RoomMsg && model_) { req.relates_to = this->relation; - (model_)->sendMessage(req); + (model_)->sendMessageEvent(req, mtx::events::EventType::KeyVerificationCancel); this->deleteLater(); } @@ -612,7 +613,7 @@ DeviceVerificationFlow::sendVerificationKey() }); } else if (this->type == DeviceVerificationFlow::Type::RoomMsg && model_) { req.relates_to = this->relation; - (model_)->sendMessage(req); + (model_)->sendMessageEvent(req, mtx::events::EventType::KeyVerificationKey); } } //! sends the mac of the keys @@ -659,7 +660,7 @@ DeviceVerificationFlow::sendVerificationMac() }); } else if (this->type == DeviceVerificationFlow::Type::RoomMsg && model_) { req.relates_to = this->relation; - (model_)->sendMessage(req); + (model_)->sendMessageEvent(req, mtx::events::EventType::KeyVerificationMac); } } //! Completes the verification flow