From 4d84561727b143ddb3f905356c63e7609791dbc7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 15 Jul 2023 20:13:07 +0300 Subject: let's use this code always --- protocols/Telegram/src/avatars.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'protocols/Telegram') 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); -- cgit v1.2.3