From 11272f620548b0c52f225dd7abd15e235b3aef3f Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 21 Feb 2019 19:45:42 +0300 Subject: [PATCH] tg_cli: combine df and dff. GitOrigin-RevId: d34c0f5876c011a9258922ad24276bbe97403227 --- td/telegram/cli.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index daa2d828..c7e4ae13 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -2352,7 +2352,7 @@ class CliClient final : public Actor { send_request(make_tl_object( as_location(latitude, longitude), to_integer(zoom), to_integer(width), to_integer(height), to_integer(scale), as_chat_id(chat_id))); - } else if (op == "df" || op == "DownloadFile") { + } else if (op == "df" || op == "DownloadFile" || op == "dff") { string file_id; string priority; string offset; @@ -2364,21 +2364,9 @@ class CliClient final : public Actor { priority = "1"; } - send_request(make_tl_object(as_file_id(file_id), to_integer(priority), - to_integer(offset), to_integer(limit))); - } else if (op == "dff") { - string max_file_id; - string priority; - string offset; - string limit; - std::tie(max_file_id, args) = split(args); - std::tie(offset, args) = split(args); - std::tie(limit, priority) = split(args); - if (priority.empty()) { - priority = "1"; - } - - for (int i = 1; i <= as_file_id(max_file_id); i++) { + int32 max_file_id = as_file_id(file_id); + int32 min_file_id = (op == "dff" ? 1 : max_file_id); + for (int32 i = min_file_id; i <= max_file_id; i++) { send_request(make_tl_object(i, to_integer(priority), to_integer(offset), to_integer(limit))); }