summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/utils.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/utils.cpp
parentc6a0095ad307a43fc83497bbb3efbc60052f6ada (diff)
Discord: dynamic user addition processing
Diffstat (limited to 'protocols/Discord/src/utils.cpp')
-rw-r--r--protocols/Discord/src/utils.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp
index ac9eb85c11..4d1747c3f9 100644
--- a/protocols/Discord/src/utils.cpp
+++ b/protocols/Discord/src/utils.cpp
@@ -179,3 +179,31 @@ CDiscordUser* CDiscordProto::PrepareUser(const JSONNode &user)
setWString(pUser->hContact, DB_KEY_AVHASH, avatar);
return pUser;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CDiscordProto::ProcessType(CDiscordUser *pUser, const JSONNode &pRoot)
+{
+ switch (pRoot["type"].as_int()) {
+ case 1: // confirmed
+ db_unset(pUser->hContact, "CList", "NotOnList");
+ delSetting(pUser->hContact, "FakeAuth");
+ break;
+
+ case 3: // expecting authorization
+ db_set_b(pUser->hContact, "CList", "NotOnList", 1);
+ if (!getByte(pUser->hContact, "FakeAuth", 0)) {
+ setByte(pUser->hContact, "FakeAuth", 1);
+
+ CMStringA szId(FORMAT, "%lld", pUser->id);
+ DB_AUTH_BLOB blob(pUser->hContact, T2Utf(pUser->wszUsername), NULL, NULL, szId, NULL);
+
+ PROTORECVEVENT pre = { 0 };
+ pre.timestamp = (DWORD)time(NULL);
+ pre.lParam = blob.size();
+ pre.szMessage = blob;
+ ProtoChainRecv(pUser->hContact, PSR_AUTH, 0, (LPARAM)&pre);
+ }
+ break;
+ }
+}