diff options
Diffstat (limited to 'protocols/Discord/src/dispatch.cpp')
-rw-r--r-- | protocols/Discord/src/dispatch.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp index 04cb8a9b8e..b5094b04ad 100644 --- a/protocols/Discord/src/dispatch.cpp +++ b/protocols/Discord/src/dispatch.cpp @@ -449,22 +449,11 @@ void CDiscordProto::OnCommandMessageDelete(const JSONNode &pRoot) void CDiscordProto::OnCommandPresence(const JSONNode &pRoot) { - CDiscordUser *pUser = FindUser(::getId(pRoot["user"]["id"])); - if (pUser == nullptr) - return; - - int iStatus = StrToStatus(pRoot["status"].as_mstring()); - if (iStatus != 0) - setWord(pUser->hContact, "Status", iStatus); - - CMStringW wszGame = pRoot["game"]["name"].as_mstring(); - if (!wszGame.IsEmpty()) - setWString(pUser->hContact, "XStatusMsg", wszGame); - else - delSetting(pUser->hContact, "XStatusMsg"); - - // check avatar - CheckAvatarChange(pUser->hContact, pRoot["user"]["avatar"].as_mstring()); + auto *pGuild = FindGuild(::getId(pRoot["user"]["guild_id"])); + if (pGuild == nullptr) + ProcessPresence(pRoot); + // else + // pGuild->ProcessPresence(pRoot); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -485,11 +474,8 @@ void CDiscordProto::OnCommandReady(const JSONNode &pRoot) ProcessType(pUser, it); } - for (auto &it : pRoot["presences"]) { - CDiscordUser *pUser = FindUser(::getId(it["user"]["id"])); - if (pUser != nullptr) - setWord(pUser->hContact, "Status", StrToStatus(it["status"].as_mstring())); - } + for (auto &it : pRoot["presences"]) + ProcessPresence(it); for (auto &it : pRoot["private_channels"]) PreparePrivateChannel(it); |