summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_avatars.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-01-17 14:37:50 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-01-17 14:37:50 +0300
commit4c60037f6852f7771ed86e0b285a872e4bbadb87 (patch)
treea6977ea0a68db5612f3ac8664efd9d66a483e52c /protocols/SkypeWeb/src/skype_avatars.cpp
parent893fe6d2f16f5e70087aa9d5949aff5aaff556d2 (diff)
PROTO_INTERFACE::GetAvatarPath - new helper for calculating avatars' root for an account
Diffstat (limited to 'protocols/SkypeWeb/src/skype_avatars.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_avatars.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp
index 015b56965b..94d097c852 100644
--- a/protocols/SkypeWeb/src/skype_avatars.cpp
+++ b/protocols/SkypeWeb/src/skype_avatars.cpp
@@ -122,15 +122,16 @@ INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam)
void CSkypeProto::GetAvatarFileName(MCONTACT hContact, wchar_t* pszDest, size_t cbLen)
{
- int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%s", VARSW(L"%miranda_avatarcache%").get(), m_tszUserName);
- CreateDirectoryTreeW(pszDest);
- pszDest[tPathLen++] = '\\';
+ CMStringW wszPath(GetAvatarPath());
+ wszPath += '\\';
const wchar_t* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_JPEG));
CMStringA username(getId(hContact));
username.Replace("live:", "__live_");
username.Replace("facebook:", "__facebook_");
- mir_snwprintf(pszDest + tPathLen, MAX_PATH - tPathLen, L"%S%s", username.c_str(), szFileType);
+ wszPath.AppendFormat(L"%S%s", username.c_str(), szFileType);
+
+ wcsncpy_s(pszDest, cbLen, wszPath, _TRUNCATE);
}
void CSkypeProto::SetAvatarUrl(MCONTACT hContact, CMStringW &tszUrl)