Register scheduled message contents.

GitOrigin-RevId: 1942ff1c3976ee24969d1c25a94fb89639ffa906
This commit is contained in:
levlam 2020-01-25 04:00:43 +03:00
parent 67e4871ea0
commit f2a4d70865
3 changed files with 10 additions and 11 deletions

View File

@ -3475,9 +3475,6 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
}
void register_message_content(Td *td, const MessageContent *content, FullMessageId full_message_id) {
if (full_message_id.get_message_id().is_scheduled()) {
return;
}
switch (content->get_type()) {
case MessageContentType::Poll:
return td->poll_manager_->register_poll(static_cast<const MessagePoll *>(content)->poll_id, full_message_id);
@ -3488,9 +3485,6 @@ void register_message_content(Td *td, const MessageContent *content, FullMessage
void reregister_message_content(Td *td, const MessageContent *old_content, const MessageContent *new_content,
FullMessageId full_message_id) {
if (full_message_id.get_message_id().is_scheduled()) {
return;
}
auto old_content_type = old_content->get_type();
auto new_content_type = new_content->get_type();
if (old_content_type == new_content_type) {
@ -3510,9 +3504,6 @@ void reregister_message_content(Td *td, const MessageContent *old_content, const
}
void unregister_message_content(Td *td, const MessageContent *content, FullMessageId full_message_id) {
if (full_message_id.get_message_id().is_scheduled()) {
return;
}
switch (content->get_type()) {
case MessageContentType::Poll:
return td->poll_manager_->unregister_poll(static_cast<const MessagePoll *>(content)->poll_id, full_message_id);

View File

@ -12853,6 +12853,8 @@ unique_ptr<MessagesManager::Message> MessagesManager::do_delete_scheduled_messag
cancel_send_deleted_message(d->dialog_id, result.get(), is_permanently_deleted);
unregister_message_content(td_, result->content.get(), {d->dialog_id, message_id});
return result;
}
@ -26574,6 +26576,8 @@ MessagesManager::Message *MessagesManager::add_scheduled_message_to_dialog(Dialo
add_message_file_sources(dialog_id, m);
register_message_content(td_, m->content.get(), {dialog_id, m->message_id});
if (from_update) {
update_sent_message_contents(dialog_id, m);
update_used_hashtags(dialog_id, m);

View File

@ -572,7 +572,9 @@ PollId PollManager::create_poll(string &&question, vector<string> &&options, boo
void PollManager::register_poll(PollId poll_id, FullMessageId full_message_id) {
CHECK(have_poll(poll_id));
CHECK(!full_message_id.get_message_id().is_scheduled());
if (full_message_id.get_message_id().is_scheduled()) {
return;
}
if (!full_message_id.get_message_id().is_server()) {
return;
}
@ -586,7 +588,9 @@ void PollManager::register_poll(PollId poll_id, FullMessageId full_message_id) {
void PollManager::unregister_poll(PollId poll_id, FullMessageId full_message_id) {
CHECK(have_poll(poll_id));
CHECK(!full_message_id.get_message_id().is_scheduled());
if (full_message_id.get_message_id().is_scheduled()) {
return;
}
if (!full_message_id.get_message_id().is_server()) {
return;
}