From 4425eadc3c005d4b5bca2fc6a407ce90ab330bc3 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 24 Oct 2023 18:54:32 +0300 Subject: [PATCH] Pass default DialogId to get_reply_message_full_id. --- td/telegram/MessageContent.cpp | 2 +- td/telegram/MessagesManager.cpp | 2 +- td/telegram/RepliedMessageInfo.cpp | 7 +++++-- td/telegram/RepliedMessageInfo.h | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 56aad77a3..6b124ec7c 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -5846,7 +5846,7 @@ unique_ptr get_action_message_content(Td *td, tl_object_ptr(action_ptr); - auto message_full_id = replied_message_info.get_reply_message_full_id(); + auto message_full_id = replied_message_info.get_reply_message_full_id(DialogId()); if (!message_full_id.get_message_id().is_valid()) { if (message_full_id.get_message_id() != MessageId()) { LOG(ERROR) << "Receive successful payment message with " << message_full_id << " in " << owner_dialog_id; diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 74e037e5a..b12757609 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -14427,7 +14427,7 @@ std::pair> MessagesManager::creat date = 1; } - auto reply_message_full_id = message_info.reply_header.replied_message_info_.get_reply_message_full_id(); + auto reply_message_full_id = message_info.reply_header.replied_message_info_.get_reply_message_full_id(DialogId()); MessageId reply_to_message_id = reply_message_full_id.get_message_id(); DialogId reply_in_dialog_id = reply_message_full_id.get_dialog_id(); MessageId top_thread_message_id = message_info.reply_header.top_thread_message_id_; diff --git a/td/telegram/RepliedMessageInfo.cpp b/td/telegram/RepliedMessageInfo.cpp index 964b30ade..6e31f0ab4 100644 --- a/td/telegram/RepliedMessageInfo.cpp +++ b/td/telegram/RepliedMessageInfo.cpp @@ -80,8 +80,11 @@ MessageId RepliedMessageInfo::get_same_chat_reply_to_message_id() const { return is_same_chat_reply() ? message_id_ : MessageId(); } -MessageFullId RepliedMessageInfo::get_reply_message_full_id() const { - return {dialog_id_, message_id_}; +MessageFullId RepliedMessageInfo::get_reply_message_full_id(DialogId owner_dialog_id) const { + if (!message_id_.is_valid() && !message_id_.is_valid_scheduled()) { + return {}; + } + return {dialog_id_.is_valid() ? dialog_id_ : owner_dialog_id, message_id_}; } bool operator==(const RepliedMessageInfo &lhs, const RepliedMessageInfo &rhs) { diff --git a/td/telegram/RepliedMessageInfo.h b/td/telegram/RepliedMessageInfo.h index 3a007773c..848c9a609 100644 --- a/td/telegram/RepliedMessageInfo.h +++ b/td/telegram/RepliedMessageInfo.h @@ -44,7 +44,7 @@ class RepliedMessageInfo { MessageId get_same_chat_reply_to_message_id() const; - MessageFullId get_reply_message_full_id() const; + MessageFullId get_reply_message_full_id(DialogId owner_dialog_id) const; template void store(StorerT &storer) const;