diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index b511ad14..b0e618d6 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -466,29 +466,27 @@ secretChatStateClosed = SecretChatState; secretChat id:int32 user_id:int32 state:SecretChatState is_outbound:Bool ttl:int32 key_hash:bytes layer:int32 = SecretChat; -//@class MessageForwardInfo @description Contains information about the initial sender of a forwarded message +//@class MessageForwardOrigin @description Contains information about the origin of a forwarded message -//@description The message was originally written by a known user -//@sender_user_id Identifier of the user that originally sent this message -//@date Point in time (Unix timestamp) when the message was originally sent -//@forwarded_from_chat_id For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown -//@forwarded_from_message_id For messages forwarded to the chat with the current user (saved messages) the identifier of the original message from which the new message was forwarded; 0 if unknown -messageForwardedFromUser sender_user_id:int32 date:int32 forwarded_from_chat_id:int53 forwarded_from_message_id:int53 = MessageForwardInfo; +//@description The message was originally written by a known user @sender_user_id Identifier of the user that originally sent the message +messageForwardOriginUser sender_user_id:int32 = MessageForwardOrigin; -//@description The message was originally written by a user, which is hidden by his privacy settings -//@sender_name Name of the sender -//@date Point in time (Unix timestamp) when the message was originally sent -//@forwarded_from_chat_id For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown -//@forwarded_from_message_id For messages forwarded to the chat with the current user (saved messages) the identifier of the original message from which the new message was forwarded; 0 if unknown -messageForwardedFromHiddenUser sender_name:string date:int32 forwarded_from_chat_id:int53 forwarded_from_message_id:int53 = MessageForwardInfo; +//@description The message was originally written by a user, which is hidden by his privacy settings @sender_name Name of the sender +messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin; //@description The message was originally a post in a channel -//@chat_id Identifier of the chat from which the message was forwarded -//@author_signature Post author signature -//@date Point in time (Unix timestamp) when the message was originally sent @message_id Message identifier of the original message from which the new message was forwarded; 0 if unknown -//@forwarded_from_chat_id For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown -//@forwarded_from_message_id For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded; 0 if unknown -messageForwardedPost chat_id:int53 author_signature:string date:int32 message_id:int53 forwarded_from_chat_id:int53 forwarded_from_message_id:int53 = MessageForwardInfo; +//@chat_id Identifier of the chat from which the message was originally forwarded +//@message_id Message identifier of the original message; 0 if unknown +//@author_signature Original post author signature +messageForwardOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageForwardOrigin; + + +//@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 +//@from_chat_id For messages forwarded to the chat with the current user (saved messages), 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), 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; //@class MessageSendingState @description Contains information about the sending state of the message @@ -524,7 +522,7 @@ messageSendingStateFailed = MessageSendingState; //@media_album_id Unique identifier of an album this message belongs to. Only photos and videos can be grouped together in albums //@content Content of the message //@reply_markup Reply markup for the message; may be null -message id:int53 sender_user_id:int32 chat_id:int53 sending_state:MessageSendingState is_outgoing:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:MessageForwardInfo reply_to_message_id:int53 ttl:int32 ttl_expires_in:double via_bot_user_id:int32 author_signature:string views:int32 media_album_id:int64 content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_user_id:int32 chat_id:int53 sending_state:MessageSendingState is_outgoing:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo reply_to_message_id:int53 ttl:int32 ttl_expires_in:double via_bot_user_id:int32 author_signature:string views:int32 media_album_id:int64 content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total count of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index 71c5a5b8..af630b33 100644 Binary files a/td/generate/scheme/td_api.tlo and b/td/generate/scheme/td_api.tlo differ diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 929c2573..c21f8ee7 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -17716,25 +17716,26 @@ unique_ptr MessagesManager::get_message_for author_signature, from_dialog_id, from_message_id); } -tl_object_ptr MessagesManager::get_message_forward_info_object( +td_api::object_ptr MessagesManager::get_message_forward_info_object( const unique_ptr &forward_info) const { if (forward_info == nullptr) { return nullptr; } - if (forward_info->dialog_id.is_valid()) { + auto origin = [&]() -> td_api::object_ptr { if (is_forward_info_sender_hidden(forward_info.get())) { - return td_api::make_object( - forward_info->author_signature, forward_info->date, forward_info->from_dialog_id.get(), - forward_info->from_message_id.get()); + return td_api::make_object(forward_info->author_signature); } - return td_api::make_object( - forward_info->dialog_id.get(), forward_info->author_signature, forward_info->date, - forward_info->message_id.get(), forward_info->from_dialog_id.get(), forward_info->from_message_id.get()); - } - return td_api::make_object( - td_->contacts_manager_->get_user_id_object(forward_info->sender_user_id, "messageForwardedFromUser"), - forward_info->date, forward_info->from_dialog_id.get(), forward_info->from_message_id.get()); + if (forward_info->dialog_id.is_valid()) { + return td_api::make_object( + forward_info->dialog_id.get(), forward_info->message_id.get(), forward_info->author_signature); + } + return td_api::make_object( + td_->contacts_manager_->get_user_id_object(forward_info->sender_user_id, "messageForwardOriginUser")); + }(); + + return td_api::make_object( + std::move(origin), forward_info->date, forward_info->from_dialog_id.get(), forward_info->from_message_id.get()); } Result> MessagesManager::get_dialog_reply_markup( diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 0708a6c6..beb61ace 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -1877,7 +1877,7 @@ class MessagesManager : public Actor { unique_ptr get_message_forward_info( tl_object_ptr &&forward_header); - tl_object_ptr get_message_forward_info_object( + td_api::object_ptr get_message_forward_info_object( const unique_ptr &forward_info) const; void ttl_read_history(Dialog *d, bool is_outgoing, MessageId from_message_id, MessageId till_message_id,