diff --git a/src/chat_gui/contact_list.hpp b/src/chat_gui/contact_list.hpp index a752095..0b2bfc8 100644 --- a/src/chat_gui/contact_list.hpp +++ b/src/chat_gui/contact_list.hpp @@ -17,6 +17,13 @@ enum class ThemeCol_Contact { icon_backdrop, }; +void renderAvatar( + const Theme& th, + ContactTextureCache& contact_tc, + const Contact3Handle c, + ImVec2 box +); + // returns true if clicked, if selectable, will highlight on hover and respect selected // TODO: refine // +------+ diff --git a/src/chat_gui4.cpp b/src/chat_gui4.cpp index 0095228..86a1758 100644 --- a/src/chat_gui4.cpp +++ b/src/chat_gui4.cpp @@ -386,6 +386,10 @@ float ChatGui4::render(float time_delta) { // name if (ImGui::TableNextColumn()) { + const float img_y {TEXT_BASE_HEIGHT - ImGui::GetStyle().FramePadding.y*2}; + renderAvatar(_theme, _contact_tc, {_cr, c_from.c}, {img_y, img_y}); + ImGui::SameLine(); + if (_cr.all_of(c_from.c)) { ImGui::TextUnformatted(_cr.get(c_from.c).name.c_str()); } else { diff --git a/src/tox_avatar_loader.cpp b/src/tox_avatar_loader.cpp index f60ec40..29eeac4 100644 --- a/src/tox_avatar_loader.cpp +++ b/src/tox_avatar_loader.cpp @@ -187,7 +187,8 @@ std::optional ToxAvatarLoader::load(TextureUploaderI& tu, Contact3 if (!_cr.any_of< Contact::Components::ToxFriendPersistent, Contact::Components::ToxGroupPersistent, - Contact::Components::ToxGroupPeerPersistent + Contact::Components::ToxGroupPeerPersistent, + Contact::Components::ID >(c)) { return std::nullopt; } @@ -199,6 +200,12 @@ std::optional ToxAvatarLoader::load(TextureUploaderI& tu, Contact3 pixels = generateToxIdenticon(_cr.get(c).chat_id); } else if (_cr.all_of(c)) { pixels = generateToxIdenticon(_cr.get(c).peer_key); + } else if (_cr.all_of(c)) { + // TODO: should we really use toxidenticons for other protocols? + // (this is required for self) + auto id_copy = _cr.get(c).data; + id_copy.resize(32); + pixels = generateToxIdenticon(id_copy); } TextureEntry new_entry;