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-23 23:29:00 +0530
committerCH Chethan Reddy <40890937+Chethan2k1@users.noreply.github.com>2020-07-30 22:10:27 +0530
commitd49ab156569f4f963a2306ff8074b6a22f28a31c (patch)
tree056616bbbb67febeb97c661d7745e1792e7981e1 /src
parentAdd some more slots and mac (diff)
downloadnheko-d49ab156569f4f963a2306ff8074b6a22f28a31c.tar.xz
Some Improvements
    - DeviceVerificationList change to LinkedList to improve time
    complexity while deleting
    - Downgrade the flow to not use key.verification.done and
    key.verification.ready
Diffstat (limited to 'src')
-rw-r--r--src/DeviceVerificationFlow.cpp6
-rw-r--r--src/timeline/TimelineViewManager.cpp17
-rw-r--r--src/timeline/TimelineViewManager.h3
3 files changed, 10 insertions, 16 deletions
diff --git a/src/DeviceVerificationFlow.cpp b/src/DeviceVerificationFlow.cpp

index 0de94c50..db76aeb1 100644 --- a/src/DeviceVerificationFlow.cpp +++ b/src/DeviceVerificationFlow.cpp
@@ -1,7 +1,6 @@ #include "DeviceVerificationFlow.h" #include "ChatPage.h" #include "Logging.h" -#include "Utils.h" #include <QDateTime> #include <QTimer> @@ -162,7 +161,10 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *) } if (msg.content.keys == this->sas->calculate_mac(key_string, info + "KEY_IDS")) { - this->sendVerificationDone(); + // uncomment this in future to be compatible with the + // MSC2366 this->sendVerificationDone(); and remoeve the + // below line + emit this->deviceVerified(); } else { this->cancelVerification(); } diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index 7d016cbd..234b0bb6 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp
@@ -26,26 +26,17 @@ namespace msgs = mtx::events::msg; void DeviceVerificationList::add(QString tran_id) { - this->dv_list.push_back(tran_id); + this->dv_list.append(tran_id); } void DeviceVerificationList::remove(QString tran_id) { - for (QVector<QString>::iterator it = 0; it != (this->dv_list).end(); ++it) { - if (*it == tran_id) { - this->dv_list.erase(it); - break; - } - } + this->dv_list.removeOne(tran_id); } bool DeviceVerificationList::exist(QString tran_id) { - for (int i = 0; i < (this->dv_list).size(); ++i) { - if (dv_list[i] == tran_id) - return true; - } - return false; + return this->dv_list.contains(tran_id); } void @@ -183,7 +174,7 @@ TimelineViewManager::TimelineViewManager(QSharedPointer<UserSettings> userSettin msg.content.methods.end(), mtx::events::msg::VerificationMethods::SASv1) != msg.content.methods.end()) { - flow->sendVerificationReady(); + // flow->sendVerificationReady(); emit newDeviceVerificationRequest( std::move(flow), QString::fromStdString(msg.content.transaction_id), diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index 946461f9..8af6d137 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h
@@ -1,6 +1,7 @@ #pragma once #include <QHash> +#include <QLinkedList> #include <QQuickView> #include <QQuickWidget> #include <QSharedPointer> @@ -31,7 +32,7 @@ public: Q_INVOKABLE bool exist(QString tran_id); private: - QVector<QString> dv_list; + QLinkedList<QString> dv_list; }; class TimelineViewManager : public QObject