diff options
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r-- | protocols/Telegram/src/avatars.cpp | 22 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 1 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 |
3 files changed, 17 insertions, 8 deletions
diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp index 237bbc627e..6b7e0bbd09 100644 --- a/protocols/Telegram/src/avatars.cpp +++ b/protocols/Telegram/src/avatars.cpp @@ -203,6 +203,18 @@ TG_FILE_REQUEST* CTelegramProto::FindFile(int id) }
/////////////////////////////////////////////////////////////////////////////////////////
+
+void CTelegramProto::ShowFileProgress(const TD::file *pFile, TG_FILE_REQUEST *ft)
+{
+ PROTOFILETRANSFERSTATUS fts = {};
+ fts.hContact = ft->m_hContact;
+ fts.totalFiles = 1;
+ fts.totalBytes = fts.currentFileSize = pFile->size_;
+ fts.totalProgress = fts.currentFileProgress = pFile->remote_->uploaded_size_;
+ ProtoBroadcastAck((UINT_PTR)ft->m_hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&fts);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// Extracts a photo/avatar to a file
void CTelegramProto::ProcessAvatar(const TD::file *pFile, TG_USER *pUser)
@@ -250,14 +262,8 @@ void CTelegramProto::ProcessFile(TD::updateFile *pObj) // file upload is not completed, skip it
if (pRemote->is_uploading_active_) {
auto *ft = FindFile(pFile->id_);
- if (ft) {
- PROTOFILETRANSFERSTATUS fts = {};
- fts.hContact = ft->m_hContact;
- fts.totalFiles = 1;
- fts.totalBytes = fts.currentFileSize = pFile->size_;
- fts.totalProgress = fts.currentFileProgress = pFile->remote_->uploaded_size_;
- ProtoBroadcastAck((UINT_PTR)ft->m_hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&fts);
- }
+ if (ft)
+ ShowFileProgress(pFile, ft);
return;
}
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 97c3e44a01..28202199b8 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -465,6 +465,7 @@ void CTelegramProto::ProcessFileMessage(TG_FILE_REQUEST *ft, const TD::message * // if that file was sent once, it might be cached at the server & reused if (auto *pRemote = pFile->remote_.get()) { if (pRemote->is_uploading_completed_) { + ShowFileProgress(pFile, ft); ProtoBroadcastAck(ft->m_hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft); delete ft; return; diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 64a4fab6ad..c0c8bca7a6 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -303,6 +303,8 @@ class CTelegramProto : public PROTO<CTelegramProto> bool bRead; }; + void ShowFileProgress(const TD::file *pFile, TG_FILE_REQUEST *ft); + bool GetMessageFile(const EmbeddedFile &embed, TG_FILE_REQUEST::Type, const TD::file *pFile, const char *pszFileName, const char *pszCaption); CMStringA GetFormattedText(TD::object_ptr<TD::formattedText> &pText); |