Variable names improvements.

GitOrigin-RevId: 39c654c4b2b262b087afb777a12307e803c260d6
This commit is contained in:
levlam 2019-10-21 17:17:12 +03:00
parent 5e8a79e984
commit ee57044ae2

View File

@ -344,12 +344,12 @@ class SetUserIsBlockedQuery : public Td::ResultHandler {
explicit SetUserIsBlockedQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) { explicit SetUserIsBlockedQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
} }
void send(UserId user_id, tl_object_ptr<telegram_api::InputUser> &&user, bool is_blocked) { void send(UserId user_id, tl_object_ptr<telegram_api::InputUser> &&input_user, bool is_blocked) {
user_id_ = user_id; user_id_ = user_id;
if (is_blocked) { if (is_blocked) {
send_query(G()->net_query_creator().create(create_storer(telegram_api::contacts_block(std::move(user))))); send_query(G()->net_query_creator().create(create_storer(telegram_api::contacts_block(std::move(input_user)))));
} else { } else {
send_query(G()->net_query_creator().create(create_storer(telegram_api::contacts_unblock(std::move(user))))); send_query(G()->net_query_creator().create(create_storer(telegram_api::contacts_unblock(std::move(input_user)))));
} }
} }
@ -3987,8 +3987,8 @@ Status ContactsManager::set_user_is_blocked(UserId user_id, bool is_blocked) {
return Status::Error(5, is_blocked ? Slice("Can't block self") : Slice("Can't unblock self")); return Status::Error(5, is_blocked ? Slice("Can't block self") : Slice("Can't unblock self"));
} }
auto user = get_input_user(user_id); auto input_user = get_input_user(user_id);
if (user == nullptr) { if (input_user == nullptr) {
return Status::Error(5, "User not found"); return Status::Error(5, "User not found");
} }
@ -3998,7 +3998,8 @@ Status ContactsManager::set_user_is_blocked(UserId user_id, bool is_blocked) {
result.move_as_error()); result.move_as_error());
} }
}); });
td_->create_handler<SetUserIsBlockedQuery>(std::move(query_promise))->send(user_id, std::move(user), is_blocked); td_->create_handler<SetUserIsBlockedQuery>(std::move(query_promise))
->send(user_id, std::move(input_user), is_blocked);
on_update_user_is_blocked(user_id, is_blocked); on_update_user_is_blocked(user_id, is_blocked);
return Status::OK(); return Status::OK();
@ -7275,9 +7276,9 @@ ContactsManager::UserFull *ContactsManager::get_user_full_force(UserId user_id)
return nullptr; return nullptr;
} }
UserFull *c = get_user_full(user_id); UserFull *user_full = get_user_full(user_id);
if (c != nullptr) { if (user_full != nullptr) {
return c; return user_full;
} }
if (!G()->parameters().use_chat_info_db) { if (!G()->parameters().use_chat_info_db) {
return nullptr; return nullptr;
@ -7349,9 +7350,9 @@ ContactsManager::ChatFull *ContactsManager::get_chat_full_force(ChatId chat_id)
return nullptr; return nullptr;
} }
ChatFull *c = get_chat_full(chat_id); ChatFull *chat_full = get_chat_full(chat_id);
if (c != nullptr) { if (chat_full != nullptr) {
return c; return chat_full;
} }
if (!G()->parameters().use_chat_info_db) { if (!G()->parameters().use_chat_info_db) {
return nullptr; return nullptr;
@ -7420,9 +7421,9 @@ ContactsManager::ChannelFull *ContactsManager::get_channel_full_force(ChannelId
return nullptr; return nullptr;
} }
ChannelFull *c = get_channel_full(channel_id); ChannelFull *channel_full = get_channel_full(channel_id);
if (c != nullptr) { if (channel_full != nullptr) {
return c; return channel_full;
} }
if (!G()->parameters().use_chat_info_db) { if (!G()->parameters().use_chat_info_db) {
return nullptr; return nullptr;
@ -10324,7 +10325,7 @@ UserId ContactsManager::get_me(Promise<Unit> &&promise) {
bool ContactsManager::get_user(UserId user_id, int left_tries, Promise<Unit> &&promise) { bool ContactsManager::get_user(UserId user_id, int left_tries, Promise<Unit> &&promise) {
if (!user_id.is_valid()) { if (!user_id.is_valid()) {
promise.set_error(Status::Error(6, "Invalid user id")); promise.set_error(Status::Error(6, "Invalid user ID"));
return false; return false;
} }
@ -10673,13 +10674,13 @@ bool ContactsManager::is_chat_full_outdated(const ChatFull *chat_full, const Cha
} }
for (const auto &participant : chat_full->participants) { for (const auto &participant : chat_full->participants) {
auto user = get_user(participant.user_id); auto u = get_user(participant.user_id);
if (user != nullptr && user->bot_info_version != -1) { if (u != nullptr && u->bot_info_version != -1) {
auto user_full = get_user_full(participant.user_id); auto user_full = get_user_full(participant.user_id);
if (user_full == nullptr || user_full->is_bot_info_expired(user->bot_info_version)) { if (user_full == nullptr || user_full->is_bot_info_expired(u->bot_info_version)) {
LOG(INFO) << "Have outdated botInfo for " << participant.user_id << " with version " LOG(INFO) << "Have outdated botInfo for " << participant.user_id << " with version "
<< (user_full && user_full->bot_info ? user_full->bot_info->version : -123456789) << (user_full && user_full->bot_info ? user_full->bot_info->version : -123456789)
<< ", but current version is " << user->bot_info_version; << ", but current version is " << u->bot_info_version;
return true; return true;
} }
} }
@ -10689,8 +10690,8 @@ bool ContactsManager::is_chat_full_outdated(const ChatFull *chat_full, const Cha
} }
bool ContactsManager::get_chat_full(ChatId chat_id, Promise<Unit> &&promise) { bool ContactsManager::get_chat_full(ChatId chat_id, Promise<Unit> &&promise) {
auto chat = get_chat(chat_id); auto c = get_chat(chat_id);
if (chat == nullptr) { if (c == nullptr) {
promise.set_error(Status::Error(6, "Group not found")); promise.set_error(Status::Error(6, "Group not found"));
return false; return false;
} }
@ -10702,7 +10703,7 @@ bool ContactsManager::get_chat_full(ChatId chat_id, Promise<Unit> &&promise) {
return false; return false;
} }
if (is_chat_full_outdated(chat_full, chat, chat_id)) { if (is_chat_full_outdated(chat_full, c, chat_id)) {
LOG(INFO) << "Have outdated full " << chat_id; LOG(INFO) << "Have outdated full " << chat_id;
if (td_->auth_manager_->is_bot()) { if (td_->auth_manager_->is_bot()) {
send_get_chat_full_query(chat_id, std::move(promise), "get expired chat_full"); send_get_chat_full_query(chat_id, std::move(promise), "get expired chat_full");
@ -11241,9 +11242,9 @@ DialogParticipant ContactsManager::get_channel_participant(ChannelId channel_id,
if (!td_->auth_manager_->is_bot() && is_user_bot(user_id)) { if (!td_->auth_manager_->is_bot() && is_user_bot(user_id)) {
// get BotInfo through UserFull // get BotInfo through UserFull
auto user = get_user(user_id); auto u = get_user(user_id);
auto user_full = get_user_full_force(user_id); auto user_full = get_user_full_force(user_id);
if (user_full == nullptr || user_full->is_bot_info_expired(user->bot_info_version)) { if (user_full == nullptr || user_full->is_bot_info_expired(u->bot_info_version)) {
if (force) { if (force) {
LOG(ERROR) << "Can't find cached UserFull"; LOG(ERROR) << "Can't find cached UserFull";
} else { } else {