diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-09-09 17:54:07 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-09-09 17:54:07 +0000 |
commit | 86c868a76a5ba3d638b3b7302cd5401df06591d8 (patch) | |
tree | c9ebd6ccca0a5498bbdeea432133ffbd879779a0 /protocols/VKontakte/src/vk_messages.cpp | |
parent | eff5259d6dac303fafa0e661a181428680197584 (diff) |
VKontakte: fix for MessageState
git-svn-id: http://svn.miranda-ng.org/main/trunk@15315 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_messages.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 3e26356f61..ad75928ae9 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -332,17 +332,35 @@ void CVkProto::OnReceiveDlgs(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) if (jnDlg == NULL)
break;
+ int uid = 0;
+ MCONTACT hContact(NULL);
+
int chatid = jnDlg["chat_id"].as_int();
- if (chatid != 0) {
+
+ if (!chatid) {
+ uid = jnDlg["user_id"].as_int();
+ hContact = FindUser(uid, true);
+
+ if (ServiceExists(MS_MESSAGESTATE_UPDATE)) {
+ time_t tLastReadMessageTime = jnDlg["date"].as_int();
+ bool isOut = jnDlg["out"].as_bool();
+ bool isRead = jnDlg["read_state"].as_bool();
+
+ if (isRead && isOut) {
+ MessageReadData data(tLastReadMessageTime, MRD_TYPE_MESSAGETIME);
+ CallService(MS_MESSAGESTATE_UPDATE, hContact, (LPARAM)&data);
+ }
+ }
+ }
+
+ if (chatid) {
debugLogA("CVkProto::OnReceiveDlgs chatid = %d", chatid);
if (m_chats.find((CVkChatInfo*)&chatid) == NULL)
AppendChat(chatid, jnDlg);
}
else if (m_iSyncHistoryMetod) {
int mid = jnDlg["id"].as_int();
- int uid = jnDlg["user_id"].as_int();
- MCONTACT hContact = FindUser(uid, true);
-
+
if (getDword(hContact, "lastmsgid", -1) == -1 && numUnread)
GetServerHistory(hContact, 0, numUnread, 0, 0, true);
else
@@ -352,8 +370,6 @@ void CVkProto::OnReceiveDlgs(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) MarkMessagesRead(hContact);
}
else if (numUnread) {
- int uid = jnDlg["user_id"].as_int();
- MCONTACT hContact = FindUser(uid, true);
GetServerHistory(hContact, 0, numUnread, 0, 0, true);
if (m_iMarkMessageReadOn == markOnReceive)
|