From 935cd15d6823bd7691fff6e6a741aebf7926c8e5 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 14 Dec 2022 19:11:40 +0100 Subject: Matrix: fix bug where rooms are removed from the rooms list sometimes during initial sync --- src/plugins/Matrix.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src') 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 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 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; } -- cgit v1.2.3