Make PhotoSizeSource constructors named.

This commit is contained in:
levlam 2021-10-27 16:52:22 +03:00
parent 93f2436f0e
commit 6f34c5c6a1
9 changed files with 99 additions and 80 deletions

View File

@ -270,9 +270,9 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo
if (document_type != Document::Type::VoiceNote) { if (document_type != Document::Type::VoiceNote) {
for (auto &thumb : document->thumbs_) { for (auto &thumb : document->thumbs_) {
auto photo_size = auto photo_size = get_photo_size(td_->file_manager_.get(), PhotoSizeSource::thumbnail(FileType::Thumbnail, 0),
get_photo_size(td_->file_manager_.get(), {FileType::Thumbnail, 0}, id, access_hash, file_reference, id, access_hash, file_reference, DcId::create(dc_id), owner_dialog_id,
DcId::create(dc_id), owner_dialog_id, std::move(thumb), thumbnail_format); std::move(thumb), thumbnail_format);
if (photo_size.get_offset() == 0) { if (photo_size.get_offset() == 0) {
if (!thumbnail.file_id.is_valid()) { if (!thumbnail.file_id.is_valid()) {
thumbnail = std::move(photo_size.get<0>()); thumbnail = std::move(photo_size.get<0>());
@ -284,8 +284,9 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo
} }
for (auto &thumb : document->video_thumbs_) { for (auto &thumb : document->video_thumbs_) {
if (thumb->type_ == "v") { if (thumb->type_ == "v") {
animated_thumbnail = get_animation_size(td_->file_manager_.get(), {FileType::Thumbnail, 0}, id, access_hash, animated_thumbnail =
file_reference, DcId::create(dc_id), owner_dialog_id, std::move(thumb)); get_animation_size(td_->file_manager_.get(), PhotoSizeSource::thumbnail(FileType::Thumbnail, 0), id,
access_hash, file_reference, DcId::create(dc_id), owner_dialog_id, std::move(thumb));
if (animated_thumbnail.file_id.is_valid()) { if (animated_thumbnail.file_id.is_valid()) {
break; break;
} }

View File

@ -3159,7 +3159,8 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
old_file_view.main_remote_location().get_access_hash() != old_file_view.main_remote_location().get_access_hash() !=
new_file_view.remote_location().get_access_hash()) { new_file_view.remote_location().get_access_hash()) {
FileId file_id = td->file_manager_->register_remote( FileId file_id = td->file_manager_->register_remote(
FullRemoteFileLocation({FileType::Photo, 'i'}, new_file_view.remote_location().get_id(), FullRemoteFileLocation(PhotoSizeSource::thumbnail(FileType::Photo, 'i'),
new_file_view.remote_location().get_id(),
new_file_view.remote_location().get_access_hash(), DcId::invalid(), new_file_view.remote_location().get_access_hash(), DcId::invalid(),
new_file_view.remote_location().get_file_reference().str()), new_file_view.remote_location().get_file_reference().str()),
FileLocationSource::FromServer, dialog_id, old_photo->photos.back().size, 0, ""); FileLocationSource::FromServer, dialog_id, old_photo->photos.back().size, 0, "");

View File

@ -162,12 +162,12 @@ ProfilePhoto get_profile_photo(FileManager *file_manager, UserId user_id, int64
result.has_animation = (profile_photo->flags_ & telegram_api::userProfilePhoto::HAS_VIDEO_MASK) != 0; result.has_animation = (profile_photo->flags_ & telegram_api::userProfilePhoto::HAS_VIDEO_MASK) != 0;
result.id = profile_photo->photo_id_; result.id = profile_photo->photo_id_;
result.minithumbnail = profile_photo->stripped_thumb_.as_slice().str(); result.minithumbnail = profile_photo->stripped_thumb_.as_slice().str();
result.small_file_id = result.small_file_id = register_photo(
register_photo(file_manager, {DialogId(user_id), user_access_hash, false}, result.id, 0 /*access_hash*/, file_manager, PhotoSizeSource::dialog_photo(DialogId(user_id), user_access_hash, false), result.id,
"" /*file_reference*/, DialogId(), 0 /*file_size*/, dc_id, PhotoFormat::Jpeg); 0 /*access_hash*/, "" /*file_reference*/, DialogId(), 0 /*file_size*/, dc_id, PhotoFormat::Jpeg);
result.big_file_id = result.big_file_id = register_photo(
register_photo(file_manager, {DialogId(user_id), user_access_hash, true}, result.id, 0 /*access_hash*/, file_manager, PhotoSizeSource::dialog_photo(DialogId(user_id), user_access_hash, true), result.id,
"" /*file_reference*/, DialogId(), 0 /*file_size*/, dc_id, PhotoFormat::Jpeg); 0 /*access_hash*/, "" /*file_reference*/, DialogId(), 0 /*file_size*/, dc_id, PhotoFormat::Jpeg);
break; break;
} }
default: default:
@ -223,10 +223,12 @@ DialogPhoto get_dialog_photo(FileManager *file_manager, DialogId dialog_id, int6
auto dc_id = DcId::create(chat_photo->dc_id_); auto dc_id = DcId::create(chat_photo->dc_id_);
result.has_animation = (chat_photo->flags_ & telegram_api::chatPhoto::HAS_VIDEO_MASK) != 0; result.has_animation = (chat_photo->flags_ & telegram_api::chatPhoto::HAS_VIDEO_MASK) != 0;
result.minithumbnail = chat_photo->stripped_thumb_.as_slice().str(); result.minithumbnail = chat_photo->stripped_thumb_.as_slice().str();
result.small_file_id = register_photo(file_manager, {dialog_id, dialog_access_hash, false}, chat_photo->photo_id_, result.small_file_id =
0, "", DialogId(), 0, dc_id, PhotoFormat::Jpeg); register_photo(file_manager, PhotoSizeSource::dialog_photo(dialog_id, dialog_access_hash, false),
result.big_file_id = register_photo(file_manager, {dialog_id, dialog_access_hash, true}, chat_photo->photo_id_, 0, chat_photo->photo_id_, 0, "", DialogId(), 0, dc_id, PhotoFormat::Jpeg);
"", DialogId(), 0, dc_id, PhotoFormat::Jpeg); result.big_file_id =
register_photo(file_manager, PhotoSizeSource::dialog_photo(dialog_id, dialog_access_hash, true),
chat_photo->photo_id_, 0, "", DialogId(), 0, dc_id, PhotoFormat::Jpeg);
break; break;
} }
@ -293,7 +295,7 @@ ProfilePhoto as_profile_photo(FileManager *file_manager, UserId user_id, int64 u
auto remote = file_view.remote_location(); auto remote = file_view.remote_location();
CHECK(remote.is_photo()); CHECK(remote.is_photo());
CHECK(!remote.is_web()); CHECK(!remote.is_web());
remote.set_source({DialogId(user_id), user_access_hash, is_big}); remote.set_source(PhotoSizeSource::dialog_photo(DialogId(user_id), user_access_hash, is_big));
return file_manager->register_remote(std::move(remote), FileLocationSource::FromServer, DialogId(), return file_manager->register_remote(std::move(remote), FileLocationSource::FromServer, DialogId(),
file_view.size(), file_view.expected_size(), file_view.remote_name()); file_view.size(), file_view.expected_size(), file_view.remote_name());
}; };
@ -335,7 +337,8 @@ PhotoSize get_secret_thumbnail_photo_size(FileManager *file_manager, BufferSlice
auto photo_id = -(Random::secure_int64() & std::numeric_limits<int64>::max()); auto photo_id = -(Random::secure_int64() & std::numeric_limits<int64>::max());
res.file_id = file_manager->register_remote( res.file_id = file_manager->register_remote(
FullRemoteFileLocation(PhotoSizeSource(FileType::EncryptedThumbnail, 't'), photo_id, 0, dc_id, string()), FullRemoteFileLocation(PhotoSizeSource::thumbnail(FileType::EncryptedThumbnail, 't'), photo_id, 0, dc_id,
string()),
FileLocationSource::FromServer, owner_dialog_id, res.size, 0, FileLocationSource::FromServer, owner_dialog_id, res.size, 0,
PSTRING() << static_cast<uint64>(photo_id) << ".jpg"); PSTRING() << static_cast<uint64>(photo_id) << ".jpg");
file_manager->set_content(res.file_id, std::move(bytes)); file_manager->set_content(res.file_id, std::move(bytes));
@ -708,9 +711,9 @@ Photo get_photo(FileManager *file_manager, tl_object_ptr<telegram_api::photo> &&
DcId dc_id = DcId::create(photo->dc_id_); DcId dc_id = DcId::create(photo->dc_id_);
for (auto &size_ptr : photo->sizes_) { for (auto &size_ptr : photo->sizes_) {
auto photo_size = get_photo_size(file_manager, {FileType::Photo, 0}, photo->id_, photo->access_hash_, auto photo_size = get_photo_size(file_manager, PhotoSizeSource::thumbnail(FileType::Photo, 0), photo->id_,
photo->file_reference_.as_slice().str(), dc_id, owner_dialog_id, photo->access_hash_, photo->file_reference_.as_slice().str(), dc_id,
std::move(size_ptr), PhotoFormat::Jpeg); owner_dialog_id, std::move(size_ptr), PhotoFormat::Jpeg);
if (photo_size.get_offset() == 0) { if (photo_size.get_offset() == 0) {
PhotoSize &size = photo_size.get<0>(); PhotoSize &size = photo_size.get<0>();
if (size.type == 0 || size.type == 't' || size.type == 'i' || size.type == 'u' || size.type == 'v') { if (size.type == 0 || size.type == 't' || size.type == 'i' || size.type == 'u' || size.type == 'v') {
@ -724,9 +727,9 @@ Photo get_photo(FileManager *file_manager, tl_object_ptr<telegram_api::photo> &&
} }
for (auto &size_ptr : photo->video_sizes_) { for (auto &size_ptr : photo->video_sizes_) {
auto animation = auto animation = get_animation_size(file_manager, PhotoSizeSource::thumbnail(FileType::Photo, 0), photo->id_,
get_animation_size(file_manager, {FileType::Photo, 0}, photo->id_, photo->access_hash_, photo->access_hash_, photo->file_reference_.as_slice().str(), dc_id,
photo->file_reference_.as_slice().str(), dc_id, owner_dialog_id, std::move(size_ptr)); owner_dialog_id, std::move(size_ptr));
if (animation.type != 0 && animation.dimensions.width == animation.dimensions.height) { if (animation.type != 0 && animation.dimensions.width == animation.dimensions.height) {
res.animations.push_back(std::move(animation)); res.animations.push_back(std::move(animation));
} }

View File

@ -218,7 +218,7 @@ static bool operator==(const PhotoSizeSource::StickerSetThumbnailVersion &lhs,
} }
bool operator==(const PhotoSizeSource &lhs, const PhotoSizeSource &rhs) { bool operator==(const PhotoSizeSource &lhs, const PhotoSizeSource &rhs) {
return lhs.variant == rhs.variant; return lhs.variant_ == rhs.variant_;
} }
bool operator!=(const PhotoSizeSource &lhs, const PhotoSizeSource &rhs) { bool operator!=(const PhotoSizeSource &lhs, const PhotoSizeSource &rhs) {

View File

@ -8,15 +8,12 @@
#include "td/telegram/DialogId.h" #include "td/telegram/DialogId.h"
#include "td/telegram/files/FileType.h" #include "td/telegram/files/FileType.h"
#include "td/telegram/telegram_api.h" #include "td/telegram/telegram_api.h"
#include "td/utils/common.h" #include "td/utils/common.h"
#include "td/utils/StringBuilder.h" #include "td/utils/StringBuilder.h"
#include "td/utils/Variant.h" #include "td/utils/Variant.h"
#include <cstddef>
namespace td { namespace td {
struct PhotoSizeSource { struct PhotoSizeSource {
@ -141,37 +138,47 @@ struct PhotoSizeSource {
}; };
PhotoSizeSource() = default; PhotoSizeSource() = default;
PhotoSizeSource(FileType file_type, int32 thumbnail_type) : variant(Thumbnail(file_type, thumbnail_type)) {
static PhotoSizeSource thumbnail(FileType file_type, int32 thumbnail_type) {
return PhotoSizeSource(Thumbnail(file_type, thumbnail_type));
} }
PhotoSizeSource(DialogId dialog_id, int64 dialog_access_hash, bool is_big) {
static PhotoSizeSource dialog_photo(DialogId dialog_id, int64 dialog_access_hash, bool is_big) {
if (is_big) { if (is_big) {
variant = DialogPhotoBig(dialog_id, dialog_access_hash); return PhotoSizeSource(DialogPhotoBig(dialog_id, dialog_access_hash));
} else { } else {
variant = DialogPhotoSmall(dialog_id, dialog_access_hash); return PhotoSizeSource(DialogPhotoSmall(dialog_id, dialog_access_hash));
} }
} }
PhotoSizeSource(int64 sticker_set_id, int64 sticker_set_access_hash)
: variant(StickerSetThumbnail(sticker_set_id, sticker_set_access_hash)) { static PhotoSizeSource sticker_set_thumbnail(int64 sticker_set_id, int64 sticker_set_access_hash) {
return PhotoSizeSource(StickerSetThumbnail(sticker_set_id, sticker_set_access_hash));
} }
PhotoSizeSource(std::nullptr_t, int64 volume_id, int32 local_id, int64 secret)
: variant(FullLegacy(volume_id, local_id, secret)) { static PhotoSizeSource full_legacy(int64 volume_id, int32 local_id, int64 secret) {
return PhotoSizeSource(FullLegacy(volume_id, local_id, secret));
} }
PhotoSizeSource(DialogId dialog_id, int64 dialog_access_hash, bool is_big, int64 volume_id, int32 local_id) {
static PhotoSizeSource dialog_photo_legacy(DialogId dialog_id, int64 dialog_access_hash, bool is_big, int64 volume_id,
int32 local_id) {
if (is_big) { if (is_big) {
variant = DialogPhotoBigLegacy(dialog_id, dialog_access_hash, volume_id, local_id); return PhotoSizeSource(DialogPhotoBigLegacy(dialog_id, dialog_access_hash, volume_id, local_id));
} else { } else {
variant = DialogPhotoSmallLegacy(dialog_id, dialog_access_hash, volume_id, local_id); return PhotoSizeSource(DialogPhotoSmallLegacy(dialog_id, dialog_access_hash, volume_id, local_id));
} }
} }
PhotoSizeSource(int64 sticker_set_id, int64 sticker_set_access_hash, int64 volume_id, int32 local_id)
: variant(StickerSetThumbnailLegacy(sticker_set_id, sticker_set_access_hash, volume_id, local_id)) { static PhotoSizeSource sticker_set_thumbnail_legacy(int64 sticker_set_id, int64 sticker_set_access_hash,
int64 volume_id, int32 local_id) {
return PhotoSizeSource(StickerSetThumbnailLegacy(sticker_set_id, sticker_set_access_hash, volume_id, local_id));
} }
PhotoSizeSource(int64 sticker_set_id, int64 sticker_set_access_hash, int32 version)
: variant(StickerSetThumbnailVersion(sticker_set_id, sticker_set_access_hash, version)) { static PhotoSizeSource sticker_set_thumbnail(int64 sticker_set_id, int64 sticker_set_access_hash, int32 version) {
return PhotoSizeSource(StickerSetThumbnailVersion(sticker_set_id, sticker_set_access_hash, version));
} }
Type get_type() const { Type get_type() const {
auto offset = variant.get_offset(); auto offset = variant_.get_offset();
CHECK(offset >= 0); CHECK(offset >= 0);
return static_cast<Type>(offset); return static_cast<Type>(offset);
} }
@ -179,58 +186,58 @@ struct PhotoSizeSource {
FileType get_file_type() const; FileType get_file_type() const;
Thumbnail &thumbnail() { Thumbnail &thumbnail() {
return variant.get<Thumbnail>(); return variant_.get<Thumbnail>();
} }
const Legacy &legacy() const { const Legacy &legacy() const {
return variant.get<Legacy>(); return variant_.get<Legacy>();
} }
const Thumbnail &thumbnail() const { const Thumbnail &thumbnail() const {
return variant.get<Thumbnail>(); return variant_.get<Thumbnail>();
} }
const DialogPhoto &dialog_photo() const { const DialogPhoto &dialog_photo() const {
switch (variant.get_offset()) { switch (variant_.get_offset()) {
case 2: case 2:
return variant.get<DialogPhotoSmall>(); return variant_.get<DialogPhotoSmall>();
case 3: case 3:
return variant.get<DialogPhotoBig>(); return variant_.get<DialogPhotoBig>();
case 6: case 6:
return variant.get<DialogPhotoSmallLegacy>(); return variant_.get<DialogPhotoSmallLegacy>();
case 7: case 7:
return variant.get<DialogPhotoBigLegacy>(); return variant_.get<DialogPhotoBigLegacy>();
default: default:
UNREACHABLE(); UNREACHABLE();
return variant.get<DialogPhotoSmall>(); return variant_.get<DialogPhotoSmall>();
} }
} }
const StickerSetThumbnail &sticker_set_thumbnail() const { const StickerSetThumbnail &sticker_set_thumbnail() const {
switch (variant.get_offset()) { switch (variant_.get_offset()) {
case 4: case 4:
return variant.get<StickerSetThumbnail>(); return variant_.get<StickerSetThumbnail>();
case 8: case 8:
return variant.get<StickerSetThumbnailLegacy>(); return variant_.get<StickerSetThumbnailLegacy>();
case 9: case 9:
return variant.get<StickerSetThumbnailVersion>(); return variant_.get<StickerSetThumbnailVersion>();
default: default:
UNREACHABLE(); UNREACHABLE();
return variant.get<StickerSetThumbnail>(); return variant_.get<StickerSetThumbnail>();
} }
} }
const FullLegacy &full_legacy() const { const FullLegacy &full_legacy() const {
return variant.get<FullLegacy>(); return variant_.get<FullLegacy>();
} }
const DialogPhotoLegacy &dialog_photo_legacy() const { const DialogPhotoLegacy &dialog_photo_legacy() const {
if (variant.get_offset() == 6) { if (variant_.get_offset() == 6) {
return variant.get<DialogPhotoSmallLegacy>(); return variant_.get<DialogPhotoSmallLegacy>();
} else { } else {
return variant.get<DialogPhotoBigLegacy>(); return variant_.get<DialogPhotoBigLegacy>();
} }
} }
const StickerSetThumbnailLegacy &sticker_set_thumbnail_legacy() const { const StickerSetThumbnailLegacy &sticker_set_thumbnail_legacy() const {
return variant.get<StickerSetThumbnailLegacy>(); return variant_.get<StickerSetThumbnailLegacy>();
} }
const StickerSetThumbnailVersion &sticker_set_thumbnail_version() const { const StickerSetThumbnailVersion &sticker_set_thumbnail_version() const {
return variant.get<StickerSetThumbnailVersion>(); return variant_.get<StickerSetThumbnailVersion>();
} }
// returns unique representation of the source // returns unique representation of the source
@ -249,7 +256,11 @@ struct PhotoSizeSource {
private: private:
Variant<Legacy, Thumbnail, DialogPhotoSmall, DialogPhotoBig, StickerSetThumbnail, FullLegacy, DialogPhotoSmallLegacy, Variant<Legacy, Thumbnail, DialogPhotoSmall, DialogPhotoBig, StickerSetThumbnail, FullLegacy, DialogPhotoSmallLegacy,
DialogPhotoBigLegacy, StickerSetThumbnailLegacy, StickerSetThumbnailVersion> DialogPhotoBigLegacy, StickerSetThumbnailLegacy, StickerSetThumbnailVersion>
variant; variant_;
template <class T>
explicit PhotoSizeSource(const T &variant) : variant_(variant) {
}
}; };
bool operator==(const PhotoSizeSource &lhs, const PhotoSizeSource &rhs); bool operator==(const PhotoSizeSource &lhs, const PhotoSizeSource &rhs);

View File

@ -180,12 +180,12 @@ void parse(PhotoSizeSource::StickerSetThumbnailVersion &source, ParserT &parser)
template <class StorerT> template <class StorerT>
void PhotoSizeSource::store(StorerT &storer) const { void PhotoSizeSource::store(StorerT &storer) const {
td::store(variant, storer); td::store(variant_, storer);
} }
template <class ParserT> template <class ParserT>
void PhotoSizeSource::parse(ParserT &parser) { void PhotoSizeSource::parse(ParserT &parser) {
td::parse(variant, parser); td::parse(variant_, parser);
} }
} // namespace td } // namespace td

View File

@ -2164,9 +2164,9 @@ std::pair<int64, FileId> StickersManager::on_get_sticker_document(
string minithumbnail; string minithumbnail;
auto thumbnail_format = has_webp_thumbnail(document->thumbs_) ? PhotoFormat::Webp : PhotoFormat::Jpeg; auto thumbnail_format = has_webp_thumbnail(document->thumbs_) ? PhotoFormat::Webp : PhotoFormat::Jpeg;
for (auto &thumb : document->thumbs_) { for (auto &thumb : document->thumbs_) {
auto photo_size = get_photo_size(td_->file_manager_.get(), {FileType::Thumbnail, 0}, document_id, auto photo_size = get_photo_size(td_->file_manager_.get(), PhotoSizeSource::thumbnail(FileType::Thumbnail, 0),
document->access_hash_, document->file_reference_.as_slice().str(), dc_id, document_id, document->access_hash_, document->file_reference_.as_slice().str(),
DialogId(), std::move(thumb), thumbnail_format); dc_id, DialogId(), std::move(thumb), thumbnail_format);
if (photo_size.get_offset() == 0) { if (photo_size.get_offset() == 0) {
if (!thumbnail.file_id.is_valid()) { if (!thumbnail.file_id.is_valid()) {
thumbnail = std::move(photo_size.get<0>()); thumbnail = std::move(photo_size.get<0>());
@ -2698,9 +2698,11 @@ StickerSetId StickersManager::on_get_sticker_set(tl_object_ptr<telegram_api::sti
PhotoSize thumbnail; PhotoSize thumbnail;
string minithumbnail; string minithumbnail;
for (auto &thumb : set->thumbs_) { for (auto &thumb : set->thumbs_) {
auto photo_size = get_photo_size(td_->file_manager_.get(), {set_id.get(), s->access_hash, set->thumb_version_}, 0, auto photo_size =
0, "", DcId::create(set->thumb_dc_id_), DialogId(), std::move(thumb), get_photo_size(td_->file_manager_.get(),
is_animated ? PhotoFormat::Tgs : PhotoFormat::Webp); PhotoSizeSource::sticker_set_thumbnail(set_id.get(), s->access_hash, set->thumb_version_), 0, 0,
"", DcId::create(set->thumb_dc_id_), DialogId(), std::move(thumb),
is_animated ? PhotoFormat::Tgs : PhotoFormat::Webp);
if (photo_size.get_offset() == 0) { if (photo_size.get_offset() == 0) {
if (!thumbnail.file_id.is_valid()) { if (!thumbnail.file_id.is_valid()) {
thumbnail = std::move(photo_size.get<0>()); thumbnail = std::move(photo_size.get<0>());

View File

@ -325,11 +325,11 @@ class FullRemoteFileLocation {
return photo().source_; return photo().source_;
case LocationType::Common: case LocationType::Common:
case LocationType::Web: case LocationType::Web:
return PhotoSizeSource(nullptr, 0, 0, 0); return PhotoSizeSource::full_legacy(0, 0, 0);
case LocationType::None: case LocationType::None:
default: default:
UNREACHABLE(); UNREACHABLE();
return PhotoSizeSource(nullptr, 0, 0, 0); return PhotoSizeSource::full_legacy(0, 0, 0);
} }
} }

View File

@ -66,7 +66,7 @@ void PhotoRemoteFileLocation::parse(ParserT &parser) {
int64 secret; int64 secret;
parse(secret, parser); parse(secret, parser);
parse(local_id, parser); parse(local_id, parser);
source = PhotoSizeSource(nullptr, volume_id, local_id, secret); source = PhotoSizeSource::full_legacy(volume_id, local_id, secret);
} }
if (parser.get_error() != nullptr) { if (parser.get_error() != nullptr) {
@ -75,7 +75,7 @@ void PhotoRemoteFileLocation::parse(ParserT &parser) {
switch (source.get_type()) { switch (source.get_type()) {
case PhotoSizeSource::Type::Legacy: case PhotoSizeSource::Type::Legacy:
source_ = PhotoSizeSource(nullptr, volume_id, local_id, source.legacy().secret); source_ = PhotoSizeSource::full_legacy(volume_id, local_id, source.legacy().secret);
break; break;
case PhotoSizeSource::Type::FullLegacy: case PhotoSizeSource::Type::FullLegacy:
case PhotoSizeSource::Type::Thumbnail: case PhotoSizeSource::Type::Thumbnail:
@ -85,13 +85,14 @@ void PhotoRemoteFileLocation::parse(ParserT &parser) {
case PhotoSizeSource::Type::DialogPhotoBig: { case PhotoSizeSource::Type::DialogPhotoBig: {
auto &dialog_photo = source.dialog_photo(); auto &dialog_photo = source.dialog_photo();
bool is_big = source.get_type() == PhotoSizeSource::Type::DialogPhotoBig; bool is_big = source.get_type() == PhotoSizeSource::Type::DialogPhotoBig;
source_ = PhotoSizeSource(dialog_photo.dialog_id, dialog_photo.dialog_access_hash, is_big, volume_id, local_id); source_ = PhotoSizeSource::dialog_photo_legacy(dialog_photo.dialog_id, dialog_photo.dialog_access_hash, is_big,
volume_id, local_id);
break; break;
} }
case PhotoSizeSource::Type::StickerSetThumbnail: { case PhotoSizeSource::Type::StickerSetThumbnail: {
auto &sticker_set_thumbnail = source.sticker_set_thumbnail(); auto &sticker_set_thumbnail = source.sticker_set_thumbnail();
source_ = PhotoSizeSource(sticker_set_thumbnail.sticker_set_id, sticker_set_thumbnail.sticker_set_access_hash, source_ = PhotoSizeSource::sticker_set_thumbnail_legacy(
volume_id, local_id); sticker_set_thumbnail.sticker_set_id, sticker_set_thumbnail.sticker_set_access_hash, volume_id, local_id);
break; break;
} }
default: default: