summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2023-06-13 21:28:18 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2023-06-13 21:28:18 -0400
commit6f1bd0014cad37f2f0b43a9b83733d9f65a91406 (patch)
tree94792781e7d6a18b7e528d8adfa5e1c7656c177f /src/components
parenta4a8293a0e9dc2e7023cc5f407eb78a505f22129 (diff)
downloadabaddon-portaudio-6f1bd0014cad37f2f0b43a9b83733d9f65a91406.tar.gz
abaddon-portaudio-6f1bd0014cad37f2f0b43a9b83733d9f65a91406.zip
refactor, update user mention handling
Diffstat (limited to 'src/components')
-rw-r--r--src/components/channels.cpp2
-rw-r--r--src/components/chatmessage.cpp22
-rw-r--r--src/components/chatwindow.cpp2
-rw-r--r--src/components/friendslist.cpp2
-rw-r--r--src/components/memberlist.cpp2
5 files changed, 15 insertions, 15 deletions
diff --git a/src/components/channels.cpp b/src/components/channels.cpp
index 0e97837..15a8348 100644
--- a/src/components/channels.cpp
+++ b/src/components/channels.cpp
@@ -863,7 +863,7 @@ Gtk::TreeModel::iterator ChannelList::CreateVoiceParticipantRow(const UserData &
auto row = *m_model->append(parent);
row[m_columns.m_type] = RenderType::VoiceParticipant;
row[m_columns.m_id] = user.ID;
- row[m_columns.m_name] = user.GetEscapedName();
+ row[m_columns.m_name] = user.GetDisplayNameEscaped();
const auto voice_state = Abaddon::Get().GetDiscordClient().GetVoiceState(user.ID);
if (voice_state.has_value()) {
diff --git a/src/components/chatmessage.cpp b/src/components/chatmessage.cpp
index 4b2e748..2f3a86d 100644
--- a/src/components/chatmessage.cpp
+++ b/src/components/chatmessage.cpp
@@ -234,23 +234,23 @@ void ChatMessageItemContainer::UpdateTextComponent(Gtk::TextView *tv) {
} break;
case MessageType::CHANNEL_NAME_CHANGE: {
const auto author = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID);
- b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " changed the name to <b>" + Glib::Markup::escape_text(data->Content) + "</b></span></i>");
+ b->insert_markup(s, "<i><span color='#999999'>" + author->GetDisplayNameEscapedBold() + " changed the name to <b>" + Glib::Markup::escape_text(data->Content) + "</b></span></i>");
} break;
case MessageType::CHANNEL_ICON_CHANGE: {
const auto author = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID);
- b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " changed the channel icon</span></i>");
+ b->insert_markup(s, "<i><span color='#999999'>" + author->GetDisplayNameEscapedBold() + " changed the channel icon</span></i>");
} break;
case MessageType::USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1:
case MessageType::USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2:
case MessageType::USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3: {
const auto author = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID);
const auto guild = Abaddon::Get().GetDiscordClient().GetGuild(*data->GuildID);
- b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " just boosted the server <b>" + Glib::Markup::escape_text(data->Content) + "</b> times! " +
+ b->insert_markup(s, "<i><span color='#999999'>" + author->GetDisplayNameEscapedBold() + " just boosted the server <b>" + Glib::Markup::escape_text(data->Content) + "</b> times! " +
Glib::Markup::escape_text(guild->Name) + " has achieved <b>Level " + std::to_string(static_cast<int>(data->Type) - 8) + "!</b></span></i>"); // oo cheeky me !!!
} break;
case MessageType::CHANNEL_FOLLOW_ADD: {
const auto author = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID);
- b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " has added <b>" + Glib::Markup::escape_text(data->Content) + "</b> to this channel. Its most important updates will show up here.</span></i>");
+ b->insert_markup(s, "<i><span color='#999999'>" + author->GetDisplayNameEscapedBold() + " has added <b>" + Glib::Markup::escape_text(data->Content) + "</b> to this channel. Its most important updates will show up here.</span></i>");
} break;
case MessageType::CALL: {
b->insert_markup(s, "<span color='#999999'><i>[started a call]</i></span>");
@@ -270,13 +270,13 @@ void ChatMessageItemContainer::UpdateTextComponent(Gtk::TextView *tv) {
case MessageType::THREAD_CREATED: {
const auto author = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID);
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 iter = b->insert_markup(s, "<i><span color='#999999'>" + author->GetDisplayNameEscapedBold() + " 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);
} else {
- b->insert_markup(s, "<i><span color='#999999'>" + author->GetEscapedBoldName() + " started a thread: </span><b>" + Glib::Markup::escape_text(data->Content) + "</b></i>");
+ b->insert_markup(s, "<i><span color='#999999'>" + author->GetDisplayNameEscapedBold() + " started a thread: </span><b>" + Glib::Markup::escape_text(data->Content) + "</b></i>");
}
} break;
default: break;
@@ -656,7 +656,7 @@ 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->GetEscapedString() + "</span></b>";
+ return "<b><span color=\"#" + IntToCSSColor(role->Color) + "\">" + author->GetUsernameEscaped() + "</span></b>";
}
}
}
@@ -664,7 +664,7 @@ Gtk::Widget *ChatMessageItemContainer::CreateReplyComponent(const Message &data)
const auto author = discord.GetUser(author_id);
if (author.has_value()) {
- return author->GetEscapedBoldString<false>();
+ return author->GetUsernameEscapedBold<false>();
}
return "<b>Unknown User</b>";
@@ -685,7 +685,7 @@ Gtk::Widget *ChatMessageItemContainer::CreateReplyComponent(const Message &data)
Glib::Markup::escape_text(data.Interaction->Name) +
"</span>");
} else if (const auto user = discord.GetUser(data.Interaction->User.ID); user.has_value()) {
- lbl->set_markup(user->GetEscapedBoldString<false>());
+ lbl->set_markup(user->GetUsernameEscapedBold<false>());
} else {
lbl->set_markup("<b>Unknown User</b>");
}
@@ -1043,7 +1043,7 @@ void ChatMessageHeader::UpdateName() {
else
m_author.set_markup("<span weight='bold'>" + name + "</span>");
} else
- m_author.set_markup("<span weight='bold'>" + user->GetEscapedName() + "</span>");
+ m_author.set_markup("<span weight='bold'>" + user->GetDisplayNameEscaped() + "</span>");
}
std::vector<Gtk::Widget *> ChatMessageHeader::GetChildContent() {
@@ -1069,7 +1069,7 @@ Glib::ustring ChatMessageHeader::GetEscapedDisplayName(const UserData &user, con
if (member.has_value() && !member->Nickname.empty())
return Glib::Markup::escape_text(member->Nickname);
else
- return Glib::Markup::escape_text(user.GetEscapedName());
+ return Glib::Markup::escape_text(user.GetDisplayNameEscaped());
}
bool ChatMessageHeader::on_author_button_press(GdkEventButton *ev) {
diff --git a/src/components/chatwindow.cpp b/src/components/chatwindow.cpp
index 1565d0c..8f59944 100644
--- a/src/components/chatwindow.cpp
+++ b/src/components/chatwindow.cpp
@@ -301,7 +301,7 @@ void ChatWindow::StartReplying(Snowflake message_id) {
m_is_replying = true;
m_input->StartReplying();
if (author.has_value())
- m_input_indicator->SetCustomMarkup("Replying to " + author->GetEscapedBoldString<false>());
+ m_input_indicator->SetCustomMarkup("Replying to " + author->GetUsernameEscapedBold<false>());
else
m_input_indicator->SetCustomMarkup("Replying...");
}
diff --git a/src/components/friendslist.cpp b/src/components/friendslist.cpp
index d8a566f..5839b65 100644
--- a/src/components/friendslist.cpp
+++ b/src/components/friendslist.cpp
@@ -265,7 +265,7 @@ FriendsListFriendRow::FriendsListFriendRow(RelationshipType type, const UserData
img->SetURL(data.GetAvatarURL("png", "32"));
}
- namelbl->set_markup(data.GetEscapedBoldName());
+ namelbl->set_markup(data.GetDisplayNameEscapedBold());
UpdatePresenceLabel();
diff --git a/src/components/memberlist.cpp b/src/components/memberlist.cpp
index a477832..9450548 100644
--- a/src/components/memberlist.cpp
+++ b/src/components/memberlist.cpp
@@ -40,7 +40,7 @@ MemberListUserRow::MemberListUserRow(const std::optional<GuildData> &guild, cons
// todo remove after migration complete
std::string display;
if (data.IsPomelo()) {
- display = data.GetName();
+ display = data.GetDisplayName();
} else {
display = data.Username;
if (Abaddon::Get().GetSettings().ShowMemberListDiscriminators) {