Add separate class messageImportInfo.

This commit is contained in:
levlam 2023-10-09 12:20:32 +03:00
parent b5bf594662
commit 13d02a8644
3 changed files with 28 additions and 14 deletions

View File

@ -1091,9 +1091,6 @@ messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin;
//@author_signature Original post author signature
messageForwardOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageForwardOrigin;
//@description The message was imported from an exported message history @sender_name Name of the sender
messageForwardOriginMessageImport sender_name:string = MessageForwardOrigin;
//@class ReactionType @description Describes type of message reaction
@ -1112,6 +1109,11 @@ reactionTypeCustomEmoji custom_emoji_id:int64 = ReactionType;
//@from_message_id For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, 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 public_service_announcement_type:string from_chat_id:int53 from_message_id:int53 = MessageForwardInfo;
//@description Contains information about a message created with importMessages
//@sender_name Name of the original sender
//@date Point in time (Unix timestamp) when the message was originally sent
messageImportInfo sender_name:string date:int32 = MessageImportInfo;
//@description Contains information about replies to a message
//@reply_count Number of times the message was directly or indirectly replied
//@recent_replier_ids Identifiers of at most 3 recent repliers to the message; available in channels with a discussion supergroup. The users and chats are expected to be inaccessible: only their photo and name will be available
@ -1193,6 +1195,7 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo;
//@date Point in time (Unix timestamp) when the message was sent
//@edit_date Point in time (Unix timestamp) when the message was last edited
//@forward_info Information about the initial message sender; may be null if none or unknown
//@import_info Information about the initial message for messages created with importMessages; may be null if the message isn't imported
//@interaction_info Information about interactions with the message; may be null if none
//@unread_reactions Information about unread reactions added to the message
//@reply_to Information about the message or the story this message is replying to; may be null if none
@ -1206,7 +1209,7 @@ messageReplyToStory story_sender_chat_id:int53 story_id:int32 = MessageReplyTo;
//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted
//@content Content of the message
//@reply_markup Reply markup for the message; may be null if none
message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo unread_reactions:vector<unreadReaction> reply_to:MessageReplyTo message_thread_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message;
message id:int53 sender_id:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_saved:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_added_reactions:Bool can_get_statistics:Bool can_get_message_thread:Bool can_get_viewers:Bool can_get_media_timestamp_links:Bool can_report_reactions:Bool has_timestamped_media:Bool is_channel_post:Bool is_topic_message:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo import_info:messageImportInfo interaction_info:messageInteractionInfo unread_reactions:vector<unreadReaction> reply_to:MessageReplyTo message_thread_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message;
//@description Contains a list of messages @total_count Approximate total number of messages found @messages List of messages; messages may be null
messages total_count:int32 messages:vector<message> = Messages;

View File

@ -23952,6 +23952,7 @@ td_api::object_ptr<td_api::message> MessagesManager::get_dialog_event_log_messag
auto sender = get_message_sender_object_const(td_, m->sender_user_id, m->sender_dialog_id,
"get_dialog_event_log_message_object");
auto forward_info = get_message_forward_info_object(m->forward_info);
auto import_info = get_message_import_info_object(m->forward_info);
auto interaction_info = get_message_interaction_info_object(dialog_id, m);
auto can_be_saved = can_save_message(dialog_id, m);
auto via_bot_user_id = td_->contacts_manager_->get_user_id_object(m->via_bot_user_id, "via_bot_user_id");
@ -23963,8 +23964,9 @@ td_api::object_ptr<td_api::message> MessagesManager::get_dialog_event_log_messag
m->message_id.get(), std::move(sender), get_chat_id_object(dialog_id, "get_dialog_event_log_message_object"),
nullptr, nullptr, m->is_outgoing, false, false, false, can_be_saved, false, false, false, false, false, false,
false, false, true, m->is_channel_post, m->is_topic_message, false, m->date, edit_date, std::move(forward_info),
std::move(interaction_info), Auto(), nullptr, 0, nullptr, 0.0, 0.0, via_bot_user_id, m->author_signature, 0,
get_restriction_reason_description(m->restriction_reasons), std::move(content), std::move(reply_markup));
std::move(import_info), std::move(interaction_info), Auto(), nullptr, 0, nullptr, 0.0, 0.0, via_bot_user_id,
m->author_signature, 0, get_restriction_reason_description(m->restriction_reasons), std::move(content),
std::move(reply_markup));
}
tl_object_ptr<td_api::message> MessagesManager::get_message_object(MessageFullId message_full_id, const char *source) {
@ -24024,6 +24026,7 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
auto sender = get_message_sender_object_const(td_, m->sender_user_id, m->sender_dialog_id, source);
auto scheduling_state = is_scheduled ? get_message_scheduling_state_object(m->date) : nullptr;
auto forward_info = get_message_forward_info_object(m->forward_info);
auto import_info = get_message_import_info_object(m->forward_info);
auto interaction_info = get_message_interaction_info_object(dialog_id, m);
auto unread_reactions = get_unread_reactions_object(dialog_id, m);
auto can_be_saved = can_save_message(dialog_id, m);
@ -24080,10 +24083,10 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
can_be_saved, can_delete_for_self, can_delete_for_all_users, can_get_added_reactions, can_get_statistics,
can_get_message_thread, can_get_viewers, can_get_media_timestamp_links, can_report_reactions,
has_timestamped_media, m->is_channel_post, m->is_topic_message, m->contains_unread_mention, date, edit_date,
std::move(forward_info), std::move(interaction_info), std::move(unread_reactions), std::move(reply_to),
top_thread_message_id, std::move(self_destruct_type), ttl_expires_in, auto_delete_in, via_bot_user_id,
m->author_signature, m->media_album_id, get_restriction_reason_description(m->restriction_reasons),
std::move(content), std::move(reply_markup));
std::move(forward_info), std::move(import_info), std::move(interaction_info), std::move(unread_reactions),
std::move(reply_to), top_thread_message_id, std::move(self_destruct_type), ttl_expires_in, auto_delete_in,
via_bot_user_id, m->author_signature, m->media_album_id,
get_restriction_reason_description(m->restriction_reasons), std::move(content), std::move(reply_markup));
}
tl_object_ptr<td_api::messages> MessagesManager::get_messages_object(int32 total_count, DialogId dialog_id,
@ -27487,14 +27490,11 @@ unique_ptr<MessagesManager::MessageForwardInfo> MessagesManager::get_message_for
td_api::object_ptr<td_api::messageForwardInfo> MessagesManager::get_message_forward_info_object(
const unique_ptr<MessageForwardInfo> &forward_info) const {
if (forward_info == nullptr) {
if (forward_info == nullptr || forward_info->is_imported) {
return nullptr;
}
auto origin = [&]() -> td_api::object_ptr<td_api::MessageForwardOrigin> {
if (forward_info->is_imported) {
return td_api::make_object<td_api::messageForwardOriginMessageImport>(forward_info->sender_name);
}
if (is_forward_info_sender_hidden(forward_info.get())) {
return td_api::make_object<td_api::messageForwardOriginHiddenUser>(
forward_info->sender_name.empty() ? forward_info->author_signature : forward_info->sender_name);
@ -27518,6 +27518,14 @@ td_api::object_ptr<td_api::messageForwardInfo> MessagesManager::get_message_forw
get_chat_id_object(forward_info->from_dialog_id, "messageForwardInfo"), forward_info->from_message_id.get());
}
td_api::object_ptr<td_api::messageImportInfo> MessagesManager::get_message_import_info_object(
const unique_ptr<MessageForwardInfo> &forward_info) const {
if (forward_info == nullptr || !forward_info->is_imported) {
return nullptr;
}
return td_api::make_object<td_api::messageImportInfo>(forward_info->sender_name, forward_info->date);
}
Result<unique_ptr<ReplyMarkup>> MessagesManager::get_dialog_reply_markup(
DialogId dialog_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup_ptr) const {
if (reply_markup_ptr == nullptr) {

View File

@ -2848,6 +2848,9 @@ class MessagesManager final : public Actor {
td_api::object_ptr<td_api::messageForwardInfo> get_message_forward_info_object(
const unique_ptr<MessageForwardInfo> &forward_info) const;
td_api::object_ptr<td_api::messageImportInfo> get_message_import_info_object(
const unique_ptr<MessageForwardInfo> &forward_info) const;
void ttl_read_history(Dialog *d, bool is_outgoing, MessageId from_message_id, MessageId till_message_id,
double view_date);
void ttl_read_history_impl(DialogId dialog_id, bool is_outgoing, MessageId from_message_id, MessageId till_message_id,