diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-08-17 23:29:48 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-08-17 23:29:48 -0400 |
commit | 1fa3e5beac2002b35d04dcd6c0f4d7132709ca30 (patch) | |
tree | 46b585765faf6ab7a9c3394c1e545999c7c587fd /components | |
parent | 2a2f96f9b6e7c8e7b490cc70525de571bbecc360 (diff) | |
download | abaddon-portaudio-1fa3e5beac2002b35d04dcd6c0f4d7132709ca30.tar.gz abaddon-portaudio-1fa3e5beac2002b35d04dcd6c0f4d7132709ca30.zip |
make channel in thread created message clickable
Diffstat (limited to 'components')
-rw-r--r-- | components/chatmessage.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/components/chatmessage.cpp b/components/chatmessage.cpp index b7cdf17..88e3f2c 100644 --- a/components/chatmessage.cpp +++ b/components/chatmessage.cpp @@ -278,7 +278,17 @@ void ChatMessageItemContainer::UpdateTextComponent(Gtk::TextView *tv) { } break; case MessageType::THREAD_CREATED: { const auto author = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID); - b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " started a thread: </span><b>" + Glib::Markup::escape_text(data->Content) + "</b></i>"); + if (data->MessageReference.has_value() && data->MessageReference->ChannelID.has_value()) { + auto iter = b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " started a thread: </span></i>"); + auto tag = b->create_tag(); + tag->property_weight() = Pango::WEIGHT_BOLD; + m_channel_tagmap[tag] = *data->MessageReference->ChannelID; + b->insert_with_tag(iter, data->Content, tag); + + tv->signal_button_press_event().connect(sigc::mem_fun(*this, &ChatMessageItemContainer::OnClickChannel), false); + } else { + b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " started a thread: </span><b>" + Glib::Markup::escape_text(data->Content) + "</b></i>"); + } } break; default: break; } |