Add public_service_announcement_type to forward info.
GitOrigin-RevId: a32fec98c5c61755930f623cdc00ce20f231d898
This commit is contained in:
parent
4498067221
commit
2e2a4b4570
@ -539,9 +539,10 @@ messageForwardOriginChannel chat_id:int53 message_id:int53 author_signature:stri
|
||||
//@description Contains information about a forwarded message
|
||||
//@origin Origin of a forwarded message
|
||||
//@date Point in time (Unix timestamp) when the message was originally sent
|
||||
//@public_service_announcement_type The type of a public service announcement for the forwarded message
|
||||
//@from_chat_id For messages forwarded to the chat with the current user (Saved Messages) or to the channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown
|
||||
//@from_message_id For messages forwarded to the chat with the current user (Saved Messages) or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown
|
||||
messageForwardInfo origin:MessageForwardOrigin date:int32 from_chat_id:int53 from_message_id:int53 = MessageForwardInfo;
|
||||
messageForwardInfo origin:MessageForwardOrigin date:int32 public_service_announcement_type:string from_chat_id:int53 from_message_id:int53 = MessageForwardInfo;
|
||||
|
||||
|
||||
//@class MessageSendingState @description Contains information about the sending state of the message
|
||||
|
Binary file not shown.
@ -3942,6 +3942,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
||||
bool has_real_forward_from = real_forward_from_dialog_id.is_valid() && real_forward_from_message_id.is_valid();
|
||||
bool has_legacy_layer = legacy_layer != 0;
|
||||
bool has_restriction_reasons = !restriction_reasons.empty();
|
||||
bool has_forward_psa_type = is_forwarded && !forward_info->psa_type.empty();
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(is_channel_post);
|
||||
STORE_FLAG(is_outgoing);
|
||||
@ -3989,6 +3990,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
||||
STORE_FLAG(has_restriction_reasons);
|
||||
STORE_FLAG(is_from_scheduled);
|
||||
STORE_FLAG(is_copy);
|
||||
STORE_FLAG(has_forward_psa_type);
|
||||
END_STORE_FLAGS();
|
||||
}
|
||||
|
||||
@ -4021,6 +4023,9 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
||||
store(forward_info->from_dialog_id, storer);
|
||||
store(forward_info->from_message_id, storer);
|
||||
}
|
||||
if (has_forward_psa_type) {
|
||||
store(forward_info->psa_type, storer);
|
||||
}
|
||||
}
|
||||
if (has_real_forward_from) {
|
||||
store(real_forward_from_dialog_id, storer);
|
||||
@ -4096,6 +4101,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
||||
bool has_real_forward_from = false;
|
||||
bool has_legacy_layer = false;
|
||||
bool has_restriction_reasons = false;
|
||||
bool has_forward_psa_type = false;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(is_channel_post);
|
||||
PARSE_FLAG(is_outgoing);
|
||||
@ -4143,6 +4149,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
||||
PARSE_FLAG(has_restriction_reasons);
|
||||
PARSE_FLAG(is_from_scheduled);
|
||||
PARSE_FLAG(is_copy);
|
||||
PARSE_FLAG(has_forward_psa_type);
|
||||
END_PARSE_FLAGS();
|
||||
}
|
||||
|
||||
@ -4181,6 +4188,9 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
||||
parse(forward_info->from_dialog_id, parser);
|
||||
parse(forward_info->from_message_id, parser);
|
||||
}
|
||||
if (has_forward_psa_type) {
|
||||
parse(forward_info->psa_type, parser);
|
||||
}
|
||||
}
|
||||
if (has_real_forward_from) {
|
||||
parse(real_forward_from_dialog_id, parser);
|
||||
@ -20577,7 +20587,7 @@ unique_ptr<MessagesManager::MessageForwardInfo> MessagesManager::get_message_for
|
||||
|
||||
return td::make_unique<MessageForwardInfo>(sender_user_id, forward_header->date_, dialog_id, message_id,
|
||||
std::move(author_signature), std::move(sender_name), from_dialog_id,
|
||||
from_message_id);
|
||||
from_message_id, std::move(forward_header->psa_type_));
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::messageForwardInfo> MessagesManager::get_message_forward_info_object(
|
||||
@ -20599,8 +20609,9 @@ td_api::object_ptr<td_api::messageForwardInfo> MessagesManager::get_message_forw
|
||||
td_->contacts_manager_->get_user_id_object(forward_info->sender_user_id, "messageForwardOriginUser"));
|
||||
}();
|
||||
|
||||
return td_api::make_object<td_api::messageForwardInfo>(
|
||||
std::move(origin), forward_info->date, forward_info->from_dialog_id.get(), forward_info->from_message_id.get());
|
||||
return td_api::make_object<td_api::messageForwardInfo>(std::move(origin), forward_info->date, forward_info->psa_type,
|
||||
forward_info->from_dialog_id.get(),
|
||||
forward_info->from_message_id.get());
|
||||
}
|
||||
|
||||
Result<unique_ptr<ReplyMarkup>> MessagesManager::get_dialog_reply_markup(
|
||||
@ -20858,14 +20869,14 @@ Result<vector<MessageId>> MessagesManager::forward_messages(DialogId to_dialog_i
|
||||
: forwarded_message->author_signature;
|
||||
forward_info = td::make_unique<MessageForwardInfo>(
|
||||
UserId(), forwarded_message->date, from_dialog_id, forwarded_message->message_id,
|
||||
std::move(author_signature), "", saved_from_dialog_id, saved_from_message_id);
|
||||
std::move(author_signature), "", saved_from_dialog_id, saved_from_message_id, "");
|
||||
} else {
|
||||
LOG(ERROR) << "Don't know how to forward a channel post not from a channel";
|
||||
}
|
||||
} else if (forwarded_message->sender_user_id.is_valid()) {
|
||||
forward_info =
|
||||
make_unique<MessageForwardInfo>(forwarded_message->sender_user_id, forwarded_message->date, DialogId(),
|
||||
MessageId(), "", "", saved_from_dialog_id, saved_from_message_id);
|
||||
MessageId(), "", "", saved_from_dialog_id, saved_from_message_id, "");
|
||||
} else {
|
||||
LOG(ERROR) << "Don't know how to forward a non-channel post message without forward info and sender";
|
||||
}
|
||||
|
@ -875,11 +875,13 @@ class MessagesManager : public Actor {
|
||||
string sender_name;
|
||||
DialogId from_dialog_id;
|
||||
MessageId from_message_id;
|
||||
string psa_type;
|
||||
|
||||
MessageForwardInfo() = default;
|
||||
|
||||
MessageForwardInfo(UserId sender_user_id, int32 date, DialogId dialog_id, MessageId message_id,
|
||||
string author_signature, string sender_name, DialogId from_dialog_id, MessageId from_message_id)
|
||||
string author_signature, string sender_name, DialogId from_dialog_id, MessageId from_message_id,
|
||||
string psa_type)
|
||||
: sender_user_id(sender_user_id)
|
||||
, date(date)
|
||||
, dialog_id(dialog_id)
|
||||
@ -887,14 +889,15 @@ class MessagesManager : public Actor {
|
||||
, author_signature(std::move(author_signature))
|
||||
, sender_name(std::move(sender_name))
|
||||
, from_dialog_id(from_dialog_id)
|
||||
, from_message_id(from_message_id) {
|
||||
, from_message_id(from_message_id)
|
||||
, psa_type(psa_type) {
|
||||
}
|
||||
|
||||
bool operator==(const MessageForwardInfo &rhs) const {
|
||||
return sender_user_id == rhs.sender_user_id && date == rhs.date && dialog_id == rhs.dialog_id &&
|
||||
message_id == rhs.message_id && author_signature == rhs.author_signature &&
|
||||
sender_name == rhs.sender_name && from_dialog_id == rhs.from_dialog_id &&
|
||||
from_message_id == rhs.from_message_id;
|
||||
from_message_id == rhs.from_message_id && psa_type == rhs.psa_type;
|
||||
}
|
||||
|
||||
bool operator!=(const MessageForwardInfo &rhs) const {
|
||||
@ -903,10 +906,10 @@ class MessagesManager : public Actor {
|
||||
|
||||
friend StringBuilder &operator<<(StringBuilder &string_builder, const MessageForwardInfo &forward_info) {
|
||||
return string_builder << "MessageForwardInfo[sender " << forward_info.sender_user_id << "("
|
||||
<< forward_info.author_signature << "/" << forward_info.sender_name << "), source "
|
||||
<< forward_info.dialog_id << ", source " << forward_info.message_id << ", from "
|
||||
<< forward_info.from_dialog_id << ", from " << forward_info.from_message_id << " at "
|
||||
<< forward_info.date << "]";
|
||||
<< forward_info.author_signature << "/" << forward_info.sender_name << "), psa_type "
|
||||
<< forward_info.psa_type << ", source " << forward_info.dialog_id << ", source "
|
||||
<< forward_info.message_id << ", from " << forward_info.from_dialog_id << ", from "
|
||||
<< forward_info.from_message_id << " at " << forward_info.date << "]";
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user