From aba3f38a2f2dd15ce169b2685637dcab6436f885 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 6 Nov 2023 18:29:47 +0300 Subject: [PATCH] Add RepliedMessageInfo::legacy static function instead of legacy constructors. --- td/telegram/MessagesManager.cpp | 4 ++-- td/telegram/RepliedMessageInfo.h | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 8e45ab928..0eed3f692 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -5174,7 +5174,7 @@ void MessagesManager::Message::parse(ParserT &parser) { if (has_replied_message_info) { parse(replied_message_info, parser); } else { - replied_message_info = RepliedMessageInfo(legacy_reply_to_message_id, legacy_reply_in_dialog_id); + replied_message_info = RepliedMessageInfo::legacy(legacy_reply_to_message_id, legacy_reply_in_dialog_id); } CHECK(content != nullptr); @@ -14072,7 +14072,7 @@ void MessagesManager::on_get_secret_message(SecretChatId secret_chat_id, UserId } } } - message_info.reply_header.replied_message_info_ = RepliedMessageInfo(reply_to_message_id); + message_info.reply_header.replied_message_info_ = RepliedMessageInfo::legacy(reply_to_message_id); } if (!clean_input_string(message->via_bot_name_)) { diff --git a/td/telegram/RepliedMessageInfo.h b/td/telegram/RepliedMessageInfo.h index acb78bb23..49231d976 100644 --- a/td/telegram/RepliedMessageInfo.h +++ b/td/telegram/RepliedMessageInfo.h @@ -51,11 +51,11 @@ class RepliedMessageInfo { RepliedMessageInfo &operator=(RepliedMessageInfo &&) = default; ~RepliedMessageInfo(); - explicit RepliedMessageInfo(MessageId reply_to_message_id) : message_id_(reply_to_message_id) { - } - - RepliedMessageInfo(MessageId reply_to_message_id, DialogId reply_in_dialog_id) - : message_id_(reply_to_message_id), dialog_id_(reply_in_dialog_id) { + static RepliedMessageInfo legacy(MessageId reply_to_message_id, DialogId reply_in_dialog_id = DialogId()) { + RepliedMessageInfo result; + result.message_id_ = reply_to_message_id; + result.dialog_id_ = reply_in_dialog_id; + return result; } RepliedMessageInfo(Td *td, tl_object_ptr &&reply_header, DialogId dialog_id,