summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-02 11:28:26 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-02 11:28:26 +0000
commit4263ea5fe912a11c35de248fcaedeea3b2c2fa85 (patch)
treec7b8d9c0e04086da01ce3145770872d8e8b1ec53
parent12f17314feedc58355930ab9942c231985537390 (diff)
VK: fix for long messages reading
git-svn-id: http://svn.miranda-ng.org/main/trunk@8009 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp7
1 files 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);