Remove unused state update function

This commit is contained in:
Nicolas Werner 2025-05-24 10:20:13 +02:00
parent d21090f872
commit 5ef67d2a91
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
3 changed files with 0 additions and 57 deletions

View file

@ -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<StrippedEvent<state::Avatar>>(e) ||
std::holds_alternative<StrippedEvent<CanonicalAlias>>(e) ||
std::holds_alternative<StrippedEvent<Name>>(e) ||
std::holds_alternative<StrippedEvent<Member>>(e) ||
std::holds_alternative<StrippedEvent<Topic>>(e);
}
bool
Cache::isHiddenEvent(lmdb::txn &txn,
mtx::events::collections::TimelineEvents e,
@ -2781,42 +2768,6 @@ Cache::savePresence(
}
}
std::vector<std::string>
Cache::roomsWithStateUpdates(const mtx::responses::Sync &res)
{
std::vector<std::string> 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<std::string>
roomsWithStateUpdates(const mtx::responses::Sync &res)
{
return instance_->roomsWithStateUpdates(res);
}
std::map<QString, RoomInfo>
getRoomInfo(const std::vector<std::string> &rooms)

View file

@ -165,7 +165,6 @@ public:
UserReceipts readReceipts(const QString &event_id, const QString &room_id);
RoomInfo singleRoomInfo(const std::string &room_id);
std::vector<std::string> roomsWithStateUpdates(const mtx::responses::Sync &res);
std::map<QString, RoomInfo> getRoomInfo(const std::vector<std::string> &rooms);
std::vector<RoomNameAlias> roomNamesAndAliases();

View file

@ -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.