diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-05-15 19:21:21 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-05-15 19:21:21 -0400 |
commit | 38c3b0c2aadc3360a8420f3394b63a4dfa4dd059 (patch) | |
tree | df1cb25e3740e3b892357366d26931f9aeb2778a /src/discord/discord.cpp | |
parent | 7dba382e63b1a8b73e3349dc273117bb339b6148 (diff) | |
download | abaddon-portaudio-38c3b0c2aadc3360a8420f3394b63a4dfa4dd059.tar.gz abaddon-portaudio-38c3b0c2aadc3360a8420f3394b63a4dfa4dd059.zip |
read guilds from merged presences (#151)
Diffstat (limited to 'src/discord/discord.cpp')
-rw-r--r-- | src/discord/discord.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp index 9b31e05..b097f57 100644 --- a/src/discord/discord.cpp +++ b/src/discord/discord.cpp @@ -2124,7 +2124,8 @@ void DiscordClient::HandleGatewayGuildMembersChunk(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; @@ -2137,6 +2138,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); + } } } |