summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/proto.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-02-24 12:23:07 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-02-24 12:23:07 +0300
commit2f8a2b2964dbf1f36db628661978ecd9189c1b1d (patch)
tree1470581e2a2a39e9f308e28d37155614ec548859 /protocols/Discord/src/proto.cpp
parente01b0dc97ef826a3f3ee6c2649df3a32af402484 (diff)
Discord:
- fixes a problem with 400 BAD REQUEST error when sending mark as read request; - code cleaning; - version bump
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);
}
}