From 8e36edeef44005c24fa574fbb90556442a6a516f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 29 Sep 2024 14:24:23 +0300 Subject: TDLIB: copyright updates & code cleaning --- protocols/Telegram/tdlib/td/test/online.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'protocols/Telegram/tdlib/td/test/online.cpp') diff --git a/protocols/Telegram/tdlib/td/test/online.cpp b/protocols/Telegram/tdlib/td/test/online.cpp index de7afa8a66..db5faa8771 100644 --- a/protocols/Telegram/tdlib/td/test/online.cpp +++ b/protocols/Telegram/tdlib/td/test/online.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) @@ -224,7 +224,9 @@ class InitTask : public Task { void start_up() override { send_query(td::make_tl_object("version"), - [](auto res) { LOG(INFO) << td::td_api::to_string(res.ok()); }); + [](td::Result> res) { + LOG(INFO) << td::td_api::to_string(res.ok()); + }); } void process_authorization_state(td::tl_object_ptr authorization_state) { td::tl_object_ptr function; @@ -244,7 +246,6 @@ class InitTask : public Task { request->system_language_code_ = "en"; request->device_model_ = "Desktop"; request->application_version_ = "tdclient-test"; - request->enable_storage_optimizer_ = true; send(std::move(request)); break; } @@ -258,7 +259,7 @@ class InitTask : public Task { } template void send(T &&query) { - send_query(std::move(query), [this](auto res) { + send_query(std::move(query), [this](td::Result res) { if (is_alive()) { res.ensure(); } @@ -284,7 +285,9 @@ class GetMe : public Task { explicit GetMe(Promise promise) : promise_(std::move(promise)) { } void start_up() override { - send_query(td::make_tl_object(), [this](auto res) { with_user_id(res.move_as_ok()->id_); }); + send_query( + td::make_tl_object(), + [this](td::Result> res) { with_user_id(res.move_as_ok()->id_); }); } private: @@ -293,8 +296,9 @@ class GetMe : public Task { void with_user_id(int64 user_id) { result_.user_id = user_id; - send_query(td::make_tl_object(user_id, false), - [this](auto res) { with_chat_id(res.move_as_ok()->id_); }); + send_query( + td::make_tl_object(user_id, false), + [this](td::Result> res) { with_chat_id(res.move_as_ok()->id_); }); } void with_chat_id(int64 chat_id) { @@ -333,11 +337,11 @@ class UploadFile : public Task { write_file(content_path_, content_).ensure(); send_query(td::make_tl_object( - chat_id_, 0, 0, nullptr, nullptr, + chat_id_, 0, nullptr, nullptr, nullptr, td::make_tl_object( td::make_tl_object(content_path_), nullptr, true, td::make_tl_object("tag", td::Auto()))), - [this](auto res) { with_message(res.move_as_ok()); }); + [this](td::Result> res) { with_message(res.move_as_ok()); }); } private: @@ -393,7 +397,7 @@ class TestDownloadFile : public Task { } void start_up() override { send_query(td::make_tl_object(remote_id_, nullptr), - [this](auto res) { start_file(*res.ok()); }); + [this](td::Result> res) { start_file(*res.ok()); }); } private: @@ -455,7 +459,7 @@ class TestDownloadFile : public Task { send_query(td::make_tl_object( file_id_, 1, static_cast(ranges_.back().begin), static_cast(ranges_.back().end - ranges_.back().begin), true), - [this](auto res) { on_get_chunk(*res.ok()); }); + [this](td::Result> res) { on_get_chunk(*res.ok()); }); } }; -- cgit v1.2.3