Fix on_get_document.

GitOrigin-RevId: 49bce4edcda4158d43c092dbb570c32aa6434e57
This commit is contained in:
levlam 2018-04-04 12:08:31 +03:00
parent 7626910c45
commit 58af6888f7

View File

@ -321,18 +321,24 @@ std::pair<DocumentsManager::DocumentType, FileId> DocumentsManager::on_get_docum
td_->animations_manager_->create_animation(file_id, std::move(thumbnail), std::move(file_name), td_->animations_manager_->create_animation(file_id, std::move(thumbnail), std::move(file_name),
std::move(mime_type), video_duration, dimensions, !is_web); std::move(mime_type), video_duration, dimensions, !is_web);
break; break;
case DocumentType::Audio: case DocumentType::Audio: {
CHECK(audio != nullptr); int32 duration = 0;
string title;
string performer;
if (audio != nullptr) {
duration = audio->duration_;
title = std::move(audio->title_);
performer = std::move(audio->performer_);
}
td_->audios_manager_->create_audio(file_id, std::move(thumbnail), std::move(file_name), std::move(mime_type), td_->audios_manager_->create_audio(file_id, std::move(thumbnail), std::move(file_name), std::move(mime_type),
audio->duration_, std::move(audio->title_), std::move(audio->performer_), duration, std::move(title), std::move(performer), !is_web);
!is_web);
break; break;
}
case DocumentType::General: case DocumentType::General:
td_->documents_manager_->create_document(file_id, std::move(thumbnail), std::move(file_name), td_->documents_manager_->create_document(file_id, std::move(thumbnail), std::move(file_name),
std::move(mime_type), !is_web); std::move(mime_type), !is_web);
break; break;
case DocumentType::Sticker: case DocumentType::Sticker:
CHECK(sticker != nullptr);
td_->stickers_manager_->create_sticker(file_id, std::move(thumbnail), dimensions, true, std::move(sticker), td_->stickers_manager_->create_sticker(file_id, std::move(thumbnail), dimensions, true, std::move(sticker),
load_data_multipromise_ptr); load_data_multipromise_ptr);
break; break;
@ -344,11 +350,17 @@ std::pair<DocumentsManager::DocumentType, FileId> DocumentsManager::on_get_docum
case DocumentType::VideoNote: case DocumentType::VideoNote:
td_->video_notes_manager_->create_video_note(file_id, std::move(thumbnail), video_duration, dimensions, !is_web); td_->video_notes_manager_->create_video_note(file_id, std::move(thumbnail), video_duration, dimensions, !is_web);
break; break;
case DocumentType::VoiceNote: case DocumentType::VoiceNote: {
CHECK(audio != nullptr); int32 duration = 0;
td_->voice_notes_manager_->create_voice_note(file_id, std::move(mime_type), audio->duration_, string waveform;
audio->waveform_.as_slice().str(), !is_web); if (audio != nullptr) {
duration = audio->duration_;
waveform = audio->waveform_.as_slice().str();
}
td_->voice_notes_manager_->create_voice_note(file_id, std::move(mime_type), duration, std::move(waveform),
!is_web);
break; break;
}
case DocumentType::Unknown: case DocumentType::Unknown:
default: default:
UNREACHABLE(); UNREACHABLE();