Skip to content

Commit

Permalink
Merge branch 'master' into voice
Browse files Browse the repository at this point in the history
  • Loading branch information
ouwou committed May 19, 2023
2 parents d0fa9cc + 38c3b0c commit 15aa875
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/discord/discord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2305,7 +2305,8 @@ void DiscordClient::HandleGatewayVoiceServerUpdate(const GatewayMessage &msg) {

void DiscordClient::HandleGatewayReadySupplemental(const GatewayMessage &msg) {
ReadySupplementalData data = msg.Data;
for (const auto &p : data.MergedPresences.Friends) {

const auto handle_presence = [this](const MergedPresence &p) {
const auto user = GetUser(p.UserID);
if (!user.has_value()) return; // should be sent in READY's `users`
const auto s = p.Presence.Status;
Expand All @@ -2318,6 +2319,15 @@ void DiscordClient::HandleGatewayReadySupplemental(const GatewayMessage &msg) {
else if (s == "dnd")
m_user_to_status[p.UserID] = PresenceStatus::DND;
m_signal_presence_update.emit(*user, m_user_to_status.at(p.UserID));
};

for (const auto &p : data.MergedPresences.Friends) {
handle_presence(p);
}
for (const auto &g : data.MergedPresences.Guilds) {
for (const auto &p : g) {
handle_presence(p);
}
}
#ifdef WITH_VOICE
for (const auto &g : data.Guilds) {
Expand Down

0 comments on commit 15aa875

Please sign in to comment.