diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-06-14 01:56:46 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-06-14 01:56:46 -0400 |
commit | 878616e2efaa9a4fa1fa6b5e7dd376eb0dd1c79a (patch) | |
tree | fd91c196256096b985eb81b12260fd4039849d1d /src/components | |
parent | 5d9f7832d7ce73db75a58db0a3b798f24d147578 (diff) | |
download | abaddon-portaudio-878616e2efaa9a4fa1fa6b5e7dd376eb0dd1c79a.tar.gz abaddon-portaudio-878616e2efaa9a4fa1fa6b5e7dd376eb0dd1c79a.zip |
use display name in typing indicator
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/chatinputindicator.cpp | 14 | ||||
-rw-r--r-- | src/components/chatinputindicator.hpp | 1 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/components/chatinputindicator.cpp b/src/components/chatinputindicator.cpp index 13315c6..0611e71 100644 --- a/src/components/chatinputindicator.cpp +++ b/src/components/chatinputindicator.cpp @@ -54,6 +54,12 @@ void ChatInputIndicator::AddUser(Snowflake channel_id, const UserData &user, int void ChatInputIndicator::SetActiveChannel(Snowflake id) { m_active_channel = id; + const auto channel = Abaddon::Get().GetDiscordClient().GetChannel(id); + if (channel.has_value()) { + m_active_guild = channel->GuildID; + } else { + m_active_guild = std::nullopt; + } ComputeTypingString(); } @@ -105,14 +111,14 @@ void ChatInputIndicator::ComputeTypingString() { if (typers.empty()) { SetTypingString(""); } else if (typers.size() == 1) { - SetTypingString(typers[0].Username + " is typing..."); + SetTypingString(typers[0].GetDisplayName(m_active_guild) + " is typing..."); } else if (typers.size() == 2) { - SetTypingString(typers[0].Username + " and " + typers[1].Username + " are typing..."); + SetTypingString(typers[0].GetDisplayName(m_active_guild) + " and " + typers[1].GetDisplayName(m_active_guild) + " are typing..."); } else if (typers.size() > 2 && typers.size() <= MaxUsersInIndicator) { Glib::ustring str; for (size_t i = 0; i < typers.size() - 1; i++) - str += typers[i].Username + ", "; - SetTypingString(str + "and " + typers[typers.size() - 1].Username + " are typing..."); + str += typers[i].GetDisplayName(m_active_guild) + ", "; + SetTypingString(str + "and " + typers[typers.size() - 1].GetDisplayName(m_active_guild) + " are typing..."); } else { // size() > MaxUsersInIndicator SetTypingString("Several people are typing..."); } diff --git a/src/components/chatinputindicator.hpp b/src/components/chatinputindicator.hpp index 40c966e..5688393 100644 --- a/src/components/chatinputindicator.hpp +++ b/src/components/chatinputindicator.hpp @@ -23,5 +23,6 @@ private: Glib::ustring m_custom_markup; Snowflake m_active_channel; + std::optional<Snowflake> m_active_guild; std::unordered_map<Snowflake, std::unordered_map<Snowflake, sigc::connection>> m_typers; // channel id -> [user id -> connection] }; |