diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-26 13:11:10 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-26 13:11:10 +0300 |
commit | 1662a4421fecfdf03e68637e9a5969085644586e (patch) | |
tree | 49a22672b2440fbbdeae448ba0ffae15e42b6626 /protocols/Telegram/src | |
parent | f05405db4308a5c419f15a3c9538e4c11e6c172a (diff) |
for #3964 - reply_id in Telegram, both for messages and files/pictures/etc
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 5 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 3 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 6 | ||||
-rw-r--r-- | protocols/Telegram/src/utils.cpp | 6 |
4 files changed, 16 insertions, 4 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 763db665e9..79694ac08c 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -345,9 +345,10 @@ INT_PTR CTelegramProto::GetCaps(int type, MCONTACT) ///////////////////////////////////////////////////////////////////////////////////////// -MEVENT CTelegramProto::RecvFile(MCONTACT, PROTORECVFILE *) +MEVENT CTelegramProto::RecvFile(MCONTACT hContact, PROTORECVFILE *pre) { - return 0; + auto *ft = (TG_FILE_REQUEST *)pre->lParam; + return (ft->m_bRecv) ? CSuper::RecvFile(hContact, pre) : 0; } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index f64492c8c2..01cbf1e6f3 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -78,7 +78,8 @@ struct TG_FILE_REQUEST : public MZeroedObject TD::int53 m_fileId, m_fileSize = 0; CMStringA m_uniqueId, m_szUserId; CMStringW m_destPath, m_fileName, m_wszDescr; - OFDTHREAD *ofd = 0; + OFDTHREAD *ofd; + bool m_bRecv; }; struct TG_USER : public MZeroedObject diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index c846d25666..c3c9bd408c 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -730,7 +730,7 @@ void CTelegramProto::ProcessMessage(const TD::message *pMessage) if (pMessage->sending_state_->get_id() == TD::messageSendingStatePending::ID)
return;
- char szId[100], szUserId[100];
+ char szId[100], szUserId[100], szReplyId[100];
_i64toa(pMessage->id_, szId, 10);
if (db_event_getById(m_szModuleName, szId))
return;
@@ -760,6 +760,10 @@ void CTelegramProto::ProcessMessage(const TD::message *pMessage) pre.flags |= PREF_SENT;
if (GetGcUserId(pUser, pMessage, szUserId))
pre.szUserId = szUserId;
+ if (pMessage->reply_to_message_id_) {
+ _i64toa(pMessage->reply_to_message_id_, szReplyId, 10);
+ pre.szReplyId = szReplyId;
+ }
ProtoChainRecvMsg(GetRealContact(pUser), &pre);
}
diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index 1ced9f9a6f..15a6484a0c 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -369,11 +369,13 @@ bool CTelegramProto::GetMessageFile( auto *pRequest = new TG_FILE_REQUEST(fileType, pFile->id_, pFile->remote_->id_.c_str());
pRequest->m_fileName = Utf2T(pszFileName);
pRequest->m_fileSize = pFile->size_;
+ pRequest->m_bRecv = true;
{
mir_cslock lck(m_csFiles);
m_arFiles.insert(pRequest);
}
+ char szReplyId[100];
MCONTACT hContact = GetRealContact(pUser);
PROTORECVFILE pre = {};
pre.dwFlags = PRFF_UTF | PRFF_SILENT;
@@ -389,6 +391,10 @@ bool CTelegramProto::GetMessageFile( pre.dwFlags |= PRFF_SENT;
if (Contact::IsGroupChat(hContact))
pre.dwFlags |= PRFF_READ;
+ if (pMsg->reply_to_message_id_) {
+ _i64toa(pMsg->reply_to_message_id_, szReplyId, 10);
+ pre.szReplyId = szReplyId;
+ }
ProtoChainRecvFile(hContact, &pre);
return true;
}
|