From 594368e571e1ab09c55bfbcf9c9199121429c358 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 1 Jan 2019 19:26:36 +0300 Subject: [PATCH] Save expected_size for generated locations. GitOrigin-RevId: f9902ca187bb39936b640106d466878d4a9457ec --- td/telegram/cli.cpp | 10 ++++++---- td/telegram/files/FileManager.hpp | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index d8c346e2b..b2ef81d61 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -2919,12 +2919,14 @@ class CliClient final : public Actor { string chat_id; string photo_path; string conversion; + string expected_size; std::tie(chat_id, args) = split(args); - std::tie(photo_path, conversion) = split(args); + std::tie(photo_path, args) = split(args); + std::tie(conversion, expected_size) = split(args); - send_message(chat_id, - make_tl_object(as_generated_file(photo_path, conversion), nullptr, - vector(), 0, 0, as_caption(""), 0)); + send_message(chat_id, make_tl_object( + as_generated_file(photo_path, conversion, to_integer(expected_size)), nullptr, + vector(), 0, 0, as_caption(""), 0)); } else if (op == "spt") { string chat_id; string photo_path; diff --git a/td/telegram/files/FileManager.hpp b/td/telegram/files/FileManager.hpp index 5f59a70e1..a072536ff 100644 --- a/td/telegram/files/FileManager.hpp +++ b/td/telegram/files/FileManager.hpp @@ -91,7 +91,7 @@ void FileManager::store_file(FileId file_id, StorerT &storer, int32 ttl) const { have_file_id = true; } store(generate_location, storer); - store(static_cast(0), storer); // expected_size + store(static_cast(file_view.expected_size()), storer); store(static_cast(0), storer); store(file_view.owner_dialog_id(), storer); @@ -100,6 +100,8 @@ void FileManager::store_file(FileId file_id, StorerT &storer, int32 ttl) const { } break; } + default: + UNREACHABLE(); } if (has_encryption_key) { store(file_view.encryption_key(), storer); @@ -175,7 +177,7 @@ FileId FileManager::parse_file(ParserT &parser) { FullGenerateFileLocation full_generated_location; parse(full_generated_location, parser); int32 expected_size; - parse(expected_size, parser); // expected_size + parse(expected_size, parser); int32 zero; parse(zero, parser); DialogId owner_dialog_id;