summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-07-15 20:13:07 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-07-15 20:13:07 +0300
commit4d84561727b143ddb3f905356c63e7609791dbc7 (patch)
treec9962c60ae9261864b643db2fa24b962d9dd81fe /protocols
parent10b9fb4af872957d78b4d8fe41eb339f9cd386b6 (diff)
let's use this code always
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Telegram/src/avatars.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp
index 22121ccabe..de4d74f2ee 100644
--- a/protocols/Telegram/src/avatars.cpp
+++ b/protocols/Telegram/src/avatars.cpp
@@ -189,21 +189,18 @@ void CTelegramProto::ProcessFile(TD::updateFile *pObj)
CMStringW wszFullName(F->ofd->wszPath);
- // let's replace fake file name with the real one
- if (F->m_type != F->FILE) {
- auto *pSlash = strrchr(pFile->local_->path_.c_str(), '\\');
- if (!pSlash)
- pSlash = pFile->local_->path_.c_str();
- else
- pSlash++;
-
- dbv.type = DBVT_UTF8;
- dbv.pszVal = (char *)pSlash;
- db_event_setJson(F->ofd->hDbEvent, "f", &dbv);
-
- wszFullName.Truncate(wszFullName.ReverseFind('\\') + 1);
- wszFullName.Append(Utf2T(pSlash));
- }
+ auto *pSlash = strrchr(pFile->local_->path_.c_str(), '\\');
+ if (!pSlash)
+ pSlash = pFile->local_->path_.c_str();
+ else
+ pSlash++;
+
+ dbv.type = DBVT_UTF8;
+ dbv.pszVal = (char *)pSlash;
+ db_event_setJson(F->ofd->hDbEvent, "f", &dbv);
+
+ wszFullName.Truncate(wszFullName.ReverseFind('\\') + 1);
+ wszFullName.Append(Utf2T(pSlash));
MoveFileW(wszExistingFile, wszFullName);
NotifyEventHooks(g_plugin.m_hevEventEdited, 0, F->ofd->hDbEvent);