Remove is_me from on_get_user.
This commit is contained in:
parent
a87a41f22d
commit
2702d19dc4
@ -1015,12 +1015,21 @@ void AuthManager::on_get_authorization(tl_object_ptr<telegram_api::auth_Authoriz
|
||||
new_password_.clear();
|
||||
new_hint_.clear();
|
||||
state_ = State::Ok;
|
||||
td_->contacts_manager_->on_get_user(std::move(auth->user_), "on_get_authorization", true);
|
||||
if (auth->user_->get_id() == telegram_api::user::ID) {
|
||||
auto *user = static_cast<telegram_api::user *>(auth->user_.get());
|
||||
int32 mask = 1 << 10;
|
||||
if ((user->flags_ & mask) == 0) {
|
||||
LOG(ERROR) << "Receive invalid authorization for " << to_string(auth->user_);
|
||||
user->flags_ |= mask;
|
||||
user->self_ = true;
|
||||
}
|
||||
}
|
||||
td_->contacts_manager_->on_get_user(std::move(auth->user_), "on_get_authorization");
|
||||
update_state(State::Ok, true);
|
||||
if (!td_->contacts_manager_->get_my_id().is_valid()) {
|
||||
LOG(ERROR) << "Server doesn't send proper authorization";
|
||||
LOG(ERROR) << "Server didsn't send proper authorization";
|
||||
if (query_id_ != 0) {
|
||||
on_query_error(Status::Error(500, "Server doesn't send proper authorization"));
|
||||
on_query_error(Status::Error(500, "Server didn't send proper authorization"));
|
||||
}
|
||||
log_out(0);
|
||||
return;
|
||||
|
@ -10179,7 +10179,7 @@ DialogId ContactsManager::get_dialog_id(const tl_object_ptr<telegram_api::Chat>
|
||||
return DialogId(get_chat_id(chat));
|
||||
}
|
||||
|
||||
void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr, const char *source, bool is_me) {
|
||||
void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr, const char *source) {
|
||||
LOG(DEBUG) << "Receive from " << source << ' ' << to_string(user_ptr);
|
||||
int32 constructor_id = user_ptr->get_id();
|
||||
if (constructor_id == telegram_api::userEmpty::ID) {
|
||||
@ -10211,12 +10211,7 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
||||
int32 flags2 = user->flags2_;
|
||||
LOG(INFO) << "Receive " << user_id << " with flags " << flags << ' ' << flags2 << " from " << source;
|
||||
|
||||
// the boolean fields aren't set for manually created telegram_api::user objects, therefore the flags must be used
|
||||
if (is_me && (flags & USER_FLAG_IS_ME) == 0) {
|
||||
LOG(ERROR) << user_id << " doesn't have flag IS_ME, but must have it when received from " << source;
|
||||
flags |= USER_FLAG_IS_ME;
|
||||
}
|
||||
|
||||
// the True fields aren't set for manually created telegram_api::user objects, therefore the flags must be used
|
||||
bool is_bot = (flags & USER_FLAG_IS_BOT) != 0;
|
||||
if (flags & USER_FLAG_IS_ME) {
|
||||
set_my_id(user_id);
|
||||
|
@ -159,7 +159,7 @@ class ContactsManager final : public Actor {
|
||||
|
||||
void reload_contacts(bool force);
|
||||
|
||||
void on_get_user(tl_object_ptr<telegram_api::User> &&user, const char *source, bool is_me = false);
|
||||
void on_get_user(tl_object_ptr<telegram_api::User> &&user, const char *source);
|
||||
void on_get_users(vector<tl_object_ptr<telegram_api::User>> &&users, const char *source);
|
||||
|
||||
void on_binlog_user_event(BinlogEvent &&event);
|
||||
@ -1166,7 +1166,7 @@ class ContactsManager final : public Actor {
|
||||
|
||||
static constexpr int32 CHANNEL_PARTICIPANT_CACHE_TIME = 1800; // some reasonable limit
|
||||
|
||||
// the boolean fields aren't set for manually created telegram_api::user objects, therefore the flags must be used
|
||||
// the True fields aren't set for manually created telegram_api::user objects, therefore the flags must be used
|
||||
static constexpr int32 USER_FLAG_HAS_ACCESS_HASH = 1 << 0;
|
||||
static constexpr int32 USER_FLAG_HAS_FIRST_NAME = 1 << 1;
|
||||
static constexpr int32 USER_FLAG_HAS_LAST_NAME = 1 << 2;
|
||||
|
@ -165,8 +165,8 @@ void PhoneNumberManager::process_check_code_result(Result<tl_object_ptr<telegram
|
||||
if (result.is_error()) {
|
||||
return on_query_error(result.move_as_error());
|
||||
}
|
||||
send_closure(G()->contacts_manager(), &ContactsManager::on_get_user, result.move_as_ok(), "process_check_code_result",
|
||||
true);
|
||||
send_closure(G()->contacts_manager(), &ContactsManager::on_get_user, result.move_as_ok(),
|
||||
"process_check_code_result");
|
||||
state_ = State::Ok;
|
||||
on_query_ok();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user