diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-12-04 01:50:16 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-12-04 01:50:16 -0500 |
commit | 260fc2a745afd4dca4e628e6c407b7757dbcf5f0 (patch) | |
tree | 7b247f485522f0e05e00527e7dc0607123aa430e | |
parent | 6b436918f8b9a96a2dcde7c61b440bc8a774fbbf (diff) | |
download | abaddon-portaudio-260fc2a745afd4dca4e628e6c407b7757dbcf5f0.tar.gz abaddon-portaudio-260fc2a745afd4dca4e628e6c407b7757dbcf5f0.zip |
show @ in reply markup if reply is a mention
-rw-r--r-- | src/components/chatmessage.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/components/chatmessage.cpp b/src/components/chatmessage.cpp index d884077..6eccba2 100644 --- a/src/components/chatmessage.cpp +++ b/src/components/chatmessage.cpp @@ -661,7 +661,12 @@ Gtk::Widget *ChatMessageItemContainer::CreateReplyComponent(const Message &data) if (role.has_value()) { const auto author = discord.GetUser(author_id); if (author.has_value()) { - return "<b><span color=\"#" + IntToCSSColor(role->Color) + "\">" + author->GetDisplayNameEscaped(guild_id) + "</span></b>"; + const auto is_mention = !data.Interaction.has_value() && data.DoesMention(author_id); + if (is_mention) { + return "<b><span color=\"#" + IntToCSSColor(role->Color) + "\">@" + author->GetDisplayNameEscaped(guild_id) + "</span></b>"; + } else { + return "<b><span color=\"#" + IntToCSSColor(role->Color) + "\">" + author->GetDisplayNameEscaped(guild_id) + "</span></b>"; + } } } } @@ -717,16 +722,12 @@ Gtk::Widget *ChatMessageItemContainer::CreateReplyComponent(const Message &data) HandleChannelMentions(buf); text = Glib::Markup::escape_text(buf->get_text()); } - // getting markup out of a textbuffer seems like something that to me should be really simple - // but actually is horribly annoying. replies won't have mention colors because you can't do this - // also no emojis because idk how to make a textview act like a label - // which of course would not be an issue if i could figure out how to get fonts to work on this god-forsaken framework - // oh well - // but ill manually get colors for the user who is being replied to - if (referenced.GuildID.has_value()) + + if (referenced.GuildID.has_value()) { lbl->set_markup(get_author_markup(referenced.Author.ID, *referenced.GuildID) + ": " + text); - else + } else { lbl->set_markup(get_author_markup(referenced.Author.ID) + ": " + text); + } } } else { lbl->set_markup("<i>reply unavailable</i>"); |