summaryrefslogtreecommitdiff
path: root/protocols/Telegram
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram')
-rw-r--r--protocols/Telegram/src/proto.cpp6
-rw-r--r--protocols/Telegram/src/proto.h2
-rw-r--r--protocols/Telegram/src/utils.cpp24
3 files changed, 15 insertions, 17 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index b506218b48..30b096813b 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -355,10 +355,10 @@ INT_PTR CTelegramProto::GetCaps(int type, MCONTACT)
/////////////////////////////////////////////////////////////////////////////////////////
-MEVENT CTelegramProto::RecvFile(MCONTACT hContact, PROTORECVFILE *pre)
+MEVENT CTelegramProto::RecvFile(MCONTACT hContact, DB::FILE_BLOB &blob, DB::EventInfo &dbei)
{
- auto *ft = (TG_FILE_REQUEST *)pre->pUserInfo;
- return (ft->m_bRecv) ? CSuper::RecvFile(hContact, pre) : 0;
+ auto *ft = (TG_FILE_REQUEST *)blob.getUserInfo();
+ return (ft->m_bRecv) ? CSuper::RecvFile(hContact, blob, dbei) : 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index 99e703d02c..a963e17119 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -357,7 +357,7 @@ public:
INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override;
HANDLE SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) override;
- MEVENT RecvFile(MCONTACT hContact, PROTORECVFILE *pre) override;
+ MEVENT RecvFile(MCONTACT hContact, DB::FILE_BLOB &blob, DB::EventInfo &dbei) override;
HANDLE SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName) override;
int SendMsg(MCONTACT hContact, MEVENT hReplyEvent, const char *pszMessage) override;
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp
index 48445a4a45..af638e1d11 100644
--- a/protocols/Telegram/src/utils.cpp
+++ b/protocols/Telegram/src/utils.cpp
@@ -402,26 +402,24 @@ bool CTelegramProto::GetMessageFile(
}
char szReplyId[100];
+ const char *szDesc = nullptr;
MCONTACT hContact = GetRealContact(pUser);
- PROTORECVFILE pre = {};
- pre.dwFlags = PRFF_UTF | PRFF_SILENT;
- pre.fileCount = 1;
- pre.timestamp = pMsg->date_;
- pre.files.a = &pszFileName;
- pre.pUserInfo = pRequest;
- pre.szId = pszId;
- pre.szUserId = pszUserId;
+ DB::EventInfo dbei;
+ dbei.flags = DBEF_TEMPORARY;
+ dbei.timestamp = pMsg->date_;
+ dbei.szId = pszId;
+ dbei.szUserId = pszUserId;
if (!caption.empty())
- pre.descr.a = caption.c_str();
+ szDesc = caption.c_str();
if (pMsg->is_outgoing_)
- pre.dwFlags |= PRFF_SENT;
+ dbei.flags |= DBEF_SENT;
if (Contact::IsGroupChat(hContact) || !pUser->bInited)
- pre.dwFlags |= PRFF_READ;
+ dbei.flags |= DBEF_READ;
if (pMsg->reply_to_message_id_) {
_i64toa(pMsg->reply_to_message_id_, szReplyId, 10);
- pre.szReplyId = szReplyId;
+ dbei.szReplyId = szReplyId;
}
- ProtoChainRecvFile(hContact, &pre);
+ ProtoChainRecvFile(hContact, DB::FILE_BLOB(pRequest, pszFileName, szDesc), dbei);
return true;
}