From 7c892dc6fd0f243bf9e38a7be7dc387a9c270291 Mon Sep 17 00:00:00 2001
From: George Hazan <george.hazan@gmail.com>
Date: Sat, 9 Nov 2013 14:11:01 +0000
Subject: VK: added reading of contact's timezone & gender

git-svn-id: http://svn.miranda-ng.org/main/trunk@6832 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 protocols/VKontakte/src/vk_thread.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

(limited to 'protocols/VKontakte')

diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index e33a881a71..684d03d38e 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -292,7 +292,7 @@ void CVkProto::RetrieveFriends()
 	debugLogA("CVkProto::RetrieveFriends");
 
 	HttpParam params[] = {
-		{ "fields", "uid,first_name,last_name,photo_medium,contacts" },
+		{ "fields", "uid,first_name,last_name,photo_medium,sex,country,timezone,contacts" },
 		{ "count", "1000" },
 		{ "access_token", m_szAccessToken }
 	};
@@ -338,6 +338,13 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq
 
 		setWord(hContact, "Status", (json_as_int( json_get(pInfo, "online")) == 0) ? ID_STATUS_OFFLINE : ID_STATUS_ONLINE); 
 
+		int iValue = json_as_int( json_get(pInfo, "sex"));
+		if (iValue)
+			setByte(hContact, "Gender", (iValue == 2) ? 'M' : 'F');
+
+		if ((iValue = json_as_int( json_get(pInfo, "timezone"))) != 0)
+			setByte(hContact, "Timezone", iValue * -2);
+
 		szValue = json_as_string( json_get(pInfo, "mobile_phone"));
 		if (szValue && *szValue) setTString(hContact, "Cellular", szValue);
 		szValue = json_as_string( json_get(pInfo, "home_phone"));
-- 
cgit v1.2.3