summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-11-26 18:26:28 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-11-26 18:26:28 +0300
commite7bfa7d9faa1d4e328ca0727174cddc0ca0cd808 (patch)
tree64071bf34747787029a45722a3e9b433f97f8cd9
parent6919a5ad9bf41c022cc55798d2fc53ce34d520fb (diff)
Discord: fix for parsing links from unknown users in group chats
-rw-r--r--protocols/Discord/src/dispatch.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index 90457116c4..01eb1868a1 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -397,15 +397,17 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot, bool bIsNew)
return;
}
- CDiscordGuildMember *pm = pGuild->FindUser(userId);
- if (pm == nullptr) {
- pm = new CDiscordGuildMember(userId);
- pm->wszNick = pRoot["nick"].as_mstring();
- if (pm->wszNick.IsEmpty())
- pm->wszNick = pRoot["user"]["username"].as_mstring() + L"#" + pRoot["user"]["discriminator"].as_mstring();
- pGuild->arChatUsers.insert(pm);
-
- AddGuildUser(pGuild, *pm);
+ if (userId != 0) {
+ CDiscordGuildMember *pm = pGuild->FindUser(userId);
+ if (pm == nullptr) {
+ pm = new CDiscordGuildMember(userId);
+ pm->wszNick = pRoot["nick"].as_mstring();
+ if (pm->wszNick.IsEmpty())
+ pm->wszNick = pRoot["user"]["username"].as_mstring() + L"#" + pRoot["user"]["discriminator"].as_mstring();
+ pGuild->arChatUsers.insert(pm);
+
+ AddGuildUser(pGuild, *pm);
+ }
}
ParseSpecialChars(si, wszText);