From 4263ea5fe912a11c35de248fcaedeea3b2c2fa85 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 2 Feb 2014 11:28:26 +0000 Subject: VK: fix for long messages reading git-svn-id: http://svn.miranda-ng.org/main/trunk@8009 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_thread.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 99a790d206..d51b0e96e5 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -422,10 +422,13 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe } CMStringA mids, lmids; + bool bDirectArray = false; JSONNODE *pMsgs = json_as_array(json_get(pResponse, "msgs")); - if (pMsgs == NULL) + if (pMsgs == NULL) { pMsgs = pResponse; + bDirectArray = true; + } int numMessages = json_as_int(json_at(pMsgs, 0)); for (int i = 1; i <= numMessages; i++) { @@ -449,7 +452,7 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe // VK documentation lies: even if you specified preview_length=0, // long messages get cut out. So we need to retrieve them from scratch ptrT ptszBody(json_as_string(json_get(pMsg, "body"))); - if (_tcslen(ptszBody) > 100) { + if (!bDirectArray && _tcslen(ptszBody) > 1000) { if (!lmids.IsEmpty()) lmids.AppendChar(','); lmids.Append(szMid); -- cgit v1.2.3