diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index cece6e2..278ffa3 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -422,13 +422,9 @@ namespace QuickMedia { void MatrixQuickMedia::update(MatrixPageType page_type) { update_pending_room_messages(page_type); std::lock_guard<std::mutex> room_body_lock(room_body_items_mutex); - bool is_window_focused = program->is_window_focused(); - RoomData *current_room = program->get_current_chat_room(); for(auto &it : unread_notifications) { - if(!it.second.empty() && (!is_window_focused || it.first != current_room || page_type == MatrixPageType::ROOM_LIST)) { - for(auto &unread_notification : it.second) { - show_notification("QuickMedia matrix - " + unread_notification.sender + " (" + it.first->get_name() + ")", unread_notification.body); - } + for(auto &unread_notification : it.second) { + show_notification("QuickMedia matrix - " + unread_notification.sender + " (" + it.first->get_name() + ")", unread_notification.body); } } //if(!unread_notifications.empty()) { @@ -455,6 +451,13 @@ namespace QuickMedia { }); } + static std::string message_to_room_description_text(Message *message) { + if(message->type == MessageType::REACTION) + return "Reacted with: " + extract_first_line_elipses(message->body, 150); + else + return extract_first_line_elipses(message->body, 150); + } + void MatrixQuickMedia::update_room_description(RoomData *room, Messages &new_messages, bool is_initial_sync, bool sync_is_cache) { time_t read_marker_message_timestamp = 0; std::shared_ptr<UserInfo> me = matrix->get_me(room); @@ -486,7 +489,7 @@ namespace QuickMedia { return; if(last_unread_message && !sync_is_cache) { - std::string room_desc = "Unread: " + matrix->message_get_author_displayname(last_unread_message) + ": " + extract_first_line_elipses(last_unread_message->body, 150); + std::string room_desc = "Unread: " + matrix->message_get_author_displayname(last_unread_message) + ": " + message_to_room_description_text(last_unread_message); int unread_notification_count = room->unread_notification_count; if(unread_notification_count > 0) room_desc += "\n** " + std::to_string(unread_notification_count) + " unread mention(s) **"; // TODO: Better notification? @@ -497,7 +500,7 @@ namespace QuickMedia { rooms_page->move_room_to_top(room); room_tags_page->move_room_to_top(room); } else if(is_initial_sync) { - room_body_item->set_description(matrix->message_get_author_displayname(last_new_message.get()) + ": " + extract_first_line_elipses(last_new_message->body, 150)); + room_body_item->set_description(matrix->message_get_author_displayname(last_new_message.get()) + ": " + message_to_room_description_text(last_new_message.get())); } } |