summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorCH Chethan Reddy <40890937+Chethan2k1@users.noreply.github.com>2020-06-25 22:38:48 +0530
committerCH Chethan Reddy <40890937+Chethan2k1@users.noreply.github.com>2020-07-30 22:10:27 +0530
commitfd232b1f4a6d55b566ee138b30cfcc272129fabb (patch)
tree6cefa62c3bc48d0be16a047765a58181b621de1b /src
parentFix presence indicator (diff)
downloadnheko-fd232b1f4a6d55b566ee138b30cfcc272129fabb.tar.xz
Some more fixes
Diffstat (limited to 'src')
-rw-r--r--src/DeviceVerificationFlow.cpp12
-rw-r--r--src/DeviceVerificationFlow.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/src/DeviceVerificationFlow.cpp b/src/DeviceVerificationFlow.cpp
index db76aeb1..9f120a00 100644
--- a/src/DeviceVerificationFlow.cpp
+++ b/src/DeviceVerificationFlow.cpp
@@ -164,7 +164,10 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *)
                                         // uncomment this in future to be compatible with the
                                         // MSC2366 this->sendVerificationDone(); and remoeve the
                                         // below line
-                                        emit this->deviceVerified();
+                                        if (this->isMacVerified == true)
+                                                emit this->deviceVerified();
+                                        else
+                                                this->isMacVerified = true;
                                 } else {
                                         this->cancelVerification();
                                 }
@@ -503,11 +506,16 @@ DeviceVerificationFlow::sendVerificationMac()
         http::client()
           ->send_to_device<mtx::events::msg::KeyVerificationMac,
                            mtx::events::EventType::KeyVerificationMac>(
-            this->transaction_id, body, [](mtx::http::RequestErr err) {
+            this->transaction_id, body, [this](mtx::http::RequestErr err) {
                     if (err)
                             nhlog::net()->warn("failed to send verification MAC: {} {}",
                                                err->matrix_error.error,
                                                static_cast<int>(err->status_code));
+
+                    if (this->isMacVerified == true)
+                            emit this->deviceVerified();
+                    else
+                            this->isMacVerified = true;
             });
 }
 //! Completes the verification flow
diff --git a/src/DeviceVerificationFlow.h b/src/DeviceVerificationFlow.h
index 81ab9c99..5830e705 100644
--- a/src/DeviceVerificationFlow.h
+++ b/src/DeviceVerificationFlow.h
@@ -78,6 +78,7 @@ private:
 
         QTimer *timeout = nullptr;
         sas_ptr sas;
+        bool isMacVerified;
         std::string mac_method;
         std::string transaction_id;
         std::string commitment;