From e009ecfc26e8884f8216ae77b5af580d5d74e83c Mon Sep 17 00:00:00 2001 From: ElzorFox Date: Sun, 30 Apr 2023 15:37:15 +0500 Subject: VKontakte: fix marking message as read for groupchat version bump --- protocols/VKontakte/src/version.h | 2 +- protocols/VKontakte/src/vk_messages.cpp | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'protocols/VKontakte/src') diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index d647c9547c..9d2cfa1eaf 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 14 -#define __BUILD_NUM 4 +#define __BUILD_NUM 5 #include diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index c0940af108..132e4dc7e3 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -214,17 +214,11 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe CMStringW wszPeerType(jnPeer["type"].as_mstring()); int iUserId = jnPeer["id"].as_int(); - if (wszPeerType == L"user" || wszPeerType == L"group") { - MCONTACT hContact = FindUser(iUserId, true); - setDword(hContact, "in_read", jnItem["in_read"].as_int()); - setDword(hContact, "out_read", jnItem["out_read"].as_int()); - if (m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnReceive) - MarkMessagesRead(hContact); - } - else { - MCONTACT hContact = FindChat(iUserId % VK_CHAT_FLAG); + MCONTACT hContact = (wszPeerType == L"chat") ? FindChat(iUserId % VK_CHAT_FLAG) : FindUser(iUserId, true); + setDword(hContact, "in_read", jnItem["in_read"].as_int()); + setDword(hContact, "out_read", jnItem["out_read"].as_int()); + if (m_vkOptions.iMarkMessageReadOn == MarkMsgReadOn::markOnReceive) MarkMessagesRead(hContact); - } } } -- cgit v1.2.3