Move get_input_message_text_object inside InputMessageText class.

This commit is contained in:
levlam 2023-10-16 20:56:28 +03:00
parent b9e7c8d7da
commit 19367e78db
3 changed files with 10 additions and 10 deletions

View File

@ -167,7 +167,7 @@ void DraftMessage::add_dependencies(Dependencies &dependencies) const {
td_api::object_ptr<td_api::draftMessage> DraftMessage::get_draft_message_object() const {
return td_api::make_object<td_api::draftMessage>(reply_to_message_id_.get(), date_,
get_input_message_text_object(input_message_text_));
input_message_text_.get_input_message_text_object());
}
DraftMessage::DraftMessage(Td *td, telegram_api::object_ptr<telegram_api::draftMessage> &&draft_message) {

View File

@ -68,16 +68,16 @@ telegram_api::object_ptr<telegram_api::InputMedia> InputMessageText::get_input_m
}
// used only for draft
td_api::object_ptr<td_api::inputMessageText> get_input_message_text_object(const InputMessageText &input_message_text) {
td_api::object_ptr<td_api::inputMessageText> InputMessageText::get_input_message_text_object() const {
td_api::object_ptr<td_api::linkPreviewOptions> options;
if (!input_message_text.web_page_url.empty() || input_message_text.disable_web_page_preview ||
input_message_text.force_small_media || input_message_text.force_large_media) {
if (!web_page_url.empty() || disable_web_page_preview ||
force_small_media || force_large_media) {
options = td_api::make_object<td_api::linkPreviewOptions>(
input_message_text.disable_web_page_preview, input_message_text.web_page_url,
input_message_text.force_small_media, input_message_text.force_large_media);
disable_web_page_preview, web_page_url,
force_small_media, force_large_media);
}
return td_api::make_object<td_api::inputMessageText>(get_formatted_text_object(input_message_text.text, false, -1),
std::move(options), input_message_text.clear_draft);
return td_api::make_object<td_api::inputMessageText>(get_formatted_text_object(text, false, -1),
std::move(options), clear_draft);
}
} // namespace td

View File

@ -41,6 +41,8 @@ class InputMessageText {
}
telegram_api::object_ptr<telegram_api::InputMedia> get_input_media_web_page() const;
td_api::object_ptr<td_api::inputMessageText> get_input_message_text_object() const;
};
bool operator==(const InputMessageText &lhs, const InputMessageText &rhs);
@ -50,6 +52,4 @@ Result<InputMessageText> process_input_message_text(const Td *td, DialogId dialo
tl_object_ptr<td_api::InputMessageContent> &&input_message_content,
bool is_bot, bool for_draft = false) TD_WARN_UNUSED_RESULT;
td_api::object_ptr<td_api::inputMessageText> get_input_message_text_object(const InputMessageText &input_message_text);
} // namespace td