diff options
author | George Hazan <george.hazan@gmail.com> | 2024-08-07 19:49:17 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-08-07 19:49:17 +0300 |
commit | 0b16ad5c516ef3f32e6d981e0c26369991cefec9 (patch) | |
tree | 89c4cec8bcd042ccb53b673db4062e23065467b0 | |
parent | 2dd79d28dbb40fe1b9d78ea5f5490bab1bb2ed5e (diff) |
fixes #4476 (Discord: Not all channels are loaded)
-rw-r--r-- | protocols/Discord/src/guilds.cpp | 7 | ||||
-rw-r--r-- | src/mir_app/src/netlib_websocket.cpp | 2 |
2 files changed, 7 insertions, 2 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;
diff --git a/src/mir_app/src/netlib_websocket.cpp b/src/mir_app/src/netlib_websocket.cpp index b92d3c168f..05392afe8e 100644 --- a/src/mir_app/src/netlib_websocket.cpp +++ b/src/mir_app/src/netlib_websocket.cpp @@ -305,7 +305,7 @@ void MWebSocket::run() void MJsonWebSocket::process(const uint8_t *buf, size_t cbLen)
{
CMStringA szJson((char*)buf, (int)cbLen);
- Netlib_Logf(m_nlu, "JSON received:\n%s", szJson.c_str());
+ Netlib_Log(m_nlu, szJson);
JSONNode root = JSONNode::parse(szJson);
if (root)
|