aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-08-15 11:39:51 +0200
committerdec05eba <dec05eba@protonmail.com>2021-08-15 11:39:51 +0200
commit0009006c39ce4bfebc3c5260b83063c800cb4fdf (patch)
treef7e2631429daa59a04ac8b2bbac6ea3f672346b5 /src/QuickMedia.cpp
parent50f97448d25224dfe33624f74c6a77f23bf54289 (diff)
Matrix: use white avatar for users with no avatar, optimize notifications update
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index a45da87..6a37b1d 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3124,6 +3124,8 @@ namespace QuickMedia {
}
AsyncImageLoader::get_instance().update();
+ if(matrix)
+ matrix->update();
if(!video_loaded) {
window.clear(get_current_theme().background_color);
@@ -4528,6 +4530,10 @@ namespace QuickMedia {
body_item->thumbnail_size = message->thumbnail_size;
} else {
body_item->thumbnail_url = room->get_user_avatar_url(message->user);
+ if(body_item->thumbnail_url.empty()) {
+ body_item->thumbnail_url = get_resource_loader_root_path() + std::string("images/no_avatar.png");
+ body_item->thumbnail_is_local = true;
+ }
body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE;
// if construct is not configured to use ImageMagic then it wont give thumbnails of size 32x32 even when requested and the spec says that the server SHOULD do that
body_item->thumbnail_size = AVATAR_THUMBNAIL_SIZE;
@@ -4602,6 +4608,10 @@ namespace QuickMedia {
if(!is_visual_media_message_type(message->type)) {
body_item->thumbnail_url = room->get_user_avatar_url(message->user);
+ if(body_item->thumbnail_url.empty()) {
+ body_item->thumbnail_url = get_resource_loader_root_path() + std::string("images/no_avatar.png");
+ body_item->thumbnail_is_local = true;
+ }
body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE;
// if construct is not configured to use ImageMagic then it wont give thumbnails of size 32x32 even when requested and the spec says that the server SHOULD do that
body_item->thumbnail_size = AVATAR_THUMBNAIL_SIZE;
@@ -4765,6 +4775,10 @@ namespace QuickMedia {
Message *original_message = static_cast<Message*>(body_item->userdata);
if(original_message && !is_system_message_type(original_message->type)) {
body_item->thumbnail_url = current_room->get_user_avatar_url(original_message->user);
+ if(body_item->thumbnail_url.empty()) {
+ body_item->thumbnail_url = get_resource_loader_root_path() + std::string("images/no_avatar.png");
+ body_item->thumbnail_is_local = true;
+ }
body_item->thumbnail_mask_type = ThumbnailMaskType::CIRCLE;
}
body_item->set_description("Message deleted");
@@ -5200,7 +5214,7 @@ namespace QuickMedia {
msgtype = "m.reaction";
text.erase(text.begin(), text.begin() + 7);
} else {
- show_notification("QuickMedia", "Error: invalid command: " + text + ", expected /upload, /join [room], /invite, /logout, /me [text] or /react [text]", Urgency::NORMAL);
+ show_notification("QuickMedia", "Error: invalid command: " + text + ", expected /upload, /join [room], /invite, /logout, /leave, /me [text] or /react [text]", Urgency::NORMAL);
return false;
}
} else if(chat_state == ChatState::REPLYING && text[0] == '/') {
@@ -6477,14 +6491,12 @@ namespace QuickMedia {
// TODO: Maybe set this instead when the mention is visible on the screen?
current_room->unread_notification_count = 0;
- matrix_chat_page->set_room_as_read(current_room);
-
Message *read_message = static_cast<Message*>(body_items[last_timeline_message]->userdata);
if(read_message->replaced_by)
read_message = read_message->replaced_by.get();
// TODO: What if two messages have the same timestamp?
if(!read_message->event_id.empty() && read_message->timestamp > current_room->last_read_message_timestamp) {
- //read_marker_timeout_ms = read_marker_timeout_ms_default;
+ matrix_chat_page->set_room_as_read(current_room);
current_room->last_read_message_timestamp = read_message->timestamp;
// TODO: What if the message is no longer valid?
setting_read_marker = true;