diff options
Diffstat (limited to 'src')
-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)); } } } |