diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-19 20:22:23 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-19 20:22:23 +0300 |
commit | 92e81067e7e81cefcea58f7e91f6d2d8c959fd0d (patch) | |
tree | 469906fd6687a406c4ae232d0260ebe5f731c128 /protocols/Discord/src/proto.cpp | |
parent | 79d4eb2e8e57025219e6c5680a88446c0a047b8f (diff) |
Discord:
- added support for channel addition & removal;
- added support for reading message acks;
- now Miranda reads the whole history, not only first 99 messages
-
Diffstat (limited to 'protocols/Discord/src/proto.cpp')
-rw-r--r-- | protocols/Discord/src/proto.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index f161d27e49..83cc7c1941 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -350,10 +350,13 @@ int CDiscordProto::SendMsg(MCONTACT hContact, int /*flags*/, const char *pszSrc) if (pUser == NULL || pUser->channelId == NULL) return 0; - CMStringA szUrl(FORMAT, "/channels/%lld/messages", pUser->channelId); + // we generate a random 64-bit integer and pass it to the server + // to distinguish our own messages from these generated by another clients SnowFlake nonce; Utils_GetRandom(&nonce, sizeof(nonce)); JSONNode body; body << WCHAR_PARAM("content", wszText) << INT64_PARAM("nonce", nonce); arOwnMessages.insert(new SnowFlake(nonce)); + + CMStringA szUrl(FORMAT, "/channels/%lld/messages", pUser->channelId); AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, szUrl, &CDiscordProto::OnReceiveMessage, &body); pReq->pUserInfo = (void*)hContact; Push(pReq); |