Remove unused can_delete_old parameter.
This commit is contained in:
parent
36693a3872
commit
33623f9818
@ -273,7 +273,7 @@ FileId AnimationsManager::dup_animation(FileId new_id, FileId old_id) {
|
|||||||
return new_id;
|
return new_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationsManager::merge_animations(FileId new_id, FileId old_id, bool can_delete_old) {
|
void AnimationsManager::merge_animations(FileId new_id, FileId old_id) {
|
||||||
CHECK(old_id.is_valid() && new_id.is_valid());
|
CHECK(old_id.is_valid() && new_id.is_valid());
|
||||||
CHECK(new_id != old_id);
|
CHECK(new_id != old_id);
|
||||||
|
|
||||||
@ -284,13 +284,7 @@ void AnimationsManager::merge_animations(FileId new_id, FileId old_id, bool can_
|
|||||||
bool need_merge = true;
|
bool need_merge = true;
|
||||||
auto new_it = animations_.find(new_id);
|
auto new_it = animations_.find(new_id);
|
||||||
if (new_it == animations_.end()) {
|
if (new_it == animations_.end()) {
|
||||||
auto &old = animations_[old_id];
|
dup_animation(new_id, old_id);
|
||||||
if (!can_delete_old) {
|
|
||||||
dup_animation(new_id, old_id);
|
|
||||||
} else {
|
|
||||||
old->file_id = new_id;
|
|
||||||
animations_.emplace(new_id, std::move(old));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Animation *new_ = new_it->second.get();
|
Animation *new_ = new_it->second.get();
|
||||||
CHECK(new_ != nullptr);
|
CHECK(new_ != nullptr);
|
||||||
@ -305,9 +299,6 @@ void AnimationsManager::merge_animations(FileId new_id, FileId old_id, bool can_
|
|||||||
if (need_merge) {
|
if (need_merge) {
|
||||||
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
||||||
}
|
}
|
||||||
if (can_delete_old) {
|
|
||||||
animations_.erase(old_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationsManager::create_animation(FileId file_id, string minithumbnail, PhotoSize thumbnail,
|
void AnimationsManager::create_animation(FileId file_id, string minithumbnail, PhotoSize thumbnail,
|
||||||
|
@ -59,7 +59,7 @@ class AnimationsManager final : public Actor {
|
|||||||
|
|
||||||
FileId dup_animation(FileId new_id, FileId old_id);
|
FileId dup_animation(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
void merge_animations(FileId new_id, FileId old_id, bool can_delete_old);
|
void merge_animations(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
void on_update_animation_search_emojis(string animation_search_emojis);
|
void on_update_animation_search_emojis(string animation_search_emojis);
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ FileId AudiosManager::dup_audio(FileId new_id, FileId old_id) {
|
|||||||
return new_id;
|
return new_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudiosManager::merge_audios(FileId new_id, FileId old_id, bool can_delete_old) {
|
void AudiosManager::merge_audios(FileId new_id, FileId old_id) {
|
||||||
CHECK(old_id.is_valid() && new_id.is_valid());
|
CHECK(old_id.is_valid() && new_id.is_valid());
|
||||||
CHECK(new_id != old_id);
|
CHECK(new_id != old_id);
|
||||||
|
|
||||||
@ -156,13 +156,7 @@ void AudiosManager::merge_audios(FileId new_id, FileId old_id, bool can_delete_o
|
|||||||
|
|
||||||
auto new_it = audios_.find(new_id);
|
auto new_it = audios_.find(new_id);
|
||||||
if (new_it == audios_.end()) {
|
if (new_it == audios_.end()) {
|
||||||
auto &old = audios_[old_id];
|
dup_audio(new_id, old_id);
|
||||||
if (!can_delete_old) {
|
|
||||||
dup_audio(new_id, old_id);
|
|
||||||
} else {
|
|
||||||
old->file_id = new_id;
|
|
||||||
audios_.emplace(new_id, std::move(old));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Audio *new_ = new_it->second.get();
|
Audio *new_ = new_it->second.get();
|
||||||
CHECK(new_ != nullptr);
|
CHECK(new_ != nullptr);
|
||||||
@ -176,9 +170,6 @@ void AudiosManager::merge_audios(FileId new_id, FileId old_id, bool can_delete_o
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
||||||
if (can_delete_old) {
|
|
||||||
audios_.erase(old_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string AudiosManager::get_audio_search_text(FileId file_id) const {
|
string AudiosManager::get_audio_search_text(FileId file_id) const {
|
||||||
|
@ -52,7 +52,7 @@ class AudiosManager {
|
|||||||
|
|
||||||
FileId dup_audio(FileId new_id, FileId old_id);
|
FileId dup_audio(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
void merge_audios(FileId new_id, FileId old_id, bool can_delete_old);
|
void merge_audios(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store_audio(FileId file_id, StorerT &storer) const;
|
void store_audio(FileId file_id, StorerT &storer) const;
|
||||||
|
@ -708,7 +708,7 @@ FileId DocumentsManager::dup_document(FileId new_id, FileId old_id) {
|
|||||||
return new_id;
|
return new_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DocumentsManager::merge_documents(FileId new_id, FileId old_id, bool can_delete_old) {
|
void DocumentsManager::merge_documents(FileId new_id, FileId old_id) {
|
||||||
CHECK(old_id.is_valid() && new_id.is_valid());
|
CHECK(old_id.is_valid() && new_id.is_valid());
|
||||||
CHECK(new_id != old_id);
|
CHECK(new_id != old_id);
|
||||||
|
|
||||||
@ -718,13 +718,7 @@ void DocumentsManager::merge_documents(FileId new_id, FileId old_id, bool can_de
|
|||||||
|
|
||||||
auto new_it = documents_.find(new_id);
|
auto new_it = documents_.find(new_id);
|
||||||
if (new_it == documents_.end()) {
|
if (new_it == documents_.end()) {
|
||||||
auto &old = documents_[old_id];
|
dup_document(new_id, old_id);
|
||||||
if (!can_delete_old) {
|
|
||||||
dup_document(new_id, old_id);
|
|
||||||
} else {
|
|
||||||
old->file_id = new_id;
|
|
||||||
documents_.emplace(new_id, std::move(old));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
GeneralDocument *new_ = new_it->second.get();
|
GeneralDocument *new_ = new_it->second.get();
|
||||||
CHECK(new_ != nullptr);
|
CHECK(new_ != nullptr);
|
||||||
@ -734,9 +728,6 @@ void DocumentsManager::merge_documents(FileId new_id, FileId old_id, bool can_de
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
||||||
if (can_delete_old) {
|
|
||||||
documents_.erase(old_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string DocumentsManager::get_document_search_text(FileId file_id) const {
|
string DocumentsManager::get_document_search_text(FileId file_id) const {
|
||||||
|
@ -106,7 +106,7 @@ class DocumentsManager {
|
|||||||
|
|
||||||
FileId dup_document(FileId new_id, FileId old_id);
|
FileId dup_document(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
void merge_documents(FileId new_id, FileId old_id, bool can_delete_old);
|
void merge_documents(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store_document(FileId file_id, StorerT &storer) const;
|
void store_document(FileId file_id, StorerT &storer) const;
|
||||||
|
@ -3165,7 +3165,7 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
const auto *new_ = static_cast<const MessageAnimation *>(new_content);
|
const auto *new_ = static_cast<const MessageAnimation *>(new_content);
|
||||||
if (old_->file_id != new_->file_id) {
|
if (old_->file_id != new_->file_id) {
|
||||||
if (need_merge_files) {
|
if (need_merge_files) {
|
||||||
td->animations_manager_->merge_animations(new_->file_id, old_->file_id, false);
|
td->animations_manager_->merge_animations(new_->file_id, old_->file_id);
|
||||||
}
|
}
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
@ -3179,7 +3179,7 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
const auto *new_ = static_cast<const MessageAudio *>(new_content);
|
const auto *new_ = static_cast<const MessageAudio *>(new_content);
|
||||||
if (old_->file_id != new_->file_id) {
|
if (old_->file_id != new_->file_id) {
|
||||||
if (need_merge_files) {
|
if (need_merge_files) {
|
||||||
td->audios_manager_->merge_audios(new_->file_id, old_->file_id, false);
|
td->audios_manager_->merge_audios(new_->file_id, old_->file_id);
|
||||||
}
|
}
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
@ -3201,7 +3201,7 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
const auto *new_ = static_cast<const MessageDocument *>(new_content);
|
const auto *new_ = static_cast<const MessageDocument *>(new_content);
|
||||||
if (old_->file_id != new_->file_id) {
|
if (old_->file_id != new_->file_id) {
|
||||||
if (need_merge_files) {
|
if (need_merge_files) {
|
||||||
td->documents_manager_->merge_documents(new_->file_id, old_->file_id, false);
|
td->documents_manager_->merge_documents(new_->file_id, old_->file_id);
|
||||||
}
|
}
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
@ -3337,7 +3337,7 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
const auto *new_ = static_cast<const MessageSticker *>(new_content);
|
const auto *new_ = static_cast<const MessageSticker *>(new_content);
|
||||||
if (old_->file_id != new_->file_id) {
|
if (old_->file_id != new_->file_id) {
|
||||||
if (need_merge_files) {
|
if (need_merge_files) {
|
||||||
td->stickers_manager_->merge_stickers(new_->file_id, old_->file_id, false);
|
td->stickers_manager_->merge_stickers(new_->file_id, old_->file_id);
|
||||||
}
|
}
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
@ -3363,7 +3363,7 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
const auto *new_ = static_cast<const MessageVideo *>(new_content);
|
const auto *new_ = static_cast<const MessageVideo *>(new_content);
|
||||||
if (old_->file_id != new_->file_id) {
|
if (old_->file_id != new_->file_id) {
|
||||||
if (need_merge_files) {
|
if (need_merge_files) {
|
||||||
td->videos_manager_->merge_videos(new_->file_id, old_->file_id, false);
|
td->videos_manager_->merge_videos(new_->file_id, old_->file_id);
|
||||||
}
|
}
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
@ -3377,7 +3377,7 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
const auto *new_ = static_cast<const MessageVideoNote *>(new_content);
|
const auto *new_ = static_cast<const MessageVideoNote *>(new_content);
|
||||||
if (old_->file_id != new_->file_id) {
|
if (old_->file_id != new_->file_id) {
|
||||||
if (need_merge_files) {
|
if (need_merge_files) {
|
||||||
td->video_notes_manager_->merge_video_notes(new_->file_id, old_->file_id, false);
|
td->video_notes_manager_->merge_video_notes(new_->file_id, old_->file_id);
|
||||||
}
|
}
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
@ -3391,7 +3391,7 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
|||||||
const auto *new_ = static_cast<const MessageVoiceNote *>(new_content);
|
const auto *new_ = static_cast<const MessageVoiceNote *>(new_content);
|
||||||
if (old_->file_id != new_->file_id) {
|
if (old_->file_id != new_->file_id) {
|
||||||
if (need_merge_files) {
|
if (need_merge_files) {
|
||||||
td->voice_notes_manager_->merge_voice_notes(new_->file_id, old_->file_id, false);
|
td->voice_notes_manager_->merge_voice_notes(new_->file_id, old_->file_id);
|
||||||
}
|
}
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
@ -3673,7 +3673,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
|
|||||||
case MessageContentType::Animation: {
|
case MessageContentType::Animation: {
|
||||||
auto content = static_cast<MessageAnimation *>(message_content);
|
auto content = static_cast<MessageAnimation *>(message_content);
|
||||||
if (new_file_id != content->file_id) {
|
if (new_file_id != content->file_id) {
|
||||||
td->animations_manager_->merge_animations(new_file_id, content->file_id, false);
|
td->animations_manager_->merge_animations(new_file_id, content->file_id);
|
||||||
content->file_id = new_file_id;
|
content->file_id = new_file_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3682,7 +3682,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
|
|||||||
case MessageContentType::Audio: {
|
case MessageContentType::Audio: {
|
||||||
auto content = static_cast<MessageAudio *>(message_content);
|
auto content = static_cast<MessageAudio *>(message_content);
|
||||||
if (new_file_id != content->file_id) {
|
if (new_file_id != content->file_id) {
|
||||||
td->audios_manager_->merge_audios(new_file_id, content->file_id, false);
|
td->audios_manager_->merge_audios(new_file_id, content->file_id);
|
||||||
content->file_id = new_file_id;
|
content->file_id = new_file_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3691,7 +3691,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
|
|||||||
case MessageContentType::Document: {
|
case MessageContentType::Document: {
|
||||||
auto content = static_cast<MessageDocument *>(message_content);
|
auto content = static_cast<MessageDocument *>(message_content);
|
||||||
if (new_file_id != content->file_id) {
|
if (new_file_id != content->file_id) {
|
||||||
td->documents_manager_->merge_documents(new_file_id, content->file_id, false);
|
td->documents_manager_->merge_documents(new_file_id, content->file_id);
|
||||||
content->file_id = new_file_id;
|
content->file_id = new_file_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3713,7 +3713,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
|
|||||||
case MessageContentType::Sticker: {
|
case MessageContentType::Sticker: {
|
||||||
auto content = static_cast<MessageSticker *>(message_content);
|
auto content = static_cast<MessageSticker *>(message_content);
|
||||||
if (new_file_id != content->file_id) {
|
if (new_file_id != content->file_id) {
|
||||||
td->stickers_manager_->merge_stickers(new_file_id, content->file_id, false);
|
td->stickers_manager_->merge_stickers(new_file_id, content->file_id);
|
||||||
content->file_id = new_file_id;
|
content->file_id = new_file_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3722,7 +3722,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
|
|||||||
case MessageContentType::Video: {
|
case MessageContentType::Video: {
|
||||||
auto content = static_cast<MessageVideo *>(message_content);
|
auto content = static_cast<MessageVideo *>(message_content);
|
||||||
if (new_file_id != content->file_id) {
|
if (new_file_id != content->file_id) {
|
||||||
td->videos_manager_->merge_videos(new_file_id, content->file_id, false);
|
td->videos_manager_->merge_videos(new_file_id, content->file_id);
|
||||||
content->file_id = new_file_id;
|
content->file_id = new_file_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3731,7 +3731,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
|
|||||||
case MessageContentType::VideoNote: {
|
case MessageContentType::VideoNote: {
|
||||||
auto content = static_cast<MessageVideoNote *>(message_content);
|
auto content = static_cast<MessageVideoNote *>(message_content);
|
||||||
if (new_file_id != content->file_id) {
|
if (new_file_id != content->file_id) {
|
||||||
td->video_notes_manager_->merge_video_notes(new_file_id, content->file_id, false);
|
td->video_notes_manager_->merge_video_notes(new_file_id, content->file_id);
|
||||||
content->file_id = new_file_id;
|
content->file_id = new_file_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -3740,7 +3740,7 @@ bool merge_message_content_file_id(Td *td, MessageContent *message_content, File
|
|||||||
case MessageContentType::VoiceNote: {
|
case MessageContentType::VoiceNote: {
|
||||||
auto content = static_cast<MessageVoiceNote *>(message_content);
|
auto content = static_cast<MessageVoiceNote *>(message_content);
|
||||||
if (new_file_id != content->file_id) {
|
if (new_file_id != content->file_id) {
|
||||||
td->voice_notes_manager_->merge_voice_notes(new_file_id, content->file_id, false);
|
td->voice_notes_manager_->merge_voice_notes(new_file_id, content->file_id);
|
||||||
content->file_id = new_file_id;
|
content->file_id = new_file_id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2809,7 +2809,7 @@ FileId StickersManager::dup_sticker(FileId new_id, FileId old_id) {
|
|||||||
return new_id;
|
return new_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersManager::merge_stickers(FileId new_id, FileId old_id, bool can_delete_old) {
|
void StickersManager::merge_stickers(FileId new_id, FileId old_id) {
|
||||||
CHECK(old_id.is_valid() && new_id.is_valid());
|
CHECK(old_id.is_valid() && new_id.is_valid());
|
||||||
CHECK(new_id != old_id);
|
CHECK(new_id != old_id);
|
||||||
|
|
||||||
@ -2819,13 +2819,7 @@ void StickersManager::merge_stickers(FileId new_id, FileId old_id, bool can_dele
|
|||||||
|
|
||||||
auto new_it = stickers_.find(new_id);
|
auto new_it = stickers_.find(new_id);
|
||||||
if (new_it == stickers_.end()) {
|
if (new_it == stickers_.end()) {
|
||||||
auto &old = stickers_[old_id];
|
dup_sticker(new_id, old_id);
|
||||||
if (!can_delete_old) {
|
|
||||||
dup_sticker(new_id, old_id);
|
|
||||||
} else {
|
|
||||||
old->file_id = new_id;
|
|
||||||
stickers_.emplace(new_id, std::move(old));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Sticker *new_ = new_it->second.get();
|
Sticker *new_ = new_it->second.get();
|
||||||
CHECK(new_ != nullptr);
|
CHECK(new_ != nullptr);
|
||||||
@ -2846,9 +2840,6 @@ void StickersManager::merge_stickers(FileId new_id, FileId old_id, bool can_dele
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
||||||
if (can_delete_old) {
|
|
||||||
stickers_.erase(old_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tl_object_ptr<telegram_api::InputStickerSet> StickersManager::get_input_sticker_set(const StickerSet *set) {
|
tl_object_ptr<telegram_api::InputStickerSet> StickersManager::get_input_sticker_set(const StickerSet *set) {
|
||||||
@ -4072,7 +4063,8 @@ vector<FileId> StickersManager::get_stickers(StickerType sticker_type, string em
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersManager::search_stickers(string emoji, int32 limit, Promise<td_api::object_ptr<td_api::stickers>> &&promise) {
|
void StickersManager::search_stickers(string emoji, int32 limit,
|
||||||
|
Promise<td_api::object_ptr<td_api::stickers>> &&promise) {
|
||||||
if (limit <= 0) {
|
if (limit <= 0) {
|
||||||
return promise.set_error(Status::Error(400, "Parameter limit must be positive"));
|
return promise.set_error(Status::Error(400, "Parameter limit must be positive"));
|
||||||
}
|
}
|
||||||
@ -6785,10 +6777,10 @@ void StickersManager::on_uploaded_sticker_file(FileId file_id, tl_object_ptr<tel
|
|||||||
|
|
||||||
if (parsed_document.file_id != file_id) {
|
if (parsed_document.file_id != file_id) {
|
||||||
if (file_type == FileType::Sticker) {
|
if (file_type == FileType::Sticker) {
|
||||||
merge_stickers(parsed_document.file_id, file_id, false);
|
merge_stickers(parsed_document.file_id, file_id);
|
||||||
} else {
|
} else {
|
||||||
// must not delete the old document, because the file_id could be used for simultaneous URL uploads
|
// must not delete the old document, because the file_id could be used for simultaneous URL uploads
|
||||||
td_->documents_manager_->merge_documents(parsed_document.file_id, file_id, false);
|
td_->documents_manager_->merge_documents(parsed_document.file_id, file_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
promise.set_value(Unit());
|
promise.set_value(Unit());
|
||||||
|
@ -331,7 +331,7 @@ class StickersManager final : public Actor {
|
|||||||
|
|
||||||
FileId dup_sticker(FileId new_id, FileId old_id);
|
FileId dup_sticker(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
void merge_stickers(FileId new_id, FileId old_id, bool can_delete_old);
|
void merge_stickers(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store_sticker(FileId file_id, bool in_sticker_set, StorerT &storer, const char *source) const;
|
void store_sticker(FileId file_id, bool in_sticker_set, StorerT &storer, const char *source) const;
|
||||||
|
@ -109,7 +109,7 @@ FileId VideoNotesManager::dup_video_note(FileId new_id, FileId old_id) {
|
|||||||
return new_id;
|
return new_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoNotesManager::merge_video_notes(FileId new_id, FileId old_id, bool can_delete_old) {
|
void VideoNotesManager::merge_video_notes(FileId new_id, FileId old_id) {
|
||||||
CHECK(old_id.is_valid() && new_id.is_valid());
|
CHECK(old_id.is_valid() && new_id.is_valid());
|
||||||
CHECK(new_id != old_id);
|
CHECK(new_id != old_id);
|
||||||
|
|
||||||
@ -119,13 +119,7 @@ void VideoNotesManager::merge_video_notes(FileId new_id, FileId old_id, bool can
|
|||||||
|
|
||||||
auto new_it = video_notes_.find(new_id);
|
auto new_it = video_notes_.find(new_id);
|
||||||
if (new_it == video_notes_.end()) {
|
if (new_it == video_notes_.end()) {
|
||||||
auto &old = video_notes_[old_id];
|
dup_video_note(new_id, old_id);
|
||||||
if (!can_delete_old) {
|
|
||||||
dup_video_note(new_id, old_id);
|
|
||||||
} else {
|
|
||||||
old->file_id = new_id;
|
|
||||||
video_notes_.emplace(new_id, std::move(old));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
VideoNote *new_ = new_it->second.get();
|
VideoNote *new_ = new_it->second.get();
|
||||||
CHECK(new_ != nullptr);
|
CHECK(new_ != nullptr);
|
||||||
@ -134,9 +128,6 @@ void VideoNotesManager::merge_video_notes(FileId new_id, FileId old_id, bool can
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
||||||
if (can_delete_old) {
|
|
||||||
video_notes_.erase(old_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoNotesManager::create_video_note(FileId file_id, string minithumbnail, PhotoSize thumbnail, int32 duration,
|
void VideoNotesManager::create_video_note(FileId file_id, string minithumbnail, PhotoSize thumbnail, int32 duration,
|
||||||
|
@ -51,7 +51,7 @@ class VideoNotesManager {
|
|||||||
|
|
||||||
FileId dup_video_note(FileId new_id, FileId old_id);
|
FileId dup_video_note(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
void merge_video_notes(FileId new_id, FileId old_id, bool can_delete_old);
|
void merge_video_notes(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store_video_note(FileId file_id, StorerT &storer) const;
|
void store_video_note(FileId file_id, StorerT &storer) const;
|
||||||
|
@ -147,7 +147,7 @@ FileId VideosManager::dup_video(FileId new_id, FileId old_id) {
|
|||||||
return new_id;
|
return new_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideosManager::merge_videos(FileId new_id, FileId old_id, bool can_delete_old) {
|
void VideosManager::merge_videos(FileId new_id, FileId old_id) {
|
||||||
CHECK(old_id.is_valid() && new_id.is_valid());
|
CHECK(old_id.is_valid() && new_id.is_valid());
|
||||||
CHECK(new_id != old_id);
|
CHECK(new_id != old_id);
|
||||||
|
|
||||||
@ -157,13 +157,7 @@ void VideosManager::merge_videos(FileId new_id, FileId old_id, bool can_delete_o
|
|||||||
|
|
||||||
auto new_it = videos_.find(new_id);
|
auto new_it = videos_.find(new_id);
|
||||||
if (new_it == videos_.end()) {
|
if (new_it == videos_.end()) {
|
||||||
auto &old = videos_[old_id];
|
dup_video(new_id, old_id);
|
||||||
if (!can_delete_old) {
|
|
||||||
dup_video(new_id, old_id);
|
|
||||||
} else {
|
|
||||||
old->file_id = new_id;
|
|
||||||
videos_.emplace(new_id, std::move(old));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Video *new_ = new_it->second.get();
|
Video *new_ = new_it->second.get();
|
||||||
CHECK(new_ != nullptr);
|
CHECK(new_ != nullptr);
|
||||||
@ -177,9 +171,6 @@ void VideosManager::merge_videos(FileId new_id, FileId old_id, bool can_delete_o
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
||||||
if (can_delete_old) {
|
|
||||||
videos_.erase(old_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideosManager::create_video(FileId file_id, string minithumbnail, PhotoSize thumbnail,
|
void VideosManager::create_video(FileId file_id, string minithumbnail, PhotoSize thumbnail,
|
||||||
|
@ -55,7 +55,7 @@ class VideosManager {
|
|||||||
|
|
||||||
FileId dup_video(FileId new_id, FileId old_id);
|
FileId dup_video(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
void merge_videos(FileId new_id, FileId old_id, bool can_delete_old);
|
void merge_videos(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store_video(FileId file_id, StorerT &storer) const;
|
void store_video(FileId file_id, StorerT &storer) const;
|
||||||
|
@ -228,7 +228,7 @@ FileId VoiceNotesManager::dup_voice_note(FileId new_id, FileId old_id) {
|
|||||||
return new_id;
|
return new_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoiceNotesManager::merge_voice_notes(FileId new_id, FileId old_id, bool can_delete_old) {
|
void VoiceNotesManager::merge_voice_notes(FileId new_id, FileId old_id) {
|
||||||
CHECK(old_id.is_valid() && new_id.is_valid());
|
CHECK(old_id.is_valid() && new_id.is_valid());
|
||||||
CHECK(new_id != old_id);
|
CHECK(new_id != old_id);
|
||||||
|
|
||||||
@ -238,13 +238,7 @@ void VoiceNotesManager::merge_voice_notes(FileId new_id, FileId old_id, bool can
|
|||||||
|
|
||||||
auto new_it = voice_notes_.find(new_id);
|
auto new_it = voice_notes_.find(new_id);
|
||||||
if (new_it == voice_notes_.end()) {
|
if (new_it == voice_notes_.end()) {
|
||||||
auto &old = voice_notes_[old_id];
|
dup_voice_note(new_id, old_id);
|
||||||
if (!can_delete_old) {
|
|
||||||
dup_voice_note(new_id, old_id);
|
|
||||||
} else {
|
|
||||||
old->file_id = new_id;
|
|
||||||
voice_notes_.emplace(new_id, std::move(old));
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
VoiceNote *new_ = new_it->second.get();
|
VoiceNote *new_ = new_it->second.get();
|
||||||
CHECK(new_ != nullptr);
|
CHECK(new_ != nullptr);
|
||||||
@ -254,9 +248,6 @@ void VoiceNotesManager::merge_voice_notes(FileId new_id, FileId old_id, bool can
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
LOG_STATUS(td_->file_manager_->merge(new_id, old_id));
|
||||||
if (can_delete_old) {
|
|
||||||
voice_notes_.erase(old_id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoiceNotesManager::create_voice_note(FileId file_id, string mime_type, int32 duration, string waveform,
|
void VoiceNotesManager::create_voice_note(FileId file_id, string mime_type, int32 duration, string waveform,
|
||||||
|
@ -63,7 +63,7 @@ class VoiceNotesManager final : public Actor {
|
|||||||
|
|
||||||
FileId dup_voice_note(FileId new_id, FileId old_id);
|
FileId dup_voice_note(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
void merge_voice_notes(FileId new_id, FileId old_id, bool can_delete_old);
|
void merge_voice_notes(FileId new_id, FileId old_id);
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store_voice_note(FileId file_id, StorerT &storer) const;
|
void store_voice_note(FileId file_id, StorerT &storer) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user