mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Ensure the encrypted rooms db is always created
This commit is contained in:
parent
4c151cc3c7
commit
760f675792
2 changed files with 7 additions and 4 deletions
|
@ -288,6 +288,9 @@ Cache::setup()
|
|||
outboundMegolmSessionDb_ = lmdb::dbi::open(txn, OUTBOUND_MEGOLM_SESSIONS_DB, MDB_CREATE);
|
||||
megolmSessionDataDb_ = lmdb::dbi::open(txn, MEGOLM_SESSIONS_DATA_DB, MDB_CREATE);
|
||||
|
||||
// What rooms are encrypted
|
||||
encryptedRooms_ = lmdb::dbi::open(txn, ENCRYPTED_ROOMS_DB, MDB_CREATE);
|
||||
|
||||
txn.commit();
|
||||
|
||||
databaseReady_ = true;
|
||||
|
@ -298,8 +301,7 @@ Cache::setEncryptedRoom(lmdb::txn &txn, const std::string &room_id)
|
|||
{
|
||||
nhlog::db()->info("mark room {} as encrypted", room_id);
|
||||
|
||||
auto db = lmdb::dbi::open(txn, ENCRYPTED_ROOMS_DB, MDB_CREATE);
|
||||
db.put(txn, room_id, "0");
|
||||
encryptedRooms_.put(txn, room_id, "0");
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -308,8 +310,7 @@ Cache::isRoomEncrypted(const std::string &room_id)
|
|||
std::string_view unused;
|
||||
|
||||
auto txn = ro_txn(env_);
|
||||
auto db = lmdb::dbi::open(txn, ENCRYPTED_ROOMS_DB, MDB_CREATE);
|
||||
auto res = db.get(txn, room_id, unused);
|
||||
auto res = encryptedRooms_.get(txn, room_id, unused);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -689,6 +689,8 @@ private:
|
|||
lmdb::dbi outboundMegolmSessionDb_;
|
||||
lmdb::dbi megolmSessionDataDb_;
|
||||
|
||||
lmdb::dbi encryptedRooms_;
|
||||
|
||||
QString localUserId_;
|
||||
QString cacheDirectory_;
|
||||
|
||||
|
|
Loading…
Reference in a new issue