Add get_message_content_story_full_id.

This commit is contained in:
levlam 2023-06-22 22:39:47 +03:00
parent d901f35d21
commit ebac96e7ec
4 changed files with 24 additions and 0 deletions

View File

@ -6332,6 +6332,18 @@ vector<FileId> get_message_content_file_ids(const MessageContent *content, const
}
}
StoryFullId get_message_content_story_full_id(const Td *td, const MessageContent *content) {
CHECK(content != nullptr);
switch (content->get_type()) {
case MessageContentType::Text:
return td->web_pages_manager_->get_web_page_story_full_id(static_cast<const MessageText *>(content)->web_page_id);
case MessageContentType::Story:
return static_cast<const MessageStory *>(content)->story_full_id;
default:
return StoryFullId();
}
}
string get_message_content_search_text(const Td *td, const MessageContent *content) {
switch (content->get_type()) {
case MessageContentType::Text: {

View File

@ -237,6 +237,8 @@ FileId get_message_content_thumbnail_file_id(const MessageContent *content, cons
vector<FileId> get_message_content_file_ids(const MessageContent *content, const Td *td);
StoryFullId get_message_content_story_full_id(const Td *td, const MessageContent *content);
string get_message_content_search_text(const Td *td, const MessageContent *content);
bool update_message_content_extended_media(MessageContent *content,

View File

@ -1809,6 +1809,14 @@ int32 WebPagesManager::get_web_page_media_duration(const WebPage *web_page) cons
return -1;
}
StoryFullId WebPagesManager::get_web_page_story_full_id(WebPageId web_page_id) const {
const WebPage *web_page = get_web_page(web_page_id);
if (web_page == nullptr || web_page->story_full_ids.empty()) {
return StoryFullId();
}
return web_page->story_full_ids[0];
}
vector<UserId> WebPagesManager::get_web_page_user_ids(WebPageId web_page_id) const {
const WebPage *web_page = get_web_page(web_page_id);
vector<UserId> user_ids;

View File

@ -87,6 +87,8 @@ class WebPagesManager final : public Actor {
int32 get_web_page_media_duration(WebPageId web_page_id) const;
StoryFullId get_web_page_story_full_id(WebPageId web_page_id) const;
vector<UserId> get_web_page_user_ids(WebPageId web_page_id) const;
void on_story_changed(StoryFullId story_full_id);