aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-23 11:53:08 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-23 11:53:08 +0100
commit5c0dd4a6885da32c52d4d03235507a5492919dd3 (patch)
tree5a3f6aff6dde6f6a157f63aedc42cc5815d82d3b
parentfe57edfe9b89df73da00961da47a0fcc24c67f86 (diff)
Matrix: show if reaction in room description, always show notifications, dont show reactions in replied to messages
-rw-r--r--src/Body.cpp4
-rw-r--r--src/plugins/Matrix.cpp19
2 files changed, 13 insertions, 10 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 9cb0c31..04330b8 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -828,7 +828,7 @@ namespace QuickMedia {
item_pos.y += item->description_text->getHeight() - 2.0f;
}
- if(!item->reactions.empty()) {
+ if(!item->reactions.empty() && include_embedded_item) {
sf::RoundedRectangleShape reaction_background(sf::Vector2f(1.0f, 1.0f), 10.0f, 10);
reaction_background.setFillColor(sf::Color(33, 38, 44));
float reaction_offset_x = 0.0f;
@@ -943,7 +943,7 @@ namespace QuickMedia {
item_height += item->description_text->getHeight() - 2.0f;
}
- if(!item->reactions.empty()) {
+ if(!item->reactions.empty() && include_embedded_item) {
float reaction_offset_x = 0.0f;
item_height += reaction_padding_y;
float reaction_max_height = 0.0f;
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()));
}
}