From c23ceac642ea95081a239c7af9f882082addb8c1 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 15 Oct 2020 17:49:39 +0200 Subject: Matrix: show users without a username (as user id) --- src/QuickMedia.cpp | 1 + src/plugins/Matrix.cpp | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index 4c41e28..9a6ff3f 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -3402,6 +3402,7 @@ namespace QuickMedia { } else if(tabs[selected_tab].type == ChatTabType::ROOMS && event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Enter) { BodyItem *selected_item = tabs[selected_tab].body->get_selected(); if(selected_item) { + tabs[selected_tab].body->clear_cache(); current_room_id = selected_item->url; selected_tab = MESSAGES_TAB_INDEX; tabs[MESSAGES_TAB_INDEX].body->clear_items(); diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index dec4a68..4de7045 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -390,8 +390,6 @@ namespace QuickMedia { avatar_url_str = avatar_url_json.asString(); const Json::Value &display_name_json = content_json["displayname"]; - if(!display_name_json.isString()) - continue; std::string sender_json_str = sender_json.asString(); @@ -402,7 +400,7 @@ namespace QuickMedia { user_info->avatar_url.erase(user_info->avatar_url.begin(), user_info->avatar_url.begin() + 6); if(!user_info->avatar_url.empty()) user_info->avatar_url = homeserver + "/_matrix/media/r0/thumbnail/" + user_info->avatar_url + "?width=32&height=32&method=crop"; - user_info->display_name = display_name_json.asString(); + user_info->display_name = display_name_json.isString() ? display_name_json.asString() : sender_json_str; user_info->display_name_color = user_id_to_color(sender_json_str); // Overwrites user data -- cgit v1.2.3