diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-04-11 00:11:46 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-04-11 01:38:46 +0200 |
commit | 10b65b78fa8265dbeeb33e755fafcd642b21b514 (patch) | |
tree | 937cd43488aa8e938937a79422cd09966422874f /src/ChatPage.cpp | |
parent | 7973fbce8c0db3eb82eafb4cc0f776ba10ec8a79 (diff) |
Adapt to the new inherited variant
Diffstat (limited to 'src/ChatPage.cpp')
-rw-r--r-- | src/ChatPage.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index b5c8d3b4..4e0d373c 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -270,7 +270,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent) auto ctx = roomModel->pushrulesRoomContext(); std::vector< - std::pair<mtx::common::Relation, mtx::events::collections::TimelineEvent>> + std::pair<mtx::common::Relation, mtx::events::collections::TimelineEvents>> relatedEvents; for (const auto &event : room.timeline.events) { @@ -286,9 +286,9 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent) if (sender == http::client()->user_id().to_string()) continue; - mtx::events::collections::TimelineEvent te{event}; + mtx::events::collections::TimelineEvents te{event}; std::visit([room_id = room_id](auto &event_) { event_.room_id = room_id; }, - te.data); + te); if (auto encryptedEvent = std::get_if<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>( @@ -298,23 +298,24 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent) auto result = olm::decryptEvent(index, *encryptedEvent); if (result.event) - te.data = result.event.value(); + te = std::move(result.event).value(); } relatedEvents.clear(); - for (const auto &r : mtx::accessors::relations(te.data).relations) { + for (const auto &r : mtx::accessors::relations(te).relations) { auto related = cache::client()->getEvent(room_id, r.event_id); if (related) { relatedEvents.emplace_back(r, *related); if (auto encryptedEvent = std::get_if< mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>( - &related->data); + &related.value()); encryptedEvent && userSettings_->decryptNotifications()) { MegolmSessionIndex index(room_id, encryptedEvent->content); auto result = olm::decryptEvent(index, *encryptedEvent); if (result.event) - relatedEvents.back().second.data = result.event.value(); + relatedEvents.back().second = + std::move(result.event).value(); } } } @@ -343,7 +344,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QObject *parent) notificationsManager->postNotification( mtx::responses::Notification{ .actions = actions, - .event = te.data, + .event = std::move(te), .read = false, .profile_tag = "", .room_id = room_id, |