Keep external replies when forwarding a message.
This commit is contained in:
parent
6c1fb4fe57
commit
887fd06e1c
@ -24584,8 +24584,8 @@ MessagesManager::ForwardedMessageInfo MessagesManager::get_forwarded_message_inf
|
|||||||
auto dialog_id = message_full_id.get_dialog_id();
|
auto dialog_id = message_full_id.get_dialog_id();
|
||||||
result.origin_date_ = m->forward_info != nullptr ? m->forward_info->date : m->date;
|
result.origin_date_ = m->forward_info != nullptr ? m->forward_info->date : m->date;
|
||||||
result.origin_ = get_forwarded_message_origin(dialog_id, m);
|
result.origin_ = get_forwarded_message_origin(dialog_id, m);
|
||||||
result.content_ =
|
result.content_ = dup_message_content(td_, get_my_dialog_id(), m->content.get(), MessageContentDupType::Forward,
|
||||||
dup_message_content(td_, dialog_id, m->content.get(), MessageContentDupType::Forward, MessageCopyOptions());
|
MessageCopyOptions());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28173,6 +28173,9 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::forward_messages(
|
|||||||
m->real_forward_from_dialog_id = from_dialog_id;
|
m->real_forward_from_dialog_id = from_dialog_id;
|
||||||
m->real_forward_from_message_id = message_id;
|
m->real_forward_from_message_id = message_id;
|
||||||
forwarded_message_id_to_new_message_id.emplace(message_id, m->message_id);
|
forwarded_message_id_to_new_message_id.emplace(message_id, m->message_id);
|
||||||
|
if (forwarded_message->replied_message_info.is_external()) {
|
||||||
|
m->replied_message_info = forwarded_message->replied_message_info.clone(td_);
|
||||||
|
}
|
||||||
|
|
||||||
if (!message_send_options.only_preview) {
|
if (!message_send_options.only_preview) {
|
||||||
if (!td_->auth_manager_->is_bot()) {
|
if (!td_->auth_manager_->is_bot()) {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
#include "td/telegram/RepliedMessageInfo.h"
|
#include "td/telegram/RepliedMessageInfo.h"
|
||||||
|
|
||||||
|
#include "td/telegram/ContactsManager.h"
|
||||||
#include "td/telegram/Dependencies.h"
|
#include "td/telegram/Dependencies.h"
|
||||||
#include "td/telegram/MessageContent.h"
|
#include "td/telegram/MessageContent.h"
|
||||||
#include "td/telegram/MessageContentType.h"
|
#include "td/telegram/MessageContentType.h"
|
||||||
@ -188,6 +189,21 @@ RepliedMessageInfo::RepliedMessageInfo(Td *td, const MessageInputReplyTo &input_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RepliedMessageInfo RepliedMessageInfo::clone(Td *td) const {
|
||||||
|
RepliedMessageInfo result;
|
||||||
|
result.message_id_ = message_id_;
|
||||||
|
result.dialog_id_ = dialog_id_;
|
||||||
|
result.origin_date_ = origin_date_;
|
||||||
|
result.origin_ = origin_;
|
||||||
|
if (content_ != nullptr) {
|
||||||
|
result.content_ = dup_message_content(td, DialogId(td->contacts_manager_->get_my_id()), content_.get(),
|
||||||
|
MessageContentDupType::Forward, MessageCopyOptions());
|
||||||
|
}
|
||||||
|
result.quote_ = quote_;
|
||||||
|
result.is_quote_manual_ = is_quote_manual_;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
bool RepliedMessageInfo::need_reget() const {
|
bool RepliedMessageInfo::need_reget() const {
|
||||||
return content_ != nullptr && need_reget_message_content(content_.get());
|
return content_ != nullptr && need_reget_message_content(content_.get());
|
||||||
}
|
}
|
||||||
@ -337,6 +353,7 @@ td_api::object_ptr<td_api::messageReplyToMessage> RepliedMessageInfo::get_messag
|
|||||||
}
|
}
|
||||||
|
|
||||||
MessageInputReplyTo RepliedMessageInfo::get_input_reply_to() const {
|
MessageInputReplyTo RepliedMessageInfo::get_input_reply_to() const {
|
||||||
|
CHECK(!is_external());
|
||||||
if (message_id_.is_valid()) {
|
if (message_id_.is_valid()) {
|
||||||
return MessageInputReplyTo{message_id_, dialog_id_, FormattedText{quote_}};
|
return MessageInputReplyTo{message_id_, dialog_id_, FormattedText{quote_}};
|
||||||
}
|
}
|
||||||
|
@ -63,11 +63,17 @@ class RepliedMessageInfo {
|
|||||||
|
|
||||||
RepliedMessageInfo(Td *td, const MessageInputReplyTo &input_reply_to);
|
RepliedMessageInfo(Td *td, const MessageInputReplyTo &input_reply_to);
|
||||||
|
|
||||||
|
RepliedMessageInfo clone(Td *td) const;
|
||||||
|
|
||||||
bool is_empty() const {
|
bool is_empty() const {
|
||||||
return message_id_ == MessageId() && dialog_id_ == DialogId() && origin_date_ == 0 && origin_.is_empty() &&
|
return message_id_ == MessageId() && dialog_id_ == DialogId() && origin_date_ == 0 && origin_.is_empty() &&
|
||||||
quote_.text.empty() && content_ == nullptr;
|
quote_.text.empty() && content_ == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_external() const {
|
||||||
|
return origin_date_ != 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool need_reget() const;
|
bool need_reget() const;
|
||||||
|
|
||||||
static bool need_reply_changed_warning(
|
static bool need_reply_changed_warning(
|
||||||
|
Loading…
Reference in New Issue
Block a user