Update layer 98. Support for legacy messages flag.
GitOrigin-RevId: b10c8b60b7fbdfdbf8ab15e65ed32f1daa6c9ad2
This commit is contained in:
parent
7fdd8c5139
commit
9007f106b9
@ -124,8 +124,8 @@ chatPhotoEmpty#37c1011c = ChatPhoto;
|
|||||||
chatPhoto#475cdbd5 photo_small:FileLocation photo_big:FileLocation dc_id:int = ChatPhoto;
|
chatPhoto#475cdbd5 photo_small:FileLocation photo_big:FileLocation dc_id:int = ChatPhoto;
|
||||||
|
|
||||||
messageEmpty#83e5de54 id:int = Message;
|
messageEmpty#83e5de54 id:int = Message;
|
||||||
message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message;
|
message#44f9b43d flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?int to_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to_msg_id:flags.3?int date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long = Message;
|
||||||
messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message;
|
messageService#9e19a1f6 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true legacy:flags.19?true id:int from_id:flags.8?int to_id:Peer reply_to_msg_id:flags.3?int date:int action:MessageAction = Message;
|
||||||
|
|
||||||
messageMediaEmpty#3ded6320 = MessageMedia;
|
messageMediaEmpty#3ded6320 = MessageMedia;
|
||||||
messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
|
messageMediaPhoto#695150d7 flags:# photo:flags.0?Photo ttl_seconds:flags.2?int = MessageMedia;
|
||||||
@ -177,8 +177,6 @@ photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;
|
|||||||
geoPointEmpty#1117dd5f = GeoPoint;
|
geoPointEmpty#1117dd5f = GeoPoint;
|
||||||
geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint;
|
geoPoint#296f104 long:double lat:double access_hash:long = GeoPoint;
|
||||||
|
|
||||||
auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone;
|
|
||||||
|
|
||||||
auth.sentCode#38faab5f flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int terms_of_service:flags.3?help.TermsOfService = auth.SentCode;
|
auth.sentCode#38faab5f flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int terms_of_service:flags.3?help.TermsOfService = auth.SentCode;
|
||||||
|
|
||||||
auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization;
|
auth.authorization#cd050916 flags:# tmp_sessions:flags.0?int user:User = auth.Authorization;
|
||||||
@ -357,7 +355,7 @@ config#e6ca25f6 flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:fla
|
|||||||
|
|
||||||
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
|
nearestDc#8e1a1775 country:string this_dc:int nearest_dc:int = NearestDc;
|
||||||
|
|
||||||
help.appUpdate#1da7158f flags:# popup:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string = help.AppUpdate;
|
help.appUpdate#1da7158f flags:# can_not_skip:flags.0?true id:int version:string text:string entities:Vector<MessageEntity> document:flags.1?Document url:flags.2?string = help.AppUpdate;
|
||||||
help.noAppUpdate#c45a6536 = help.AppUpdate;
|
help.noAppUpdate#c45a6536 = help.AppUpdate;
|
||||||
|
|
||||||
help.inviteText#18cb9f78 message:string = help.InviteText;
|
help.inviteText#18cb9f78 message:string = help.InviteText;
|
||||||
|
Binary file not shown.
@ -3572,6 +3572,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
|||||||
bool has_forward_sender_name = is_forwarded && !forward_info->sender_name.empty();
|
bool has_forward_sender_name = is_forwarded && !forward_info->sender_name.empty();
|
||||||
bool has_send_error_code = send_error_code != 0;
|
bool has_send_error_code = send_error_code != 0;
|
||||||
bool has_real_forward_from_dialog_id = real_forward_from_dialog_id.is_valid();
|
bool has_real_forward_from_dialog_id = real_forward_from_dialog_id.is_valid();
|
||||||
|
bool has_legacy_layer = legacy_layer != 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);
|
||||||
@ -3613,6 +3614,8 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
|||||||
STORE_FLAG(has_send_error_code);
|
STORE_FLAG(has_send_error_code);
|
||||||
STORE_FLAG(hide_via_bot);
|
STORE_FLAG(hide_via_bot);
|
||||||
STORE_FLAG(is_bot_start_message);
|
STORE_FLAG(is_bot_start_message);
|
||||||
|
STORE_FLAG(has_real_forward_from_dialog_id);
|
||||||
|
STORE_FLAG(has_legacy_layer);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3681,6 +3684,9 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
|||||||
if (has_notification_id) {
|
if (has_notification_id) {
|
||||||
store(notification_id, storer);
|
store(notification_id, storer);
|
||||||
}
|
}
|
||||||
|
if (has_legacy_layer) {
|
||||||
|
store(legacy_layer, storer);
|
||||||
|
}
|
||||||
store_message_content(content.get(), storer);
|
store_message_content(content.get(), storer);
|
||||||
if (has_reply_markup) {
|
if (has_reply_markup) {
|
||||||
store(*reply_markup, storer);
|
store(*reply_markup, storer);
|
||||||
@ -3711,6 +3717,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
|||||||
bool has_forward_sender_name = false;
|
bool has_forward_sender_name = false;
|
||||||
bool has_send_error_code = false;
|
bool has_send_error_code = false;
|
||||||
bool has_real_forward_from_dialog_id = false;
|
bool has_real_forward_from_dialog_id = false;
|
||||||
|
bool has_legacy_layer = 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);
|
||||||
@ -3753,6 +3760,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
|||||||
PARSE_FLAG(hide_via_bot);
|
PARSE_FLAG(hide_via_bot);
|
||||||
PARSE_FLAG(is_bot_start_message);
|
PARSE_FLAG(is_bot_start_message);
|
||||||
PARSE_FLAG(has_real_forward_from_dialog_id);
|
PARSE_FLAG(has_real_forward_from_dialog_id);
|
||||||
|
PARSE_FLAG(has_legacy_layer);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3826,6 +3834,9 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
|||||||
if (has_notification_id) {
|
if (has_notification_id) {
|
||||||
parse(notification_id, parser);
|
parse(notification_id, parser);
|
||||||
}
|
}
|
||||||
|
if (has_legacy_layer) {
|
||||||
|
parse(legacy_layer, parser);
|
||||||
|
}
|
||||||
parse_message_content(content, parser);
|
parse_message_content(content, parser);
|
||||||
if (has_reply_markup) {
|
if (has_reply_markup) {
|
||||||
reply_markup = make_unique<ReplyMarkup>();
|
reply_markup = make_unique<ReplyMarkup>();
|
||||||
@ -9879,17 +9890,19 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32 flags = message_info.flags;
|
int32 flags = message_info.flags;
|
||||||
if (flags & ~(MESSAGE_FLAG_IS_OUT | MESSAGE_FLAG_IS_FORWARDED | MESSAGE_FLAG_IS_REPLY | MESSAGE_FLAG_HAS_MENTION |
|
if (flags &
|
||||||
|
~(MESSAGE_FLAG_IS_OUT | MESSAGE_FLAG_IS_FORWARDED | MESSAGE_FLAG_IS_REPLY | MESSAGE_FLAG_HAS_MENTION |
|
||||||
MESSAGE_FLAG_HAS_UNREAD_CONTENT | MESSAGE_FLAG_HAS_REPLY_MARKUP | MESSAGE_FLAG_HAS_ENTITIES |
|
MESSAGE_FLAG_HAS_UNREAD_CONTENT | MESSAGE_FLAG_HAS_REPLY_MARKUP | MESSAGE_FLAG_HAS_ENTITIES |
|
||||||
MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA | MESSAGE_FLAG_HAS_VIEWS |
|
MESSAGE_FLAG_HAS_FROM_ID | MESSAGE_FLAG_HAS_MEDIA | MESSAGE_FLAG_HAS_VIEWS | MESSAGE_FLAG_IS_SENT_VIA_BOT |
|
||||||
MESSAGE_FLAG_IS_SENT_VIA_BOT | MESSAGE_FLAG_IS_SILENT | MESSAGE_FLAG_IS_POST |
|
MESSAGE_FLAG_IS_SILENT | MESSAGE_FLAG_IS_POST | MESSAGE_FLAG_HAS_EDIT_DATE | MESSAGE_FLAG_HAS_AUTHOR_SIGNATURE |
|
||||||
MESSAGE_FLAG_HAS_EDIT_DATE | MESSAGE_FLAG_HAS_AUTHOR_SIGNATURE | MESSAGE_FLAG_HAS_MEDIA_ALBUM_ID)) {
|
MESSAGE_FLAG_HAS_MEDIA_ALBUM_ID | MESSAGE_FLAG_IS_LEGACY)) {
|
||||||
LOG(ERROR) << "Unsupported message flags = " << flags << " received";
|
LOG(ERROR) << "Unsupported message flags = " << flags << " received";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_outgoing = (flags & MESSAGE_FLAG_IS_OUT) != 0;
|
bool is_outgoing = (flags & MESSAGE_FLAG_IS_OUT) != 0;
|
||||||
bool is_silent = (flags & MESSAGE_FLAG_IS_SILENT) != 0;
|
bool is_silent = (flags & MESSAGE_FLAG_IS_SILENT) != 0;
|
||||||
bool is_channel_post = (flags & MESSAGE_FLAG_IS_POST) != 0;
|
bool is_channel_post = (flags & MESSAGE_FLAG_IS_POST) != 0;
|
||||||
|
bool is_legacy = (flags & MESSAGE_FLAG_IS_LEGACY) != 0;
|
||||||
|
|
||||||
LOG_IF(ERROR, is_channel_message && dialog_type != DialogType::Channel)
|
LOG_IF(ERROR, is_channel_message && dialog_type != DialogType::Channel)
|
||||||
<< "is_channel_message is true for message received in the " << dialog_id;
|
<< "is_channel_message is true for message received in the " << dialog_id;
|
||||||
@ -9987,6 +10000,7 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
message->disable_notification = is_silent;
|
message->disable_notification = is_silent;
|
||||||
message->is_content_secret = is_content_secret;
|
message->is_content_secret = is_content_secret;
|
||||||
message->views = views;
|
message->views = views;
|
||||||
|
message->legacy_layer = (is_legacy ? MTPROTO_LAYER : 0);
|
||||||
message->content = std::move(message_info.content);
|
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->reply_markup = get_reply_markup(std::move(message_info.reply_markup), td_->auth_manager_->is_bot(), false,
|
||||||
message->contains_mention || dialog_id.get_type() == DialogType::User);
|
message->contains_mention || dialog_id.get_type() == DialogType::User);
|
||||||
@ -23271,8 +23285,8 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
|
|||||||
auto old_index_mask = get_message_index_mask(dialog_id, v->get()) & INDEX_MASK_MASK;
|
auto old_index_mask = get_message_index_mask(dialog_id, v->get()) & INDEX_MASK_MASK;
|
||||||
bool was_deleted = delete_active_live_location(dialog_id, v->get());
|
bool was_deleted = delete_active_live_location(dialog_id, v->get());
|
||||||
auto old_file_ids = get_message_content_file_ids((*v)->content.get(), td_);
|
auto old_file_ids = get_message_content_file_ids((*v)->content.get(), td_);
|
||||||
bool is_changed = update_message(d, *v, std::move(message), need_update_dialog_pos);
|
bool need_send_update = update_message(d, *v, std::move(message), need_update_dialog_pos);
|
||||||
if (!is_changed) {
|
if (!need_send_update) {
|
||||||
LOG(INFO) << message_id << " in " << dialog_id << " is not changed";
|
LOG(INFO) << message_id << " in " << dialog_id << " is not changed";
|
||||||
}
|
}
|
||||||
const Message *m = v->get();
|
const Message *m = v->get();
|
||||||
@ -23298,14 +23312,14 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
|
|||||||
td_->file_manager_->change_files_source(file_source_id, old_file_ids, new_file_ids);
|
td_->file_manager_->change_files_source(file_source_id, old_file_ids, new_file_ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_changed && m->notification_id.is_valid() && is_message_notification_active(d, m)) {
|
if (need_send_update && m->notification_id.is_valid() && is_message_notification_active(d, m)) {
|
||||||
auto &group_info = get_notification_group_info(d, m);
|
auto &group_info = get_notification_group_info(d, m);
|
||||||
if (group_info.group_id.is_valid()) {
|
if (group_info.group_id.is_valid()) {
|
||||||
send_closure_later(G()->notification_manager(), &NotificationManager::edit_notification,
|
send_closure_later(G()->notification_manager(), &NotificationManager::edit_notification,
|
||||||
group_info.group_id, m->notification_id, create_new_message_notification(m->message_id));
|
group_info.group_id, m->notification_id, create_new_message_notification(m->message_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_changed && m->message_id == d->pinned_message_id &&
|
if (need_send_update && m->message_id == d->pinned_message_id &&
|
||||||
d->pinned_message_notification_message_id.is_valid() && d->mention_notification_group.group_id.is_valid()) {
|
d->pinned_message_notification_message_id.is_valid() && d->mention_notification_group.group_id.is_valid()) {
|
||||||
auto pinned_message = get_message_force(d, d->pinned_message_notification_message_id, "after update_message");
|
auto pinned_message = get_message_force(d, d->pinned_message_notification_message_id, "after update_message");
|
||||||
if (pinned_message != nullptr && pinned_message->notification_id.is_valid() &&
|
if (pinned_message != nullptr && pinned_message->notification_id.is_valid() &&
|
||||||
@ -23664,7 +23678,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (message_id.is_server() && dialog_id.get_type() != DialogType::SecretChat &&
|
if (message_id.is_server() && dialog_id.get_type() != DialogType::SecretChat &&
|
||||||
need_reget_message_content(m->content.get())) {
|
(need_reget_message_content(m->content.get()) || (m->legacy_layer != 0 && m->legacy_layer < MTPROTO_LAYER))) {
|
||||||
FullMessageId full_message_id{dialog_id, message_id};
|
FullMessageId full_message_id{dialog_id, message_id};
|
||||||
LOG(INFO) << "Reget from server " << full_message_id;
|
LOG(INFO) << "Reget from server " << full_message_id;
|
||||||
get_message_from_server(full_message_id, Auto());
|
get_message_from_server(full_message_id, Auto());
|
||||||
@ -24127,7 +24141,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
|
|
||||||
DialogId dialog_id = d->dialog_id;
|
DialogId dialog_id = d->dialog_id;
|
||||||
MessageId message_id = old_message->message_id;
|
MessageId message_id = old_message->message_id;
|
||||||
bool is_changed = false;
|
bool need_send_update = false;
|
||||||
bool is_new_available = new_message->content->get_type() != MessageContentType::ChatDeleteHistory;
|
bool is_new_available = new_message->content->get_type() != MessageContentType::ChatDeleteHistory;
|
||||||
if (old_message->date != new_message->date) {
|
if (old_message->date != new_message->date) {
|
||||||
if (new_message->date > 0) {
|
if (new_message->date > 0) {
|
||||||
@ -24141,7 +24155,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
if (d->last_message_id == message_id) {
|
if (d->last_message_id == message_id) {
|
||||||
*need_update_dialog_pos = true;
|
*need_update_dialog_pos = true;
|
||||||
}
|
}
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
} else {
|
} else {
|
||||||
LOG(ERROR) << "Receive " << message_id << " in " << dialog_id << " with wrong date " << new_message->date
|
LOG(ERROR) << "Receive " << message_id << " in " << dialog_id << " with wrong date " << new_message->date
|
||||||
<< ", message content type is " << old_message->content->get_type() << '/'
|
<< ", message content type is " << old_message->content->get_type() << '/'
|
||||||
@ -24156,7 +24170,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
<< new_message->edit_date;
|
<< new_message->edit_date;
|
||||||
old_message->edit_date = new_message->edit_date;
|
old_message->edit_date = new_message->edit_date;
|
||||||
is_edited = true;
|
is_edited = true;
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG(ERROR) << "Receive " << message_id << " in " << dialog_id << " of type " << old_message->content->get_type()
|
LOG(ERROR) << "Receive " << message_id << " in " << dialog_id << " of type " << old_message->content->get_type()
|
||||||
@ -24170,7 +24184,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
<< old_message->sender_user_id << "/" << new_message->sender_user_id << " from "
|
<< old_message->sender_user_id << "/" << new_message->sender_user_id << " from "
|
||||||
<< old_message->author_signature << " to " << new_message->author_signature;
|
<< old_message->author_signature << " to " << new_message->author_signature;
|
||||||
old_message->author_signature = std::move(new_message->author_signature);
|
old_message->author_signature = std::move(new_message->author_signature);
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
if (old_message->sender_user_id != new_message->sender_user_id) {
|
if (old_message->sender_user_id != new_message->sender_user_id) {
|
||||||
// there can be race for sent signed posts
|
// there can be race for sent signed posts
|
||||||
@ -24184,7 +24198,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
<< " in " << dialog_id;
|
<< " in " << dialog_id;
|
||||||
LOG(DEBUG) << "Change message sender";
|
LOG(DEBUG) << "Change message sender";
|
||||||
old_message->sender_user_id = new_message->sender_user_id;
|
old_message->sender_user_id = new_message->sender_user_id;
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
if (old_message->forward_info == nullptr) {
|
if (old_message->forward_info == nullptr) {
|
||||||
if (new_message->forward_info != nullptr) {
|
if (new_message->forward_info != nullptr) {
|
||||||
@ -24193,14 +24207,14 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
<< ", message content type is " << old_message->content->get_type() << '/'
|
<< ", message content type is " << old_message->content->get_type() << '/'
|
||||||
<< new_message->content->get_type();
|
<< new_message->content->get_type();
|
||||||
old_message->forward_info = std::move(new_message->forward_info);
|
old_message->forward_info = std::move(new_message->forward_info);
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (new_message->forward_info != nullptr) {
|
if (new_message->forward_info != nullptr) {
|
||||||
if (old_message->forward_info->author_signature != new_message->forward_info->author_signature) {
|
if (old_message->forward_info->author_signature != new_message->forward_info->author_signature) {
|
||||||
old_message->forward_info->author_signature = new_message->forward_info->author_signature;
|
old_message->forward_info->author_signature = new_message->forward_info->author_signature;
|
||||||
LOG(DEBUG) << "Change message signature";
|
LOG(DEBUG) << "Change message signature";
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
if (*old_message->forward_info != *new_message->forward_info) {
|
if (*old_message->forward_info != *new_message->forward_info) {
|
||||||
if (!is_forward_info_sender_hidden(new_message->forward_info.get())) {
|
if (!is_forward_info_sender_hidden(new_message->forward_info.get())) {
|
||||||
@ -24210,7 +24224,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
<< old_message->content->get_type() << '/' << new_message->content->get_type();
|
<< old_message->content->get_type() << '/' << new_message->content->get_type();
|
||||||
}
|
}
|
||||||
old_message->forward_info = std::move(new_message->forward_info);
|
old_message->forward_info = std::move(new_message->forward_info);
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
} else if (is_new_available) {
|
} else if (is_new_available) {
|
||||||
LOG(ERROR) << message_id << " in " << dialog_id << " sent by " << old_message->sender_user_id
|
LOG(ERROR) << message_id << " in " << dialog_id << " sent by " << old_message->sender_user_id
|
||||||
@ -24218,12 +24232,12 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
<< old_message->real_forward_from_dialog_id << ", message content type is "
|
<< old_message->real_forward_from_dialog_id << ", message content type is "
|
||||||
<< old_message->content->get_type() << '/' << new_message->content->get_type();
|
<< old_message->content->get_type() << '/' << new_message->content->get_type();
|
||||||
old_message->forward_info = nullptr;
|
old_message->forward_info = nullptr;
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (old_message->had_forward_info != new_message->had_forward_info) {
|
if (old_message->had_forward_info != new_message->had_forward_info) {
|
||||||
old_message->had_forward_info = new_message->had_forward_info;
|
old_message->had_forward_info = new_message->had_forward_info;
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
if (old_message->notification_id != new_message->notification_id) {
|
if (old_message->notification_id != new_message->notification_id) {
|
||||||
if (old_message->notification_id.is_valid()) {
|
if (old_message->notification_id.is_valid()) {
|
||||||
@ -24249,7 +24263,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
if (new_message->reply_to_message_id == MessageId()) {
|
if (new_message->reply_to_message_id == MessageId()) {
|
||||||
LOG(DEBUG) << "Drop message reply_to_message_id";
|
LOG(DEBUG) << "Drop message reply_to_message_id";
|
||||||
old_message->reply_to_message_id = MessageId();
|
old_message->reply_to_message_id = MessageId();
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
} else if (is_new_available) {
|
} else if (is_new_available) {
|
||||||
LOG(ERROR) << message_id << " in " << dialog_id << " has changed message it is reply to from "
|
LOG(ERROR) << message_id << " in " << dialog_id << " has changed message it is reply to from "
|
||||||
<< old_message->reply_to_message_id << " to " << new_message->reply_to_message_id
|
<< old_message->reply_to_message_id << " to " << new_message->reply_to_message_id
|
||||||
@ -24268,7 +24282,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
LOG(DEBUG) << "Change message via_bot from " << old_message->via_bot_user_id << " to "
|
LOG(DEBUG) << "Change message via_bot from " << old_message->via_bot_user_id << " to "
|
||||||
<< new_message->via_bot_user_id;
|
<< new_message->via_bot_user_id;
|
||||||
old_message->via_bot_user_id = new_message->via_bot_user_id;
|
old_message->via_bot_user_id = new_message->via_bot_user_id;
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
|
|
||||||
if (old_message->hide_via_bot && old_message->via_bot_user_id.is_valid()) {
|
if (old_message->hide_via_bot && old_message->via_bot_user_id.is_valid()) {
|
||||||
// wrongly set hide_via_bot
|
// wrongly set hide_via_bot
|
||||||
@ -24280,7 +24294,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
<< " to " << new_message->is_outgoing << ", message content type is " << old_message->content->get_type()
|
<< " to " << new_message->is_outgoing << ", message content type is " << old_message->content->get_type()
|
||||||
<< '/' << new_message->content->get_type();
|
<< '/' << new_message->content->get_type();
|
||||||
old_message->is_outgoing = new_message->is_outgoing;
|
old_message->is_outgoing = new_message->is_outgoing;
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
LOG_IF(ERROR, old_message->is_channel_post != new_message->is_channel_post)
|
LOG_IF(ERROR, old_message->is_channel_post != new_message->is_channel_post)
|
||||||
<< message_id << " in " << dialog_id << " has changed is_channel_post from " << old_message->is_channel_post
|
<< message_id << " in " << dialog_id << " has changed is_channel_post from " << old_message->is_channel_post
|
||||||
@ -24298,7 +24312,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
// contains_mention flag shouldn't be changed, because the message will not be added to unread mention list
|
// contains_mention flag shouldn't be changed, because the message will not be added to unread mention list
|
||||||
// and we are unable to show/hide message notification
|
// and we are unable to show/hide message notification
|
||||||
// old_message->contains_mention = new_message->contains_mention;
|
// old_message->contains_mention = new_message->contains_mention;
|
||||||
// is_changed = true;
|
// need_send_update = true;
|
||||||
}
|
}
|
||||||
if (old_message->disable_notification != new_message->disable_notification) {
|
if (old_message->disable_notification != new_message->disable_notification) {
|
||||||
LOG_IF(ERROR, old_message->edit_date == 0 && is_new_available)
|
LOG_IF(ERROR, old_message->edit_date == 0 && is_new_available)
|
||||||
@ -24308,20 +24322,23 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
<< ". New message: " << to_string(get_message_object(dialog_id, new_message.get()));
|
<< ". New message: " << to_string(get_message_object(dialog_id, new_message.get()));
|
||||||
// disable_notification flag shouldn't be changed, because we are unable to show/hide message notification
|
// disable_notification flag shouldn't be changed, because we are unable to show/hide message notification
|
||||||
// old_message->disable_notification = new_message->disable_notification;
|
// old_message->disable_notification = new_message->disable_notification;
|
||||||
// is_changed = true;
|
// need_send_update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (update_message_contains_unread_mention(d, old_message.get(), new_message->contains_unread_mention,
|
if (update_message_contains_unread_mention(d, old_message.get(), new_message->contains_unread_mention,
|
||||||
"update_message")) {
|
"update_message")) {
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
if (update_message_views(dialog_id, old_message.get(), new_message->views)) {
|
if (update_message_views(dialog_id, old_message.get(), new_message->views)) {
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
|
}
|
||||||
|
if (old_message->legacy_layer != new_message->legacy_layer) {
|
||||||
|
old_message->legacy_layer = new_message->legacy_layer;
|
||||||
}
|
}
|
||||||
if ((old_message->media_album_id == 0 || td_->auth_manager_->is_bot()) && new_message->media_album_id != 0) {
|
if ((old_message->media_album_id == 0 || td_->auth_manager_->is_bot()) && new_message->media_album_id != 0) {
|
||||||
old_message->media_album_id = new_message->media_album_id;
|
old_message->media_album_id = new_message->media_album_id;
|
||||||
LOG(DEBUG) << "Update message media_album_id";
|
LOG(DEBUG) << "Update message media_album_id";
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_message->edit_date > 0) {
|
if (old_message->edit_date > 0) {
|
||||||
@ -24337,7 +24354,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
LOG(DEBUG) << "Update message reply keyboard";
|
LOG(DEBUG) << "Update message reply keyboard";
|
||||||
old_message->reply_markup = std::move(new_message->reply_markup);
|
old_message->reply_markup = std::move(new_message->reply_markup);
|
||||||
is_edited = true;
|
is_edited = true;
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
old_message->had_reply_markup = false;
|
old_message->had_reply_markup = false;
|
||||||
} else {
|
} else {
|
||||||
@ -24357,7 +24374,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
|
|
||||||
old_message->had_reply_markup = false;
|
old_message->had_reply_markup = false;
|
||||||
old_message->reply_markup = std::move(new_message->reply_markup);
|
old_message->reply_markup = std::move(new_message->reply_markup);
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (new_message->reply_markup != nullptr) {
|
if (new_message->reply_markup != nullptr) {
|
||||||
@ -24367,7 +24384,7 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
// this is needed to get correct button_id for UrlAuth buttons
|
// this is needed to get correct button_id for UrlAuth buttons
|
||||||
old_message->had_reply_markup = false;
|
old_message->had_reply_markup = false;
|
||||||
old_message->reply_markup = std::move(new_message->reply_markup);
|
old_message->reply_markup = std::move(new_message->reply_markup);
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
} else {
|
} else {
|
||||||
LOG_IF(WARNING, *old_message->reply_markup != *new_message->reply_markup)
|
LOG_IF(WARNING, *old_message->reply_markup != *new_message->reply_markup)
|
||||||
<< message_id << " in " << dialog_id << " has changed reply_markup from " << *old_message->reply_markup
|
<< message_id << " in " << dialog_id << " has changed reply_markup from " << *old_message->reply_markup
|
||||||
@ -24398,15 +24415,15 @@ bool MessagesManager::update_message(Dialog *d, unique_ptr<Message> &old_message
|
|||||||
if (update_message_content(dialog_id, old_message.get(), std::move(new_message->content), true,
|
if (update_message_content(dialog_id, old_message.get(), std::move(new_message->content), true,
|
||||||
message_id.is_yet_unsent() && new_message->edit_date == 0,
|
message_id.is_yet_unsent() && new_message->edit_date == 0,
|
||||||
get_message(d, message_id) != nullptr)) {
|
get_message(d, message_id) != nullptr)) {
|
||||||
is_changed = true;
|
need_send_update = true;
|
||||||
}
|
}
|
||||||
// TODO update can be send only if the message has already been returned to the user
|
// TODO update can be send only if the message has already been returned to the user
|
||||||
if (is_edited && !td_->auth_manager_->is_bot()) {
|
if (is_edited && !td_->auth_manager_->is_bot()) {
|
||||||
send_update_message_edited(dialog_id, old_message.get());
|
send_update_message_edited(dialog_id, old_message.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
on_message_changed(d, old_message.get(), is_changed, "update_message");
|
on_message_changed(d, old_message.get(), need_send_update, "update_message");
|
||||||
return is_changed;
|
return need_send_update;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MessagesManager::need_message_changed_warning(const Message *old_message) {
|
bool MessagesManager::need_message_changed_warning(const Message *old_message) {
|
||||||
|
@ -140,6 +140,7 @@ class MessagesManager : public Actor {
|
|||||||
static constexpr int32 MESSAGE_FLAG_HAS_EDIT_DATE = 1 << 15;
|
static constexpr int32 MESSAGE_FLAG_HAS_EDIT_DATE = 1 << 15;
|
||||||
static constexpr int32 MESSAGE_FLAG_HAS_AUTHOR_SIGNATURE = 1 << 16;
|
static constexpr int32 MESSAGE_FLAG_HAS_AUTHOR_SIGNATURE = 1 << 16;
|
||||||
static constexpr int32 MESSAGE_FLAG_HAS_MEDIA_ALBUM_ID = 1 << 17;
|
static constexpr int32 MESSAGE_FLAG_HAS_MEDIA_ALBUM_ID = 1 << 17;
|
||||||
|
static constexpr int32 MESSAGE_FLAG_IS_LEGACY = 1 << 19;
|
||||||
|
|
||||||
static constexpr int32 SEND_MESSAGE_FLAG_IS_REPLY = 1 << 0;
|
static constexpr int32 SEND_MESSAGE_FLAG_IS_REPLY = 1 << 0;
|
||||||
static constexpr int32 SEND_MESSAGE_FLAG_DISABLE_WEB_PAGE_PREVIEW = 1 << 1;
|
static constexpr int32 SEND_MESSAGE_FLAG_DISABLE_WEB_PAGE_PREVIEW = 1 << 1;
|
||||||
@ -896,6 +897,7 @@ class MessagesManager : public Actor {
|
|||||||
NotificationId removed_notification_id;
|
NotificationId removed_notification_id;
|
||||||
|
|
||||||
int32 views = 0;
|
int32 views = 0;
|
||||||
|
int32 legacy_layer = 0;
|
||||||
|
|
||||||
int32 send_error_code = 0;
|
int32 send_error_code = 0;
|
||||||
string send_error_message;
|
string send_error_message;
|
||||||
|
@ -639,13 +639,13 @@ void UpdatesManager::on_get_updates(tl_object_ptr<telegram_api::Updates> &&updat
|
|||||||
: update->user_id_;
|
: update->user_id_;
|
||||||
|
|
||||||
update->flags_ |= MessagesManager::MESSAGE_FLAG_HAS_FROM_ID;
|
update->flags_ |= MessagesManager::MESSAGE_FLAG_HAS_FROM_ID;
|
||||||
on_pending_update(
|
on_pending_update(make_tl_object<telegram_api::updateNewMessage>(
|
||||||
make_tl_object<telegram_api::updateNewMessage>(
|
|
||||||
make_tl_object<telegram_api::message>(
|
make_tl_object<telegram_api::message>(
|
||||||
update->flags_, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
update->flags_, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||||
false /*ignored*/, update->id_, from_id, make_tl_object<telegram_api::peerUser>(update->user_id_),
|
false /*ignored*/, false /*ignored*/, false /*ignored*/, update->id_, from_id,
|
||||||
std::move(update->fwd_from_), update->via_bot_id_, update->reply_to_msg_id_, update->date_,
|
make_tl_object<telegram_api::peerUser>(update->user_id_), std::move(update->fwd_from_),
|
||||||
update->message_, nullptr, nullptr, std::move(update->entities_), 0, 0, "", 0),
|
update->via_bot_id_, update->reply_to_msg_id_, update->date_, update->message_, nullptr,
|
||||||
|
nullptr, std::move(update->entities_), 0, 0, "", 0),
|
||||||
update->pts_, update->pts_count_),
|
update->pts_, update->pts_count_),
|
||||||
0, "telegram_api::updatesShortMessage");
|
0, "telegram_api::updatesShortMessage");
|
||||||
break;
|
break;
|
||||||
@ -665,7 +665,7 @@ void UpdatesManager::on_get_updates(tl_object_ptr<telegram_api::Updates> &&updat
|
|||||||
on_pending_update(make_tl_object<telegram_api::updateNewMessage>(
|
on_pending_update(make_tl_object<telegram_api::updateNewMessage>(
|
||||||
make_tl_object<telegram_api::message>(
|
make_tl_object<telegram_api::message>(
|
||||||
update->flags_, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
update->flags_, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||||
false /*ignored*/, false /*ignored*/, update->id_, update->from_id_,
|
false /*ignored*/, false /*ignored*/, false /*ignored*/, update->id_, update->from_id_,
|
||||||
make_tl_object<telegram_api::peerChat>(update->chat_id_), std::move(update->fwd_from_),
|
make_tl_object<telegram_api::peerChat>(update->chat_id_), std::move(update->fwd_from_),
|
||||||
update->via_bot_id_, update->reply_to_msg_id_, update->date_, update->message_, nullptr,
|
update->via_bot_id_, update->reply_to_msg_id_, update->date_, update->message_, nullptr,
|
||||||
nullptr, std::move(update->entities_), 0, 0, "", 0),
|
nullptr, std::move(update->entities_), 0, 0, "", 0),
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
|
constexpr int32 MTPROTO_LAYER = 98;
|
||||||
|
|
||||||
enum class Version : int32 {
|
enum class Version : int32 {
|
||||||
Initial,
|
Initial,
|
||||||
StoreFileId,
|
StoreFileId,
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "td/telegram/JsonValue.h"
|
#include "td/telegram/JsonValue.h"
|
||||||
#include "td/telegram/LanguagePackManager.h"
|
#include "td/telegram/LanguagePackManager.h"
|
||||||
|
#include "td/telegram/Version.h"
|
||||||
|
|
||||||
#include "td/tl/tl_object_store.h"
|
#include "td/tl/tl_object_store.h"
|
||||||
|
|
||||||
@ -24,12 +25,10 @@ class HeaderStorer {
|
|||||||
}
|
}
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store(StorerT &storer) const {
|
void store(StorerT &storer) const {
|
||||||
constexpr int32 LAYER = 98;
|
|
||||||
|
|
||||||
using td::store;
|
using td::store;
|
||||||
// invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;
|
// invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;
|
||||||
store(static_cast<int32>(0xda9b0d0d), storer);
|
store(static_cast<int32>(0xda9b0d0d), storer);
|
||||||
store(LAYER, storer);
|
store(MTPROTO_LAYER, storer);
|
||||||
// initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string
|
// initConnection#785188b8 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string
|
||||||
// system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X;
|
// system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy query:!X = X;
|
||||||
store(static_cast<int32>(0x785188b8), storer);
|
store(static_cast<int32>(0x785188b8), storer);
|
||||||
|
Loading…
Reference in New Issue
Block a user