From cdab2f33dbc361eec1d6a90899a907e61a682f18 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 9 Feb 2021 15:37:13 +0100 Subject: Matrix: its all so tiresome --- TODO | 1 - src/plugins/Matrix.cpp | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index c8dcbff..f8183e4 100644 --- a/TODO +++ b/TODO @@ -158,6 +158,5 @@ Searching in channel page should search in the channel instead of filter, becaus Allow hiding videos so they dont show up in recommendations and related videos. Add an option to select video resolution, if we want to use less power and less bandwidth for example. Use mpv option --gpu-context=x11egl on pinephone to force xwayland on wayland, to be able to embed the mpv window inside the quickmedia. -Read marker may be incorrect if the last message in a room has an earlier timestamp than a previous message (as seen in element and matrix api). Setting read marker to a previous message seems to be ignored silently by synapse. To fix this we would have to sort messages by unsigned age field instead (I guess?), or save the read marker in user account data specifically for quickmedia (under an unique namespace). Replies to the local user shouldn't remove the red text. Maybe fix this by checking if the reply to message user is the local user or when the replied to message has loaded then make the reply red if its a reply to us. Also for existing messages check if the message is a notification message and then make the message red. Sort reactions by timestamp. diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 50a2cd4..f97f574 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -500,19 +500,16 @@ namespace QuickMedia { } void MatrixQuickMedia::update_room_description(RoomData *room, Messages &new_messages, bool is_initial_sync, bool sync_is_cache) { - time_t read_marker_message_timestamp = 0; + time_t read_marker_message_timestamp = room->last_read_message_timestamp; std::shared_ptr me = matrix->get_me(room); std::string my_user_read_marker; - if(me) { + if(me && read_marker_message_timestamp == 0) { my_user_read_marker = room->get_user_read_marker(me); auto read_marker_message = room->get_message_by_id(my_user_read_marker); if(read_marker_message) read_marker_message_timestamp = read_marker_message->timestamp; } - if(read_marker_message_timestamp == 0) - read_marker_message_timestamp = room->last_read_message_timestamp; - std::shared_ptr last_new_message = get_last_message_by_timestamp(new_messages); if(!last_new_message) return; -- cgit v1.2.3