summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-02-01 21:03:42 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-02-01 21:03:42 +0300
commit3e9fed0c18b72ccf4a7b06f62fe7eff2e12d773c (patch)
treef4cc66cf0f18bba5a10d0a93d42dc9debee0f90f /protocols/Discord/src/server.cpp
parentd2d633a1667ea16c9c88eae9d679c91c545a77ee (diff)
Discord:
- we don't request user info when no user id is set; - fix for the user addition; - fix for creating shadow users when a presence is sent to non-existing user
Diffstat (limited to 'protocols/Discord/src/server.cpp')
-rw-r--r--protocols/Discord/src/server.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index ecc43c6b07..ece1f6a79d 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -117,10 +117,14 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest
void CDiscordProto::RetrieveUserInfo(MCONTACT hContact)
{
CMStringA szUrl;
- if (hContact == 0)
- szUrl = "/users/@me";
- else
- szUrl.Format("/users/%lld", getId(hContact, DB_KEY_ID));
+ if (hContact != 0) {
+ SnowFlake id = getId(hContact, DB_KEY_ID);
+ if (id == 0)
+ return;
+ szUrl.Format("/users/%lld", id);
+ }
+ else szUrl = "/users/@me";
+
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, szUrl, &CDiscordProto::OnReceiveUserInfo);
pReq->pUserInfo = (void*)hContact;
Push(pReq);