diff --git a/td/telegram/DocumentsManager.cpp b/td/telegram/DocumentsManager.cpp index af952d5dc..93ca3b846 100644 --- a/td/telegram/DocumentsManager.cpp +++ b/td/telegram/DocumentsManager.cpp @@ -348,7 +348,7 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo premium_animation_file_id = register_photo_size(td_->file_manager_.get(), PhotoSizeSource::thumbnail(FileType::Thumbnail, 'f'), id, access_hash, file_reference, owner_dialog_id, video_size->size_, DcId::create(dc_id), - get_sticker_format_photo_format(sticker_format)); + get_sticker_format_photo_format(sticker_format), "on_get_document"); } } } diff --git a/td/telegram/Photo.cpp b/td/telegram/Photo.cpp index 91cee5e7a..7e42af55a 100644 --- a/td/telegram/Photo.cpp +++ b/td/telegram/Photo.cpp @@ -54,12 +54,14 @@ ProfilePhoto get_profile_photo(FileManager *file_manager, UserId user_id, int64 result.is_personal = profile_photo->personal_; result.id = profile_photo->photo_id_; result.minithumbnail = profile_photo->stripped_thumb_.as_slice().str(); - result.small_file_id = register_photo_size( - file_manager, PhotoSizeSource::dialog_photo(DialogId(user_id), user_access_hash, false), result.id, - 0 /*access_hash*/, "" /*file_reference*/, DialogId(), 0 /*file_size*/, dc_id, PhotoFormat::Jpeg); - result.big_file_id = register_photo_size( - file_manager, PhotoSizeSource::dialog_photo(DialogId(user_id), user_access_hash, true), result.id, - 0 /*access_hash*/, "" /*file_reference*/, DialogId(), 0 /*file_size*/, dc_id, PhotoFormat::Jpeg); + result.small_file_id = + register_photo_size(file_manager, PhotoSizeSource::dialog_photo(DialogId(user_id), user_access_hash, false), + result.id, 0 /*access_hash*/, "" /*file_reference*/, DialogId(), 0 /*file_size*/, dc_id, + PhotoFormat::Jpeg, "get_profile_photo small"); + result.big_file_id = + register_photo_size(file_manager, PhotoSizeSource::dialog_photo(DialogId(user_id), user_access_hash, true), + result.id, 0 /*access_hash*/, "" /*file_reference*/, DialogId(), 0 /*file_size*/, dc_id, + PhotoFormat::Jpeg, "get_profile_photo big"); break; } default: @@ -107,12 +109,12 @@ DialogPhoto get_dialog_photo(FileManager *file_manager, DialogId dialog_id, int6 result.has_animation = chat_photo->has_video_; result.is_personal = false; result.minithumbnail = chat_photo->stripped_thumb_.as_slice().str(); - result.small_file_id = - register_photo_size(file_manager, PhotoSizeSource::dialog_photo(dialog_id, dialog_access_hash, false), - chat_photo->photo_id_, 0, "", DialogId(), 0, dc_id, PhotoFormat::Jpeg); - result.big_file_id = - register_photo_size(file_manager, PhotoSizeSource::dialog_photo(dialog_id, dialog_access_hash, true), - chat_photo->photo_id_, 0, "", DialogId(), 0, dc_id, PhotoFormat::Jpeg); + result.small_file_id = register_photo_size( + file_manager, PhotoSizeSource::dialog_photo(dialog_id, dialog_access_hash, false), chat_photo->photo_id_, 0, + "", DialogId(), 0, dc_id, PhotoFormat::Jpeg, "get_dialog_photo small"); + result.big_file_id = register_photo_size( + file_manager, PhotoSizeSource::dialog_photo(dialog_id, dialog_access_hash, true), chat_photo->photo_id_, 0, + "", DialogId(), 0, dc_id, PhotoFormat::Jpeg, "get_dialog_photo big"); break; } diff --git a/td/telegram/PhotoSize.cpp b/td/telegram/PhotoSize.cpp index c705f7f8e..5bf53fcd3 100644 --- a/td/telegram/PhotoSize.cpp +++ b/td/telegram/PhotoSize.cpp @@ -123,10 +123,10 @@ static StringBuilder &operator<<(StringBuilder &string_builder, PhotoFormat form FileId register_photo_size(FileManager *file_manager, const PhotoSizeSource &source, int64 id, int64 access_hash, string file_reference, DialogId owner_dialog_id, int32 file_size, DcId dc_id, - PhotoFormat format) { - LOG(DEBUG) << "Receive " << format << " photo " << id << " of type " << source.get_file_type("register_photo_size") - << " from " << dc_id; - auto suggested_name = PSTRING() << source.get_unique_name(id, "register_photo_size") << '.' << format; + PhotoFormat format, const char *call_source) { + LOG(DEBUG) << "Receive " << format << " photo " << id << " of type " << source.get_file_type(call_source) << " from " + << dc_id << " from " << call_source; + auto suggested_name = PSTRING() << source.get_unique_name(id, call_source) << '.' << format; auto file_location_source = owner_dialog_id.get_type() == DialogType::SecretChat ? FileLocationSource::FromUser : FileLocationSource::FromServer; return file_manager->register_remote( @@ -250,7 +250,7 @@ Variant get_photo_size(FileManager *file_manager, PhotoSizeSo } res.file_id = register_photo_size(file_manager, source, id, access_hash, std::move(file_reference), owner_dialog_id, - res.size, dc_id, format); + res.size, dc_id, format, "get_photo_size"); if (!content.empty()) { file_manager->set_content(res.file_id, std::move(content)); @@ -287,7 +287,7 @@ AnimationSize get_animation_size(Td *td, PhotoSizeSource source, int64 id, int64 } result.file_id = register_photo_size(td->file_manager_.get(), source, id, access_hash, std::move(file_reference), - owner_dialog_id, result.size, dc_id, PhotoFormat::Mpeg4); + owner_dialog_id, result.size, dc_id, PhotoFormat::Mpeg4, "get_animation_size"); return result; } diff --git a/td/telegram/PhotoSize.h b/td/telegram/PhotoSize.h index 57db931ab..6b2c71928 100644 --- a/td/telegram/PhotoSize.h +++ b/td/telegram/PhotoSize.h @@ -45,7 +45,7 @@ td_api::object_ptr get_minithumbnail_object(const string FileId register_photo_size(FileManager *file_manager, const PhotoSizeSource &source, int64 id, int64 access_hash, string file_reference, DialogId owner_dialog_id, int32 file_size, DcId dc_id, - PhotoFormat format); + PhotoFormat format, const char *call_source); PhotoSize get_secret_thumbnail_photo_size(FileManager *file_manager, BufferSlice bytes, DialogId owner_dialog_id, int32 width, int32 height); diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index d8798d5a4..40bfbc288 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -3162,10 +3162,10 @@ std::pair StickersManager::on_get_sticker_document(tl_object_ptr< auto video_size = move_tl_object_as(thumbnail_ptr); if (video_size->type_ == "f") { if (!premium_animation_file_id.is_valid()) { - premium_animation_file_id = - register_photo_size(td_->file_manager_.get(), PhotoSizeSource::thumbnail(FileType::Thumbnail, 'f'), - document_id, document->access_hash_, document->file_reference_.as_slice().str(), - DialogId(), video_size->size_, dc_id, get_sticker_format_photo_format(format)); + premium_animation_file_id = register_photo_size( + td_->file_manager_.get(), PhotoSizeSource::thumbnail(FileType::Thumbnail, 'f'), document_id, + document->access_hash_, document->file_reference_.as_slice().str(), DialogId(), video_size->size_, dc_id, + get_sticker_format_photo_format(format), "on_get_sticker_document"); } } }