Add has_message_content_web_page.

GitOrigin-RevId: 3bc382c77754a6a517616235d7b2572cfdfda607
This commit is contained in:
levlam 2020-03-28 01:49:59 +03:00
parent 36cc950820
commit 8e666c2d7a
3 changed files with 11 additions and 3 deletions

View File

@ -2512,11 +2512,16 @@ bool get_message_content_poll_is_anonymous(const Td *td, const MessageContent *c
}
}
void has_message_content_web_page(const MessageContent *content) {
if (content->get_type() == MessageContentType::Text) {
return static_cast<const MessageText *>(content)->web_page_id.is_valid();
}
return false;
}
void remove_message_content_web_page(MessageContent *content) {
CHECK(content->get_type() == MessageContentType::Text);
auto &web_page_id = static_cast<MessageText *>(content)->web_page_id;
CHECK(web_page_id.is_valid());
web_page_id = WebPageId();
static_cast<MessageText *>(content)->web_page_id = WebPageId();
}
void set_message_content_poll_answer(Td *td, const MessageContent *content, FullMessageId full_message_id,

View File

@ -135,6 +135,8 @@ bool get_message_content_poll_is_closed(const Td *td, const MessageContent *cont
bool get_message_content_poll_is_anonymous(const Td *td, const MessageContent *content);
void has_message_content_web_page(const MessageContent *content);
void remove_message_content_web_page(MessageContent *content);
void set_message_content_poll_answer(Td *td, const MessageContent *content, FullMessageId full_message_id,

View File

@ -12021,6 +12021,7 @@ void MessagesManager::delete_pending_message_web_page(FullMessageId full_message
CHECK(m != nullptr);
MessageContent *content = m->content.get();
CHECK(has_message_content_web_page(content));
unregister_message_content(td_, content, full_message_id, "delete_pending_message_web_page");
remove_message_content_web_page(content);
register_message_content(td_, content, full_message_id, "delete_pending_message_web_page");