diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/Matrix.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 0c94dd5..e604745 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -99,8 +99,9 @@ namespace QuickMedia { } UserInfo::UserInfo(RoomData *room, std::string user_id) : - room(room), display_name_color(user_id_to_color(user_id)), user_id(std::move(user_id)), display_name(user_id) { - + room(room), display_name_color(user_id_to_color(user_id)), user_id(user_id) + { + display_name = std::move(user_id); } UserInfo::UserInfo(RoomData *room, std::string user_id, std::string display_name, std::string avatar_url) : @@ -1760,6 +1761,10 @@ namespace QuickMedia { std::string user_display_name = room_data->get_user_display_name(user); std::string sender_display_name = room_data->get_user_display_name(user_sender); std::string body; + std::string reason_str; + const rapidjson::Value &reason_json = GetMember(*content_json, "reason"); + if(reason_json.IsString()) + reason_str = std::string(reason_json.GetString(), reason_json.GetStringLength()); const rapidjson::Value &membership_json = GetMember(*content_json, "membership"); if(strcmp(membership_json.GetString(), "join") == 0) { const rapidjson::Value &unsigned_json = GetMember(event_item_json, "unsigned"); @@ -1800,10 +1805,14 @@ namespace QuickMedia { body = user_display_name + " was kicked from the room by " + sender_display_name; else body = user_display_name + " left the room"; + if(!reason_str.empty()) + body += ", reason: " + reason_str; } else if(strcmp(membership_json.GetString(), "invite") == 0) { body = user_display_name + " was invited to the room by " + sender_display_name; } else if(strcmp(membership_json.GetString(), "ban") == 0) { body = user_display_name + " was banned from the room by " + sender_display_name; + if(!reason_str.empty()) + body += ", reason: " + reason_str; } else { body = "unimplemented membership: " + std::string(membership_json.GetString()); } |