From 3e9fed0c18b72ccf4a7b06f62fe7eff2e12d773c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 1 Feb 2017 21:03:42 +0300 Subject: 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 --- protocols/Discord/src/server.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'protocols/Discord/src/server.cpp') 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); -- cgit v1.2.3