diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-12-14 19:11:40 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-12-14 19:11:40 +0100 |
commit | 935cd15d6823bd7691fff6e6a741aebf7926c8e5 (patch) | |
tree | 9c524fbe431a29069a62d9e5218ecf9eb499eeb6 /src/plugins | |
parent | d74f242c8efe879a985e870a274f937c9efa37c6 (diff) |
Matrix: fix bug where rooms are removed from the rooms list sometimes during initial sync
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 230232a..5355208 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -1816,7 +1816,7 @@ namespace QuickMedia { // Then the daemon will do the sync and matrix processes will ask that daemon for the cached data // and fetch previous messages etc themselves. if(!matrix_instance_already_running) { - sync_cache_file = fopen(matrix_cache_dir.data.c_str(), initial_sync ? "wb" : "ab"); + sync_cache_file = fopen(matrix_cache_dir.data.c_str(), "ab"); if(sync_cache_file) { if(json_root.IsObject()) { rapidjson::StringBuffer buffer; @@ -2224,8 +2224,6 @@ namespace QuickMedia { if(!rooms_json.IsObject()) return PluginResult::OK; - std::unordered_set<RoomData*> existing_rooms; - const rapidjson::Value &join_json = GetMember(rooms_json, "join"); if(join_json.IsObject()) { for(auto const &it : join_json.GetObject()) { @@ -2247,8 +2245,6 @@ namespace QuickMedia { add_room(std::move(new_room)); is_new_room = true; } - if(initial_sync) - existing_rooms.insert(room); const rapidjson::Value &state_json = GetMember(it.value, "state"); if(state_json.IsObject()) { @@ -2329,17 +2325,6 @@ namespace QuickMedia { const rapidjson::Value &invite_json = GetMember(rooms_json, "invite"); add_invites(invite_json); - if(initial_sync) { - std::lock_guard<std::recursive_mutex> lock(room_data_mutex); - for(auto &room : rooms) { - if(existing_rooms.find(room.get()) == existing_rooms.end()) { - RoomData *room_p = room.get(); - ui_thread_tasks.push([this, room_p]{ delegate->leave_room(room_p, LeaveType::LEAVE, ""); }); - remove_room(room->id); - } - } - } - return PluginResult::OK; } |