summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorElzorFox <elzorfox@ya.ru>2017-02-02 09:26:50 +0500
committerElzorFox <elzorfox@ya.ru>2017-02-02 09:26:50 +0500
commit3e556a95086b1e34ad60c73a0f40409bf13ec345 (patch)
tree57d7a04d1b08276b46e4a01100efd8d0027c8594 /protocols
parent3e9fed0c18b72ccf4a7b06f62fe7eff2e12d773c (diff)
VKontakte: fix VK API bug on messages.send return value type (see https://vk.com/bugs?act=show&id=4717174_71)
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/src/vk_messages.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp
index c13efc9516..50bf218266 100644
--- a/protocols/VKontakte/src/vk_messages.cpp
+++ b/protocols/VKontakte/src/vk_messages.cpp
@@ -102,10 +102,20 @@ void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
const JSONNode &jnResponse = CheckJsonResponse(pReq, reply, jnRoot);
if (jnResponse) {
UINT mid;
- if (jnResponse.type() != JSON_STRING)
+ switch (jnResponse.type()) {
+ case JSON_NUMBER:
mid = jnResponse.as_int();
- else if (swscanf(jnResponse.as_mstring(), L"%d", &mid) != 1)
+ break;
+ case JSON_STRING:
+ if (swscanf(jnResponse.as_mstring(), L"%d", &mid) != 1)
+ mid = 0;
+ break;
+ case JSON_ARRAY:
+ mid = jnResponse.as_array()[json_index_t(0)].as_int();
+ break;
+ default:
mid = 0;
+ }
if (param->iMsgID != -1)
m_sendIds.insert((HANDLE)mid);