From 4e8370452526b6d3e5fb6a95ec1bfe39e2b61034 Mon Sep 17 00:00:00 2001 From: ElzorFox Date: Mon, 3 Jun 2024 17:29:33 +0500 Subject: VKontakte: fix for last non-version API VK changes version bump --- protocols/VKontakte/src/version.h | 2 +- protocols/VKontakte/src/vk.h | 2 +- protocols/VKontakte/src/vk_chats.cpp | 6 ++++-- protocols/VKontakte/src/vk_thread.cpp | 2 +- protocols/VKontakte/src/vkjs.js | 14 +++++++++----- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index e7a6adffcc..0389c1468a 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 16 -#define __BUILD_NUM 9 +#define __BUILD_NUM 10 #include diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index c5cd548119..152f77c8eb 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -88,7 +88,7 @@ along with this program. If not, see . #define VK_USER_DEACTIVATE_ACTION 9321 -#define VK_API_VER "5.199" +#define VK_API_VER "5.236" #define VER_API CHAR_PARAM("v", VK_API_VER) #define VK_FEED_USER 2147483647L diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index d58c53c801..90c38fb366 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -218,13 +218,15 @@ void CVkProto::OnReceiveChatInfo(MHttpResponse *reply, AsyncHttpRequest *pReq) SetChatTitle(cc, jnInfo["title"].as_mstring()); - CMStringW wszValue = jnInfo["photo_100"].as_mstring(); + CMStringW wszValue = jnInfo["photo"] ? jnInfo["photo"]["photo_100"].as_mstring() : ""; if (!wszValue.IsEmpty()) { SetAvatarUrl(cc->m_si->hContact, wszValue); ReloadAvatarInfo(cc->m_si->hContact); } - if (jnInfo["left"].as_bool() || jnInfo["kicked"].as_bool()) { + CMStringW wszState = jnInfo["state"].as_mstring(); + + if (jnInfo["left"].as_bool() || jnInfo["kicked"].as_bool() || wszState == L"left" || wszState == L"kicked") { setByte(cc->m_si->hContact, "kicked", jnInfo["kicked"].as_bool()); LeaveChat(cc->m_iChatId); return; diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 08a09e3ca9..47484a2d60 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -676,7 +676,7 @@ void CVkProto::RetrieveGroupInfo(VKUserID_t iGroupId) Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/groups.getById.json", true, &CVkProto::OnReceiveGroupInfo) << CHAR_PARAM("fields", "description") - << INT_PARAM("group_id", -1 * iGroupId)); + << INT_PARAM("group_ids", -1 * iGroupId)); } void CVkProto::RetrieveGroupInfo(CMStringA& groupIDs) diff --git a/protocols/VKontakte/src/vkjs.js b/protocols/VKontakte/src/vkjs.js index 59a57a0677..7feb127504 100644 --- a/protocols/VKontakte/src/vkjs.js +++ b/protocols/VKontakte/src/vkjs.js @@ -374,9 +374,10 @@ return { "info": Info, "users": ChatUsers, "msgs": ChatMsg, "fwd_users": FUsers // ver 4 -var Info = API.messages.getChat({ "chat_id": Args.chatid }); var PeerId = 2000000000 + parseInt(Args.chatid); -var ChatUsers = API.messages.getConversationMembers({ "peer_id": PeerId, "fields": "id,first_name,last_name" }); +var Conv=API.messages.getConversationsById({"peer_ids": PeerId}); +var Info=Conv.items[0].chat_settings; +var ChatUsers = API.messages.getConversationMembers({ "peer_id": PeerId, extended: 1, "fields": "id,first_name,last_name" }); var ChatMsg = API.messages.getHistory({ "peer_id": PeerId, "count": 20, "rev": 0 }); var UR = parseInt(ChatMsg.unread); if (UR > 20) { @@ -410,13 +411,16 @@ var MsgUsers = API.users.get({ "user_ids": ChatMsg.items@.from_id, "fields":"id, return { "info": Info, "users": ChatUsers, "msgs": ChatMsg, "fwd_users": FUsers + GUsers.groups, "msgs_users": MsgUsers}; - // ver 5 -var Info=API.messages.getChat({"chat_id": Args.chatid}); var PeerId = 2000000000 + parseInt(Args.chatid); -var ChatUsers = API.messages.getConversationMembers({ "peer_id": PeerId, "fields": "id,first_name,last_name" }); +var Conv=API.messages.getConversationsById({"peer_ids": PeerId}); +var Info=Conv.items[0].chat_settings; +var ChatUsers = API.messages.getConversationMembers({ "peer_id": PeerId, extended: 1, "fields": "id,first_name,last_name" }); return {"info":Info,"users":ChatUsers}; + + + // Stored procedure name: RetrieveChatInfo = End // Stored procedure name: DestroyKickChat = Begin -- cgit v1.2.3