diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-06-14 02:04:39 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-06-14 02:04:39 -0400 |
commit | 00dddf410e8aa9df64d323211e9dcdf4309f06a1 (patch) | |
tree | 6843177261c7cd2b2ad095c86d099ef2e6d6467e /src/components | |
parent | 878616e2efaa9a4fa1fa6b5e7dd376eb0dd1c79a (diff) | |
download | abaddon-portaudio-00dddf410e8aa9df64d323211e9dcdf4309f06a1.tar.gz abaddon-portaudio-00dddf410e8aa9df64d323211e9dcdf4309f06a1.zip |
convert a bunch of .Username accesses to proper access
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/chatmessage.cpp | 6 | ||||
-rw-r--r-- | src/components/completer.cpp | 3 | ||||
-rw-r--r-- | src/components/friendslist.cpp | 10 |
3 files changed, 10 insertions, 9 deletions
diff --git a/src/components/chatmessage.cpp b/src/components/chatmessage.cpp index 12f8c33..4fde039 100644 --- a/src/components/chatmessage.cpp +++ b/src/components/chatmessage.cpp @@ -221,16 +221,16 @@ void ChatMessageItemContainer::UpdateTextComponent(Gtk::TextView *tv) { if (data->Mentions.empty()) break; const auto &adder = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID); const auto &added = data->Mentions[0]; - b->insert_markup(s, "<i><span color='#999999'><span color='#eeeeee'>" + adder->Username + "</span> added <span color='#eeeeee'>" + added.Username + "</span></span></i>"); + b->insert_markup(s, "<i><span color='#999999'><span color='#eeeeee'>" + adder->GetUsername() + "</span> added <span color='#eeeeee'>" + added.GetUsername() + "</span></span></i>"); } break; case MessageType::RECIPIENT_REMOVE: { if (data->Mentions.empty()) break; const auto &adder = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID); const auto &added = data->Mentions[0]; if (adder->ID == added.ID) - b->insert_markup(s, "<i><span color='#999999'><span color='#eeeeee'>" + adder->Username + "</span> left</span></i>"); + b->insert_markup(s, "<i><span color='#999999'><span color='#eeeeee'>" + adder->GetUsername() + "</span> left</span></i>"); else - b->insert_markup(s, "<i><span color='#999999'><span color='#eeeeee'>" + adder->Username + "</span> removed <span color='#eeeeee'>" + added.Username + "</span></span></i>"); + b->insert_markup(s, "<i><span color='#999999'><span color='#eeeeee'>" + adder->GetUsername() + "</span> removed <span color='#eeeeee'>" + added.GetUsername() + "</span></span></i>"); } break; case MessageType::CHANNEL_NAME_CHANGE: { const auto author = Abaddon::Get().GetDiscordClient().GetUser(data->Author.ID); diff --git a/src/components/completer.cpp b/src/components/completer.cpp index c6a5a08..f6f0906 100644 --- a/src/components/completer.cpp +++ b/src/components/completer.cpp @@ -117,12 +117,13 @@ void Completer::CompleteMentions(const Glib::ustring &term) { if (id == me) continue; const auto author = discord.GetUser(id); if (!author.has_value()) continue; + // todo improve the predicate here if (!StringContainsCaseless(author->Username, term)) continue; if (i++ > 15) break; auto entry = CreateEntry(author->GetMention()); - entry->SetText(author->Username + "#" + author->Discriminator); + entry->SetText(author->GetUsername()); if (channel_id.IsValid()) { const auto chan = discord.GetChannel(channel_id); diff --git a/src/components/friendslist.cpp b/src/components/friendslist.cpp index 5839b65..99fbafa 100644 --- a/src/components/friendslist.cpp +++ b/src/components/friendslist.cpp @@ -117,16 +117,16 @@ void FriendsList::OnActionRemove(Snowflake id) { Glib::ustring str; switch (*discord.GetRelationship(id)) { case RelationshipType::Blocked: - str = "Are you sure you want to unblock " + user->Username + "#" + user->Discriminator + "?"; + str = "Are you sure you want to unblock " + user->GetUsername() + "?"; break; case RelationshipType::Friend: - str = "Are you sure you want to remove " + user->Username + "#" + user->Discriminator + "?"; + str = "Are you sure you want to remove " + user->GetUsername() + "?"; break; case RelationshipType::PendingIncoming: - str = "Are you sure you want to ignore " + user->Username + "#" + user->Discriminator + "?"; + str = "Are you sure you want to ignore " + user->GetUsername() + "?"; break; case RelationshipType::PendingOutgoing: - str = "Are you sure you want to cancel your request to " + user->Username + "#" + user->Discriminator + "?"; + str = "Are you sure you want to cancel your request to " + user->GetUsername() + "?"; break; default: break; @@ -244,7 +244,7 @@ bool FriendsListAddComponent::OnKeyPress(GdkEventKey *e) { FriendsListFriendRow::FriendsListFriendRow(RelationshipType type, const UserData &data) : ID(data.ID) , Type(type) - , Name(data.Username + "#" + data.Discriminator) + , Name(data.GetUsername()) , Status(Abaddon::Get().GetDiscordClient().GetUserStatus(data.ID)) , m_accept("Accept") { auto *ev = Gtk::manage(new Gtk::EventBox); |