Add td_api::forwardSource.

This commit is contained in:
levlam 2024-01-11 22:48:22 +03:00
parent 8a8b87c9ea
commit 91aef01e7e
3 changed files with 20 additions and 8 deletions

View File

@ -1181,6 +1181,12 @@ messageOriginChat sender_chat_id:int53 author_signature:string = MessageOrigin;
messageOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageOrigin;
//@description Contains information about the last message from which the new message was forwarded last time
//@chat_id Identifier of the chat from which the message was forwarded last time
//@message_id Identifier of the source message from which the message was forwarded last time
forwardSource chat_id:int53 message_id:int53 = ForwardSource;
//@class ReactionType @description Describes type of message reaction
//@description A reaction with an emoji @emoji Text representation of the reaction
@ -1193,10 +1199,9 @@ reactionTypeCustomEmoji custom_emoji_id:int64 = ReactionType;
//@description Contains information about a forwarded message
//@origin Origin of the forwarded message
//@date Point in time (Unix timestamp) when the message was originally sent
//@source For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, information about the source message, from which the message was forwarded last time; may be null for other forwards or if unknown
//@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), to the Replies bot chat, 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), 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:MessageOrigin date:int32 public_service_announcement_type:string from_chat_id:int53 from_message_id:int53 = MessageForwardInfo;
messageForwardInfo origin:MessageOrigin date:int32 source:forwardSource public_service_announcement_type:string = MessageForwardInfo;
//@description Contains information about a message created with importMessages
//@sender_name Name of the original sender

View File

@ -46,6 +46,14 @@ void LastForwardedMessageInfo::add_min_channel_ids(vector<ChannelId> &channel_id
}
}
td_api::object_ptr<td_api::forwardSource> LastForwardedMessageInfo::get_forward_source_object(Td *td) const {
if (is_empty()) {
return nullptr;
}
return td_api::make_object<td_api::forwardSource>(
td->messages_manager_->get_chat_id_object(dialog_id_, "forwardSource"), message_id_.get());
}
bool operator==(const LastForwardedMessageInfo &lhs, const LastForwardedMessageInfo &rhs) {
return lhs.dialog_id_ == rhs.dialog_id_ && lhs.message_id_ == rhs.message_id_;
}
@ -111,11 +119,8 @@ td_api::object_ptr<td_api::messageForwardInfo> MessageForwardInfo::get_message_f
if (is_imported_) {
return nullptr;
}
auto last_message_full_id = get_last_message_full_id();
return td_api::make_object<td_api::messageForwardInfo>(
origin_.get_message_origin_object(td), date_, psa_type_,
td->messages_manager_->get_chat_id_object(last_message_full_id.get_dialog_id(), "messageForwardInfo"),
last_message_full_id.get_message_id().get());
return td_api::make_object<td_api::messageForwardInfo>(origin_.get_message_origin_object(td), date_,
last_message_info_.get_forward_source_object(td), psa_type_);
}
td_api::object_ptr<td_api::messageImportInfo> MessageForwardInfo::get_message_import_info_object() const {

View File

@ -47,6 +47,8 @@ class LastForwardedMessageInfo {
void add_min_channel_ids(vector<ChannelId> &channel_ids) const;
td_api::object_ptr<td_api::forwardSource> get_forward_source_object(Td *td) const;
DialogId get_dialog_id() const {
return dialog_id_;
}