diff options
author | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-09-23 10:27:30 +0000 |
---|---|---|
committer | Sergey Bolhovskoy <elzorfox@ya.ru> | 2014-09-23 10:27:30 +0000 |
commit | 2be198e70035b758e0cfbd468d551051f9b5d939 (patch) | |
tree | 0492b7a2c221093277e5c3ac10f27db9d0839bfb | |
parent | 08e2cef3aec75f8f913e6e1bab6b2a9b622ed640 (diff) |
VKontakte: support my avatar
git-svn-id: http://svn.miranda-ng.org/main/trunk@10563 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/VKontakte/src/vk_avatars.cpp | 21 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 1 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 1 |
3 files changed, 23 insertions, 0 deletions
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index c69fab2f32..fc6cfee1a8 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -62,6 +62,10 @@ INT_PTR CVkProto::SvcGetAvatarCaps(WPARAM wParam, LPARAM lParam) void CVkProto::ReloadAvatarInfo(MCONTACT hContact)
{
+ if (!hContact){
+ CallService(MS_AV_REPORTMYAVATARCHANGED, (WPARAM)m_szModuleName, 0);
+ return;
+ }
PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) };
AI.hContact = hContact;
SvcGetAvatarInfo(0, (LPARAM)&AI);
@@ -102,6 +106,23 @@ INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM wParam, LPARAM lParam) return GAIR_NOAVATAR;
}
+INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam)
+{
+ debugLogA("CVkProto::SvcGetMyAvatar");
+ PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) };
+ AI.hContact = NULL;
+ if (SvcGetAvatarInfo(0, (LPARAM)&AI) != GAIR_SUCCESS)
+ return 1;
+
+ TCHAR* buf = (TCHAR*)wParam;
+ int size = (int)lParam;
+
+ _tcsncpy(buf, AI.filename, size);
+ buf[size - 1] = 0;
+
+ return 0;
+}
+
void CVkProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen)
{
int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 9ccda85054..43fe08645c 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -39,6 +39,7 @@ CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) : CreateProtoService(PS_CREATEACCMGRUI, &CVkProto::SvcCreateAccMgrUI);
CreateProtoService(PS_GETAVATARINFOT, &CVkProto::SvcGetAvatarInfo);
CreateProtoService(PS_GETAVATARCAPS, &CVkProto::SvcGetAvatarCaps);
+ CreateProtoService(PS_GETMYAVATART, &CVkProto::SvcGetMyAvatar);
CreateProtoService(PS_SET_LISTENINGTO, &CVkProto::SvcSetListeningTo);
HookProtoEvent(ME_OPT_INITIALISE, &CVkProto::OnOptionsInit);
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 4f36c7e95c..344639496e 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -192,6 +192,7 @@ struct CVkProto : public PROTO<CVkProto> INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM);
INT_PTR __cdecl SvcGetAvatarInfo(WPARAM, LPARAM);
INT_PTR __cdecl SvcGetAvatarCaps(WPARAM, LPARAM);
+ INT_PTR __cdecl SvcGetMyAvatar(WPARAM, LPARAM);
INT_PTR __cdecl SvcSetListeningTo(WPARAM, LPARAM);
//==== Menus ==========================================================================
|