diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-12-12 03:25:50 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-12-12 03:25:50 +0000 |
commit | 4f57c77f78480ac20879d4ab1b10c47ec99666bf (patch) | |
tree | bd51d0512d899686853f9d3e26f900da05981960 | |
parent | ee0f577f3169211400f03b6fe012686c416c34da (diff) |
VKontakte: fix for set offline all users on RetrieveUserInfo one user
git-svn-id: http://svn.miranda-ng.org/main/trunk@11339 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 3cd6ca13fb..320efa0a6f 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -384,7 +384,7 @@ void CVkProto::RetrieveUserInfo(LONG userID) CMString userIDs, code;
userIDs.AppendFormat(_T("%i"), userID);
CMString codeformat("var userIDs=\"%s\";"
- "return{\"users\":API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"})};");
+ "return{\"freeoffline\":0,\"users\":API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"})};");
code.AppendFormat(codeformat, userIDs.GetBuffer(), CMString(fieldsName).GetBuffer());
Push(new AsyncHttpRequest(this, REQUEST_POST, "/method/execute.json", true, &CVkProto::OnReceiveUserInfo)
@@ -412,10 +412,10 @@ void CVkProto::RetrieveUsersInfo(bool flag) if (flag)
codeformat += CMString("var US=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});"
"var res=[];var index=US.length;while(index >0){index=index-1;if(US[index].online==1){res.unshift(US[index]);};};"
- "return{\"users\":res,\"requests\":API.friends.getRequests({\"extended\":0,\"need_mutual\":0,\"out\":0})};");
+ "return{\"freeoffline\":1,\"users\":res,\"requests\":API.friends.getRequests({\"extended\":0,\"need_mutual\":0,\"out\":0})};");
else
codeformat += CMString("var res=API.users.get({\"user_ids\":userIDs,\"fields\":\"%s\",\"name_case\":\"nom\"});"
- "return{\"users\":res};");
+ "return{\"freeoffline\":0,\"users\":res};");
code.AppendFormat(codeformat, userIDs.GetBuffer(), CMString(flag ? "online,status" : fieldsName).GetBuffer());
Push(new AsyncHttpRequest(this, REQUEST_POST, "/method/execute.json", true, &CVkProto::OnReceiveUserInfo)
@@ -449,16 +449,16 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe for (size_t i = 0; (hContact = SetContactInfo(json_at(pUsers, i))) != INVALID_CONTACT_ID; i++)
if (hContact)
arContacts.remove((HANDLE)hContact);
-
- for (int i = 0; i < arContacts.getCount(); i++) {
- hContact = (MCONTACT)arContacts[i];
- if (getDword(hContact, "ID", -1) == m_myUserId)
- continue;
- if (getWord(hContact, "Status", 0) != ID_STATUS_OFFLINE) {
- setWord(hContact, "Status", ID_STATUS_OFFLINE);
- SetMirVer(hContact, -1);
+ if (json_as_int(json_get(pResponse, "freeoffline")))
+ for (int i = 0; i < arContacts.getCount(); i++) {
+ hContact = (MCONTACT)arContacts[i];
+ if (getDword(hContact, "ID", -1) == m_myUserId)
+ continue;
+ if (getWord(hContact, "Status", 0) != ID_STATUS_OFFLINE) {
+ setWord(hContact, "Status", ID_STATUS_OFFLINE);
+ SetMirVer(hContact, -1);
+ }
}
- }
arContacts.destroy();
JSONNODE *pRequests = json_get(pResponse, "requests");
|