summaryrefslogtreecommitdiff
path: root/src/components/channels.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/channels.cpp')
-rw-r--r--src/components/channels.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/components/channels.cpp b/src/components/channels.cpp
index 09e40c3..dc14688 100644
--- a/src/components/channels.cpp
+++ b/src/components/channels.cpp
@@ -651,13 +651,30 @@ Gtk::TreeModel::iterator ChannelList::AddGuild(const GuildData &guild) {
m_tmp_channel_map[thread.ID] = CreateThreadRow(row.children(), thread);
};
+ auto add_voice_participants = [this, &discord](const ChannelData &channel, const Gtk::TreeNodeChildren &root) {
+ for (auto user_id : discord.GetUsersInVoiceChannel(channel.ID)) {
+ const auto user = discord.GetUser(user_id);
+
+ auto user_row = *m_model->append(root);
+ user_row[m_columns.m_type] = RenderType::VoiceParticipant;
+ user_row[m_columns.m_id] = user_id;
+ if (user.has_value()) {
+ user_row[m_columns.m_name] = user->GetEscapedName();
+ } else {
+ user_row[m_columns.m_name] = "<i>Unknown</i>";
+ }
+ }
+ };
+
for (const auto &channel : orphan_channels) {
auto channel_row = *m_model->append(guild_row.children());
if (IsTextChannel(channel.Type))
channel_row[m_columns.m_type] = RenderType::TextChannel;
#ifdef WITH_VOICE
- else
+ else {
channel_row[m_columns.m_type] = RenderType::VoiceChannel;
+ add_voice_participants(channel, channel_row->children());
+ }
#endif
channel_row[m_columns.m_id] = channel.ID;
channel_row[m_columns.m_name] = "#" + Glib::Markup::escape_text(*channel.Name);
@@ -684,8 +701,10 @@ Gtk::TreeModel::iterator ChannelList::AddGuild(const GuildData &guild) {
if (IsTextChannel(channel.Type))
channel_row[m_columns.m_type] = RenderType::TextChannel;
#ifdef WITH_VOICE
- else
+ else {
channel_row[m_columns.m_type] = RenderType::VoiceChannel;
+ add_voice_participants(channel, channel_row->children());
+ }
#endif
channel_row[m_columns.m_id] = channel.ID;
channel_row[m_columns.m_name] = "#" + Glib::Markup::escape_text(*channel.Name);