diff options
author | George Hazan <george.hazan@gmail.com> | 2023-12-03 17:14:30 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-12-03 17:14:30 +0300 |
commit | 1338ad89ee45bdb681c531476dca00a377d7d033 (patch) | |
tree | 3eae8ad7620848a1a8b12ced532d826aae81a224 /protocols/Telegram/src | |
parent | 8a0d55713496fe7c8eecc0267d775b1bb29e0842 (diff) |
PROTO_INTERFACE::SendMsg: second parameter became a reply event id
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r-- | protocols/Telegram/src/groupchat.cpp | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 11 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 4 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 3 |
4 files changed, 14 insertions, 6 deletions
diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp index 618f415922..c99302d435 100644 --- a/protocols/Telegram/src/groupchat.cpp +++ b/protocols/Telegram/src/groupchat.cpp @@ -205,7 +205,7 @@ int CTelegramProto::GcEventHook(WPARAM, LPARAM lParam) rtrimw(gch->ptszText); Chat_UnescapeTags(gch->ptszText); if (auto *pUser = FindUser(userId)) - SendTextMessage(pUser->chatId, T2Utf(gch->ptszText)); + SendTextMessage(pUser->chatId, 0, T2Utf(gch->ptszText)); } break; diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 3f5037e65f..be2156be82 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -597,7 +597,7 @@ HANDLE CTelegramProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, ///////////////////////////////////////////////////////////////////////////////////////// -int CTelegramProto::SendMsg(MCONTACT hContact, const char *pszMessage) +int CTelegramProto::SendMsg(MCONTACT hContact, MEVENT hReplyEvent, const char *pszMessage) { ptrA szId(getStringA(hContact, DBKEY_ID)); if (szId == nullptr) @@ -608,7 +608,14 @@ int CTelegramProto::SendMsg(MCONTACT hContact, const char *pszMessage) if (pUser == nullptr) return 0; - int msgid = SendTextMessage(pUser->chatId, pszMessage); + TD::int53 iReplyId = 0; + if (hReplyEvent) { + DB::EventInfo dbei(hReplyEvent, false); + if (dbei) + iReplyId = dbei2id(dbei); + } + + int msgid = SendTextMessage(pUser->chatId, iReplyId, pszMessage); if (msgid != -1) m_arOwnMsg.insert(new TG_OWN_MESSAGE(hContact, (HANDLE)msgid, "")); diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index db995e49be..45839832a5 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -241,7 +241,7 @@ class CTelegramProto : public PROTO<CTelegramProto> void SendMarkRead(void); int SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER pHandler = nullptr); int SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER_FULL pHandler, void *pUserInfo); - int SendTextMessage(int64_t chatId, const char *pszMessage); + int SendTextMessage(TD::int53 chatId, TD::int53 replyId, const char *pszMessage); void ProcessAuth(TD::updateAuthorizationState *pObj); void ProcessBasicGroup(TD::updateBasicGroup *pObj); @@ -356,7 +356,7 @@ public: MEVENT RecvFile(MCONTACT hContact, PROTORECVFILE *pre) override; HANDLE SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName) override; - int SendMsg(MCONTACT hContact, const char *pszMessage) override; + int SendMsg(MCONTACT hContact, MEVENT hReplyEvent, const char *pszMessage) override; int SetStatus(int iNewStatus) override; void OnBuildProtoMenu() override; diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index bb92d2af7d..75e4fa0cdc 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -327,7 +327,7 @@ void CTelegramProto::OnSendMessage(td::ClientManager::Response &response) }
}
-int CTelegramProto::SendTextMessage(int64_t chatId, const char *pszMessage)
+int CTelegramProto::SendTextMessage(int64_t chatId, TD::int53 replyId, const char *pszMessage)
{
auto pContent = TD::make_object<TD::inputMessageText>();
pContent->text_ = formatBbcodes(pszMessage);
@@ -335,6 +335,7 @@ int CTelegramProto::SendTextMessage(int64_t chatId, const char *pszMessage) auto *pMessage = new TD::sendMessage();
pMessage->chat_id_ = chatId;
pMessage->input_message_content_ = std::move(pContent);
+ pMessage->reply_to_message_id_ = replyId;
return SendQuery(pMessage, &CTelegramProto::OnSendMessage);
}
|