summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-01-17 16:00:54 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-01-17 16:04:23 +0300
commita61f99f45ad4707f1654544d2ba6438a8556815c (patch)
tree63d3ada9225dbf52ca23bd8b32ef35bde858275e /protocols/Discord/src/server.cpp
parentc6a0095ad307a43fc83497bbb3efbc60052f6ada (diff)
Discord: dynamic user addition processing
Diffstat (limited to 'protocols/Discord/src/server.cpp')
-rw-r--r--protocols/Discord/src/server.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index 0b7c59fa9a..58742a63d4 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -112,35 +112,30 @@ void CDiscordProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpReques
ptrW wszOldAvatar(getWStringA(hContact, DB_KEY_AVHASH));
- m_ownId = _wtoi64(root["id"].as_mstring());
- setId(hContact, DB_KEY_ID, m_ownId);
+ SnowFlake id = _wtoi64(root["id"].as_mstring());
+ setId(hContact, DB_KEY_ID, id);
setByte(hContact, DB_KEY_MFA, root["mfa_enabled"].as_bool());
setDword(hContact, DB_KEY_DISCR, _wtoi(root["discriminator"].as_mstring()));
setWString(hContact, DB_KEY_NICK, root["username"].as_mstring());
setWString(hContact, DB_KEY_EMAIL, root["email"].as_mstring());
- switch (root["type"].as_int()) {
- case 1: // confirmed
- db_unset(hContact, "CList", "NotOnList");
- break;
-
- case 3: // expecting autorization
- db_set_b(hContact, "CList", "NotOnList", 1);
- break;
- }
-
-
CMStringW wszNewAvatar(root["avatar"].as_mstring());
setWString(hContact, DB_KEY_AVHASH, wszNewAvatar);
if (hContact == NULL) {
+ m_ownId = id;
+
// if avatar's hash changed, we need to request a new one
if (mir_wstrcmp(wszNewAvatar, wszOldAvatar))
RetrieveAvatar(NULL);
OnLoggedIn();
}
+ else {
+ CDiscordUser *pUser = FindUser(id);
+ ProcessType(pUser, root);
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////