Move the rest options to OptionManager::get_current_state.

This commit is contained in:
levlam 2021-12-16 12:16:09 +03:00
parent a333f3fb61
commit 10505fae72
3 changed files with 11 additions and 11 deletions

View File

@ -302,7 +302,15 @@ void OptionManager::get_option(const string &name, Promise<td_api::object_ptr<td
wrap_promise().set_value(Unit());
}
void OptionManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) {
void OptionManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
updates.push_back(td_api::make_object<td_api::updateOption>(
"version", td_api::make_object<td_api::optionValueString>(Td::TDLIB_VERSION)));
updates.push_back(
td_api::make_object<td_api::updateOption>("online", td_api::make_object<td_api::optionValueBoolean>(td_->is_online())));
updates.push_back(td_api::make_object<td_api::updateOption>(
"unix_time", td_api::make_object<td_api::optionValueInteger>(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<td_api::updateOption>(

View File

@ -34,7 +34,7 @@ class OptionManager final : public Actor {
static void clear_options();
static void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates);
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
private:
void tear_down() final;

View File

@ -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<td_api::object_ptr<td_api::Update>> updates;
updates.push_back(td_api::make_object<td_api::updateOption>(
"version", td_api::make_object<td_api::optionValueString>(TDLIB_VERSION)));
updates.push_back(
td_api::make_object<td_api::updateOption>("online", make_tl_object<td_api::optionValueBoolean>(is_online_)));
updates.push_back(td_api::make_object<td_api::updateOption>(
"unix_time", make_tl_object<td_api::optionValueInteger>(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) {