Add call_source to register_photo_size.
This commit is contained in:
parent
0dc9aac724
commit
e5cb2fa963
@ -348,7 +348,7 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo
|
|||||||
premium_animation_file_id =
|
premium_animation_file_id =
|
||||||
register_photo_size(td_->file_manager_.get(), PhotoSizeSource::thumbnail(FileType::Thumbnail, 'f'), 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),
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,12 +54,14 @@ ProfilePhoto get_profile_photo(FileManager *file_manager, UserId user_id, int64
|
|||||||
result.is_personal = profile_photo->personal_;
|
result.is_personal = profile_photo->personal_;
|
||||||
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 = register_photo_size(
|
result.small_file_id =
|
||||||
file_manager, PhotoSizeSource::dialog_photo(DialogId(user_id), user_access_hash, false), result.id,
|
register_photo_size(file_manager, PhotoSizeSource::dialog_photo(DialogId(user_id), user_access_hash, false),
|
||||||
0 /*access_hash*/, "" /*file_reference*/, DialogId(), 0 /*file_size*/, dc_id, PhotoFormat::Jpeg);
|
result.id, 0 /*access_hash*/, "" /*file_reference*/, DialogId(), 0 /*file_size*/, dc_id,
|
||||||
result.big_file_id = register_photo_size(
|
PhotoFormat::Jpeg, "get_profile_photo small");
|
||||||
file_manager, PhotoSizeSource::dialog_photo(DialogId(user_id), user_access_hash, true), result.id,
|
result.big_file_id =
|
||||||
0 /*access_hash*/, "" /*file_reference*/, DialogId(), 0 /*file_size*/, dc_id, PhotoFormat::Jpeg);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -107,12 +109,12 @@ DialogPhoto get_dialog_photo(FileManager *file_manager, DialogId dialog_id, int6
|
|||||||
result.has_animation = chat_photo->has_video_;
|
result.has_animation = chat_photo->has_video_;
|
||||||
result.is_personal = false;
|
result.is_personal = false;
|
||||||
result.minithumbnail = chat_photo->stripped_thumb_.as_slice().str();
|
result.minithumbnail = chat_photo->stripped_thumb_.as_slice().str();
|
||||||
result.small_file_id =
|
result.small_file_id = register_photo_size(
|
||||||
register_photo_size(file_manager, PhotoSizeSource::dialog_photo(dialog_id, dialog_access_hash, false),
|
file_manager, PhotoSizeSource::dialog_photo(dialog_id, dialog_access_hash, false), chat_photo->photo_id_, 0,
|
||||||
chat_photo->photo_id_, 0, "", DialogId(), 0, dc_id, PhotoFormat::Jpeg);
|
"", DialogId(), 0, dc_id, PhotoFormat::Jpeg, "get_dialog_photo small");
|
||||||
result.big_file_id =
|
result.big_file_id = register_photo_size(
|
||||||
register_photo_size(file_manager, PhotoSizeSource::dialog_photo(dialog_id, dialog_access_hash, true),
|
file_manager, PhotoSizeSource::dialog_photo(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, "get_dialog_photo big");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -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,
|
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,
|
string file_reference, DialogId owner_dialog_id, int32 file_size, DcId dc_id,
|
||||||
PhotoFormat format) {
|
PhotoFormat format, const char *call_source) {
|
||||||
LOG(DEBUG) << "Receive " << format << " photo " << id << " of type " << source.get_file_type("register_photo_size")
|
LOG(DEBUG) << "Receive " << format << " photo " << id << " of type " << source.get_file_type(call_source) << " from "
|
||||||
<< " from " << dc_id;
|
<< dc_id << " from " << call_source;
|
||||||
auto suggested_name = PSTRING() << source.get_unique_name(id, "register_photo_size") << '.' << format;
|
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
|
auto file_location_source = owner_dialog_id.get_type() == DialogType::SecretChat ? FileLocationSource::FromUser
|
||||||
: FileLocationSource::FromServer;
|
: FileLocationSource::FromServer;
|
||||||
return file_manager->register_remote(
|
return file_manager->register_remote(
|
||||||
@ -250,7 +250,7 @@ Variant<PhotoSize, string> 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.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()) {
|
if (!content.empty()) {
|
||||||
file_manager->set_content(res.file_id, std::move(content));
|
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),
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ td_api::object_ptr<td_api::minithumbnail> get_minithumbnail_object(const string
|
|||||||
|
|
||||||
FileId register_photo_size(FileManager *file_manager, const PhotoSizeSource &source, int64 id, int64 access_hash,
|
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,
|
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,
|
PhotoSize get_secret_thumbnail_photo_size(FileManager *file_manager, BufferSlice bytes, DialogId owner_dialog_id,
|
||||||
int32 width, int32 height);
|
int32 width, int32 height);
|
||||||
|
@ -3162,10 +3162,10 @@ std::pair<int64, FileId> StickersManager::on_get_sticker_document(tl_object_ptr<
|
|||||||
auto video_size = move_tl_object_as<telegram_api::videoSize>(thumbnail_ptr);
|
auto video_size = move_tl_object_as<telegram_api::videoSize>(thumbnail_ptr);
|
||||||
if (video_size->type_ == "f") {
|
if (video_size->type_ == "f") {
|
||||||
if (!premium_animation_file_id.is_valid()) {
|
if (!premium_animation_file_id.is_valid()) {
|
||||||
premium_animation_file_id =
|
premium_animation_file_id = register_photo_size(
|
||||||
register_photo_size(td_->file_manager_.get(), PhotoSizeSource::thumbnail(FileType::Thumbnail, 'f'),
|
td_->file_manager_.get(), PhotoSizeSource::thumbnail(FileType::Thumbnail, 'f'), document_id,
|
||||||
document_id, document->access_hash_, document->file_reference_.as_slice().str(),
|
document->access_hash_, document->file_reference_.as_slice().str(), DialogId(), video_size->size_, dc_id,
|
||||||
DialogId(), video_size->size_, dc_id, get_sticker_format_photo_format(format));
|
get_sticker_format_photo_format(format), "on_get_sticker_document");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user