Save pts of the last processed message edit.
This commit is contained in:
parent
ebc4e57da7
commit
b70eb33158
@ -7227,7 +7227,7 @@ void MessagesManager::process_update(tl_object_ptr<telegram_api::Update> &&updat
|
|||||||
auto full_message_id = on_get_message(std::move(update_edit_message->message_), false, false, false, false, false,
|
auto full_message_id = on_get_message(std::move(update_edit_message->message_), false, false, false, false, false,
|
||||||
"updateEditMessage");
|
"updateEditMessage");
|
||||||
LOG(INFO) << "Process updateEditMessage";
|
LOG(INFO) << "Process updateEditMessage";
|
||||||
on_message_edited(full_message_id);
|
on_message_edited(full_message_id, update_edit_message->pts_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case telegram_api::updateDeleteMessages::ID: {
|
case telegram_api::updateDeleteMessages::ID: {
|
||||||
@ -7318,7 +7318,7 @@ void MessagesManager::process_channel_update(tl_object_ptr<telegram_api::Update>
|
|||||||
LOG(INFO) << "Process updateEditChannelMessage";
|
LOG(INFO) << "Process updateEditChannelMessage";
|
||||||
auto full_message_id = on_get_message(std::move(update_edit_channel_message->message_), false, true, false, false,
|
auto full_message_id = on_get_message(std::move(update_edit_channel_message->message_), false, true, false, false,
|
||||||
false, "updateEditChannelMessage");
|
false, "updateEditChannelMessage");
|
||||||
on_message_edited(full_message_id);
|
on_message_edited(full_message_id, update_edit_channel_message->pts_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case telegram_api::updatePinnedChannelMessages::ID: {
|
case telegram_api::updatePinnedChannelMessages::ID: {
|
||||||
@ -7344,15 +7344,16 @@ void MessagesManager::process_channel_update(tl_object_ptr<telegram_api::Update>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessagesManager::on_message_edited(FullMessageId full_message_id) {
|
void MessagesManager::on_message_edited(FullMessageId full_message_id, int32 pts) {
|
||||||
if (full_message_id == FullMessageId()) {
|
if (full_message_id == FullMessageId()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dialog_id = full_message_id.get_dialog_id();
|
auto dialog_id = full_message_id.get_dialog_id();
|
||||||
Dialog *d = get_dialog(dialog_id);
|
Dialog *d = get_dialog(dialog_id);
|
||||||
const Message *m = get_message(d, full_message_id.get_message_id());
|
Message *m = get_message(d, full_message_id.get_message_id());
|
||||||
CHECK(m != nullptr);
|
CHECK(m != nullptr);
|
||||||
|
m->last_edit_pts = pts;
|
||||||
if (td_->auth_manager_->is_bot()) {
|
if (td_->auth_manager_->is_bot()) {
|
||||||
d->last_edited_message_id = m->message_id;
|
d->last_edited_message_id = m->message_id;
|
||||||
send_update_message_edited(dialog_id, m);
|
send_update_message_edited(dialog_id, m);
|
||||||
@ -32933,6 +32934,7 @@ bool MessagesManager::update_message_content(DialogId dialog_id, Message *old_me
|
|||||||
"update_message_content");
|
"update_message_content");
|
||||||
}
|
}
|
||||||
old_content = std::move(new_content);
|
old_content = std::move(new_content);
|
||||||
|
old_message->last_edit_pts = 0;
|
||||||
update_message_content_file_id_remote(old_content.get(), old_file_id);
|
update_message_content_file_id_remote(old_content.get(), old_file_id);
|
||||||
} else {
|
} else {
|
||||||
update_message_content_file_id_remote(old_content.get(), get_message_content_any_file_id(new_content.get()));
|
update_message_content_file_id_remote(old_content.get(), get_message_content_any_file_id(new_content.get()));
|
||||||
|
@ -1138,6 +1138,8 @@ class MessagesManager : public Actor {
|
|||||||
uint64 edit_generation = 0;
|
uint64 edit_generation = 0;
|
||||||
Promise<Unit> edit_promise;
|
Promise<Unit> edit_promise;
|
||||||
|
|
||||||
|
int32 last_edit_pts = 0;
|
||||||
|
|
||||||
unique_ptr<Message> left;
|
unique_ptr<Message> left;
|
||||||
unique_ptr<Message> right;
|
unique_ptr<Message> right;
|
||||||
|
|
||||||
@ -1828,7 +1830,7 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
void process_channel_update(tl_object_ptr<telegram_api::Update> &&update);
|
void process_channel_update(tl_object_ptr<telegram_api::Update> &&update);
|
||||||
|
|
||||||
void on_message_edited(FullMessageId full_message_id);
|
void on_message_edited(FullMessageId full_message_id, int32 pts);
|
||||||
|
|
||||||
void delete_messages_from_updates(const vector<MessageId> &message_ids);
|
void delete_messages_from_updates(const vector<MessageId> &message_ids);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user