Add Message.effect_id.

This commit is contained in:
levlam 2024-05-09 17:55:33 +03:00
parent 1b200bb820
commit fe239b7595
3 changed files with 23 additions and 4 deletions

View File

@ -1512,10 +1512,11 @@ inputMessageReplyToStory story_sender_chat_id:int53 story_id:int32 = InputMessag
//@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead //@sender_boost_count Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead
//@author_signature For channel posts and anonymous group messages, optional author signature //@author_signature For channel posts and anonymous group messages, optional author signature
//@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums //@media_album_id Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums
//@effect_id Unique identifier of the effect added to the message; 0 if none
//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted //@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 //@content Content of the message
//@reply_markup Reply markup for the message; may be null if none //@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 is_from_offline:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat: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_read_date: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 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 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 is_from_offline:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_replied_in_another_chat: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_read_date: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 saved_messages_topic_id:int53 self_destruct_type:MessageSelfDestructType self_destruct_in:double auto_delete_in:double via_bot_user_id:int53 sender_business_bot_user_id:int53 sender_boost_count:int32 author_signature:string media_album_id:int64 effect_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 //@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; messages total_count:int32 messages:vector<message> = Messages;

View File

@ -4114,6 +4114,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
bool has_initial_top_thread_message_id = !message_id.is_any_server() && initial_top_thread_message_id.is_valid(); bool has_initial_top_thread_message_id = !message_id.is_any_server() && initial_top_thread_message_id.is_valid();
bool has_sender_boost_count = sender_boost_count != 0; bool has_sender_boost_count = sender_boost_count != 0;
bool has_via_business_bot_user_id = via_business_bot_user_id.is_valid(); bool has_via_business_bot_user_id = via_business_bot_user_id.is_valid();
bool has_effect_id = effect_id != 0;
BEGIN_STORE_FLAGS(); BEGIN_STORE_FLAGS();
STORE_FLAG(is_channel_post); STORE_FLAG(is_channel_post);
STORE_FLAG(is_outgoing); STORE_FLAG(is_outgoing);
@ -4200,6 +4201,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
STORE_FLAG(has_sender_boost_count); STORE_FLAG(has_sender_boost_count);
STORE_FLAG(has_via_business_bot_user_id); STORE_FLAG(has_via_business_bot_user_id);
STORE_FLAG(is_from_offline); STORE_FLAG(is_from_offline);
STORE_FLAG(has_effect_id);
END_STORE_FLAGS(); END_STORE_FLAGS();
} }
@ -4326,6 +4328,9 @@ void MessagesManager::Message::store(StorerT &storer) const {
if (has_via_business_bot_user_id) { if (has_via_business_bot_user_id) {
store(via_business_bot_user_id, storer); store(via_business_bot_user_id, storer);
} }
if (has_effect_id) {
store(effect_id, storer);
}
} }
// do not forget to resolve message dependencies // do not forget to resolve message dependencies
@ -4383,6 +4388,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
bool has_initial_top_thread_message_id = false; bool has_initial_top_thread_message_id = false;
bool has_sender_boost_count = false; bool has_sender_boost_count = false;
bool has_via_business_bot_user_id = false; bool has_via_business_bot_user_id = false;
bool has_effect_id = false;
BEGIN_PARSE_FLAGS(); BEGIN_PARSE_FLAGS();
PARSE_FLAG(is_channel_post); PARSE_FLAG(is_channel_post);
PARSE_FLAG(is_outgoing); PARSE_FLAG(is_outgoing);
@ -4469,6 +4475,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
PARSE_FLAG(has_sender_boost_count); PARSE_FLAG(has_sender_boost_count);
PARSE_FLAG(has_via_business_bot_user_id); PARSE_FLAG(has_via_business_bot_user_id);
PARSE_FLAG(is_from_offline); PARSE_FLAG(is_from_offline);
PARSE_FLAG(has_effect_id);
END_PARSE_FLAGS(); END_PARSE_FLAGS();
} }
@ -4659,6 +4666,9 @@ void MessagesManager::Message::parse(ParserT &parser) {
if (has_via_business_bot_user_id) { if (has_via_business_bot_user_id) {
parse(via_business_bot_user_id, parser); parse(via_business_bot_user_id, parser);
} }
if (has_effect_id) {
parse(effect_id, parser);
}
CHECK(content != nullptr); CHECK(content != nullptr);
is_content_secret |= ttl.is_secret_message_content(content->get_type()); // repair is_content_secret for old messages is_content_secret |= ttl.is_secret_message_content(content->get_type()); // repair is_content_secret for old messages
@ -13051,6 +13061,7 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
message_info.has_mention = message->mentioned_; message_info.has_mention = message->mentioned_;
message_info.has_unread_content = message->media_unread_; message_info.has_unread_content = message->media_unread_;
message_info.invert_media = message->invert_media_; message_info.invert_media = message->invert_media_;
message_info.effect_id = message->effect_;
bool is_content_read = true; bool is_content_read = true;
if (!td->auth_manager_->is_bot()) { if (!td->auth_manager_->is_bot()) {
@ -13381,6 +13392,7 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
message->forward_count = forward_count; message->forward_count = forward_count;
message->reply_info = std::move(reply_info); message->reply_info = std::move(reply_info);
message->reactions = std::move(reactions); message->reactions = std::move(reactions);
message->effect_id = message_info.effect_id;
message->legacy_layer = (message_info.is_legacy ? MTPROTO_LAYER : 0); message->legacy_layer = (message_info.is_legacy ? MTPROTO_LAYER : 0);
message->invert_media = message_info.invert_media; message->invert_media = message_info.invert_media;
message->content = std::move(message_info.content); message->content = std::move(message_info.content);
@ -22509,7 +22521,7 @@ td_api::object_ptr<td_api::message> MessagesManager::get_dialog_event_log_messag
nullptr, nullptr, m->is_outgoing, m->is_pinned, m->is_from_offline, false, false, false, can_be_saved, false, nullptr, nullptr, m->is_outgoing, m->is_pinned, m->is_from_offline, false, false, false, can_be_saved, false,
false, false, false, false, false, false, false, false, true, m->is_channel_post, m->is_topic_message, false, 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(import_info), std::move(interaction_info), Auto(), nullptr, m->date, edit_date, std::move(forward_info), std::move(import_info), std::move(interaction_info), Auto(), nullptr,
0, 0, nullptr, 0.0, 0.0, via_bot_user_id, 0, m->sender_boost_count, m->author_signature, 0, 0, 0, nullptr, 0.0, 0.0, via_bot_user_id, 0, m->sender_boost_count, m->author_signature, 0, 0,
get_restriction_reason_description(m->restriction_reasons), std::move(content), std::move(reply_markup)); get_restriction_reason_description(m->restriction_reasons), std::move(content), std::move(reply_markup));
} }
@ -22578,7 +22590,7 @@ td_api::object_ptr<td_api::message> MessagesManager::get_business_message_messag
false, false, false, false, false, false, false, false, false, false, false, m->date, m->edit_date, false, false, false, false, false, false, false, false, false, false, false, m->date, m->edit_date,
std::move(forward_info), std::move(import_info), nullptr, Auto(), std::move(reply_to), 0, 0, std::move(forward_info), std::move(import_info), nullptr, Auto(), std::move(reply_to), 0, 0,
std::move(self_destruct_type), 0.0, 0.0, via_bot_user_id, via_business_bot_user_id, 0, string(), std::move(self_destruct_type), 0.0, 0.0, via_bot_user_id, via_business_bot_user_id, 0, string(),
m->media_album_id, get_restriction_reason_description(m->restriction_reasons), std::move(content), m->media_album_id, m->effect_id, get_restriction_reason_description(m->restriction_reasons), std::move(content),
std::move(reply_markup)); std::move(reply_markup));
} }
@ -22695,7 +22707,7 @@ td_api::object_ptr<td_api::message> MessagesManager::get_message_object(DialogId
std::move(interaction_info), std::move(unread_reactions), std::move(reply_to), top_thread_message_id, std::move(interaction_info), std::move(unread_reactions), std::move(reply_to), top_thread_message_id,
td_->saved_messages_manager_->get_saved_messages_topic_id_object(m->saved_messages_topic_id), td_->saved_messages_manager_->get_saved_messages_topic_id_object(m->saved_messages_topic_id),
std::move(self_destruct_type), ttl_expires_in, auto_delete_in, via_bot_user_id, via_business_bot_user_id, std::move(self_destruct_type), ttl_expires_in, auto_delete_in, via_bot_user_id, via_business_bot_user_id,
m->sender_boost_count, m->author_signature, m->media_album_id, m->sender_boost_count, m->author_signature, m->media_album_id, m->effect_id,
get_restriction_reason_description(m->restriction_reasons), std::move(content), std::move(reply_markup)); get_restriction_reason_description(m->restriction_reasons), std::move(content), std::move(reply_markup));
} }
@ -33677,6 +33689,10 @@ bool MessagesManager::update_message(Dialog *d, Message *old_message, unique_ptr
LOG(DEBUG) << "Update message media_album_id"; LOG(DEBUG) << "Update message media_album_id";
need_send_update = true; need_send_update = true;
} }
if (old_message->effect_id != new_message->effect_id) {
old_message->effect_id = new_message->effect_id;
need_send_update = true;
}
if (old_message->hide_edit_date != new_message->hide_edit_date) { if (old_message->hide_edit_date != new_message->hide_edit_date) {
old_message->hide_edit_date = new_message->hide_edit_date; old_message->hide_edit_date = new_message->hide_edit_date;
} }

View File

@ -1005,6 +1005,7 @@ class MessagesManager final : public Actor {
vector<RestrictionReason> restriction_reasons; vector<RestrictionReason> restriction_reasons;
string author_signature; string author_signature;
int64 media_album_id = 0; int64 media_album_id = 0;
int64 effect_id = 0;
bool is_outgoing = false; bool is_outgoing = false;
bool is_silent = false; bool is_silent = false;
bool is_channel_post = false; bool is_channel_post = false;
@ -1120,6 +1121,7 @@ class MessagesManager final : public Actor {
double ttl_expires_at = 0; // only for TTL double ttl_expires_at = 0; // only for TTL
int64 media_album_id = 0; int64 media_album_id = 0;
int64 effect_id = 0;
unique_ptr<MessageContent> content; unique_ptr<MessageContent> content;