tdlight/td/telegram/StoryContent.h

72 lines
2.7 KiB
C
Raw Normal View History

2023-05-18 16:20:22 +02:00
//
2024-01-01 01:07:21 +01:00
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
2023-05-18 16:20:22 +02:00
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/telegram/DialogId.h"
2023-05-19 16:00:33 +02:00
#include "td/telegram/files/FileId.h"
2023-07-03 14:42:42 +02:00
#include "td/telegram/logevent/LogEvent.h"
2023-05-18 16:20:22 +02:00
#include "td/telegram/StoryContentType.h"
2023-05-19 12:41:15 +02:00
#include "td/telegram/td_api.h"
2023-05-18 16:20:22 +02:00
#include "td/telegram/telegram_api.h"
2023-05-19 16:00:33 +02:00
#include "td/utils/common.h"
2023-05-23 15:05:04 +02:00
#include "td/utils/Status.h"
2023-05-19 16:00:33 +02:00
2023-05-18 16:20:22 +02:00
namespace td {
2023-07-03 19:03:26 +02:00
class Dependencies;
2023-05-18 16:20:22 +02:00
class Td;
class StoryContent {
public:
StoryContent() = default;
StoryContent(const StoryContent &) = default;
StoryContent &operator=(const StoryContent &) = default;
StoryContent(StoryContent &&) = default;
StoryContent &operator=(StoryContent &&) = default;
virtual StoryContentType get_type() const = 0;
virtual ~StoryContent() = default;
};
2023-07-03 14:42:42 +02:00
void store_story_content(const StoryContent *content, LogEventStorerCalcLength &storer);
void store_story_content(const StoryContent *content, LogEventStorerUnsafe &storer);
void parse_story_content(unique_ptr<StoryContent> &content, LogEventParser &parser);
2023-07-03 19:03:26 +02:00
void add_story_content_dependencies(Dependencies &dependencies, const StoryContent *story_content);
2023-05-18 16:20:22 +02:00
unique_ptr<StoryContent> get_story_content(Td *td, telegram_api::object_ptr<telegram_api::MessageMedia> &&media_ptr,
DialogId owner_dialog_id);
2023-05-23 15:05:04 +02:00
Result<unique_ptr<StoryContent>> get_input_story_content(
Td *td, td_api::object_ptr<td_api::InputStoryContent> &&input_story_content, DialogId owner_dialog_id);
2023-05-24 18:35:45 +02:00
telegram_api::object_ptr<telegram_api::InputMedia> get_story_content_input_media(
Td *td, const StoryContent *content, telegram_api::object_ptr<telegram_api::InputFile> input_file);
2023-06-02 14:54:43 +02:00
void compare_story_contents(Td *td, const StoryContent *old_content, const StoryContent *new_content,
bool &is_content_changed, bool &need_update);
2023-05-18 16:20:22 +02:00
void merge_story_contents(Td *td, const StoryContent *old_content, StoryContent *new_content, DialogId dialog_id,
2023-06-13 11:46:31 +02:00
bool &is_content_changed, bool &need_update);
2023-05-18 16:20:22 +02:00
2023-05-29 19:48:31 +02:00
unique_ptr<StoryContent> copy_story_content(const StoryContent *content);
2023-05-29 22:00:32 +02:00
unique_ptr<StoryContent> dup_story_content(Td *td, const StoryContent *content);
2023-05-19 12:41:15 +02:00
td_api::object_ptr<td_api::StoryContent> get_story_content_object(Td *td, const StoryContent *content);
2023-05-24 16:24:36 +02:00
FileId get_story_content_any_file_id(const Td *td, const StoryContent *content);
2023-05-19 16:00:33 +02:00
vector<FileId> get_story_content_file_ids(const Td *td, const StoryContent *content);
int32 get_story_content_duration(const Td *td, const StoryContent *content);
2023-05-18 16:20:22 +02:00
} // namespace td