Hide too big media timestamps.
This commit is contained in:
parent
304280df69
commit
da3b8f93a0
@ -93,7 +93,7 @@ const FormattedText &Game::get_text() const {
|
|||||||
|
|
||||||
tl_object_ptr<td_api::game> Game::get_game_object(Td *td, bool skip_bot_commands) const {
|
tl_object_ptr<td_api::game> Game::get_game_object(Td *td, bool skip_bot_commands) const {
|
||||||
return make_tl_object<td_api::game>(
|
return make_tl_object<td_api::game>(
|
||||||
id_, short_name_, title_, get_formatted_text_object(text_, skip_bot_commands), description_,
|
id_, short_name_, title_, get_formatted_text_object(text_, skip_bot_commands, -1), description_,
|
||||||
get_photo_object(td->file_manager_.get(), photo_),
|
get_photo_object(td->file_manager_.get(), photo_),
|
||||||
td->animations_manager_->get_animation_object(animation_file_id_, "get_game_object"));
|
td->animations_manager_->get_animation_object(animation_file_id_, "get_game_object"));
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,9 @@ Result<InputMessageText> process_input_message_text(const ContactsManager *conta
|
|||||||
return std::move(result);
|
return std::move(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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> get_input_message_text_object(const InputMessageText &input_message_text) {
|
||||||
return td_api::make_object<td_api::inputMessageText>(get_formatted_text_object(input_message_text.text, false),
|
return td_api::make_object<td_api::inputMessageText>(get_formatted_text_object(input_message_text.text, false, -1),
|
||||||
input_message_text.disable_web_page_preview,
|
input_message_text.disable_web_page_preview,
|
||||||
input_message_text.clear_draft);
|
input_message_text.clear_draft);
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ class LinkManager::InternalLinkMessageDraft final : public InternalLink {
|
|||||||
bool contains_link_ = false;
|
bool contains_link_ = false;
|
||||||
|
|
||||||
td_api::object_ptr<td_api::InternalLinkType> get_internal_link_type_object() const final {
|
td_api::object_ptr<td_api::InternalLinkType> get_internal_link_type_object() const final {
|
||||||
return td_api::make_object<td_api::internalLinkTypeMessageDraft>(get_formatted_text_object(text_, true),
|
return td_api::make_object<td_api::internalLinkTypeMessageDraft>(get_formatted_text_object(text_, true, -1),
|
||||||
contains_link_);
|
contains_link_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +367,7 @@ class GetDeepLinkInfoQuery final : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
FormattedText text{std::move(info->message_), std::move(entities)};
|
FormattedText text{std::move(info->message_), std::move(entities)};
|
||||||
return promise_.set_value(
|
return promise_.set_value(
|
||||||
td_api::make_object<td_api::deepLinkInfo>(get_formatted_text_object(text, true), need_update));
|
td_api::make_object<td_api::deepLinkInfo>(get_formatted_text_object(text, true, -1), need_update));
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
@ -2914,9 +2914,9 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
if (old_->text.text != new_->text.text) {
|
if (old_->text.text != new_->text.text) {
|
||||||
if (need_message_changed_warning && need_message_text_changed_warning(old_, new_)) {
|
if (need_message_changed_warning && need_message_text_changed_warning(old_, new_)) {
|
||||||
LOG(ERROR) << "Message text has changed from "
|
LOG(ERROR) << "Message text has changed from "
|
||||||
<< to_string(get_message_content_object(old_content, td, dialog_id, -1, false, false))
|
<< to_string(get_message_content_object(old_content, td, dialog_id, -1, false, false, -1))
|
||||||
<< ". New content is "
|
<< ". New content is "
|
||||||
<< to_string(get_message_content_object(new_content, td, dialog_id, -1, false, false));
|
<< to_string(get_message_content_object(new_content, td, dialog_id, -1, false, false, -1));
|
||||||
}
|
}
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
@ -2926,9 +2926,9 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
old_->text.entities.size() <= MAX_CUSTOM_ENTITIES_COUNT &&
|
old_->text.entities.size() <= MAX_CUSTOM_ENTITIES_COUNT &&
|
||||||
need_message_entities_changed_warning(old_->text.entities, new_->text.entities)) {
|
need_message_entities_changed_warning(old_->text.entities, new_->text.entities)) {
|
||||||
LOG(WARNING) << "Entities has changed from "
|
LOG(WARNING) << "Entities has changed from "
|
||||||
<< to_string(get_message_content_object(old_content, td, dialog_id, -1, false, false))
|
<< to_string(get_message_content_object(old_content, td, dialog_id, -1, false, false, -1))
|
||||||
<< ". New content is "
|
<< ". New content is "
|
||||||
<< to_string(get_message_content_object(new_content, td, dialog_id, -1, false, false));
|
<< to_string(get_message_content_object(new_content, td, dialog_id, -1, false, false, -1));
|
||||||
}
|
}
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
@ -4647,19 +4647,21 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
|
|||||||
|
|
||||||
tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageContent *content, Td *td,
|
tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageContent *content, Td *td,
|
||||||
DialogId dialog_id, int32 message_date,
|
DialogId dialog_id, int32 message_date,
|
||||||
bool is_content_secret, bool skip_bot_commands) {
|
bool is_content_secret, bool skip_bot_commands,
|
||||||
|
int32 max_media_timestamp) {
|
||||||
CHECK(content != nullptr);
|
CHECK(content != nullptr);
|
||||||
switch (content->get_type()) {
|
switch (content->get_type()) {
|
||||||
case MessageContentType::Animation: {
|
case MessageContentType::Animation: {
|
||||||
const MessageAnimation *m = static_cast<const MessageAnimation *>(content);
|
const MessageAnimation *m = static_cast<const MessageAnimation *>(content);
|
||||||
return make_tl_object<td_api::messageAnimation>(
|
return make_tl_object<td_api::messageAnimation>(
|
||||||
td->animations_manager_->get_animation_object(m->file_id, "get_message_content_object"),
|
td->animations_manager_->get_animation_object(m->file_id, "get_message_content_object"),
|
||||||
get_formatted_text_object(m->caption, skip_bot_commands), is_content_secret);
|
get_formatted_text_object(m->caption, skip_bot_commands, max_media_timestamp), is_content_secret);
|
||||||
}
|
}
|
||||||
case MessageContentType::Audio: {
|
case MessageContentType::Audio: {
|
||||||
const MessageAudio *m = static_cast<const MessageAudio *>(content);
|
const MessageAudio *m = static_cast<const MessageAudio *>(content);
|
||||||
return make_tl_object<td_api::messageAudio>(td->audios_manager_->get_audio_object(m->file_id),
|
return make_tl_object<td_api::messageAudio>(
|
||||||
get_formatted_text_object(m->caption, skip_bot_commands));
|
td->audios_manager_->get_audio_object(m->file_id),
|
||||||
|
get_formatted_text_object(m->caption, skip_bot_commands, max_media_timestamp));
|
||||||
}
|
}
|
||||||
case MessageContentType::Contact: {
|
case MessageContentType::Contact: {
|
||||||
const MessageContact *m = static_cast<const MessageContact *>(content);
|
const MessageContact *m = static_cast<const MessageContact *>(content);
|
||||||
@ -4669,7 +4671,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
|||||||
const MessageDocument *m = static_cast<const MessageDocument *>(content);
|
const MessageDocument *m = static_cast<const MessageDocument *>(content);
|
||||||
return make_tl_object<td_api::messageDocument>(
|
return make_tl_object<td_api::messageDocument>(
|
||||||
td->documents_manager_->get_document_object(m->file_id, PhotoFormat::Jpeg),
|
td->documents_manager_->get_document_object(m->file_id, PhotoFormat::Jpeg),
|
||||||
get_formatted_text_object(m->caption, skip_bot_commands));
|
get_formatted_text_object(m->caption, skip_bot_commands, max_media_timestamp));
|
||||||
}
|
}
|
||||||
case MessageContentType::Game: {
|
case MessageContentType::Game: {
|
||||||
const MessageGame *m = static_cast<const MessageGame *>(content);
|
const MessageGame *m = static_cast<const MessageGame *>(content);
|
||||||
@ -4694,9 +4696,9 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
|||||||
}
|
}
|
||||||
case MessageContentType::Photo: {
|
case MessageContentType::Photo: {
|
||||||
const MessagePhoto *m = static_cast<const MessagePhoto *>(content);
|
const MessagePhoto *m = static_cast<const MessagePhoto *>(content);
|
||||||
return make_tl_object<td_api::messagePhoto>(get_photo_object(td->file_manager_.get(), m->photo),
|
return make_tl_object<td_api::messagePhoto>(
|
||||||
get_formatted_text_object(m->caption, skip_bot_commands),
|
get_photo_object(td->file_manager_.get(), m->photo),
|
||||||
is_content_secret);
|
get_formatted_text_object(m->caption, skip_bot_commands, max_media_timestamp), is_content_secret);
|
||||||
}
|
}
|
||||||
case MessageContentType::Sticker: {
|
case MessageContentType::Sticker: {
|
||||||
const MessageSticker *m = static_cast<const MessageSticker *>(content);
|
const MessageSticker *m = static_cast<const MessageSticker *>(content);
|
||||||
@ -4704,8 +4706,9 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
|||||||
}
|
}
|
||||||
case MessageContentType::Text: {
|
case MessageContentType::Text: {
|
||||||
const MessageText *m = static_cast<const MessageText *>(content);
|
const MessageText *m = static_cast<const MessageText *>(content);
|
||||||
return make_tl_object<td_api::messageText>(get_formatted_text_object(m->text, skip_bot_commands),
|
return make_tl_object<td_api::messageText>(
|
||||||
td->web_pages_manager_->get_web_page_object(m->web_page_id));
|
get_formatted_text_object(m->text, skip_bot_commands, max_media_timestamp),
|
||||||
|
td->web_pages_manager_->get_web_page_object(m->web_page_id));
|
||||||
}
|
}
|
||||||
case MessageContentType::Unsupported:
|
case MessageContentType::Unsupported:
|
||||||
return make_tl_object<td_api::messageUnsupported>();
|
return make_tl_object<td_api::messageUnsupported>();
|
||||||
@ -4715,9 +4718,9 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
|||||||
}
|
}
|
||||||
case MessageContentType::Video: {
|
case MessageContentType::Video: {
|
||||||
const MessageVideo *m = static_cast<const MessageVideo *>(content);
|
const MessageVideo *m = static_cast<const MessageVideo *>(content);
|
||||||
return make_tl_object<td_api::messageVideo>(td->videos_manager_->get_video_object(m->file_id),
|
return make_tl_object<td_api::messageVideo>(
|
||||||
get_formatted_text_object(m->caption, skip_bot_commands),
|
td->videos_manager_->get_video_object(m->file_id),
|
||||||
is_content_secret);
|
get_formatted_text_object(m->caption, skip_bot_commands, max_media_timestamp), is_content_secret);
|
||||||
}
|
}
|
||||||
case MessageContentType::VideoNote: {
|
case MessageContentType::VideoNote: {
|
||||||
const MessageVideoNote *m = static_cast<const MessageVideoNote *>(content);
|
const MessageVideoNote *m = static_cast<const MessageVideoNote *>(content);
|
||||||
@ -4726,9 +4729,9 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
|
|||||||
}
|
}
|
||||||
case MessageContentType::VoiceNote: {
|
case MessageContentType::VoiceNote: {
|
||||||
const MessageVoiceNote *m = static_cast<const MessageVoiceNote *>(content);
|
const MessageVoiceNote *m = static_cast<const MessageVoiceNote *>(content);
|
||||||
return make_tl_object<td_api::messageVoiceNote>(td->voice_notes_manager_->get_voice_note_object(m->file_id),
|
return make_tl_object<td_api::messageVoiceNote>(
|
||||||
get_formatted_text_object(m->caption, skip_bot_commands),
|
td->voice_notes_manager_->get_voice_note_object(m->file_id),
|
||||||
m->is_listened);
|
get_formatted_text_object(m->caption, skip_bot_commands, max_media_timestamp), m->is_listened);
|
||||||
}
|
}
|
||||||
case MessageContentType::ChatCreate: {
|
case MessageContentType::ChatCreate: {
|
||||||
const MessageChatCreate *m = static_cast<const MessageChatCreate *>(content);
|
const MessageChatCreate *m = static_cast<const MessageChatCreate *>(content);
|
||||||
|
@ -198,7 +198,8 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
|
|||||||
|
|
||||||
tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageContent *content, Td *td,
|
tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageContent *content, Td *td,
|
||||||
DialogId dialog_id, int32 message_date,
|
DialogId dialog_id, int32 message_date,
|
||||||
bool is_content_secret, bool skip_bot_commands);
|
bool is_content_secret, bool skip_bot_commands,
|
||||||
|
int32 max_media_timestamp);
|
||||||
|
|
||||||
const FormattedText *get_message_content_text(const MessageContent *content);
|
const FormattedText *get_message_content_text(const MessageContent *content);
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ tl_object_ptr<td_api::textEntity> MessageEntity::get_text_entity_object() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
vector<tl_object_ptr<td_api::textEntity>> get_text_entities_object(const vector<MessageEntity> &entities,
|
vector<tl_object_ptr<td_api::textEntity>> get_text_entities_object(const vector<MessageEntity> &entities,
|
||||||
bool skip_bot_commands) {
|
bool skip_bot_commands, int32 max_media_timestamp) {
|
||||||
vector<tl_object_ptr<td_api::textEntity>> result;
|
vector<tl_object_ptr<td_api::textEntity>> result;
|
||||||
result.reserve(entities.size());
|
result.reserve(entities.size());
|
||||||
|
|
||||||
@ -153,6 +153,10 @@ vector<tl_object_ptr<td_api::textEntity>> get_text_entities_object(const vector<
|
|||||||
if (skip_bot_commands && entity.type == MessageEntity::Type::BotCommand) {
|
if (skip_bot_commands && entity.type == MessageEntity::Type::BotCommand) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (entity.type == MessageEntity::Type::MediaTimestamp &&
|
||||||
|
(max_media_timestamp < 0 || max_media_timestamp < to_integer<int32>(entity.argument))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
auto entity_object = entity.get_text_entity_object();
|
auto entity_object = entity.get_text_entity_object();
|
||||||
if (entity_object->type_ != nullptr) {
|
if (entity_object->type_ != nullptr) {
|
||||||
result.push_back(std::move(entity_object));
|
result.push_back(std::move(entity_object));
|
||||||
@ -166,9 +170,10 @@ StringBuilder &operator<<(StringBuilder &string_builder, const FormattedText &te
|
|||||||
return string_builder << '"' << text.text << "\" with entities " << text.entities;
|
return string_builder << '"' << text.text << "\" with entities " << text.entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::formattedText> get_formatted_text_object(const FormattedText &text, bool skip_bot_commands) {
|
td_api::object_ptr<td_api::formattedText> get_formatted_text_object(const FormattedText &text, bool skip_bot_commands,
|
||||||
return td_api::make_object<td_api::formattedText>(text.text,
|
int32 max_media_timestamp) {
|
||||||
get_text_entities_object(text.entities, skip_bot_commands));
|
return td_api::make_object<td_api::formattedText>(
|
||||||
|
text.text, get_text_entities_object(text.entities, skip_bot_commands, max_media_timestamp));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool is_word_character(uint32 code) {
|
static bool is_word_character(uint32 code) {
|
||||||
|
@ -133,9 +133,10 @@ Result<vector<MessageEntity>> get_message_entities(const ContactsManager *contac
|
|||||||
bool allow_all = false);
|
bool allow_all = false);
|
||||||
|
|
||||||
vector<tl_object_ptr<td_api::textEntity>> get_text_entities_object(const vector<MessageEntity> &entities,
|
vector<tl_object_ptr<td_api::textEntity>> get_text_entities_object(const vector<MessageEntity> &entities,
|
||||||
bool skip_bot_commands);
|
bool skip_bot_commands, int32 max_media_timestamp);
|
||||||
|
|
||||||
td_api::object_ptr<td_api::formattedText> get_formatted_text_object(const FormattedText &text, bool skip_bot_commands);
|
td_api::object_ptr<td_api::formattedText> get_formatted_text_object(const FormattedText &text, bool skip_bot_commands,
|
||||||
|
int32 max_media_timestamp);
|
||||||
|
|
||||||
vector<MessageEntity> find_entities(Slice text, bool skip_bot_commands, bool skip_media_timestamps);
|
vector<MessageEntity> find_entities(Slice text, bool skip_bot_commands, bool skip_media_timestamps);
|
||||||
|
|
||||||
|
@ -6534,8 +6534,8 @@ void MessagesManager::on_update_service_notification(tl_object_ptr<telegram_api:
|
|||||||
if ((update->flags_ & telegram_api::updateServiceNotification::POPUP_MASK) != 0) {
|
if ((update->flags_ & telegram_api::updateServiceNotification::POPUP_MASK) != 0) {
|
||||||
send_closure(G()->td(), &Td::send_update,
|
send_closure(G()->td(), &Td::send_update,
|
||||||
td_api::make_object<td_api::updateServiceNotification>(
|
td_api::make_object<td_api::updateServiceNotification>(
|
||||||
update->type_,
|
update->type_, get_message_content_object(content.get(), td_, owner_dialog_id, date,
|
||||||
get_message_content_object(content.get(), td_, owner_dialog_id, date, is_content_secret, true)));
|
is_content_secret, true, -1)));
|
||||||
}
|
}
|
||||||
if (has_date && is_user) {
|
if (has_date && is_user) {
|
||||||
Dialog *d = get_service_notifications_dialog();
|
Dialog *d = get_service_notifications_dialog();
|
||||||
@ -13512,7 +13512,7 @@ std::pair<DialogId, unique_ptr<MessagesManager::Message>> MessagesManager::creat
|
|||||||
LOG(ERROR) << "Receive media group identifier " << message_info.media_album_id << " in " << message_id << " from "
|
LOG(ERROR) << "Receive media group identifier " << message_info.media_album_id << " in " << message_id << " from "
|
||||||
<< dialog_id << " with content "
|
<< dialog_id << " with content "
|
||||||
<< oneline(to_string(get_message_content_object(message->content.get(), td_, dialog_id, message->date,
|
<< oneline(to_string(get_message_content_object(message->content.get(), td_, dialog_id, message->date,
|
||||||
is_content_secret, false)));
|
is_content_secret, false, -1)));
|
||||||
} else {
|
} else {
|
||||||
message->media_album_id = message_info.media_album_id;
|
message->media_album_id = message_info.media_album_id;
|
||||||
}
|
}
|
||||||
@ -22840,7 +22840,8 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
|
|||||||
auto date = is_scheduled ? 0 : m->date;
|
auto date = is_scheduled ? 0 : m->date;
|
||||||
auto edit_date = m->hide_edit_date ? 0 : m->edit_date;
|
auto edit_date = m->hide_edit_date ? 0 : m->edit_date;
|
||||||
auto is_pinned = for_event_log || is_scheduled ? false : m->is_pinned;
|
auto is_pinned = for_event_log || is_scheduled ? false : m->is_pinned;
|
||||||
bool skip_bot_commands = for_event_log || need_skip_bot_commands(dialog_id, m);
|
bool skip_bot_commands = for_event_log ? true : need_skip_bot_commands(dialog_id, m);
|
||||||
|
int32 max_media_timestamp = for_event_log ? -1 : get_message_content_duration(m->content.get(), td_);
|
||||||
string source = PSTRING() << dialog_id << ' ' << m->message_id;
|
string source = PSTRING() << dialog_id << ' ' << m->message_id;
|
||||||
return make_tl_object<td_api::message>(
|
return make_tl_object<td_api::message>(
|
||||||
m->message_id.get(), get_message_sender_object_const(m->sender_user_id, m->sender_dialog_id, source.c_str()),
|
m->message_id.get(), get_message_sender_object_const(m->sender_user_id, m->sender_dialog_id, source.c_str()),
|
||||||
@ -22851,7 +22852,7 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
|
|||||||
reply_in_dialog_id.get(), reply_to_message_id, top_thread_message_id, ttl, ttl_expires_in, via_bot_user_id,
|
reply_in_dialog_id.get(), reply_to_message_id, top_thread_message_id, ttl, ttl_expires_in, via_bot_user_id,
|
||||||
m->author_signature, media_album_id, get_restriction_reason_description(m->restriction_reasons),
|
m->author_signature, media_album_id, get_restriction_reason_description(m->restriction_reasons),
|
||||||
get_message_content_object(m->content.get(), td_, dialog_id, live_location_date, m->is_content_secret,
|
get_message_content_object(m->content.get(), td_, dialog_id, live_location_date, m->is_content_secret,
|
||||||
skip_bot_commands),
|
skip_bot_commands, max_media_timestamp),
|
||||||
get_reply_markup_object(m->reply_markup));
|
get_reply_markup_object(m->reply_markup));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24042,7 +24043,7 @@ void MessagesManager::do_send_message_group(int64 media_album_id) {
|
|||||||
<< file_view.has_active_download_remote_location() << " " << file_view.is_encrypted() << " " << is_web
|
<< file_view.has_active_download_remote_location() << " " << file_view.is_encrypted() << " " << is_web
|
||||||
<< " " << file_view.has_url() << " "
|
<< " " << file_view.has_url() << " "
|
||||||
<< to_string(get_message_content_object(m->content.get(), td_, dialog_id, m->date,
|
<< to_string(get_message_content_object(m->content.get(), td_, dialog_id, m->date,
|
||||||
m->is_content_secret, false));
|
m->is_content_secret, false, -1));
|
||||||
}
|
}
|
||||||
auto entities = get_input_message_entities(td_->contacts_manager_.get(), caption, "do_send_message_group");
|
auto entities = get_input_message_entities(td_->contacts_manager_.get(), caption, "do_send_message_group");
|
||||||
int32 input_single_media_flags = 0;
|
int32 input_single_media_flags = 0;
|
||||||
@ -28144,8 +28145,10 @@ void MessagesManager::send_update_message_content(DialogId dialog_id, const Mess
|
|||||||
void MessagesManager::send_update_message_content_impl(DialogId dialog_id, const Message *m, const char *source) const {
|
void MessagesManager::send_update_message_content_impl(DialogId dialog_id, const Message *m, const char *source) const {
|
||||||
CHECK(m != nullptr);
|
CHECK(m != nullptr);
|
||||||
LOG(INFO) << "Send updateMessageContent for " << m->message_id << " in " << dialog_id << " from " << source;
|
LOG(INFO) << "Send updateMessageContent for " << m->message_id << " in " << dialog_id << " from " << source;
|
||||||
auto content_object = get_message_content_object(m->content.get(), td_, dialog_id, m->is_failed_to_send ? 0 : m->date,
|
int32 max_media_timestamp = get_message_content_duration(m->content.get(), td_);
|
||||||
m->is_content_secret, need_skip_bot_commands(dialog_id, m));
|
auto content_object =
|
||||||
|
get_message_content_object(m->content.get(), td_, dialog_id, m->is_failed_to_send ? 0 : m->date,
|
||||||
|
m->is_content_secret, need_skip_bot_commands(dialog_id, m), max_media_timestamp);
|
||||||
send_closure(G()->td(), &Td::send_update,
|
send_closure(G()->td(), &Td::send_update,
|
||||||
td_api::make_object<td_api::updateMessageContent>(dialog_id.get(), m->message_id.get(),
|
td_api::make_object<td_api::updateMessageContent>(dialog_id.get(), m->message_id.get(),
|
||||||
std::move(content_object)));
|
std::move(content_object)));
|
||||||
@ -30486,7 +30489,7 @@ void MessagesManager::on_send_dialog_action_timeout(DialogId dialog_id) {
|
|||||||
if (!file_id.is_valid()) {
|
if (!file_id.is_valid()) {
|
||||||
LOG(ERROR) << "Have no file in "
|
LOG(ERROR) << "Have no file in "
|
||||||
<< to_string(get_message_content_object(m->content.get(), td_, dialog_id, m->date, m->is_content_secret,
|
<< to_string(get_message_content_object(m->content.get(), td_, dialog_id, m->date, m->is_content_secret,
|
||||||
false));
|
false, -1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto file_view = td_->file_manager_->get_file_view(file_id);
|
auto file_view = td_->file_manager_->get_file_view(file_id);
|
||||||
|
@ -558,7 +558,7 @@ td_api::object_ptr<td_api::poll> PollManager::get_poll_object(PollId poll_id, co
|
|||||||
auto correct_option_id = is_local_poll_id(poll_id) ? -1 : poll->correct_option_id;
|
auto correct_option_id = is_local_poll_id(poll_id) ? -1 : poll->correct_option_id;
|
||||||
poll_type = td_api::make_object<td_api::pollTypeQuiz>(
|
poll_type = td_api::make_object<td_api::pollTypeQuiz>(
|
||||||
correct_option_id,
|
correct_option_id,
|
||||||
get_formatted_text_object(is_local_poll_id(poll_id) ? FormattedText() : poll->explanation, true));
|
get_formatted_text_object(is_local_poll_id(poll_id) ? FormattedText() : poll->explanation, true, -1));
|
||||||
} else {
|
} else {
|
||||||
poll_type = td_api::make_object<td_api::pollTypeRegular>(poll->allow_multiple_answers);
|
poll_type = td_api::make_object<td_api::pollTypeRegular>(poll->allow_multiple_answers);
|
||||||
}
|
}
|
||||||
|
@ -8320,7 +8320,8 @@ td_api::object_ptr<td_api::Object> Td::do_static_request(const td_api::getTextEn
|
|||||||
return make_error(400, "Text must be encoded in UTF-8");
|
return make_error(400, "Text must be encoded in UTF-8");
|
||||||
}
|
}
|
||||||
auto text_entities = find_entities(request.text_, false, false);
|
auto text_entities = find_entities(request.text_, false, false);
|
||||||
return make_tl_object<td_api::textEntities>(get_text_entities_object(text_entities, false));
|
return make_tl_object<td_api::textEntities>(
|
||||||
|
get_text_entities_object(text_entities, false, std::numeric_limits<int32>::max()));
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::Object> Td::do_static_request(td_api::parseTextEntities &request) {
|
td_api::object_ptr<td_api::Object> Td::do_static_request(td_api::parseTextEntities &request) {
|
||||||
@ -8355,7 +8356,7 @@ td_api::object_ptr<td_api::Object> Td::do_static_request(td_api::parseTextEntiti
|
|||||||
}
|
}
|
||||||
|
|
||||||
return make_tl_object<td_api::formattedText>(std::move(request.text_),
|
return make_tl_object<td_api::formattedText>(std::move(request.text_),
|
||||||
get_text_entities_object(r_entities.ok(), false));
|
get_text_entities_object(r_entities.ok(), false, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::Object> Td::do_static_request(td_api::parseMarkdown &request) {
|
td_api::object_ptr<td_api::Object> Td::do_static_request(td_api::parseMarkdown &request) {
|
||||||
@ -8375,7 +8376,7 @@ td_api::object_ptr<td_api::Object> Td::do_static_request(td_api::parseMarkdown &
|
|||||||
|
|
||||||
auto parsed_text = parse_markdown_v3({std::move(request.text_->text_), std::move(entities)});
|
auto parsed_text = parse_markdown_v3({std::move(request.text_->text_), std::move(entities)});
|
||||||
fix_formatted_text(parsed_text.text, parsed_text.entities, true, true, true, true, true).ensure();
|
fix_formatted_text(parsed_text.text, parsed_text.entities, true, true, true, true, true).ensure();
|
||||||
return get_formatted_text_object(parsed_text, true);
|
return get_formatted_text_object(parsed_text, false, std::numeric_limits<int32>::max());
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::Object> Td::do_static_request(td_api::getMarkdownText &request) {
|
td_api::object_ptr<td_api::Object> Td::do_static_request(td_api::getMarkdownText &request) {
|
||||||
@ -8393,7 +8394,8 @@ td_api::object_ptr<td_api::Object> Td::do_static_request(td_api::getMarkdownText
|
|||||||
return make_error(400, status.error().message());
|
return make_error(400, status.error().message());
|
||||||
}
|
}
|
||||||
|
|
||||||
return get_formatted_text_object(get_markdown_v3({std::move(request.text_->text_), std::move(entities)}), true);
|
return get_formatted_text_object(get_markdown_v3({std::move(request.text_->text_), std::move(entities)}), false,
|
||||||
|
std::numeric_limits<int32>::max());
|
||||||
}
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::Object> Td::do_static_request(const td_api::getFileMimeType &request) {
|
td_api::object_ptr<td_api::Object> Td::do_static_request(const td_api::getFileMimeType &request) {
|
||||||
|
@ -42,7 +42,7 @@ class TermsOfService {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return td_api::make_object<td_api::termsOfService>(get_formatted_text_object(text_, true), min_user_age_,
|
return td_api::make_object<td_api::termsOfService>(get_formatted_text_object(text_, true, -1), min_user_age_,
|
||||||
show_popup_);
|
show_popup_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1254,11 +1254,16 @@ tl_object_ptr<td_api::webPage> WebPagesManager::get_web_page_object(WebPageId we
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32 max_media_timestamp = -1;
|
||||||
|
if (web_page->document.type == Document::Type::Audio || web_page->document.type == Document::Type::Video ||
|
||||||
|
web_page->document.type == Document::Type::VideoNote || web_page->document.type == Document::Type::VoiceNote) {
|
||||||
|
max_media_timestamp = web_page->duration == 0 ? std::numeric_limits<int32>::max() : web_page->duration;
|
||||||
|
}
|
||||||
return make_tl_object<td_api::webPage>(
|
return make_tl_object<td_api::webPage>(
|
||||||
web_page->url, web_page->display_url, web_page->type, web_page->site_name, web_page->title,
|
web_page->url, web_page->display_url, web_page->type, web_page->site_name, web_page->title,
|
||||||
get_formatted_text_object(description, true), get_photo_object(td_->file_manager_.get(), web_page->photo),
|
get_formatted_text_object(description, true, max_media_timestamp),
|
||||||
web_page->embed_url, web_page->embed_type, web_page->embed_dimensions.width, web_page->embed_dimensions.height,
|
get_photo_object(td_->file_manager_.get(), web_page->photo), web_page->embed_url, web_page->embed_type,
|
||||||
web_page->duration, web_page->author,
|
web_page->embed_dimensions.width, web_page->embed_dimensions.height, web_page->duration, web_page->author,
|
||||||
web_page->document.type == Document::Type::Animation
|
web_page->document.type == Document::Type::Animation
|
||||||
? td_->animations_manager_->get_animation_object(web_page->document.file_id, "get_web_page_object")
|
? td_->animations_manager_->get_animation_object(web_page->document.file_id, "get_web_page_object")
|
||||||
: nullptr,
|
: nullptr,
|
||||||
|
Loading…
Reference in New Issue
Block a user