From daa6574a80a37d50dad3c6f5ca94a4f974451729 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 21 May 2021 00:25:07 +0200 Subject: Add new mentions that are read to notifications list as well --- src/plugins/Matrix.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/plugins/Matrix.cpp') diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 49a3988..1e1e41b 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -403,20 +403,22 @@ namespace QuickMedia { if(!sync_is_cache && message_dir == MessageDirection::AFTER && !is_initial_sync) { for(auto &message : messages) { if(message->notification_mentions_me) { + std::string body = remove_reply_formatting(message->body); + bool read = true; // 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) && message->related_event_type != RelatedEventType::EDIT && message->related_event_type != RelatedEventType::REDACTION) { - std::string body = remove_reply_formatting(message->body); show_notification("QuickMedia matrix - " + extract_first_line_remove_newline_elipses(matrix->message_get_author_displayname(message.get()), AUTHOR_MAX_LENGTH) + " (" + room->get_name() + ")", body); - - MatrixNotification notification; - notification.room = room; - notification.event_id = message->event_id; - notification.sender_user_id = message->user->user_id; - notification.body = std::move(body); - notification.timestamp = message->timestamp; - notification.read = false; - notifications_page->add_notification(std::move(notification)); + read = false; } + + MatrixNotification notification; + notification.room = room; + notification.event_id = message->event_id; + notification.sender_user_id = message->user->user_id; + notification.body = std::move(body); + notification.timestamp = message->timestamp; + notification.read = read; + notifications_page->add_notification(std::move(notification)); } } } -- cgit v1.2.3