diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-10-03 22:35:02 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-10-03 22:35:02 +0200 |
commit | 8a21f2d4f70ecd4509aa8976c5e40ee70395a6a0 (patch) | |
tree | f6919c2533cf0e936b741b363f4facf6b1d0e2a1 /src | |
parent | df8cbfada237cb4c0467215b55ccb697cc64d568 (diff) |
Matrix: do not set avatar url for users with no avatar
Diffstat (limited to 'src')
-rw-r--r-- | src/QuickMedia.cpp | 6 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index ca3cedb..6c3bc34 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -1945,9 +1945,9 @@ namespace QuickMedia { image_path.join(std::to_string(image_index + 1)); if(get_file_type(image_path) == FileType::REGULAR) { - std::string image_data; - if(file_get_content(image_path, image_data) == 0) { - if(image_texture.loadFromMemory(image_data.data(), image_data.size())) { + sf::Image image; + if(image.loadFromFile(image_path.data)) { + if(image_texture.loadFromImage(image)) { image_texture.setSmooth(true); //image_texture.generateMipmap(); return LoadImageResult::OK; diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 8ef7f47..d4fdd03 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -411,8 +411,8 @@ namespace QuickMedia { user_info->avatar_url = std::move(avatar_url_str); if(strncmp(user_info->avatar_url.c_str(), "mxc://", 6) == 0) user_info->avatar_url.erase(user_info->avatar_url.begin(), user_info->avatar_url.begin() + 6); - // TODO: What if the user hasn't selected an avatar? - user_info->avatar_url = homeserver + "/_matrix/media/r0/thumbnail/" + user_info->avatar_url + "?width=32&height=32&method=crop"; + 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_color = user_id_to_color(sender_json_str); |