diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-04-30 10:59:27 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-04-30 10:59:27 +0200 |
commit | b11ae7add71f92d540fffec9ef97bc224ef01825 (patch) | |
tree | cc7d65af76427bd3dee4352d3c309542651e6e67 /src/plugins | |
parent | d4c56b8d220ca6b2927df56bcf8732569a741c86 (diff) |
Update cache version because cache is corrupt (missing messages)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index b0af624..41dea9f 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -1691,7 +1691,8 @@ namespace QuickMedia { return; } - const bool cache_updated = get_file_type(get_cache_dir().join("matrix").join("updated-cache-version1")) == FileType::REGULAR; + const char *update_cache_file_name = "updated-cache-version2"; + const bool cache_updated = get_file_type(get_cache_dir().join("matrix").join(update_cache_file_name)) == FileType::REGULAR; bool overwrite_cache = !cache_updated; std::ifstream sync_cache_file_stream; sync_cache_file_stream.open(matrix_cache_dir.data.c_str(), std::ifstream::in | std::ifstream::binary); @@ -1858,7 +1859,7 @@ namespace QuickMedia { json_data += '\n'; fwrite(json_data.data(), 1, json_data.size(), sync_cache_file); - file_overwrite(get_cache_dir().join("matrix").join("updated-cache-version1"), "1"); // To make sure the cache format is up to date + file_overwrite(get_cache_dir().join("matrix").join(update_cache_file_name), "1"); // To make sure the cache format is up to date malloc_trim(0); } fclose(sync_cache_file); @@ -2323,6 +2324,12 @@ namespace QuickMedia { has_unread_notifications = true; } + // TODO: timeline_json may contain "prev_batch", if so set it for the room. + // TODO: timeline_json may contain "limited" and if it's set to true then clear the messages in the room + // here so we only show the new messages. + // This will allow us to fetch older messages. But what if we do sync and we have limited messages + // but then receive a new sync and then restart quickmedia again and this time we dont have "limited" messages? + const rapidjson::Value &events_json = GetMember(timeline_json, "events"); events_add_user_info(events_json, room, 0); events_set_room_info(events_json, room, 0); |