From 47e83290f474e01aa8e247375abcd2bffb9a2bf5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 23 Feb 2019 19:16:49 +0300 Subject: fixes #1843 ([discord] Group chat history is no longer retrieved on login) --- protocols/Discord/src/server.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'protocols/Discord/src/server.cpp') diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp index 1dd9cd104a..f1d1db3a5e 100644 --- a/protocols/Discord/src/server.cpp +++ b/protocols/Discord/src/server.cpp @@ -28,12 +28,8 @@ void CDiscordProto::RemoveFriend(SnowFlake id) ///////////////////////////////////////////////////////////////////////////////////////// // retrieves server history -void CDiscordProto::RetrieveHistory(MCONTACT hContact, CDiscordHistoryOp iOp, SnowFlake msgid, int iLimit) +void CDiscordProto::RetrieveHistory(CDiscordUser *pUser, CDiscordHistoryOp iOp, SnowFlake msgid, int iLimit) { - CDiscordUser *pUser = FindUser(getId(hContact, DB_KEY_ID)); - if (pUser == nullptr) - return; - CMStringA szUrl(FORMAT, "/channels/%lld/messages", pUser->channelId); AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_GET, szUrl, &CDiscordProto::OnReceiveHistory); pReq << INT_PARAM("limit", iLimit); @@ -138,7 +134,7 @@ void CDiscordProto::OnReceiveHistory(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest // if we fetched 99 messages, but have smth more to go, continue fetching if (iNumMessages == 99 && lastId < pUser->lastMsgId) - RetrieveHistory(pUser->hContact, MSG_AFTER, lastId, 99); + RetrieveHistory(pUser, MSG_AFTER, lastId, 99); } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3