diff --git a/td/telegram/Document.cpp b/td/telegram/Document.cpp index 12150cf32..5e73c34c8 100644 --- a/td/telegram/Document.cpp +++ b/td/telegram/Document.cpp @@ -15,6 +15,7 @@ #include "td/telegram/VideosManager.h" #include "td/utils/algorithm.h" +#include "Document.hpp" namespace td { @@ -36,24 +37,26 @@ void Document::append_file_ids(const Td *td, vector &file_ids) const { file_ids.push_back(file_id); - FileId thumbnail_file_id = [&] { - switch (type) { - case Type::Animation: - return td->animations_manager_->get_animation_thumbnail_file_id(file_id); - case Type::Audio: - return td->audios_manager_->get_audio_thumbnail_file_id(file_id); - case Type::General: - return td->documents_manager_->get_document_thumbnail_file_id(file_id); - case Type::Video: - return td->videos_manager_->get_video_thumbnail_file_id(file_id); - case Type::VideoNote: - return td->video_notes_manager_->get_video_note_thumbnail_file_id(file_id); - default: - return FileId(); + if (!G()->shared_config().get_option_boolean("disable_minithumbnails")) { + FileId thumbnail_file_id = [&] { + switch (type) { + case Type::Animation: + return td->animations_manager_->get_animation_thumbnail_file_id(file_id); + case Type::Audio: + return td->audios_manager_->get_audio_thumbnail_file_id(file_id); + case Type::General: + return td->documents_manager_->get_document_thumbnail_file_id(file_id); + case Type::Video: + return td->videos_manager_->get_video_thumbnail_file_id(file_id); + case Type::VideoNote: + return td->video_notes_manager_->get_video_note_thumbnail_file_id(file_id); + default: + return FileId(); + } + }(); + if (thumbnail_file_id.is_valid()) { + file_ids.push_back(thumbnail_file_id); } - }(); - if (thumbnail_file_id.is_valid()) { - file_ids.push_back(thumbnail_file_id); } FileId animated_thumbnail_file_id = [&] { diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 530dfdec3..0ce6c70f3 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -4943,34 +4943,36 @@ void update_message_content_file_id_remote(MessageContent *content, FileId file_ } FileId get_message_content_thumbnail_file_id(const MessageContent *content, const Td *td) { - switch (content->get_type()) { - case MessageContentType::Animation: - return td->animations_manager_->get_animation_thumbnail_file_id( - static_cast(content)->file_id); - case MessageContentType::Audio: - return td->audios_manager_->get_audio_thumbnail_file_id(static_cast(content)->file_id); - case MessageContentType::Document: - return td->documents_manager_->get_document_thumbnail_file_id( - static_cast(content)->file_id); - case MessageContentType::Photo: - for (auto &size : static_cast(content)->photo.photos) { - if (size.type == 't') { - return size.file_id; + if (!G()->shared_config().get_option_boolean("disable_minithumbnails")) { + switch (content->get_type()) { + case MessageContentType::Animation: + return td->animations_manager_->get_animation_thumbnail_file_id( + static_cast(content)->file_id); + case MessageContentType::Audio: + return td->audios_manager_->get_audio_thumbnail_file_id(static_cast(content)->file_id); + case MessageContentType::Document: + return td->documents_manager_->get_document_thumbnail_file_id( + static_cast(content)->file_id); + case MessageContentType::Photo: + for (auto &size : static_cast(content)->photo.photos) { + if (size.type == 't') { + return size.file_id; + } } - } - break; - case MessageContentType::Sticker: - return td->stickers_manager_->get_sticker_thumbnail_file_id( - static_cast(content)->file_id); - case MessageContentType::Video: - return td->videos_manager_->get_video_thumbnail_file_id(static_cast(content)->file_id); - case MessageContentType::VideoNote: - return td->video_notes_manager_->get_video_note_thumbnail_file_id( - static_cast(content)->file_id); - case MessageContentType::VoiceNote: - return FileId(); - default: - break; + break; + case MessageContentType::Sticker: + return td->stickers_manager_->get_sticker_thumbnail_file_id( + static_cast(content)->file_id); + case MessageContentType::Video: + return td->videos_manager_->get_video_thumbnail_file_id(static_cast(content)->file_id); + case MessageContentType::VideoNote: + return td->video_notes_manager_->get_video_note_thumbnail_file_id( + static_cast(content)->file_id); + case MessageContentType::VoiceNote: + return FileId(); + default: + break; + } } return FileId(); }