diff options
-rw-r--r-- | protocols/VKontakte/src/version.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_avatars.cpp | 20 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 1 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 8 |
4 files changed, 26 insertions, 5 deletions
diff --git a/protocols/VKontakte/src/version.h b/protocols/VKontakte/src/version.h index 247b6da7f6..4ff3156678 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 0
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 3811ee9f64..59c9d5cbdb 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -113,3 +113,23 @@ void CVkProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen) mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%d%s"), id, szFileType);
}
+void CVkProto::SetAvatarUrl(HANDLE hContact, LPCTSTR ptszUrl)
+{
+ ptrT oldUrl( getTStringA(hContact, "AvatarUrl"));
+ if ( !lstrcmp(ptszUrl, oldUrl))
+ return;
+
+ if (ptszUrl == NULL) {
+ delSetting(hContact, "AvatarUrl");
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, NULL, 0);
+ }
+ else {
+ setTString(hContact, "AvatarUrl", ptszUrl);
+
+ PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) };
+ AI.hContact = hContact;
+ GetAvatarFileName(AI.hContact, AI.filename, SIZEOF(AI.filename));
+ AI.format = ProtoGetAvatarFormat(AI.filename);
+ ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&AI, 0);
+ }
+}
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 8e0860f479..e045147af7 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -169,6 +169,7 @@ private: void OnLoggedOut();
void ShutdownSession();
+ void SetAvatarUrl(HANDLE hContact, LPCTSTR ptszUrl);
void GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen);
HANDLE FindUser(LONG userid, bool bCreate = false);
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 5dfabf3b08..1b73c38180 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -264,8 +264,8 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe }
}
- if (szValue = json_as_string( json_get(pRecord, "photo_medium")))
- setTString(hContact, "AvatarUrl", szValue);
+ szValue = json_as_string( json_get(pRecord, "photo_medium"));
+ SetAvatarUrl(hContact, szValue);
}
}
@@ -317,8 +317,8 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq if ( !tszNick.IsEmpty())
setTString(hContact, "Nick", tszNick);
- if (szValue = json_as_string( json_get(pInfo, "photo_medium")))
- setTString(hContact, "AvatarUrl", szValue);
+ szValue = json_as_string( json_get(pInfo, "photo_medium"));
+ SetAvatarUrl(hContact, szValue);
setWord(hContact, "Status", (json_as_int( json_get(pInfo, "online")) == 0) ? ID_STATUS_OFFLINE : ID_STATUS_ONLINE);
|