diff --git a/td/telegram/AnimationsManager.cpp b/td/telegram/AnimationsManager.cpp index d5f9818a..fff5b730 100644 --- a/td/telegram/AnimationsManager.cpp +++ b/td/telegram/AnimationsManager.cpp @@ -167,8 +167,9 @@ tl_object_ptr AnimationsManager::get_animation_object(FileId FileId AnimationsManager::on_get_animation(unique_ptr new_animation, bool replace) { auto file_id = new_animation->file_id; - LOG(INFO) << (replace ? "Replace" : "Add") << " animation " << file_id << " of size " << new_animation->dimensions; auto &a = animations_[file_id]; + LOG(INFO) << (a == nullptr ? "Add" : (replace ? "Replace" : "Ignore")) << " animation " << file_id << " of size " + << new_animation->dimensions; if (a == nullptr) { a = std::move(new_animation); } else if (replace) { @@ -644,7 +645,13 @@ void AnimationsManager::add_saved_animation_by_id(FileId animation_id) { bool AnimationsManager::add_saved_animation_impl(FileId animation_id, Promise &promise) { CHECK(!td_->auth_manager_->is_bot()); - LOG(INFO) << "Add saved animation " << animation_id; + auto file_view = td_->file_manager_->get_file_view(animation_id); + if (file_view.empty()) { + promise.set_error(Status::Error(7, "Animation file not found")); + return false; + } + + LOG(INFO) << "Add saved animation " << animation_id << " with main file " << file_view.file_id(); if (!are_saved_animations_loaded_) { load_saved_animations(PromiseCreator::lambda([animation_id, promise = std::move(promise)](Result<> result) mutable { if (result.is_ok()) { @@ -677,7 +684,6 @@ bool AnimationsManager::add_saved_animation_impl(FileId animation_id, Promisefile_manager_->get_file_view(animation_id); if (!file_view.has_remote_location()) { promise.set_error(Status::Error(7, "Can save only sent animations")); return false; diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index e0afd1ca..7dd14aa9 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -1725,6 +1725,8 @@ Result get_input_message_content( DialogId dialog_id, tl_object_ptr &&input_message_content, Td *td) { bool is_secret = dialog_id.get_type() == DialogType::SecretChat; + LOG(INFO) << "Get input message content from " << to_string(input_message_content); + bool have_file = true; // TODO: send from secret chat to common Result r_file_id = Status::Error(500, "Have no file"); diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index a7e312ee..5f8e43c4 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -2574,7 +2574,7 @@ Result FileManager::check_input_file_id(FileType type, Result re // But it will not be duped if has_input_media(), so for now we can't return main_file_id return dup_file_id(file_id); } - return file_node->main_file_id_; + return FileId(file_node->main_file_id_.get(), file_id.get_remote()); } Result FileManager::get_input_thumbnail_file_id(const tl_object_ptr &thumbnail_input_file, diff --git a/tdutils/td/utils/JsonBuilder.cpp b/tdutils/td/utils/JsonBuilder.cpp index debeed91..1fc0169a 100644 --- a/tdutils/td/utils/JsonBuilder.cpp +++ b/tdutils/td/utils/JsonBuilder.cpp @@ -12,6 +12,7 @@ #include namespace td { + StringBuilder &operator<<(StringBuilder &sb, const JsonRawString &val) { sb << '"'; SCOPE_EXIT { @@ -133,6 +134,7 @@ StringBuilder &operator<<(StringBuilder &sb, const JsonString &val) { } return sb; } + Result json_string_decode(Parser &parser) { if (!parser.try_skip('"')) { return Status::Error("Opening '\"' expected");