From 82eea06a77a2c38d33cdabc0a1e74c0fae9b197e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 16 Nov 2022 02:48:21 +0100 Subject: Matrix: unfuck year 2500 provisional message timestamp read marker --- src/QuickMedia.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index ae3d720..7e37214 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -7612,7 +7612,7 @@ namespace QuickMedia { for(; last_timeline_message >= 0; --last_timeline_message) { BodyItem *item = body_items[last_timeline_message].get(); Message *message = static_cast(item->userdata); - if(message && message_is_timeline(message) && !message->event_id.empty()) + if(message && message_is_timeline(message) && !message->event_id.empty() && message->timestamp != timestamp_provisional_event) break; } @@ -7627,7 +7627,8 @@ namespace QuickMedia { Message *read_message = get_latest_message_in_edit_chain(static_cast(body_items[last_timeline_message]->userdata)); // TODO: What if two messages have the same timestamp? - if(!read_message->event_id.empty() && read_message->timestamp > current_room->last_read_message_timestamp) { + // Oops, fuckup. If provisional timestamp then overwrite it. + if(!read_message->event_id.empty() && (read_message->timestamp > current_room->last_read_message_timestamp || current_room->last_message_timestamp == timestamp_provisional_event)) { matrix_chat_page->set_room_as_read(current_room); current_room->last_read_message_timestamp = read_message->timestamp; // TODO: What if the message is no longer valid? -- cgit v1.2.3