summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/proto.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Discord/src/proto.cpp')
-rw-r--r--protocols/Discord/src/proto.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index 626b30088e..1789963959 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -482,13 +482,22 @@ int CDiscordProto::UserIsTyping(MCONTACT hContact, int type)
/////////////////////////////////////////////////////////////////////////////////////////
+void CDiscordProto::OnReceiveMarkRead(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *)
+{
+ JsonReply root(pReply);
+ if (root)
+ SaveToken(root.data());
+}
+
void CDiscordProto::SendMarkRead()
{
mir_cslock lck(csMarkReadQueue);
while (arMarkReadQueue.getCount()) {
CDiscordUser *pUser = arMarkReadQueue[0];
+ JSONNode payload; payload << CHAR_PARAM("token", m_szAccessToken);
CMStringA szUrl(FORMAT, "/channels/%lld/messages/%lld/ack", pUser->channelId, pUser->lastMsgId);
- Push(new AsyncHttpRequest(this, REQUEST_POST, szUrl, nullptr));
+ auto *pReq = new AsyncHttpRequest(this, REQUEST_POST, szUrl, &CDiscordProto::OnReceiveMarkRead, &payload);
+ Push(pReq);
arMarkReadQueue.remove(0);
}
}