tg_cli: combine df and dff.

GitOrigin-RevId: d34c0f5876c011a9258922ad24276bbe97403227
This commit is contained in:
levlam 2019-02-21 19:45:42 +03:00
parent 29446af0c0
commit 11272f6205

View File

@ -2352,7 +2352,7 @@ class CliClient final : public Actor {
send_request(make_tl_object<td_api::getMapThumbnailFile>( send_request(make_tl_object<td_api::getMapThumbnailFile>(
as_location(latitude, longitude), to_integer<int32>(zoom), to_integer<int32>(width), as_location(latitude, longitude), to_integer<int32>(zoom), to_integer<int32>(width),
to_integer<int32>(height), to_integer<int32>(scale), as_chat_id(chat_id))); to_integer<int32>(height), to_integer<int32>(scale), as_chat_id(chat_id)));
} else if (op == "df" || op == "DownloadFile") { } else if (op == "df" || op == "DownloadFile" || op == "dff") {
string file_id; string file_id;
string priority; string priority;
string offset; string offset;
@ -2364,21 +2364,9 @@ class CliClient final : public Actor {
priority = "1"; priority = "1";
} }
send_request(make_tl_object<td_api::downloadFile>(as_file_id(file_id), to_integer<int32>(priority), int32 max_file_id = as_file_id(file_id);
to_integer<int32>(offset), to_integer<int32>(limit))); int32 min_file_id = (op == "dff" ? 1 : max_file_id);
} else if (op == "dff") { for (int32 i = min_file_id; i <= max_file_id; i++) {
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++) {
send_request(make_tl_object<td_api::downloadFile>(i, to_integer<int32>(priority), to_integer<int32>(offset), send_request(make_tl_object<td_api::downloadFile>(i, to_integer<int32>(priority), to_integer<int32>(offset),
to_integer<int32>(limit))); to_integer<int32>(limit)));
} }