Simplify AuthManager::is_bot.

This commit is contained in:
levlam 2023-11-13 15:07:21 +03:00
parent 2a50068d7e
commit 70828853e8
2 changed files with 3 additions and 8 deletions

View File

@ -327,13 +327,6 @@ void AuthManager::tear_down() {
parent_.reset();
}
bool AuthManager::is_bot() const {
if (net_query_id_ != 0 && net_query_type_ == NetQueryType::BotAuthentication) {
return true;
}
return is_bot_ && was_authorized();
}
bool AuthManager::was_authorized() const {
return state_ == State::Ok || state_ == State::LoggingOut || state_ == State::DestroyingKeys ||
state_ == State::Closing;

View File

@ -28,7 +28,9 @@ class AuthManager final : public NetActor {
public:
AuthManager(int32 api_id, const string &api_hash, ActorShared<> parent);
bool is_bot() const;
bool is_bot() const {
return is_bot_ || net_query_type_ == NetQueryType::BotAuthentication;
}
bool is_authorized() const;
bool was_authorized() const;