Add MessageForwardInfo::copy_message_forward_info.

This commit is contained in:
levlam 2024-01-11 20:10:14 +03:00
parent c30c6168b5
commit 6b180bcfd9
3 changed files with 16 additions and 7 deletions

View File

@ -51,6 +51,17 @@ unique_ptr<MessageForwardInfo> MessageForwardInfo::get_message_forward_info(
std::move(psa_type), is_imported);
}
unique_ptr<MessageForwardInfo> MessageForwardInfo::copy_message_forward_info(Td *td,
const MessageForwardInfo &forward_info,
DialogId from_dialog_id,
MessageId from_message_id) {
auto result = make_unique<MessageForwardInfo>(forward_info);
result->from_dialog_id_ = from_dialog_id;
result->from_message_id_ = from_message_id;
result->origin_.hide_sender_if_needed(td);
return result;
}
td_api::object_ptr<td_api::messageForwardInfo> MessageForwardInfo::get_message_forward_info_object(Td *td) const {
if (is_imported_) {
return nullptr;

View File

@ -50,6 +50,9 @@ struct MessageForwardInfo {
static unique_ptr<MessageForwardInfo> get_message_forward_info(
Td *td, telegram_api::object_ptr<telegram_api::messageFwdHeader> &&forward_header);
static unique_ptr<MessageForwardInfo> copy_message_forward_info(Td *td, const MessageForwardInfo &forward_info,
DialogId from_dialog_id, MessageId from_message_id);
td_api::object_ptr<td_api::messageForwardInfo> get_message_forward_info_object(Td *td) const;
td_api::object_ptr<td_api::messageImportInfo> get_message_import_info_object() const;

View File

@ -25854,13 +25854,8 @@ unique_ptr<MessageForwardInfo> MessagesManager::create_message_forward_info(Dial
}
if (m->forward_info != nullptr) {
auto forward_info = make_unique<MessageForwardInfo>(*m->forward_info);
forward_info->from_dialog_id_ = saved_from_dialog_id;
forward_info->from_message_id_ = saved_from_message_id;
if (!forward_info->is_imported()) {
forward_info->origin_.hide_sender_if_needed(td_);
}
return forward_info;
return MessageForwardInfo::copy_message_forward_info(td_, *m->forward_info, saved_from_dialog_id,
saved_from_message_id);
}
if (from_dialog_id != my_dialog_id || content_type == MessageContentType::Dice) {