From 21b895b97019d918ede01ca6d7c190c8591160eb Mon Sep 17 00:00:00 2001 From: ElzorFox Date: Sun, 20 Nov 2016 20:17:09 +0500 Subject: VKontakte: optimize loading user status info version bump --- protocols/VKontakte/src/version.h | 2 +- protocols/VKontakte/src/vk_proto.cpp | 2 +- protocols/VKontakte/src/vk_thread.cpp | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 167af8b3f9..af23f8317a 100644 --- a/protocols/VKontakte/src/version.h +++ b/protocols/VKontakte/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 2 -#define __BUILD_NUM 8 +#define __BUILD_NUM 9 #include diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index c50f2559a1..e0463a7866 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -357,7 +357,7 @@ void CVkProto::InitMenus() int CVkProto::OnPreBuildContactMenu(WPARAM hContact, LPARAM) { LONG userID = getDword(hContact, "ID", VK_INVALID_USER); - bool bisFriend = (getBool(hContact, "Auth", true) == 0); + bool bisFriend = !getBool(hContact, "Auth", true); bool bisBroadcast = !(IsEmpty(ptrW(db_get_wsa(hContact, m_szModuleName, "AudioUrl")))); bool bIsGroup = IsGroupUser(hContact); Menu_ShowItem(m_hContactMenuItems[CMI_VISITPROFILE], userID != VK_FEED_USER); diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index d68790ab2b..5a5563f3d8 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -527,6 +527,11 @@ void CVkProto::RetrieveUsersInfo(bool bFreeOffline, bool bRepeat) LONG userID = getDword(hContact, "ID", VK_INVALID_USER); if (userID == VK_INVALID_USER || userID == VK_FEED_USER || userID < 0) continue; + + bool bIsFriend = !getBool(hContact, "Auth", true); + if (bFreeOffline && !m_vkOptions.bLoadFullCList && bIsFriend) + continue; + if (!userIDs.IsEmpty()) userIDs.AppendChar(','); userIDs.AppendFormat(L"%i", userID); @@ -542,7 +547,8 @@ void CVkProto::RetrieveUsersInfo(bool bFreeOffline, bool bRepeat) codeformat += L"API.account.setOnline();"; if (bFreeOffline && !m_vkOptions.bLoadFullCList) - codeformat += CMStringW("var US=[];var res=[];var t=10;while(t>0){" + codeformat += CMStringW("var US=[];var res=API.users.get({\"user_ids\":API.friends.getOnline(),\"fields\":_fields,\"name_case\":\"nom\"});" + "var t=10;while(t>0){" "US=API.users.get({\"user_ids\":userIDs,\"fields\":_fields,\"name_case\":\"nom\"});" "var index=US.length;while(index>0){" "index=index-1;if(US[index].online!=0){res.push(US[index]);};};" -- cgit v1.2.3