aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO5
-rw-r--r--src/QuickMedia.cpp7
-rw-r--r--src/plugins/Matrix.cpp10
3 files changed, 14 insertions, 8 deletions
diff --git a/TODO b/TODO
index 346ed0f..71bd2dd 100644
--- a/TODO
+++ b/TODO
@@ -163,4 +163,7 @@ Add option to decline and mute user in invites. This is to combat invite spam, w
Searching in channel page should search in the channel instead of filter, because with filtering we only filter the videos we have loaded in the channel page and the channel page uses pagination; so we may have only loaded 20 videos while the channel may actually have 2000 videos.
Allow hiding videos so they dont show up in recommendations and related videos.
Limit youtube-dl video resolution to <= largest monitor resolution. This is absolutely required for smooth playback on pinephone. Also add an option to select video resolution, if we want to use less power and less bandwidth.
-Use mpv option --gpu-context=x11egl on pinephone to force xwayland on wayland, to be able to embed the mpv window inside the quickmedia. \ No newline at end of file
+Use mpv option --gpu-context=x11egl on pinephone to force xwayland on wayland, to be able to embed the mpv window inside the quickmedia.
+Read marker may be incorrect if the last message in a room has an earlier timestamp than a previous message (as seen in element and matrix api). Setting read marker to a previous message seems to be ignored silently by synapse. To fix this we would have to sort messages by unsigned age field instead (I guess?), or save the read marker in user account data specifically for quickmedia (under an unique namespace).
+Replies to the local user shouldn't remove the red text. Maybe fix this by checking if the reply to message user is the local user or when the replied to message has loaded then make the reply red if its a reply to us. Also for existing messages check if the message is a notification message and then make the message red.
+Sort reactions by timestamp.
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 4cf4b09..41c2c6e 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3231,6 +3231,7 @@ namespace QuickMedia {
body_item->set_description("Message deleted");
body_item->set_description_color(sf::Color::White);
body_item->thumbnail_size = sf::Vector2i(32, 32);
+ body_item->url.clear();
};
// TODO: Optimize with hash map?
@@ -3251,8 +3252,9 @@ namespace QuickMedia {
if(message->related_event_type == RelatedEventType::REDACTION) {
set_body_as_deleted(message.get(), body_item.get());
} else {
+ Message *orig_message = static_cast<Message*>(body_item->userdata);
body_item->set_description(message_get_body_remove_formatting(message.get()));
- if(message_contains_user_mention(message->body, my_display_name) || message_contains_user_mention(message->body, me->user_id))
+ if(message_contains_user_mention(message->body, my_display_name) || message_contains_user_mention(message->body, me->user_id) || (orig_message && orig_message->user == me))
body_item->set_description_color(sf::Color(255, 100, 100));
else
body_item->set_description_color(sf::Color::White);
@@ -3285,8 +3287,9 @@ namespace QuickMedia {
if(message->related_event_type == RelatedEventType::REDACTION) {
set_body_as_deleted(message.get(), body_item.get());
} else {
+ Message *orig_message = static_cast<Message*>(body_item->userdata);
body_item->set_description(message_get_body_remove_formatting(message.get()));
- if(message_contains_user_mention(message->body, my_display_name) || message_contains_user_mention(message->body, me->user_id))
+ if(message_contains_user_mention(message->body, my_display_name) || message_contains_user_mention(message->body, me->user_id) || (orig_message && orig_message->user == me))
body_item->set_description_color(sf::Color(255, 100, 100));
else
body_item->set_description_color(sf::Color::White);
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 4ed6409..ba8533b 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -1866,7 +1866,7 @@ namespace QuickMedia {
const rapidjson::Value &prev_membership_json = GetMember(prev_content_json, "membership");
if(prev_membership_json.IsString() && strcmp(prev_membership_json.GetString(), "leave") == 0) {
body = user_display_name + " joined the room";
- } else if(new_displayname_json.IsString() && (!prev_displayname_json.IsString() || strcmp(new_displayname_json.GetString(), prev_displayname_json.GetString()) != 0)) {
+ } else if(new_displayname_json.IsString() && new_displayname_json.GetStringLength() > 0 && (!prev_displayname_json.IsString() || strcmp(new_displayname_json.GetString(), prev_displayname_json.GetString()) != 0)) {
std::string new_displayname_str = std::string(new_displayname_json.GetString());
std::string prev_displayname_str;
if(prev_displayname_json.IsString())
@@ -1875,17 +1875,17 @@ namespace QuickMedia {
prev_displayname_str = sender_json_str;
body = prev_displayname_str + " changed their display name to " + new_displayname_str;
room_data->set_user_display_name(user, std::move(new_displayname_str));
- } else if(!new_displayname_json.IsString() && prev_displayname_json.IsString()) {
+ } else if((!new_displayname_json.IsString() || new_displayname_json.GetStringLength() == 0) && prev_displayname_json.IsString()) {
body = user_display_name + " removed their display name";
room_data->set_user_display_name(user, "");
- } else if(new_avatar_url_json.IsString() && (!prev_avatar_url_json.IsString() || strcmp(new_avatar_url_json.GetString(), prev_avatar_url_json.GetString()) != 0)) {
+ } else if(new_avatar_url_json.IsString() && new_avatar_url_json.GetStringLength() > 0 && (!prev_avatar_url_json.IsString() || strcmp(new_avatar_url_json.GetString(), prev_avatar_url_json.GetString()) != 0)) {
body = user_display_name + " changed their profile picture";
std::string new_avatar_url_str = thumbnail_url_extract_media_id(new_avatar_url_json.GetString());
if(!new_avatar_url_str.empty())
new_avatar_url_str = homeserver + "/_matrix/media/r0/thumbnail/" + new_avatar_url_str + "?width=32&height=32&method=crop"; // TODO: Remove the constant strings around to reduce memory usage (6.3mb)
room_data->set_user_avatar_url(user, std::move(new_avatar_url_str));
- } else if(!new_avatar_url_json.IsString() && prev_avatar_url_json.IsString()) {
- body = user_display_name + " removed their profile picture.";
+ } else if((!new_avatar_url_json.IsString() || new_avatar_url_json.GetStringLength() == 0) && prev_avatar_url_json.IsString()) {
+ body = user_display_name + " removed their profile picture";
room_data->set_user_avatar_url(user, "");
} else {
body = user_display_name + " joined the room";