From 8a4bd37fead20e24876ec9ce703cabb041ec67ba Mon Sep 17 00:00:00 2001 From: CH Chethan Reddy <40890937+Chethan2k1@users.noreply.github.com> Date: Tue, 18 Aug 2020 11:29:02 +0530 Subject: [WIP] Room Verification Works! --- src/timeline/EventStore.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/timeline/EventStore.cpp') diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp index 208b20e2..b210e157 100644 --- a/src/timeline/EventStore.cpp +++ b/src/timeline/EventStore.cpp @@ -95,8 +95,8 @@ EventStore::EventStore(std::string room_id, QObject *) room_id_, txn_id, e.content, - [this, txn_id](const mtx::responses::EventId &event_id, - mtx::http::RequestErr err) { + [this, txn_id, e](const mtx::responses::EventId &event_id, + mtx::http::RequestErr err) { if (err) { const int status_code = static_cast(err->status_code); @@ -108,7 +108,21 @@ EventStore::EventStore(std::string room_id, QObject *) emit messageFailed(txn_id); return; } + emit messageSent(txn_id, event_id.event_id.to_string()); + if constexpr (mtx::events::message_content_to_type< + decltype(e.content)> == + mtx::events::EventType::RoomEncrypted) { + auto event = + decryptEvent({room_id_, e.event_id}, e); + if (auto dec = + std::get_if>(event)) { + emit updateFlowEventId( + event_id.event_id.to_string()); + } + } }); }, event->data); @@ -318,12 +332,12 @@ EventStore::reactions(const std::string &event_id) if (auto reaction = std::get_if>( related_event)) { - auto &agg = aggregation[reaction->content.relates_to.key]; + auto &agg = aggregation[reaction->content.relates_to.key.value()]; if (agg.count == 0) { Reaction temp{}; temp.key_ = - QString::fromStdString(reaction->content.relates_to.key); + QString::fromStdString(reaction->content.relates_to.key.value()); reactions.push_back(temp); } -- cgit 1.5.1