From 5ef67d2a911230b33e0c19e1629d6ca8ee8829f3 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 24 May 2025 10:20:13 +0200 Subject: [PATCH] Remove unused state update function --- src/Cache.cpp | 54 ------------------------------------------------ src/Cache_p.h | 1 - src/ChatPage.cpp | 2 -- 3 files changed, 57 deletions(-) diff --git a/src/Cache.cpp b/src/Cache.cpp index 612f2721..65e703e0 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -357,19 +357,6 @@ compactDatabase(lmdb::env &from, lmdb::env &to) toTxn.commit(); } -static bool -containsStateUpdates(const mtx::events::collections::StrippedEvents &e) -{ - using namespace mtx::events; - using namespace mtx::events::state; - - return std::holds_alternative>(e) || - std::holds_alternative>(e) || - std::holds_alternative>(e) || - std::holds_alternative>(e) || - std::holds_alternative>(e); -} - bool Cache::isHiddenEvent(lmdb::txn &txn, mtx::events::collections::TimelineEvents e, @@ -2781,42 +2768,6 @@ Cache::savePresence( } } -std::vector -Cache::roomsWithStateUpdates(const mtx::responses::Sync &res) -{ - std::vector rooms; - for (const auto &room : res.rooms.join) { - bool hasUpdates = false; - for (const auto &s : room.second.state.events) { - if (mtx::accessors::is_state_event(s)) { - hasUpdates = true; - break; - } - } - - for (const auto &s : room.second.timeline.events) { - if (mtx::accessors::is_state_event(s)) { - hasUpdates = true; - break; - } - } - - if (hasUpdates) - rooms.emplace_back(room.first); - } - - for (const auto &room : res.rooms.invite) { - for (const auto &s : room.second.invite_state) { - if (containsStateUpdates(s)) { - rooms.emplace_back(room.first); - break; - } - } - } - - return rooms; -} - RoomInfo Cache::singleRoomInfo(const std::string &room_id) { @@ -6223,11 +6174,6 @@ singleRoomInfo(const std::string &room_id) { return instance_->singleRoomInfo(room_id); } -std::vector -roomsWithStateUpdates(const mtx::responses::Sync &res) -{ - return instance_->roomsWithStateUpdates(res); -} std::map getRoomInfo(const std::vector &rooms) diff --git a/src/Cache_p.h b/src/Cache_p.h index 3e6da887..89fdd843 100644 --- a/src/Cache_p.h +++ b/src/Cache_p.h @@ -165,7 +165,6 @@ public: UserReceipts readReceipts(const QString &event_id, const QString &room_id); RoomInfo singleRoomInfo(const std::string &room_id); - std::vector roomsWithStateUpdates(const mtx::responses::Sync &res); std::map getRoomInfo(const std::vector &rooms); std::vector roomNamesAndAliases(); diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index f9870bb9..d8f2f0c9 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -807,8 +807,6 @@ ChatPage::handleSyncResponse(const mtx::responses::Sync &res, const std::string cache::client()->saveState(res); olm::handle_to_device_messages(res.to_device.events); - auto updates = cache::getRoomInfo(cache::client()->roomsWithStateUpdates(res)); - emit syncUI(std::move(res)); // if the ignored users changed, clear timeline of all affected rooms.