Add RepliedMessageInfo::legacy static function instead of legacy constructors.

This commit is contained in:
levlam 2023-11-06 18:29:47 +03:00
parent e9bf274f33
commit aba3f38a2f
2 changed files with 7 additions and 7 deletions

View File

@ -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_)) {

View File

@ -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<telegram_api::messageReplyHeader> &&reply_header, DialogId dialog_id,