aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
parent92a53f252d4ef90aed1e239436afcce4dba9165e (diff)
Matrix: show number of pinned messages in tab, show previous displayname in name change
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp2
-rw-r--r--src/plugins/Matrix.cpp7
2 files changed, 8 insertions, 1 deletions
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";