aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-09 21:14:45 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-09 21:14:45 +0100
commite8085267aeb23e33fd5cdbc2e4b6d43c64cc7a78 (patch)
treed25fa3a717836e101597f0f2e30cf8395593c2e4
parent92a53f252d4ef90aed1e239436afcce4dba9165e (diff)
Matrix: show number of pinned messages in tab, show previous displayname in name change
-rw-r--r--TODO3
-rw-r--r--src/QuickMedia.cpp2
-rw-r--r--src/plugins/Matrix.cpp7
3 files changed, 10 insertions, 2 deletions
diff --git a/TODO b/TODO
index 2f0ec6b..8c0708c 100644
--- a/TODO
+++ b/TODO
@@ -130,4 +130,5 @@ Editing a reply removes reply formatting (both in body and formatted_body). Elem
Implement m.room.tombstone.
Show a marker when a room uses encryption.
Remove replied-to message text in room preview. That shows ignored users text and we want to see the reply message instead anyways.
-Update room name/avatar with new data in /sync. \ No newline at end of file
+Update room name/avatar with new data in /sync.
+Read marker is incorrect if the last message is an edit/redact, because they are hidden and replaces other body items instead. \ No newline at end of file
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index fdaf3d1..a7933d9 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3280,6 +3280,8 @@ namespace QuickMedia {
tabs[PINNED_TAB_INDEX].body->select_last_item();
else
tabs[PINNED_TAB_INDEX].body->set_selected_item(selected_before);
+
+ tabs[PINNED_TAB_INDEX].text.setString("Pinned messages (" + std::to_string(tabs[PINNED_TAB_INDEX].body->items.size()) + ")");
};
Body url_selection_body(this, loading_icon);
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 9a64bda..a90bb30 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -1779,7 +1779,12 @@ namespace QuickMedia {
const rapidjson::Value &new_avatar_url_json = GetMember(*content_json, "avatar_url");
if(new_displayname_json.IsString() && (!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());
- body = user_display_name + " changed their display name to " + new_displayname_str;
+ std::string prev_displayname_str;
+ if(prev_displayname_json.IsString())
+ prev_displayname_str = std::string(prev_displayname_json.GetString(), prev_displayname_json.GetStringLength());
+ else
+ 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()) {
body = user_display_name + " removed their display name";