Add Td::get_version_option_value_object().
This commit is contained in:
parent
6eb03bdc8b
commit
4300c64a30
@ -426,7 +426,7 @@ void OptionManager::get_option(const string &name, Promise<td_api::object_ptr<td
|
||||
break;
|
||||
case 'v':
|
||||
if (name == "version") {
|
||||
return promise.set_value(td_api::make_object<td_api::optionValueString>(Td::TDLIB_VERSION));
|
||||
return promise.set_value(Td::get_version_option_value_object());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -760,8 +760,7 @@ td_api::object_ptr<td_api::OptionValue> OptionManager::get_option_value_object(S
|
||||
}
|
||||
|
||||
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>("version", Td::get_version_option_value_object()));
|
||||
|
||||
updates.push_back(td_api::make_object<td_api::updateOption>(
|
||||
"online", td_api::make_object<td_api::optionValueBoolean>(td_->is_online())));
|
||||
|
@ -3057,8 +3057,7 @@ void Td::run_request(uint64 id, tl_object_ptr<td_api::Function> function) {
|
||||
return send_result(id, get_fake_authorization_state_object());
|
||||
case td_api::getCurrentState::ID: {
|
||||
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>("version", get_version_option_value_object()));
|
||||
updates.push_back(td_api::make_object<td_api::updateAuthorizationState>(get_fake_authorization_state_object()));
|
||||
// send response synchronously to prevent "Request aborted"
|
||||
return send_result(id, td_api::make_object<td_api::updates>(std::move(updates)));
|
||||
@ -3255,6 +3254,10 @@ void Td::on_connection_state_changed(ConnectionState new_state) {
|
||||
send_closure(actor_id(this), &Td::send_update, get_update_connection_state_object(connection_state_));
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::OptionValue> Td::get_version_option_value_object() {
|
||||
return td_api::make_object<td_api::optionValueString>(TDLIB_VERSION);
|
||||
}
|
||||
|
||||
void Td::start_up() {
|
||||
always_wait_for_mailbox();
|
||||
|
||||
@ -3275,8 +3278,7 @@ void Td::start_up() {
|
||||
alarm_timeout_.set_callback_data(static_cast<void *>(this));
|
||||
|
||||
CHECK(state_ == State::WaitParameters);
|
||||
send_update(td_api::make_object<td_api::updateOption>("version",
|
||||
td_api::make_object<td_api::optionValueString>(TDLIB_VERSION)));
|
||||
send_update(td_api::make_object<td_api::updateOption>("version", get_version_option_value_object()));
|
||||
send_update(td_api::make_object<td_api::updateAuthorizationState>(
|
||||
td_api::make_object<td_api::authorizationStateWaitTdlibParameters>()));
|
||||
}
|
||||
|
@ -102,8 +102,6 @@ class Td final : public Actor {
|
||||
Td &operator=(Td &&) = delete;
|
||||
~Td() final;
|
||||
|
||||
static constexpr const char *TDLIB_VERSION = "1.8.4";
|
||||
|
||||
struct Options {
|
||||
std::shared_ptr<NetQueryStats> net_query_stats;
|
||||
};
|
||||
@ -248,6 +246,8 @@ class Td final : public Actor {
|
||||
|
||||
static td_api::object_ptr<td_api::Object> static_request(td_api::object_ptr<td_api::Function> function);
|
||||
|
||||
static td_api::object_ptr<td_api::OptionValue> get_version_option_value_object();
|
||||
|
||||
private:
|
||||
static constexpr int64 ONLINE_ALARM_ID = 0;
|
||||
static constexpr int64 PING_SERVER_ALARM_ID = -1;
|
||||
@ -255,6 +255,8 @@ class Td final : public Actor {
|
||||
static constexpr int64 TERMS_OF_SERVICE_ALARM_ID = -2;
|
||||
static constexpr int64 PROMO_DATA_ALARM_ID = -3;
|
||||
|
||||
static constexpr const char *TDLIB_VERSION = "1.8.4";
|
||||
|
||||
void on_connection_state_changed(ConnectionState new_state);
|
||||
|
||||
void run_request(uint64 id, tl_object_ptr<td_api::Function> function);
|
||||
|
Loading…
Reference in New Issue
Block a user