summary refs log tree commit diff
path: root/src/encryption/DeviceVerificationFlow.h
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-10-31 16:38:15 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-10-31 18:47:58 +0100
commit7824c772346e13f26eb878ce6a945fbb707e2247 (patch)
tree373ac7850c6eb87c1b4da7a62ec24330277d18f0 /src/encryption/DeviceVerificationFlow.h
parentFix version code having too many segments (diff)
downloadnheko-7824c772346e13f26eb878ce6a945fbb707e2247.tar.xz
Cleanup headers a bit more
Diffstat (limited to 'src/encryption/DeviceVerificationFlow.h')
-rw-r--r--src/encryption/DeviceVerificationFlow.h32
1 files changed, 3 insertions, 29 deletions
diff --git a/src/encryption/DeviceVerificationFlow.h b/src/encryption/DeviceVerificationFlow.h

index 6b1776e0..e64eab96 100644 --- a/src/encryption/DeviceVerificationFlow.h +++ b/src/encryption/DeviceVerificationFlow.h
@@ -7,13 +7,14 @@ #include <QObject> #include <mtx/responses/crypto.hpp> +#include <mtxclient/crypto/client.hpp> #include "CacheCryptoStructs.h" #include "Logging.h" #include "MatrixClient.h" -#include "timeline/TimelineModel.h" class QTimer; +class TimelineModel; using sas_ptr = std::unique_ptr<mtx::crypto::SAS>; @@ -230,32 +231,5 @@ private: bool keySent = false, macSent = false, acceptSent = false, startSent = false; template<typename T> - void send(T msg) - { - if (this->type == DeviceVerificationFlow::Type::ToDevice) { - mtx::requests::ToDeviceMessages<T> body; - msg.transaction_id = this->transaction_id; - for (const auto &d : deviceIds) - body[this->toClient][d.toStdString()] = msg; - - http::client()->send_to_device<T>( - http::client()->generate_txn_id(), body, [](mtx::http::RequestErr err) { - if (err) - nhlog::net()->warn("failed to send verification to_device message: {} {}", - err->matrix_error.error, - static_cast<int>(err->status_code)); - }); - } else if (this->type == DeviceVerificationFlow::Type::RoomMsg && model_) { - if constexpr (!std::is_same_v<T, mtx::events::msg::KeyVerificationRequest>) { - msg.relations.relations.push_back(this->relation); - // Set synthesized to surpress the nheko relation extensions - msg.relations.synthesized = true; - } - (model_)->sendMessageEvent(msg, mtx::events::to_device_content_to_type<T>); - } - - nhlog::net()->debug("Sent verification step: {} in state: {}", - mtx::events::to_string(mtx::events::to_device_content_to_type<T>), - state().toStdString()); - } + void send(T msg); };