From 054cc300e1edeacf1cbc68a02968cd70d3982783 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 27 Feb 2024 20:36:43 +0300 Subject: Telegram: fix to displaying my own avatar --- protocols/Telegram/src/avatars.cpp | 6 ++++-- protocols/Telegram/src/server.cpp | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'protocols/Telegram/src') diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp index 8751b744fd..0875ad21d2 100644 --- a/protocols/Telegram/src/avatars.cpp +++ b/protocols/Telegram/src/avatars.cpp @@ -65,9 +65,11 @@ INT_PTR CTelegramProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) return GAIR_NOAVATAR; } -INT_PTR CTelegramProto::SvcGetMyAvatar(WPARAM, LPARAM) +INT_PTR CTelegramProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) { - return 1; + auto wszFileName(GetAvatarFilename(0)); + mir_wstrncpy((wchar_t *)wParam, wszFileName, lParam); + return 0; } INT_PTR CTelegramProto::SvcSetMyAvatar(WPARAM, LPARAM) diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 9136b4c11d..8f27bcab27 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -1037,7 +1037,8 @@ void CTelegramProto::ProcessUser(TD::updateUser *pObj) if (auto *pSmall = pPhoto->small_.get()) { auto remoteId = pSmall->remote_->unique_id_; auto storedId = getMStringA(pu->hContact, DBKEY_AVATAR_HASH); - if (remoteId != storedId.c_str()) { + auto wszFileName = GetAvatarFilename(pu->hContact); + if (remoteId != storedId.c_str() || _waccess(wszFileName, 0)) { if (!remoteId.empty()) { pu->szAvatarHash = remoteId.c_str(); setString(pu->hContact, DBKEY_AVATAR_HASH, remoteId.c_str()); -- cgit v1.2.3