Add Message.invert_media flag.

This commit is contained in:
levlam 2023-10-17 12:27:26 +03:00
parent 72cb3665b4
commit 8552180f0d
2 changed files with 15 additions and 1 deletions

View File

@ -4744,6 +4744,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
STORE_FLAG(has_history_generation);
STORE_FLAG(is_reply_to_story);
STORE_FLAG(has_forward_origin);
STORE_FLAG(invert_media);
END_STORE_FLAGS();
}
@ -4993,6 +4994,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
PARSE_FLAG(has_history_generation);
PARSE_FLAG(is_reply_to_story);
PARSE_FLAG(has_forward_origin);
PARSE_FLAG(invert_media);
END_PARSE_FLAGS();
}
@ -13344,6 +13346,7 @@ void MessagesManager::on_message_ttl_expired_impl(Dialog *d, Message *m, bool is
m->contains_mention = false;
m->linked_top_thread_message_id = MessageId();
m->is_content_secret = false;
m->invert_media = false;
}
void MessagesManager::loop() {
@ -14262,6 +14265,7 @@ MessagesManager::MessageInfo MessagesManager::parse_telegram_api_message(
message_info.noforwards = message->noforwards_;
message_info.has_mention = message->mentioned_;
message_info.has_unread_content = message->media_unread_;
message_info.invert_media = message->invert_media_;
bool is_content_read = !message_info.has_unread_content;
if (is_message_auto_read(message_info.dialog_id, message_info.is_outgoing)) {
@ -14536,6 +14540,7 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
reply_to_story_full_id = StoryFullId();
noforwards = false;
is_content_secret = false;
message_info.invert_media = false;
}
bool is_pinned = message_info.is_pinned;
@ -14586,6 +14591,7 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
message->reply_info = std::move(reply_info);
message->reactions = std::move(reactions);
message->legacy_layer = (message_info.is_legacy ? MTPROTO_LAYER : 0);
message->invert_media = message_info.invert_media;
message->content = std::move(message_info.content);
message->reply_markup = get_reply_markup(std::move(message_info.reply_markup), td_->auth_manager_->is_bot(), false,
message->contains_mention || dialog_type == DialogType::User);
@ -27363,6 +27369,9 @@ int32 MessagesManager::get_message_flags(const Message *m) {
if (m->update_stickersets_order) {
flags |= SEND_MESSAGE_FLAG_UPDATE_STICKER_SETS_ORDER;
}
if (m->invert_media) {
flags |= SEND_MESSAGE_FLAG_INVERT_MEDIA;
}
return flags;
}
@ -35984,7 +35993,9 @@ bool MessagesManager::update_message(Dialog *d, Message *old_message, unique_ptr
bool is_content_changed = false;
if (update_message_content(dialog_id, old_message, std::move(new_message->content),
message_id.is_yet_unsent() && new_message->edit_date == 0, is_message_in_dialog,
is_content_changed)) {
is_content_changed) ||
old_message->invert_media != new_message->invert_media) {
old_message->invert_media = new_message->invert_media;
send_update_message_content(d, old_message, is_message_in_dialog, "update_message");
need_send_update = true;
}

View File

@ -132,6 +132,7 @@ class MessagesManager final : public Actor {
static constexpr int32 SEND_MESSAGE_FLAG_HAS_SEND_AS = 1 << 13;
static constexpr int32 SEND_MESSAGE_FLAG_NOFORWARDS = 1 << 14;
static constexpr int32 SEND_MESSAGE_FLAG_UPDATE_STICKER_SETS_ORDER = 1 << 15;
static constexpr int32 SEND_MESSAGE_FLAG_INVERT_MEDIA = 1 << 16;
static constexpr int32 ONLINE_MEMBER_COUNT_CACHE_EXPIRE_TIME = 30 * 60;
@ -1074,6 +1075,7 @@ class MessagesManager final : public Actor {
bool noforwards = false;
bool has_mention = false;
bool has_unread_content = false;
bool invert_media = false;
unique_ptr<MessageContent> content;
tl_object_ptr<telegram_api::ReplyMarkup> reply_markup;
@ -1164,6 +1166,7 @@ class MessagesManager final : public Actor {
bool is_pinned = false;
bool are_media_timestamp_entities_found = false;
bool noforwards = false;
bool invert_media = false;
bool has_explicit_sender = false; // for send_message
bool is_copy = false; // for send_message