From 513c5f177e4f02e93d5e1e34b444400d968c4247 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 22 Feb 2025 20:09:31 +0200 Subject: =?UTF-8?q?fixes=20#4875=20(Telegram:=20=D0=9C=D0=B8=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D0=B4=D0=B0=20=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B0=D0=B5?= =?UTF-8?q?=D1=82,=20=D1=87=D1=82=D0=BE=20=D1=84=D0=B0=D0=B9=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0=D0=BD=20=D0=B2=20=D1=82?= =?UTF-8?q?=D0=BE=20=D0=B2=D1=80=D0=B5=D0=BC=D1=8F,=20=D0=BA=D0=B0=D0=BA?= =?UTF-8?q?=20=D0=BE=D0=BD=20=D0=B5=D1=89=D1=91=20=D0=B7=D0=B0=D0=B3=D1=80?= =?UTF-8?q?=D1=83=D0=B6=D0=B0=D0=B5=D1=82=D1=81=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/src/proto.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'protocols/Telegram/src/proto.cpp') diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 40f7f166d6..627b00c228 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -473,22 +473,30 @@ void CTelegramProto::ProcessFileMessage(TG_FILE_REQUEST *ft, const TD::message * dbei.flags = DBEF_SENT | DBEF_UTF; dbei.iTimestamp = time(0); - TG_FILE_REQUEST localft(TG_FILE_REQUEST::FILE, 0, 0); - localft.m_fileName = Utf2T(pFile->local_->path_.c_str()); - localft.m_fileSize = pFile->size_; - localft.m_uniqueId = szMsgId; - localft.m_szUserId = szUserId; - - DB::FILE_BLOB blob(localft.m_fileName, ft->m_wszDescr); - OnSendOfflineFile(dbei, blob, &localft); + auto *localft = new TG_FILE_REQUEST(TG_FILE_REQUEST::FILE, 0, 0); + localft->m_hContact = ft->m_hContact; + localft->m_fileName = Utf2T(pFile->local_->path_.c_str()); + localft->m_fileSize = pFile->size_; + localft->m_uniqueId = szMsgId; + localft->m_szUserId = szUserId; + localft->m_fileId = pFile->id_; + + DB::FILE_BLOB blob(localft->m_fileName, ft->m_wszDescr); + OnSendOfflineFile(dbei, blob, localft); blob.write(dbei); db_event_add(ft->m_hContact, &dbei); + + mir_cslock lck(m_csFiles); + m_arFiles.insert(localft); } else { ft->m_szUserId = szUserId; ft->m_uniqueId = szMsgId; - ProtoBroadcastAck(ft->m_hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft); + ft->m_fileId = pFile->id_; + + mir_cslock lck(m_csFiles); + m_arFiles.insert(ft); } } } @@ -499,7 +507,6 @@ void CTelegramProto::OnSendFile(td::ClientManager::Response &response, void *pUs if (response.object->get_id() == TD::message::ID) { ProcessFileMessage(ft, (TD::message *)response.object.get(), false); - ProtoBroadcastAck(ft->m_hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft); } else if (response.object->get_id() == TD::messages::ID) { int i = 0; @@ -509,8 +516,6 @@ void CTelegramProto::OnSendFile(td::ClientManager::Response &response, void *pUs i++; } } - - delete ft; } HANDLE CTelegramProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) -- cgit v1.2.3