summary refs log tree commit diff
path: root/src/Cache.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-22 14:19:05 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-22 14:19:05 +0300
commit1642f3cf40154e6183b7eae031a40d89c7eba948 (patch)
treea45add2aa5bb43625ced920c37c4573209ae5a05 /src/Cache.cc
parentProperly clean stale invites (diff)
downloadnheko-1642f3cf40154e6183b7eae031a40d89c7eba948.tar.xz
Update invites in the UI after sync
Diffstat (limited to 'src/Cache.cc')
-rw-r--r--src/Cache.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Cache.cc b/src/Cache.cc

index 2e210f6b..129b6696 100644 --- a/src/Cache.cc +++ b/src/Cache.cc
@@ -579,6 +579,25 @@ Cache::roomInfo(bool withInvites) return result; } +std::map<QString, bool> +Cache::invites() +{ + std::map<QString, bool> result; + + auto txn = lmdb::txn::begin(env_, nullptr, MDB_RDONLY); + auto cursor = lmdb::cursor::open(txn, invitesDb_); + + std::string room_id, unused; + + while (cursor.get(room_id, unused, MDB_NEXT)) + result.emplace(QString::fromStdString(std::move(room_id)), true); + + cursor.close(); + txn.commit(); + + return result; +} + QString Cache::getRoomAvatarUrl(lmdb::txn &txn, lmdb::dbi &statesdb,