Add and use UserManager::get_user_id_object_async.
This commit is contained in:
parent
3fad1b68a7
commit
699707a09b
@ -924,12 +924,16 @@ void CallActor::flush_call_state() {
|
||||
}
|
||||
call_state_need_flush_ = false;
|
||||
|
||||
// TODO can't call const function
|
||||
// send_closure(G()->user_manager(), &UserManager::get_user_id_object, user_id_, "flush_call_state");
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
make_tl_object<td_api::updateCall>(make_tl_object<td_api::call>(
|
||||
local_call_id_.get(), is_outgoing_ ? user_id_.get() : call_admin_user_id_.get(), is_outgoing_,
|
||||
is_video_, call_state_.get_call_state_object())));
|
||||
auto peer_id = is_outgoing_ ? user_id_ : call_admin_user_id_;
|
||||
auto update = td_api::make_object<td_api::updateCall>(td_api::make_object<td_api::call>(
|
||||
local_call_id_.get(), 0, is_outgoing_, is_video_, call_state_.get_call_state_object()));
|
||||
send_closure(G()->user_manager(), &UserManager::get_user_id_object_async, peer_id,
|
||||
[td_actor = G()->td(), update = std::move(update)](Result<int64> r_user_id) mutable {
|
||||
if (r_user_id.is_ok()) {
|
||||
update->call_->user_id_ = r_user_id.ok();
|
||||
send_closure(td_actor, &Td::send_update, std::move(update));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7844,6 +7844,10 @@ int64 UserManager::get_user_id_object(UserId user_id, const char *source) const
|
||||
return user_id.get();
|
||||
}
|
||||
|
||||
void UserManager::get_user_id_object_async(UserId user_id, Promise<int64> &&promise) {
|
||||
promise.set_value(get_user_id_object(user_id, "get_user_id_object_async"));
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::user> UserManager::get_user_object(UserId user_id) const {
|
||||
return get_user_object(user_id, get_user(user_id));
|
||||
}
|
||||
|
@ -451,6 +451,8 @@ class UserManager final : public Actor {
|
||||
|
||||
int64 get_user_id_object(UserId user_id, const char *source) const;
|
||||
|
||||
void get_user_id_object_async(UserId user_id, Promise<int64> &&promise);
|
||||
|
||||
td_api::object_ptr<td_api::user> get_user_object(UserId user_id) const;
|
||||
|
||||
vector<int64> get_user_ids_object(const vector<UserId> &user_ids, const char *source) const;
|
||||
|
Loading…
Reference in New Issue
Block a user