diff options
author | ElzorFox <elzorfox@ya.ru> | 2020-06-11 21:16:08 +0500 |
---|---|---|
committer | ElzorFox <elzorfox@ya.ru> | 2020-06-11 21:17:04 +0500 |
commit | 9696040cbbaaf89dd5f2f663278b4b45f4ebc7bd (patch) | |
tree | e2cbcf4b5a93cac0014e9c4a7bd519638c7b8910 /protocols | |
parent | 7478fc7427143486c6f2ecf552b460c78fb44e82 (diff) |
VKontakte: prepare for upgrade VK API version
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/VKontakte/src/vk.h | 9 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 4 | ||||
-rw-r--r-- | protocols/VKontakte/src/vkjs.js | 10 |
3 files changed, 22 insertions, 1 deletions
diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index 1f6b5107c7..06eb52bf97 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -88,7 +88,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define VK_USER_DEACTIVATE_ACTION 9321
-#define VK_API_VER "5.76"
+#define VK_NEW_API 0
+
+#if (VK_NEW_API == 0)
+ #define VK_API_VER "5.76"
+#else
+ #define VK_API_VER "5.110"
+#endif
+
#define VER_API CHAR_PARAM("v", VK_API_VER)
#define VK_FEED_USER 2147483647L
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index ce7cbe2736..11c0b96c8d 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -199,7 +199,11 @@ void CVkProto::RetrieveUnreadMessages() if (!IsOnline())
return;
+#if (VK_NEW_API == 1)
+ Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.RetrieveUnreadConversations", true, &CVkProto::OnReceiveDlgs, AsyncHttpRequest::rpHigh));
+#else
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.RetrieveUnreadMessages", true, &CVkProto::OnReceiveDlgs, AsyncHttpRequest::rpHigh));
+#endif
}
void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
diff --git a/protocols/VKontakte/src/vkjs.js b/protocols/VKontakte/src/vkjs.js index 51bc9b2377..8a95f260b5 100644 --- a/protocols/VKontakte/src/vkjs.js +++ b/protocols/VKontakte/src/vkjs.js @@ -134,6 +134,16 @@ var groups = API.groups.get(); return { "dialogs": dlg, "users": users, "groups": groups.items }; // Stored procedure name: RetrieveUnreadMessages = End +// Stored procedure name: RetrieveUnreadConversations = Begin +// Arguments: no + +var dlg = API.messages.getConversations({ "count": 200 }); +var users = API.friends.areFriends({ "user_ids": dlg.items@.conversation@.peer@.local_id}); +var groups = API.groups.get(); +return { "dialogs": dlg, "users": users, "groups": groups.items }; +// Stored procedure name: RetrieveUnreadConversations = End + + // Stored procedure name: RetrieveStatusMusic = Begin // Arguments: // Args.statusmsg |