From b4a062fa0625cff6d7c2205508f6c0f10f8cbff7 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 6 Apr 2015 09:18:45 +0000 Subject: avatar support 2nd attempt git-svn-id: http://svn.miranda-ng.org/main/trunk@12624 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_avatars.cpp | 39 ++++++++++++++++++++++++++++++++ protocols/SkypeWeb/src/skype_proto.cpp | 2 ++ protocols/SkypeWeb/src/skype_proto.h | 2 ++ 3 files changed, 43 insertions(+) diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index b997c92bb1..eb034906aa 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -1,5 +1,27 @@ #include "common.h" +INT_PTR CSkypeProto::SvcGetAvatarCaps(WPARAM wParam, LPARAM lParam) +{ + switch (wParam) { + case AF_MAXSIZE: + ((POINT*)lParam)->x = 96; + ((POINT*)lParam)->y = 96; + return 0; + + case AF_PROPORTION: + return PIP_SQUARE; + + case AF_FORMATSUPPORTED: + case AF_ENABLED: + case AF_DONTNEEDDELAYS: + case AF_FETCHIFPROTONOTVISIBLE: + case AF_FETCHIFCONTACTOFFLINE: + return 1; + } + + return 0; +} + void CSkypeProto::ReloadAvatarInfo(MCONTACT hContact) { if (!hContact) { @@ -60,6 +82,23 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) return GAIR_NOAVATAR; } +INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) +{ + debugLogA("CSkypeProto::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 CSkypeProto::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/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index d66af083a4..cf4bec1bdf 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -18,6 +18,8 @@ PROTO(protoName, userName), password(NULL) CreateProtoService(PS_CREATEACCMGRUI, &CSkypeProto::OnAccountManagerInit); CreateProtoService(PS_GETAVATARINFOT, &CSkypeProto::SvcGetAvatarInfo); + CreateProtoService(PS_GETAVATARCAPS, &CSkypeProto::SvcGetAvatarCaps); + CreateProtoService(PS_GETMYAVATART, &CSkypeProto::SvcGetMyAvatar); // custom event DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) }; diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 39ec1acbf0..007bbfe327 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -103,6 +103,8 @@ private: INT_PTR __cdecl OnAccountManagerInit(WPARAM, LPARAM); INT_PTR __cdecl SvcGetAvatarInfo(WPARAM, LPARAM); + INT_PTR __cdecl SvcGetAvatarCaps(WPARAM, LPARAM); + INT_PTR __cdecl SvcGetMyAvatar(WPARAM, LPARAM); // requests void PushRequest(HttpRequest *request); -- cgit v1.2.3