summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-08-07 19:49:17 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-08-07 19:49:17 +0300
commit0b16ad5c516ef3f32e6d981e0c26369991cefec9 (patch)
tree89c4cec8bcd042ccb53b673db4062e23065467b0 /protocols
parent2dd79d28dbb40fe1b9d78ea5f5490bab1bb2ed5e (diff)
fixes #4476 (Discord: Not all channels are loaded)
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/guilds.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/protocols/Discord/src/guilds.cpp b/protocols/Discord/src/guilds.cpp
index 4a6df1f34b..59bcdb0649 100644
--- a/protocols/Discord/src/guilds.cpp
+++ b/protocols/Discord/src/guilds.cpp
@@ -204,7 +204,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
bool bIsVoice = false;
// filter our all channels but the text ones
- switch (pch["type"].as_int()) {
+ switch (auto iChannelType = pch["type"].as_int()) {
case 4: // channel group
if (!m_bUseGuildGroups) // ignore groups when they aren't enabled
return nullptr;
@@ -230,6 +230,7 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
__fallthrough;
case 0: // text channel
+ case 5: // announcement channel
// check permissions to enter the channel
auto permissions = pGuild->CalcPermissionOverride(m_ownId, pch["permission_overwrites"]);
if (!(permissions & Permission::VIEW_CHANNEL))
@@ -247,6 +248,10 @@ CDiscordUser* CDiscordProto::ProcessGuildChannel(CDiscordGuild *pGuild, const JS
if (pGuild->arChannels.find(pUser) == nullptr)
pGuild->arChannels.insert(pUser);
+ // make announcement channels read-only
+ if (iChannelType == 5)
+ Contact::Readonly(pUser->hContact, true);
+
pUser->wszUsername = wszChannelId;
if (m_bUseGuildGroups)
pUser->wszChannelName = L"#" + wszName;