From c36d883a90dac83b5a227ebd2d88b7b868d9f422 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 17 Nov 2020 03:34:36 +0100 Subject: Matrix: attempt to fix fetching previous messages before initial sync is finished fetching old messages --- TODO | 1 + src/plugins/Matrix.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index cdf4c3d..3824473 100644 --- a/TODO +++ b/TODO @@ -134,4 +134,5 @@ Continue matrix requests when switching room, instead of resetting them when goi Pinned messages authors doesn't seem to be updated when fetching users, if the pinned messages are fetched before the users (by navigating to the pending messages tab quickly). Improve /sync by not removing cached data on initial sync, and also always append data to sync file instead of overwriting sync file on "initial sync". Also cache "since", but take into consideration that not all messages are fetched on the initial sync, then add a gap between old messages from before sync and after sync so we can fetch the messages between the old messages and new messages and remove the gap when the fetched messages contains any of the old messages. +Fetching of previous messages should also be saved in the /sync file and messages fetched with get_message_by_id, which would cache embedded items and pinned messages; also cache users. Implement m.sticker. \ No newline at end of file diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 199cba5..e53df9c 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -2280,9 +2280,8 @@ namespace QuickMedia { PluginResult Matrix::get_previous_room_messages(RoomData *room_data, bool latest_messages) { std::string from = room_data->get_prev_batch(); - if(latest_messages) - from = "END"; - else if(from.empty()) { + if(from.empty()) { + #if 0 fprintf(stderr, "Info: missing previous batch for room: %s, using /sync next batch\n", room_data->id.c_str()); // TODO: When caching /sync, remember to add lock around getting next_batch! from = get_next_batch(); @@ -2290,6 +2289,8 @@ namespace QuickMedia { fprintf(stderr, "Error: missing next batch!\n"); return PluginResult::OK; } + #endif + from = "END"; } rapidjson::Document request_data(rapidjson::kObjectType); -- cgit v1.2.3