Store all state events

This commit is contained in:
Nicolas Werner 2021-03-15 17:11:02 +01:00
parent 6548b84e29
commit 86766b739d
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
3 changed files with 38 additions and 51 deletions

View file

@ -91,6 +91,26 @@ namespace {
std::unique_ptr<Cache> instance_ = nullptr;
}
template<class T>
bool
containsStateUpdates(const T &e)
{
return std::visit([](const auto &ev) { return Cache::isStateEvent(ev); }, e);
}
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,