Remove unused function parameter.

GitOrigin-RevId: 88f3fee550593cbdc7a7392293cb22f484e9f986
This commit is contained in:
levlam 2018-08-14 02:49:32 +03:00
parent 8d5c17036a
commit 55417e88fd
3 changed files with 41 additions and 43 deletions

View File

@ -175,49 +175,47 @@ void PasswordManager::set_recovery_email_address(string password, string new_rec
update_password_settings(std::move(update_settings), std::move(promise));
}
void PasswordManager::get_secure_secret(string password, optional<int64> hash,
Promise<secure_storage::Secret> promise) {
return do_get_secure_secret(true, std::move(password), std::move(hash), std::move(promise));
void PasswordManager::get_secure_secret(string password, Promise<secure_storage::Secret> promise) {
return do_get_secure_secret(true, std::move(password), std::move(promise));
}
void PasswordManager::do_get_secure_secret(bool recursive, string password, optional<int64> hash,
Promise<secure_storage::Secret> promise) {
if (secret_ && (!hash || secret_.value().get_hash() == hash.value())) {
void PasswordManager::do_get_secure_secret(bool recursive, string password, Promise<secure_storage::Secret> promise) {
if (secret_) {
return promise.set_value(secret_.value().clone());
}
get_full_state(
password, PromiseCreator::lambda([password, recursive, hash = std::move(hash), promise = std::move(promise),
actor_id = actor_id(this)](Result<PasswordFullState> r_state) mutable {
if (r_state.is_error()) {
return promise.set_error(r_state.move_as_error());
}
auto state = r_state.move_as_ok();
if (!state.state.has_password) {
return promise.set_error(Status::Error(400, "2-step verification is disabled"));
}
if (state.private_state.secret) {
send_closure(actor_id, &PasswordManager::cache_secret, state.private_state.secret.value().clone());
return promise.set_value(std::move(state.private_state.secret.value()));
}
if (!recursive) {
return promise.set_error(Status::Error(400, "Failed to get Telegram Passport secret"));
}
get_full_state(password,
PromiseCreator::lambda([password, recursive, promise = std::move(promise),
actor_id = actor_id(this)](Result<PasswordFullState> r_state) mutable {
if (r_state.is_error()) {
return promise.set_error(r_state.move_as_error());
}
auto state = r_state.move_as_ok();
if (!state.state.has_password) {
return promise.set_error(Status::Error(400, "2-step verification is disabled"));
}
if (state.private_state.secret) {
send_closure(actor_id, &PasswordManager::cache_secret, state.private_state.secret.value().clone());
return promise.set_value(std::move(state.private_state.secret.value()));
}
if (!recursive) {
return promise.set_error(Status::Error(400, "Failed to get Telegram Passport secret"));
}
auto new_promise = PromiseCreator::lambda([password, hash = std::move(hash), promise = std::move(promise),
actor_id = actor_id](Result<bool> r_ok) mutable {
if (r_ok.is_error()) {
return promise.set_error(r_ok.move_as_error());
}
send_closure(actor_id, &PasswordManager::do_get_secure_secret, false, std::move(password), std::move(hash),
std::move(promise));
});
auto new_promise = PromiseCreator::lambda(
[password, promise = std::move(promise), actor_id = actor_id](Result<bool> r_ok) mutable {
if (r_ok.is_error()) {
return promise.set_error(r_ok.move_as_error());
}
send_closure(actor_id, &PasswordManager::do_get_secure_secret, false, std::move(password),
std::move(promise));
});
UpdateSettings update_settings;
update_settings.current_password = password;
update_settings.update_secure_secret = true;
send_closure(actor_id, &PasswordManager::do_update_password_settings, std::move(update_settings),
std::move(state), std::move(new_promise));
}));
UpdateSettings update_settings;
update_settings.current_password = password;
update_settings.update_secure_secret = true;
send_closure(actor_id, &PasswordManager::do_update_password_settings, std::move(update_settings),
std::move(state), std::move(new_promise));
}));
}
void PasswordManager::get_temp_password_state(Promise<TempState> promise) /*const*/ {

View File

@ -76,7 +76,7 @@ class PasswordManager : public NetQueryCallback {
void request_password_recovery(Promise<td_api::object_ptr<td_api::emailAddressAuthenticationCodeInfo>> promise);
void recover_password(string code, Promise<State> promise);
void get_secure_secret(string password, optional<int64> hash, Promise<secure_storage::Secret> promise);
void get_secure_secret(string password, Promise<secure_storage::Secret> promise);
void get_temp_password_state(Promise<TempState> promise) /*const*/;
void create_temp_password(string password, int32 timeout, Promise<TempState> promise);
@ -162,7 +162,7 @@ class PasswordManager : public NetQueryCallback {
PasswordPrivateState private_state, Promise<bool> promise);
void do_get_state(Promise<PasswordState> promise);
void get_full_state(string password, Promise<PasswordFullState> promise);
void do_get_secure_secret(bool recursive, string passwod, optional<int64>, Promise<secure_storage::Secret> promise);
void do_get_secure_secret(bool recursive, string passwod, Promise<secure_storage::Secret> promise);
void do_get_full_state(string password, PasswordState state, Promise<PasswordFullState> promise);
void cache_secret(secure_storage::Secret secret);

View File

@ -201,7 +201,7 @@ void GetSecureValue::start_up() {
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this));
send_closure(G()->password_manager(), &PasswordManager::get_secure_secret, password_, optional<int64>(),
send_closure(G()->password_manager(), &PasswordManager::get_secure_secret, password_,
PromiseCreator::lambda([actor_id = actor_id(this)](Result<secure_storage::Secret> r_secret) {
send_closure(actor_id, &GetSecureValue::on_secret, std::move(r_secret), true);
}));
@ -278,7 +278,7 @@ void GetAllSecureValues::start_up() {
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this));
send_closure(G()->password_manager(), &PasswordManager::get_secure_secret, password_, optional<int64>(),
send_closure(G()->password_manager(), &PasswordManager::get_secure_secret, password_,
PromiseCreator::lambda([actor_id = actor_id(this)](Result<secure_storage::Secret> r_secret) {
send_closure(actor_id, &GetAllSecureValues::on_secret, std::move(r_secret), true);
}));
@ -381,7 +381,7 @@ void SetSecureValue::on_secret(Result<secure_storage::Secret> r_secret, bool x)
}
void SetSecureValue::start_up() {
send_closure(G()->password_manager(), &PasswordManager::get_secure_secret, password_, optional<int64>(),
send_closure(G()->password_manager(), &PasswordManager::get_secure_secret, password_,
PromiseCreator::lambda([actor_id = actor_id(this)](Result<secure_storage::Secret> r_secret) {
send_closure(actor_id, &SetSecureValue::on_secret, std::move(r_secret), true);
}));
@ -669,7 +669,7 @@ class GetPassportAuthorizationForm : public NetQueryCallback {
auto query = G()->net_query_creator().create(create_storer(account_get_authorization_form));
G()->net_query_dispatcher().dispatch_with_callback(std::move(query), actor_shared(this));
send_closure(G()->password_manager(), &PasswordManager::get_secure_secret, password_, optional<int64>(),
send_closure(G()->password_manager(), &PasswordManager::get_secure_secret, password_,
PromiseCreator::lambda([actor_id = actor_id(this)](Result<secure_storage::Secret> r_secret) {
send_closure(actor_id, &GetPassportAuthorizationForm::on_secret, std::move(r_secret), true);
}));