summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2015-06-18 04:53:34 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2015-06-18 04:53:34 +0000
commita27ae3e0c1f1f17596db3abeae16ec3fc4b4ba80 (patch)
tree36d24b1d0ba617d66ebdc5bd9798cc842d9d93da /protocols/VKontakte
parent65cf85ee6e83594f4de5d6d06012bde070b6c6b1 (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')
-rw-r--r--protocols/VKontakte/src/version.h2
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp26
-rw-r--r--protocols/VKontakte/src/vk_messages.cpp8
3 files changed, 24 insertions, 12 deletions
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h
index a004a2c4e0..087bea8737 100644
--- a/protocols/VKontakte/src/version.h
+++ b/protocols/VKontakte/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 1
-#define __BUILD_NUM 6
+#define __BUILD_NUM 7
#include <stdver.h>
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 38353271b7..2021f0ee12 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -335,17 +335,23 @@ void CVkProto::AppendChatMessage(int id, const JSONNode &jnMsg, bool bIsHistory)
if (tszActionMid.IsEmpty())
tszBody = TranslateT("invite user");
else {
- int a_uid = 0;
- int iReadCount = _stscanf(tszActionMid, _T("%d"), &a_uid);
- if (iReadCount == 1) {
- CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&a_uid);
- if (cu == NULL)
- tszBody.AppendFormat(_T("%s (https://vk.com/id%d)"), TranslateT("invite user"), a_uid);
+ CMString tszUid;
+ tszUid.AppendFormat(_T("%d"), uid);
+ if (tszUid == tszActionMid)
+ tszBody.AppendFormat(_T(" (https://vk.com/id%s) %s"), tszUid, TranslateT("returned to chat"));
+ else {
+ int a_uid = 0;
+ int iReadCount = _stscanf(tszActionMid, _T("%d"), &a_uid);
+ if (iReadCount == 1) {
+ CVkChatUser *cu = cc->m_users.find((CVkChatUser*)&a_uid);
+ if (cu == NULL)
+ tszBody.AppendFormat(_T("%s (https://vk.com/id%d)"), TranslateT("invite user"), a_uid);
+ else
+ tszBody.AppendFormat(_T("%s %s (https://vk.com/id%d)"), TranslateT("invite user"), cu->m_tszNick, a_uid);
+ }
else
- tszBody.AppendFormat(_T("%s %s (https://vk.com/id%d)"), TranslateT("invite user"), cu->m_tszNick, a_uid);
- }
- else
- tszBody = TranslateT("invite user");
+ tszBody = TranslateT("invite user");
+ }
}
}
else if (tszAction == _T("chat_title_update")) {
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))