From 7a11ce58becfc750e5b4a9bb07102f8d334bbcf6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 24 Apr 2023 13:41:41 +0300 Subject: Telegram: silent file transfers don't require f/t manager, but simply create offline events --- protocols/Telegram/src/proto.cpp | 32 -------------------------------- protocols/Telegram/src/proto.h | 4 ---- protocols/Telegram/src/utils.cpp | 2 +- 3 files changed, 1 insertion(+), 37 deletions(-) (limited to 'protocols') diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 11bed96d85..172b299ebc 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -278,38 +278,6 @@ INT_PTR CTelegramProto::GetCaps(int type, MCONTACT) } } -///////////////////////////////////////////////////////////////////////////////////////// - -HANDLE CTelegramProto::FileAllow(MCONTACT, HANDLE hTransfer, const wchar_t *pwszSavePath) -{ - auto *ft = (TG_FILE_REQUEST *)hTransfer; - if (ft == nullptr) - return nullptr; - - ft->m_destPath = pwszSavePath; - ft->pfts.szCurrentFile.w = ft->m_fileName.GetBuffer(); - ft->pfts.szWorkingDir.w = ft->m_destPath.GetBuffer(); - SendQuery(new TD::downloadFile(ft->m_fileId, 5, 0, 0, false)); - return ft; -} - -int CTelegramProto::FileCancel(MCONTACT, HANDLE hTransfer) -{ - auto *ft = (TG_FILE_REQUEST *)hTransfer; - delete ft; - return 1; -} - -int CTelegramProto::FileResume(HANDLE hTransfer, int, const wchar_t *pwszFilename) -{ - auto *ft = (TG_FILE_REQUEST *)hTransfer; - if (ft == nullptr) - return 1; - - ft->m_destPath = pwszFilename; - return 0; -} - //////////////////////////////////////////////////////////////////////////////////////// // RecvFile - writes down an incoming file transfer to db diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 25c4bd9af3..95c98a0739 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -286,10 +286,6 @@ public: MCONTACT AddToList(int flags, PROTOSEARCHRESULT *psr); - HANDLE FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath) override; - int FileCancel(MCONTACT hContact, HANDLE hTransfer) override; - int FileResume(HANDLE hTransfer, int action, const wchar_t *szFilename) override; - INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override; MEVENT RecvFile(MCONTACT hContact, PROTORECVFILE *pre) override; diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index 28b3204cf7..99887aa661 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -270,7 +270,7 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg auto *pszFileName = pDoc->document_->file_name_.c_str(); PROTORECVFILE pre = {}; - pre.dwFlags = PRFF_UTF; + pre.dwFlags = PRFF_UTF | PRFF_SILENT; pre.fileCount = 1; pre.timestamp = time(0); pre.files.a = &pszFileName; -- cgit v1.2.3