diff options
Diffstat (limited to 'protocols/Telegram/tdlib/td/td/telegram/AudiosManager.cpp')
-rw-r--r-- | protocols/Telegram/tdlib/td/td/telegram/AudiosManager.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/protocols/Telegram/tdlib/td/td/telegram/AudiosManager.cpp b/protocols/Telegram/tdlib/td/td/telegram/AudiosManager.cpp index ddceb1f713..12ecd8464c 100644 --- a/protocols/Telegram/tdlib/td/td/telegram/AudiosManager.cpp +++ b/protocols/Telegram/tdlib/td/td/telegram/AudiosManager.cpp @@ -1,5 +1,5 @@ // -// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023 +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024 // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -14,6 +14,7 @@ #include "td/telegram/PhotoFormat.h" #include "td/telegram/secret_api.h" #include "td/telegram/Td.h" +#include "td/telegram/telegram_api.h" #include "td/actor/actor.h" @@ -80,8 +81,9 @@ td_api::object_ptr<td_api::notificationSound> AudiosManager::get_notification_so auto file_view = td_->file_manager_->get_file_view(file_id); CHECK(!file_view.empty()); CHECK(file_view.get_type() == FileType::Ringtone); - CHECK(file_view.has_remote_location()); - auto document_id = file_view.remote_location().get_id(); + auto full_remote_location = file_view.get_full_remote_location(); + CHECK(full_remote_location != nullptr); + auto document_id = full_remote_location->get_id(); auto title = audio->title; if (title.empty() && !audio->file_name.empty()) { title = PathView(audio->file_name).file_name_without_extension().str(); @@ -236,8 +238,9 @@ SecretInputMedia AudiosManager::get_secret_input_media(FileId audio_file_id, if (!file_view.is_encrypted_secret() || file_view.encryption_key().empty()) { return SecretInputMedia{}; } - if (file_view.has_remote_location()) { - input_file = file_view.main_remote_location().as_input_encrypted_file(); + const auto *main_remote_location = file_view.get_main_remote_location(); + if (main_remote_location != nullptr) { + input_file = main_remote_location->as_input_encrypted_file(); } if (!input_file) { return SecretInputMedia{}; @@ -270,12 +273,14 @@ tl_object_ptr<telegram_api::InputMedia> AudiosManager::get_input_media( if (file_view.is_encrypted()) { return nullptr; } - if (file_view.has_remote_location() && !file_view.main_remote_location().is_web() && input_file == nullptr) { - return make_tl_object<telegram_api::inputMediaDocument>( - 0, false /*ignored*/, file_view.main_remote_location().as_input_document(), 0, string()); + const auto *main_remote_location = file_view.get_main_remote_location(); + if (main_remote_location != nullptr && !main_remote_location->is_web() && input_file == nullptr) { + return make_tl_object<telegram_api::inputMediaDocument>(0, false /*ignored*/, + main_remote_location->as_input_document(), 0, string()); } - if (file_view.has_url()) { - return make_tl_object<telegram_api::inputMediaDocumentExternal>(0, false /*ignored*/, file_view.url(), 0); + const auto *url = file_view.get_url(); + if (url != nullptr) { + return make_tl_object<telegram_api::inputMediaDocumentExternal>(0, false /*ignored*/, *url, 0); } if (input_file != nullptr) { @@ -302,7 +307,7 @@ tl_object_ptr<telegram_api::InputMedia> AudiosManager::get_input_media( std::move(input_thumbnail), mime_type, std::move(attributes), vector<tl_object_ptr<telegram_api::InputDocument>>(), 0); } else { - CHECK(!file_view.has_remote_location()); + CHECK(main_remote_location == nullptr); } return nullptr; |