Minor improvements.

This commit is contained in:
levlam 2023-11-04 02:39:57 +03:00
parent f169ae654c
commit 9447ce07ea
3 changed files with 7 additions and 14 deletions

View File

@ -5160,14 +5160,12 @@ void Client::on_update(object_ptr<td_api::Object> result) {
auto update = move_object_as<td_api::updateNewChat>(result);
auto chat = std::move(update->chat_);
auto chat_info = add_chat(chat->id_);
bool need_warning = false;
switch (chat->type_->get_id()) {
case td_api::chatTypePrivate::ID: {
auto type = move_object_as<td_api::chatTypePrivate>(chat->type_);
chat_info->type = ChatInfo::Type::Private;
auto user_id = type->user_id_;
chat_info->user_id = user_id;
need_warning = get_user_info(user_id) == nullptr;
break;
}
case td_api::chatTypeBasicGroup::ID: {
@ -5175,7 +5173,6 @@ void Client::on_update(object_ptr<td_api::Object> result) {
chat_info->type = ChatInfo::Type::Group;
auto group_id = type->basic_group_id_;
chat_info->group_id = group_id;
need_warning = get_group_info(group_id) == nullptr;
break;
}
case td_api::chatTypeSupergroup::ID: {
@ -5183,7 +5180,6 @@ void Client::on_update(object_ptr<td_api::Object> result) {
chat_info->type = ChatInfo::Type::Supergroup;
auto supergroup_id = type->supergroup_id_;
chat_info->supergroup_id = supergroup_id;
need_warning = get_supergroup_info(supergroup_id) == nullptr;
break;
}
case td_api::chatTypeSecret::ID:
@ -5192,9 +5188,6 @@ void Client::on_update(object_ptr<td_api::Object> result) {
default:
UNREACHABLE();
}
if (need_warning) {
LOG(ERROR) << "Received updateNewChat about chat " << chat->id_ << ", but hadn't received corresponding info";
}
chat_info->title = std::move(chat->title_);
chat_info->photo_info = std::move(chat->photo_);
@ -10457,8 +10450,8 @@ void Client::set_group_photo(int64 group_id, object_ptr<td_api::chatPhoto> &&pho
add_group_info(group_id)->photo = std::move(photo);
}
void Client::set_group_description(int64 group_id, td::string &&descripton) {
add_group_info(group_id)->description = std::move(descripton);
void Client::set_group_description(int64 group_id, td::string &&description) {
add_group_info(group_id)->description = std::move(description);
}
void Client::set_group_invite_link(int64 group_id, td::string &&invite_link) {
@ -10486,8 +10479,8 @@ void Client::set_supergroup_photo(int64 supergroup_id, object_ptr<td_api::chatPh
add_supergroup_info(supergroup_id)->photo = std::move(photo);
}
void Client::set_supergroup_description(int64 supergroup_id, td::string &&descripton) {
add_supergroup_info(supergroup_id)->description = std::move(descripton);
void Client::set_supergroup_description(int64 supergroup_id, td::string &&description) {
add_supergroup_info(supergroup_id)->description = std::move(description);
}
void Client::set_supergroup_invite_link(int64 supergroup_id, td::string &&invite_link) {

View File

@ -746,7 +746,7 @@ class Client final : public WebhookActor::Callback {
};
static void add_group(GroupInfo *group_info, object_ptr<td_api::basicGroup> &&group);
void set_group_photo(int64 group_id, object_ptr<td_api::chatPhoto> &&photo);
void set_group_description(int64 group_id, td::string &&descripton);
void set_group_description(int64 group_id, td::string &&description);
void set_group_invite_link(int64 group_id, td::string &&invite_link);
GroupInfo *add_group_info(int64 group_id);
const GroupInfo *get_group_info(int64 group_id) const;
@ -774,7 +774,7 @@ class Client final : public WebhookActor::Callback {
};
static void add_supergroup(SupergroupInfo *supergroup_info, object_ptr<td_api::supergroup> &&supergroup);
void set_supergroup_photo(int64 supergroup_id, object_ptr<td_api::chatPhoto> &&photo);
void set_supergroup_description(int64 supergroup_id, td::string &&descripton);
void set_supergroup_description(int64 supergroup_id, td::string &&description);
void set_supergroup_invite_link(int64 supergroup_id, td::string &&invite_link);
void set_supergroup_sticker_set_id(int64 supergroup_id, int64 sticker_set_id);
void set_supergroup_can_set_sticker_set(int64 supergroup_id, bool can_set_sticker_set);

View File

@ -147,7 +147,7 @@ class BotStatActor final : public td::Actor {
}
BotStatActor(const BotStatActor &) = delete;
BotStatActor &operator=(const BotStatActor &other) = delete;
BotStatActor &operator=(const BotStatActor &) = delete;
BotStatActor(BotStatActor &&) = default;
BotStatActor &operator=(BotStatActor &&other) noexcept {
if (!empty()) {