summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp
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/WhatsApp
parent893fe6d2f16f5e70087aa9d5949aff5aaff556d2 (diff)
PROTO_INTERFACE::GetAvatarPath - new helper for calculating avatars' root for an account
Diffstat (limited to 'protocols/WhatsApp')
-rw-r--r--protocols/WhatsApp/src/avatars.cpp4
-rw-r--r--protocols/WhatsApp/src/proto.cpp5
-rw-r--r--protocols/WhatsApp/src/proto.h1
3 files changed, 3 insertions, 7 deletions
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp
index dfe45817b7..fd4bbfde1f 100644
--- a/protocols/WhatsApp/src/avatars.cpp
+++ b/protocols/WhatsApp/src/avatars.cpp
@@ -90,7 +90,7 @@ INT_PTR WhatsAppProto::GetAvatarCaps(WPARAM wParam, LPARAM lParam)
CMStringW WhatsAppProto::GetAvatarFileName(MCONTACT hContact)
{
- CMStringW result = m_tszAvatarFolder + L"\\";
+ CMStringW result = GetAvatarPath() + L"\\";
CMStringA jid;
if (hContact != NULL) {
@@ -107,7 +107,7 @@ CMStringW WhatsAppProto::GetAvatarFileName(MCONTACT hContact)
INT_PTR WhatsAppProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- std::wstring tszOwnAvatar(m_tszAvatarFolder + L"\\myavatar.jpg");
+ CMStringW tszOwnAvatar(GetAvatarPath() + L"\\myavatar.jpg");
wcsncpy_s((wchar_t*)wParam, lParam, tszOwnAvatar.c_str(), _TRUNCATE);
return 0;
}
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index 8fabeb098b..40ab1336b8 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -85,10 +85,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) :
CreateDirectoryTreeW(CMStringW(VARSW(L"%miranda_userdata%")) + L"\\" + _A2T(m_szModuleName));
// Avatars folder
- m_tszAvatarFolder = CMStringW(VARSW(L"%miranda_avatarcache%")) + L"\\" + _A2T(m_szModuleName);
- DWORD dwAttributes = GetFileAttributes(m_tszAvatarFolder.c_str());
- if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
- CreateDirectoryTreeW(m_tszAvatarFolder.c_str());
+ CreateDirectoryTreeW(GetAvatarPath());
// default contacts group
if (m_tszDefaultGroup == NULL)
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h
index 8ec4593767..4edc296d3f 100644
--- a/protocols/WhatsApp/src/proto.h
+++ b/protocols/WhatsApp/src/proto.h
@@ -289,7 +289,6 @@ class WhatsAppProto : public PROTO<WhatsAppProto>
ptrW m_tszDefaultGroup;
CMStringA m_szJid;
- CMStringW m_tszAvatarFolder;
EVP_PKEY *m_pKeys; // private & public keys
WANoise *m_noise;