summary refs log tree commit diff
path: root/src/Cache.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-03-15 17:11:02 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-03-15 17:11:02 +0100
commit86766b739d634adcaa3953c78510d5b10fa88835 (patch)
treeeb9f76683febbf5c7fecedd61ec9bd62660aa4d8 /src/Cache.cpp
parentMerge pull request #523 from Jedi18/master (diff)
downloadnheko-86766b739d634adcaa3953c78510d5b10fa88835.tar.xz
Store all state events
Diffstat (limited to '')
-rw-r--r--src/Cache.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp

index cfc6a727..ec0f2858 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp
@@ -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,