From bf544dfabcd87e7fe826307a9ee34cc684806023 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 17 Nov 2020 14:05:53 +0100 Subject: Matrix: fix duplicate notifications on mention for initial sync --- TODO | 3 ++- src/plugins/Matrix.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 3824473..bd57926 100644 --- a/TODO +++ b/TODO @@ -135,4 +135,5 @@ Pinned messages authors doesn't seem to be updated when fetching users, if the p 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 +Implement m.sticker. +If manga page fails to download then show "failed to download image" as text and bind F5 to refresh (retry download). \ No newline at end of file diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index e53df9c..78ddac7 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -493,11 +493,11 @@ namespace QuickMedia { //std::string room_desc = matrix->message_get_author_displayname(it.second.back().get()) + ": " + extract_first_line_elipses(it.second.back()->body, 150); //room_body_item->set_description(std::move(room_desc)); - if(!it.second.sync_is_cache) { + if(!it.second.sync_is_cache && it.second.message_dir == MessageDirection::AFTER && !is_initial_sync) { for(auto &message : messages) { if(message->mentions_me) { // TODO: What if the message or username begins with "-"? also make the notification image be the avatar of the user - if((!is_window_focused || room != current_room || is_initial_sync || page_type == MatrixPageType::ROOM_LIST) && message->related_event_type != RelatedEventType::EDIT && message->related_event_type != RelatedEventType::REDACTION) + if((!is_window_focused || room != current_room || page_type == MatrixPageType::ROOM_LIST) && message->related_event_type != RelatedEventType::EDIT && message->related_event_type != RelatedEventType::REDACTION) show_notification("QuickMedia matrix - " + matrix->message_get_author_displayname(message.get()) + " (" + room->get_name() + ")", message->body); } } -- cgit v1.2.3