diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-06-18 04:53:34 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-06-18 04:53:34 +0000 |
commit | a27ae3e0c1f1f17596db3abeae16ec3fc4b4ba80 (patch) | |
tree | 36d24b1d0ba617d66ebdc5bd9798cc842d9d93da /protocols/VKontakte/src/vk_messages.cpp | |
parent | 65cf85ee6e83594f4de5d6d06012bde070b6c6b1 (diff) |
VKontakte:
add ‘returned’ muc action
message.send now use guid param for prevent duplicate messages
version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@14242 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_messages.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 03d946045e..ee41e1768c 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -54,6 +54,7 @@ int CVkProto::SendMsg(MCONTACT hContact, int, const char *szMsg) ULONG msgId = ::InterlockedIncrement(&m_msgId);
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, &CVkProto::OnSendMessage, AsyncHttpRequest::rpHigh)
<< INT_PARAM("user_id", userID)
+ << INT_PARAM("guid", ((LONG) time(NULL)) * 100 + msgId % 100)
<< VER_API;
if (StickerId != 0)
@@ -89,7 +90,12 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) JSONNode jnRoot;
const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
if (!jnResponse.isnull()) {
- UINT mid = jnResponse.as_int();
+ UINT mid;
+ if (jnResponse.type() != JSON_STRING)
+ mid = jnResponse.as_int();
+ else if (_stscanf(jnResponse.as_mstring(), _T("%d"), &mid) != 1)
+ mid = 0;
+
if (param->iMsgID != -1)
m_sendIds.insert((HANDLE)mid);
if (mid > getDword(param->hContact, "lastmsgid", 0))
|