diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-07-05 05:01:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-05 05:01:08 +0000 |
commit | 8a5f23fcb93a8674e394943af148c511165ac153 (patch) | |
tree | 3c5c0c931dd6ab2f6ca85ce4c6ade22d08fc823e /src/discord | |
parent | 060e79ff2af65c46b5a53606784345b570118f2b (diff) | |
parent | 88da9e17b86ae0315ff4c08bb22e7c78f6a19000 (diff) | |
download | abaddon-portaudio-8a5f23fcb93a8674e394943af148c511165ac153.tar.gz abaddon-portaudio-8a5f23fcb93a8674e394943af148c511165ac153.zip |
Merge pull request #186 from jkozera/unread-category-indicators
Show unread indicators next to categories containing unread channels
Diffstat (limited to 'src/discord')
-rw-r--r-- | src/discord/discord.cpp | 11 | ||||
-rw-r--r-- | src/discord/discord.hpp | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp index 817aca8..7b05b2d 100644 --- a/src/discord/discord.cpp +++ b/src/discord/discord.cpp @@ -1317,6 +1317,17 @@ int DiscordClient::GetUnreadStateForChannel(Snowflake id) const noexcept { return iter->second; } +int DiscordClient::GetUnreadChannelsCountForCategory(Snowflake id) const noexcept { + int result = 0; + for (Snowflake channel_id : m_store.GetChannelIDsWithParentID(id)) { + if (IsChannelMuted(channel_id)) continue; + const auto iter = m_unread.find(channel_id); + if (iter == m_unread.end()) continue; + result += 1; + } + return result; +} + bool DiscordClient::GetUnreadStateForGuild(Snowflake id, int &total_mentions) const noexcept { total_mentions = 0; bool has_any_unread = false; diff --git a/src/discord/discord.hpp b/src/discord/discord.hpp index d2435dd..29ac00c 100644 --- a/src/discord/discord.hpp +++ b/src/discord/discord.hpp @@ -214,6 +214,7 @@ public: bool IsChannelMuted(Snowflake id) const noexcept; bool IsGuildMuted(Snowflake id) const noexcept; int GetUnreadStateForChannel(Snowflake id) const noexcept; + int GetUnreadChannelsCountForCategory(Snowflake id) const noexcept; bool GetUnreadStateForGuild(Snowflake id, int &total_mentions) const noexcept; int GetUnreadDMsCount() const; |