summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-27 20:36:43 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-27 20:36:43 +0300
commit054cc300e1edeacf1cbc68a02968cd70d3982783 (patch)
treea30475c66e44ba488dbf75a19c1d6efbd6bd227b /protocols/Telegram/src
parent09695993c1a6fe40eb22b3caceffab8e8b71e349 (diff)
Telegram: fix to displaying my own avatar
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r--protocols/Telegram/src/avatars.cpp6
-rw-r--r--protocols/Telegram/src/server.cpp3
2 files changed, 6 insertions, 3 deletions
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());