From b1582b887972892b58cc93ddc12c9bd854c0d489 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Thu, 9 Apr 2015 07:30:38 +0000 Subject: fixed getting contacts avatars fixed options page init git-svn-id: http://svn.miranda-ng.org/main/trunk@12689 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_avatars.cpp | 23 ++++++++--------------- protocols/SkypeWeb/src/skype_options.cpp | 2 ++ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 8fd2c6a727..0f792d5e2f 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -46,6 +46,7 @@ void CSkypeProto::OnReceiveAvatar(const NETLIBHTTPREQUEST *response, void *arg) PROTO_AVATAR_INFORMATIONT AI = { sizeof(AI) }; GetAvatarFileName(hContact, AI.filename, SIZEOF(AI.filename)); AI.format = ProtoGetBufferFormat(response->pData); + setByte(AI.hContact, "AvatarType", AI.format); FILE *out = _tfopen(AI.filename, _T("wb")); if (out == NULL) { @@ -82,11 +83,12 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) _tcsncpy(AI->filename, tszFileName, SIZEOF(AI->filename)); AI->format = ProtoGetAvatarFormat(AI->filename); + setByte(AI->hContact, "AvatarType", AI->format); if (::_taccess(AI->filename, 0) == 0 && !getBool(AI->hContact, "NeedNewAvatar", 0)) return GAIR_SUCCESS; - if (IsOnline()) { + if (m_hPollingThread) { PushRequest(new GetAvatarRequest(szUrl), &CSkypeProto::OnReceiveAvatar, (void*)AI->hContact); debugLogA("Requested to read an avatar from '%s'", szUrl); return GAIR_WAITFOR; @@ -98,24 +100,15 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) 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; - + TCHAR path[MAX_PATH]; + GetAvatarFileName(NULL, path, SIZEOF(path)); + _tcsncpy((TCHAR*)wParam, path, (int)lParam); 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); + int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%s"), VARST(_T("%miranda_avatarcache%")), m_tszUserName); DWORD dwAttributes = GetFileAttributes(pszDest); if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) @@ -123,7 +116,7 @@ void CSkypeProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cb pszDest[tPathLen++] = '\\'; - const TCHAR* szFileType = _T(".jpg"); + const TCHAR* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_JPEG)); ptrA username(getStringA(hContact, "Skypename")); mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%s%s"), _A2T(username), szFileType); } diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index d20b1d360b..66446e1a38 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -15,6 +15,8 @@ void CSkypeOptionsMain::OnInitDialog() { CSkypeDlgBase::OnInitDialog(); + m_skypename.SetTextA(ptrA(m_proto->getStringA(SKYPE_SETTINGS_ID))); + m_password.SetTextA(ptrA(m_proto->getStringA("Password"))); SendMessage(m_skypename.GetHwnd(), EM_LIMITTEXT, 32, 0); SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 20, 0); SendMessage(m_group.GetHwnd(), EM_LIMITTEXT, 64, 0); -- cgit v1.2.3