summary refs log tree commit diff
path: root/src/Cache.cpp
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-21 21:40:11 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-22 14:11:28 +0300
commit5dfd26abc5c57fe278a3b396a793da11f56eae6f (patch)
tree61217f65887e539fd2c4260c1433f0c30fd96be8 /src/Cache.cpp
parenti18n: Update Polish translation (#382) (diff)
downloadnheko-5dfd26abc5c57fe278a3b396a793da11f56eae6f.tar.xz
Reject key requests for users that are not members of the room
Diffstat (limited to '')
-rw-r--r--src/Cache.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp

index a1242633..b12c8679 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp
@@ -1714,6 +1714,19 @@ Cache::getMembers(const std::string &room_id, std::size_t startIndex, std::size_ return members; } +bool +Cache::isRoomMember(const std::string &user_id, const std::string &room_id) +{ + auto txn = lmdb::txn::begin(env_); + auto db = getMembersDb(txn, room_id); + + lmdb::val value; + bool res = lmdb::dbi_get(txn, db, lmdb::val(user_id), value); + txn.commit(); + + return res; +} + void Cache::saveTimelineMessages(lmdb::txn &txn, const std::string &room_id,