From 10505fae724f1295c6581a6aea6851fff6dba1cd Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 16 Dec 2021 12:16:09 +0300 Subject: [PATCH] Move the rest options to OptionManager::get_current_state. --- td/telegram/OptionManager.cpp | 10 +++++++++- td/telegram/OptionManager.h | 2 +- td/telegram/Td.cpp | 10 +--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/td/telegram/OptionManager.cpp b/td/telegram/OptionManager.cpp index 334cadaaf..ac7f312ef 100644 --- a/td/telegram/OptionManager.cpp +++ b/td/telegram/OptionManager.cpp @@ -302,7 +302,15 @@ void OptionManager::get_option(const string &name, Promise> &updates) { +void OptionManager::get_current_state(vector> &updates) const { + updates.push_back(td_api::make_object( + "version", td_api::make_object(Td::TDLIB_VERSION))); + + updates.push_back( + td_api::make_object("online", td_api::make_object(td_->is_online()))); + updates.push_back(td_api::make_object( + "unix_time", td_api::make_object(G()->unix_time()))); + for (const auto &option : G()->shared_config().get_options()) { if (!is_internal_option(option.first)) { updates.push_back(td_api::make_object( diff --git a/td/telegram/OptionManager.h b/td/telegram/OptionManager.h index 957034ec9..5dda42b81 100644 --- a/td/telegram/OptionManager.h +++ b/td/telegram/OptionManager.h @@ -34,7 +34,7 @@ class OptionManager final : public Actor { static void clear_options(); - static void get_current_state(vector> &updates); + void get_current_state(vector> &updates) const; private: void tear_down() final; diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index afaa95906..19b60c0fb 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4398,15 +4398,7 @@ void Td::on_request(uint64 id, td_api::confirmQrCodeAuthentication &request) { void Td::on_request(uint64 id, const td_api::getCurrentState &request) { vector> updates; - updates.push_back(td_api::make_object( - "version", td_api::make_object(TDLIB_VERSION))); - - updates.push_back( - td_api::make_object("online", make_tl_object(is_online_))); - updates.push_back(td_api::make_object( - "unix_time", make_tl_object(G()->unix_time()))); - - OptionManager::get_current_state(updates); + option_manager_->get_current_state(updates); auto state = auth_manager_->get_current_authorization_state_object(); if (state != nullptr) {