diff options
author | George Hazan <ghazan@miranda.im> | 2023-01-17 14:37:50 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-01-17 14:37:50 +0300 |
commit | 4c60037f6852f7771ed86e0b285a872e4bbadb87 (patch) | |
tree | a6977ea0a68db5612f3ac8664efd9d66a483e52c /protocols/Telegram | |
parent | 893fe6d2f16f5e70087aa9d5949aff5aaff556d2 (diff) |
PROTO_INTERFACE::GetAvatarPath - new helper for calculating avatars' root for an account
Diffstat (limited to 'protocols/Telegram')
-rw-r--r-- | protocols/Telegram/src/avatars.cpp | 10 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 5 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 12 |
3 files changed, 22 insertions, 5 deletions
diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp index 6aacd51190..71ee97f3d6 100644 --- a/protocols/Telegram/src/avatars.cpp +++ b/protocols/Telegram/src/avatars.cpp @@ -17,6 +17,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
+CMStringW CTelegramProto::GetAvatarFilename(MCONTACT hContact)
+{
+ CMStringW wszResult(GetAvatarPath());
+ wszResult.AppendChar('\\');
+
+ const wchar_t *szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_JPEG));
+ wszResult.AppendFormat(L"%s%s", getMStringW(hContact, DBKEY_ID).c_str(), szFileType);
+ return wszResult;
+}
+
INT_PTR CTelegramProto::SvcGetAvatarCaps(WPARAM wParam, LPARAM lParam)
{
switch (wParam) {
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 2dd667314b..2767e7c059 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -38,12 +38,15 @@ CTelegramProto::CTelegramProto(const char* protoName, const wchar_t* userName) : HookProtoEvent(ME_OPT_INITIALISE, &CTelegramProto::OnOptionsInit); HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CTelegramProto::OnDbMarkedRead); + // avatar + CreateDirectoryTreeW(GetAvatarPath()); + // default contacts group if (m_wszDefaultGroup == NULL) m_wszDefaultGroup = mir_wstrdup(L"WhatsApp"); m_iBaseGroup = Clist_GroupCreate(0, m_wszDefaultGroup); - // Create standard network connection + // create standard network connection NETLIBUSER nlu = {}; nlu.flags = NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index a303f81eb9..5ffe9e4222 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -151,6 +151,14 @@ class CTelegramProto : public PROTO<CTelegramProto> void UpdateString(MCONTACT hContact, const char *pszSetting, const std::string &str); + // Avatars + CMStringW GetAvatarFilename(MCONTACT hContact); + + INT_PTR __cdecl SvcGetAvatarCaps(WPARAM, LPARAM); + INT_PTR __cdecl SvcGetAvatarInfo(WPARAM, LPARAM); + INT_PTR __cdecl SvcGetMyAvatar(WPARAM, LPARAM); + INT_PTR __cdecl SvcSetMyAvatar(WPARAM, LPARAM); + // Users int64_t m_iOwnId; MGROUP m_iBaseGroup; @@ -187,10 +195,6 @@ public: // Services ////////////////////////////////////////////////////////////////////////// INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM); - INT_PTR __cdecl SvcGetAvatarCaps(WPARAM, LPARAM); - INT_PTR __cdecl SvcGetAvatarInfo(WPARAM, LPARAM); - INT_PTR __cdecl SvcGetMyAvatar(WPARAM, LPARAM); - INT_PTR __cdecl SvcSetMyAvatar(WPARAM, LPARAM); // Events //////////////////////////////////////////////////////////////////////////// |