aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Matrix.cpp10
1 files changed, 5 insertions, 5 deletions
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";