summaryrefslogtreecommitdiff
path: root/discord/discord.cpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-08-05 03:32:53 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-08-05 03:32:53 -0400
commit41a63df1b108a9520a8dfcb862f108b42f9a1bb1 (patch)
treeb9eae63b43a9dd418fe7d7b3b7c8562fd92ec7ab /discord/discord.cpp
parent40897ece3ced8bfc051708a8d85f413f330631a9 (diff)
downloadabaddon-portaudio-41a63df1b108a9520a8dfcb862f108b42f9a1bb1.tar.gz
abaddon-portaudio-41a63df1b108a9520a8dfcb862f108b42f9a1bb1.zip
add temporary row for non-joined threads
Diffstat (limited to 'discord/discord.cpp')
-rw-r--r--discord/discord.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/discord/discord.cpp b/discord/discord.cpp
index 49684ae..5a7c07e 100644
--- a/discord/discord.cpp
+++ b/discord/discord.cpp
@@ -253,6 +253,10 @@ std::vector<ChannelData> DiscordClient::GetPublicThreads(Snowflake channel_id) c
return m_store.GetThreads(channel_id);
}
+bool DiscordClient::IsThreadJoined(Snowflake thread_id) const {
+ return std::find(m_joined_threads.begin(), m_joined_threads.end(), thread_id) != m_joined_threads.end();
+}
+
bool DiscordClient::HasGuildPermission(Snowflake user_id, Snowflake guild_id, Permission perm) const {
const auto base = ComputePermissions(user_id, guild_id);
return (base & perm) == perm;
@@ -1250,6 +1254,7 @@ void DiscordClient::ProcessNewGuild(GuildData &guild) {
if (guild.Threads.has_value()) {
for (auto &c : *guild.Threads) {
+ m_joined_threads.push_back(c.ID);
c.GuildID = guild.ID;
m_store.SetChannel(c.ID, c);
}
@@ -1668,6 +1673,7 @@ void DiscordClient::HandleGatewayRelationshipAdd(const GatewayMessage &msg) {
void DiscordClient::HandleGatewayThreadCreate(const GatewayMessage &msg) {
ThreadCreateData data = msg.Data;
m_store.SetChannel(data.Channel.ID, data.Channel);
+ m_joined_threads.push_back(data.Channel.ID);
m_signal_thread_create.emit(data.Channel);
}