From c0e355f485b3aef8feaa8f2061b0eda9ded67a0a Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sun, 22 Apr 2018 12:26:41 +0300 Subject: Properly clean stale invites --- include/Cache.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/Cache.h b/include/Cache.h index 9a151aba..78a35a65 100644 --- a/include/Cache.h +++ b/include/Cache.h @@ -155,6 +155,7 @@ public: void deleteData(); + void removeInvite(lmdb::txn &txn, const std::string &room_id); void removeInvite(const std::string &room_id); void removeRoom(lmdb::txn &txn, const std::string &roomid); void removeRoom(const std::string &roomid); @@ -335,8 +336,12 @@ private: void removeLeftRooms(lmdb::txn &txn, const std::map &rooms) { - for (const auto &room : rooms) + for (const auto &room : rooms) { removeRoom(txn, room.first); + + // Clean up leftover invites. + removeInvite(txn, room.first); + } } lmdb::dbi getInviteStatesDb(lmdb::txn &txn, const std::string &room_id) -- cgit 1.5.1