From 02071aa486675ab521d180adbdc830bedb17ffa2 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 9 Feb 2021 12:12:10 +0100 Subject: Matrix: select first room on selection --- src/QuickMedia.cpp | 3 ++- src/plugins/Matrix.cpp | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 552ceae..5d4f7bd 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1114,6 +1114,7 @@ namespace QuickMedia { } else if(new_tabs.size() == 1 && new_tabs[0].page->get_type() == PageTypez::CHAT) { current_page = PageType::CHAT; current_chat_room = matrix->get_room_by_id(selected_item->url); + tabs[selected_tab].body->select_first_item(); while(window.isOpen()) { bool move_room = chat_page(static_cast(new_tabs[0].page.get()), current_chat_room, tabs, selected_tab, tab_associated_data[selected_tab]); if(!move_room) @@ -3745,7 +3746,7 @@ namespace QuickMedia { if(!message) return; - if(message->type >= MessageType::TEXT && message->type <= MessageType::FILE && is_window_focused && chat_state != ChatState::URL_SELECTION && !setting_read_marker && read_marker_timer.getElapsedTime().asMilliseconds() >= read_marker_timeout_ms) { + if(matrix->is_initial_sync_finished() && message->type >= MessageType::TEXT && message->type <= MessageType::FILE && is_window_focused && chat_state != ChatState::URL_SELECTION && !setting_read_marker && read_marker_timer.getElapsedTime().asMilliseconds() >= read_marker_timeout_ms) { // TODO: What if two messages have the same timestamp? if(message && !message->event_id.empty() && message->timestamp > current_room->last_read_message_timestamp) { //read_marker_timeout_ms = read_marker_timeout_ms_default; diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 051e951..b16b551 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -515,6 +515,7 @@ namespace QuickMedia { } // The event id in encrypted rooms contain the timestamp. Sort by that if possible. Such messages contain a colon. + // TODO: Test if this also works with construct and other homeservers Message *last_unread_message = nullptr; if(read_marker_message_timestamp != 0 && last_new_message->timestamp > read_marker_message_timestamp) -- cgit v1.2.3