diff options
author | George Hazan <ghazan@miranda.im> | 2020-12-27 19:49:39 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-12-27 19:49:39 +0300 |
commit | eae122c522acf00d2ee3d85988c811794a3b25fc (patch) | |
tree | 03b4015638b77bd9d13fcb2e3ef2dacb82586ecf /protocols/Discord/src/dispatch.cpp | |
parent | 0a5de30626a30971cb99387a0624dc19c53f528a (diff) |
unified guild members processing
Diffstat (limited to 'protocols/Discord/src/dispatch.cpp')
-rw-r--r-- | protocols/Discord/src/dispatch.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp index 1e1704eb4a..4ba7a1f7b2 100644 --- a/protocols/Discord/src/dispatch.cpp +++ b/protocols/Discord/src/dispatch.cpp @@ -217,25 +217,17 @@ void CDiscordProto::OnCommandGuildMemberListUpdate(const JSONNode &pRoot) if (!mir_strcmp(item .name(), "member")) { bool bNew = false; - CMStringW wszUserId = item["user"]["id"].as_mstring(); - SnowFlake userId = _wtoi64(wszUserId); - CDiscordGuildMember *pm = pGuild->FindUser(userId); - if (pm == nullptr) { - pm = new CDiscordGuildMember(userId); - pGuild->arChatUsers.insert(pm); - pm->wszNick = item["user"]["username"].as_mstring() + L"#" + item["user"]["discriminator"].as_mstring(); - bNew = true; - } - + auto *pm = ProcessGuildUser(pGuild, item, &bNew); pm->iStatus = iStatus; if (bNew) AddGuildUser(pGuild, *pm); else if (iStatus) { + CMStringW wszUserId(FORMAT, L"%lld", pm->userId); + GCEVENT gce = { m_szModuleName, 0, GC_EVENT_SETCONTACTSTATUS }; gce.time = time(0); gce.pszUID.w = wszUserId; - Chat_Event(&gce); for (auto &cc : pGuild->arChannels) { if (!cc->bIsGroup) |