diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-05-21 00:25:07 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-05-21 00:25:07 +0200 |
commit | daa6574a80a37d50dad3c6f5ca94a4f974451729 (patch) | |
tree | 83e3bbc33f2f2a743dd6b28b09aec91931f41d87 /src/plugins | |
parent | bd13b51eb83ef95d46960db920a8572766e91789 (diff) |
Add new mentions that are read to notifications list as well
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
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)); } } } |