summaryrefslogtreecommitdiff
path: root/protocols/Telegram/tdlib/td/test/online.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-09-29 14:24:23 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-09-29 19:04:02 +0300
commit8e36edeef44005c24fa574fbb90556442a6a516f (patch)
treee4766ace481283264e172b243b3026c26f47bd89 /protocols/Telegram/tdlib/td/test/online.cpp
parent55793991ad8b130f5146c1b72bfa0d126ce13456 (diff)
TDLIB: copyright updates & code cleaning
Diffstat (limited to 'protocols/Telegram/tdlib/td/test/online.cpp')
-rw-r--r--protocols/Telegram/tdlib/td/test/online.cpp26
1 files changed, 15 insertions, 11 deletions
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<td::td_api::getOption>("version"),
- [](auto res) { LOG(INFO) << td::td_api::to_string(res.ok()); });
+ [](td::Result<td::td_api::object_ptr<td::td_api::OptionValue>> res) {
+ LOG(INFO) << td::td_api::to_string(res.ok());
+ });
}
void process_authorization_state(td::tl_object_ptr<td::td_api::Object> authorization_state) {
td::tl_object_ptr<td::td_api::Function> 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 <class T>
void send(T &&query) {
- send_query(std::move(query), [this](auto res) {
+ send_query(std::move(query), [this](td::Result<typename T::element_type::ReturnType> res) {
if (is_alive()) {
res.ensure();
}
@@ -284,7 +285,9 @@ class GetMe : public Task {
explicit GetMe(Promise<Result> promise) : promise_(std::move(promise)) {
}
void start_up() override {
- send_query(td::make_tl_object<td::td_api::getMe>(), [this](auto res) { with_user_id(res.move_as_ok()->id_); });
+ send_query(
+ td::make_tl_object<td::td_api::getMe>(),
+ [this](td::Result<td::td_api::object_ptr<td::td_api::user>> 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<td::td_api::createPrivateChat>(user_id, false),
- [this](auto res) { with_chat_id(res.move_as_ok()->id_); });
+ send_query(
+ td::make_tl_object<td::td_api::createPrivateChat>(user_id, false),
+ [this](td::Result<td::td_api::object_ptr<td::td_api::chat>> 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<td::td_api::sendMessage>(
- chat_id_, 0, 0, nullptr, nullptr,
+ chat_id_, 0, nullptr, nullptr, nullptr,
td::make_tl_object<td::td_api::inputMessageDocument>(
td::make_tl_object<td::td_api::inputFileLocal>(content_path_), nullptr, true,
td::make_tl_object<td::td_api::formattedText>("tag", td::Auto()))),
- [this](auto res) { with_message(res.move_as_ok()); });
+ [this](td::Result<td::td_api::object_ptr<td::td_api::message>> 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<td::td_api::getRemoteFile>(remote_id_, nullptr),
- [this](auto res) { start_file(*res.ok()); });
+ [this](td::Result<td::td_api::object_ptr<td::td_api::file>> res) { start_file(*res.ok()); });
}
private:
@@ -455,7 +459,7 @@ class TestDownloadFile : public Task {
send_query(td::make_tl_object<td::td_api::downloadFile>(
file_id_, 1, static_cast<int64>(ranges_.back().begin),
static_cast<int64>(ranges_.back().end - ranges_.back().begin), true),
- [this](auto res) { on_get_chunk(*res.ok()); });
+ [this](td::Result<td::td_api::object_ptr<td::td_api::file>> res) { on_get_chunk(*res.ok()); });
}
};