summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_avatars.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src/vk_avatars.cpp')
-rw-r--r--protocols/VKontakte/src/vk_avatars.cpp20
1 files changed, 20 insertions, 0 deletions
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);
+ }
+}