summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Discord/src/guilds.cpp7
-rw-r--r--src/mir_app/src/netlib_websocket.cpp2
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)