Improve td_api::messageForwardInfo class.

GitOrigin-RevId: 6dd56fce26f9b04d62e205e02708706baddcd155
This commit is contained in:
levlam 2019-04-15 05:14:41 +03:00
parent 0cb60722c2
commit aa96b03908
4 changed files with 32 additions and 33 deletions

View File

@ -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; 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 //@description The message was originally written by a known user @sender_user_id Identifier of the user that originally sent the message
//@sender_user_id Identifier of the user that originally sent this message messageForwardOriginUser sender_user_id:int32 = MessageForwardOrigin;
//@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 user, which is hidden by his privacy settings //@description The message was originally written by a user, which is hidden by his privacy settings @sender_name Name of the sender
//@sender_name Name of the sender messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin;
//@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 a post in a channel //@description The message was originally a post in a channel
//@chat_id Identifier of the chat from which the message was forwarded //@chat_id Identifier of the chat from which the message was originally forwarded
//@author_signature Post author signature //@message_id Message identifier of the original message; 0 if unknown
//@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 //@author_signature Original post author signature
//@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 messageForwardOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageForwardOrigin;
//@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;
//@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 //@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 //@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 //@content Content of the message
//@reply_markup Reply markup for the message; may be null //@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 //@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<message> = Messages; messages total_count:int32 messages:vector<message> = Messages;

Binary file not shown.

View File

@ -17716,25 +17716,26 @@ unique_ptr<MessagesManager::MessageForwardInfo> MessagesManager::get_message_for
author_signature, from_dialog_id, from_message_id); author_signature, from_dialog_id, from_message_id);
} }
tl_object_ptr<td_api::MessageForwardInfo> MessagesManager::get_message_forward_info_object( td_api::object_ptr<td_api::messageForwardInfo> MessagesManager::get_message_forward_info_object(
const unique_ptr<MessageForwardInfo> &forward_info) const { const unique_ptr<MessageForwardInfo> &forward_info) const {
if (forward_info == nullptr) { if (forward_info == nullptr) {
return nullptr; return nullptr;
} }
if (forward_info->dialog_id.is_valid()) { auto origin = [&]() -> td_api::object_ptr<td_api::MessageForwardOrigin> {
if (is_forward_info_sender_hidden(forward_info.get())) { if (is_forward_info_sender_hidden(forward_info.get())) {
return td_api::make_object<td_api::messageForwardedFromHiddenUser>( return td_api::make_object<td_api::messageForwardOriginHiddenUser>(forward_info->author_signature);
forward_info->author_signature, forward_info->date, forward_info->from_dialog_id.get(),
forward_info->from_message_id.get());
} }
return td_api::make_object<td_api::messageForwardedPost>( if (forward_info->dialog_id.is_valid()) {
forward_info->dialog_id.get(), forward_info->author_signature, forward_info->date, return td_api::make_object<td_api::messageForwardOriginChannel>(
forward_info->message_id.get(), forward_info->from_dialog_id.get(), forward_info->from_message_id.get()); forward_info->dialog_id.get(), forward_info->message_id.get(), forward_info->author_signature);
} }
return td_api::make_object<td_api::messageForwardedFromUser>( return td_api::make_object<td_api::messageForwardOriginUser>(
td_->contacts_manager_->get_user_id_object(forward_info->sender_user_id, "messageForwardedFromUser"), td_->contacts_manager_->get_user_id_object(forward_info->sender_user_id, "messageForwardOriginUser"));
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->from_dialog_id.get(), forward_info->from_message_id.get());
} }
Result<unique_ptr<ReplyMarkup>> MessagesManager::get_dialog_reply_markup( Result<unique_ptr<ReplyMarkup>> MessagesManager::get_dialog_reply_markup(

View File

@ -1877,7 +1877,7 @@ class MessagesManager : public Actor {
unique_ptr<MessageForwardInfo> get_message_forward_info( unique_ptr<MessageForwardInfo> get_message_forward_info(
tl_object_ptr<telegram_api::messageFwdHeader> &&forward_header); tl_object_ptr<telegram_api::messageFwdHeader> &&forward_header);
tl_object_ptr<td_api::MessageForwardInfo> get_message_forward_info_object( td_api::object_ptr<td_api::messageForwardInfo> get_message_forward_info_object(
const unique_ptr<MessageForwardInfo> &forward_info) const; const unique_ptr<MessageForwardInfo> &forward_info) const;
void ttl_read_history(Dialog *d, bool is_outgoing, MessageId from_message_id, MessageId till_message_id, void ttl_read_history(Dialog *d, bool is_outgoing, MessageId from_message_id, MessageId till_message_id,