diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-02-06 07:52:46 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2015-02-06 07:52:46 +0000 |
commit | 7aa194b9f14d8f1520ee248b6dbc643bc57aefa9 (patch) | |
tree | 4a1e81885319625cfdeaa30a6ced3d26606d62f9 /protocols/VKontakte/src/vk_history.cpp | |
parent | 890f005fb098f226924dd04eb402a8dc8490a753 (diff) |
VKontakte:
code cleanup and optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@12016 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_history.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_history.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index 09715eac04..f2a6d53f05 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -126,14 +126,15 @@ void CVkProto::GetServerHistory(MCONTACT hContact, int iOffset, int iCount, int if (-1 == userID || userID == VK_FEED_USER)
return;
- CMStringA code, formatcode = "var iOffset=%d;var iReqCount=%d;var userID=%d;var iTime=%d;var lastMid=%d;"
+ CMStringA code;
+
+ code.AppendFormat("var iOffset=%d;var iReqCount=%d;var userID=%d;var iTime=%d;var lastMid=%d;"
"var Hist=API.messages.getHistory({\"user_id\":userID,\"count\":iReqCount,\"offset\":iOffset});"
"var allCount=Hist.count;var ext=Hist.items.length;var index=0;"
"while(ext!=0){if(Hist.items[index].date>iTime){if(Hist.items[index].id>lastMid)"
"{index=index+1;ext=ext-1;}else ext=0;}else ext=0;};"
- "var ret=Hist.items.slice(0,index); return{\"count\":index,\"datetime\":iTime,\"items\":ret,\"once\":%d,\"rcount\":iReqCount};";
-
- code.AppendFormat(formatcode, iOffset, iCount, userID, iTime, iLastMsgId, (int)once);
+ "var ret=Hist.items.slice(0,index); return{\"count\":index,\"datetime\":iTime,\"items\":ret,\"once\":%d,\"rcount\":iReqCount};",
+ iOffset, iCount, userID, iTime, iLastMsgId, (int)once);
Push(new AsyncHttpRequest(this, REQUEST_GET, "/method/execute.json", true, &CVkProto::OnReceiveHistoryMessages)
<< CHAR_PARAM("code", code)
<< VER_API)->pUserInfo = new CVkSendMsgParam(hContact, iLastMsgId, iOffset);
|