summaryrefslogtreecommitdiff
path: root/protocols/Telegram
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram')
-rw-r--r--protocols/Telegram/src/avatars.cpp5
-rw-r--r--protocols/Telegram/src/proto.h2
-rw-r--r--protocols/Telegram/src/utils.cpp6
3 files changed, 5 insertions, 8 deletions
diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp
index ed6efbd3de..dcfa894ced 100644
--- a/protocols/Telegram/src/avatars.cpp
+++ b/protocols/Telegram/src/avatars.cpp
@@ -149,11 +149,12 @@ INT_PTR __cdecl CTelegramProto::SvcOfflineFile(WPARAM param, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
// Cloud file pre-creator
-void CTelegramProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob, void *pHandle)
+void CTelegramProto::OnReceiveOfflineFile(DB::FILE_BLOB &blob)
{
- if (auto *ft = (TG_FILE_REQUEST *)pHandle) {
+ if (auto *ft = (TG_FILE_REQUEST *)blob.getUserInfo()) {
blob.setUrl(ft->m_uniqueId.GetBuffer());
blob.setSize(ft->m_fileSize);
+ delete ft;
}
}
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index b4df98a636..141a2d3034 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -384,7 +384,7 @@ public:
void OnEventEdited(MCONTACT, MEVENT, const DBEVENTINFO &dbei) override;
void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
- void OnReceiveOfflineFile(DB::FILE_BLOB &blob, void *ft) override;
+ void OnReceiveOfflineFile(DB::FILE_BLOB &blob) override;
void OnSendOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob, void *hTransfer) override;
void OnShutdown() override;
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp
index ef19a92d3e..71a17bd3b6 100644
--- a/protocols/Telegram/src/utils.cpp
+++ b/protocols/Telegram/src/utils.cpp
@@ -403,10 +403,6 @@ bool CTelegramProto::GetMessageFile(
pRequest->m_fileSize = pFile->size_;
pRequest->m_bRecv = !pMsg->is_outgoing_;
pRequest->m_hContact = GetRealContact(pUser);
- {
- mir_cslock lck(m_csFiles);
- m_arFiles.insert(pRequest);
- }
char szReplyId[100];
const char *szDesc = nullptr;
@@ -430,7 +426,7 @@ bool CTelegramProto::GetMessageFile(
if (dbei) {
DB::FILE_BLOB blob(dbei);
- OnReceiveOfflineFile(blob, pRequest);
+ OnReceiveOfflineFile(blob);
blob.write(dbei);
db_event_edit(hDbEvent, &dbei, true);
delete pRequest;