Rename is_aggressive_anti_spam_enabled to has_aggressive_anti_spam_enabled.

This commit is contained in:
levlam 2022-12-27 19:14:37 +03:00
parent bb9108ca32
commit a19f55b116
7 changed files with 46 additions and 46 deletions

View File

@ -890,14 +890,14 @@ supergroup id:int53 usernames:usernames date:int32 status:ChatMemberStatus membe
//@can_toggle_aggressive_anti_spam True, if aggressive anti-spam checks can be enabled or disabled in the supergroup
//@is_all_history_available True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available,
//-so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators
//@is_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators
//@has_aggressive_anti_spam_enabled True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators
//@sticker_set_id Identifier of the supergroup sticker set; 0 if none
//@location Location to which the supergroup is connected; may be null
//@invite_link Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only
//@bot_commands List of commands of bots in the group
//@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none
//@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none
supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_username:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool is_aggressive_anti_spam_enabled:Bool sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector<botCommands> upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo;
supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool has_hidden_members:Bool can_hide_members:Bool can_set_username:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool can_toggle_aggressive_anti_spam:Bool is_all_history_available:Bool has_aggressive_anti_spam_enabled:Bool sticker_set_id:int64 location:chatLocation invite_link:chatInviteLink bot_commands:vector<botCommands> upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo;
//@class SecretChatState @description Describes the current secret chat state
@ -3517,8 +3517,8 @@ chatEventInvitesToggled can_invite_users:Bool = ChatEventAction;
//@description The is_all_history_available setting of a supergroup was toggled @is_all_history_available New value of is_all_history_available
chatEventIsAllHistoryAvailableToggled is_all_history_available:Bool = ChatEventAction;
//@description The is_aggressive_anti_spam_enabled setting of a supergroup was toggled @is_aggressive_anti_spam_enabled New value of is_aggressive_anti_spam_enabled
chatEventIsAggressiveAntiSpamEnabledToggled is_aggressive_anti_spam_enabled:Bool = ChatEventAction;
//@description The has_aggressive_anti_spam_enabled setting of a supergroup was toggled @has_aggressive_anti_spam_enabled New value of has_aggressive_anti_spam_enabled
chatEventHasAggressiveAntiSpamEnabledToggled has_aggressive_anti_spam_enabled:Bool = ChatEventAction;
//@description The sign_messages setting of a channel was toggled @sign_messages New value of sign_messages
chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction;
@ -7337,8 +7337,8 @@ toggleSupergroupHasHiddenMembers supergroup_id:int53 has_hidden_members:Bool = O
//@description Toggles whether aggressive anti-spam checks are enabled in the supergroup. Can be called only if supergroupFullInfo.can_toggle_aggressive_anti_spam == true
//@supergroup_id The identifier of the supergroup, which isn't a broadcast group
//@is_aggressive_anti_spam_enabled The new value of is_aggressive_anti_spam_enabled
toggleSupergroupIsAggressiveAntiSpamEnabled supergroup_id:int53 is_aggressive_anti_spam_enabled:Bool = Ok;
//@has_aggressive_anti_spam_enabled The new value of has_aggressive_anti_spam_enabled
toggleSupergroupHasAggressiveAntiSpamEnabled supergroup_id:int53 has_aggressive_anti_spam_enabled:Bool = Ok;
//@description Toggles whether the supergroup is a forum; requires owner privileges in the supergroup @supergroup_id Identifier of the supergroup @is_forum New value of is_forum. A supergroup can be converted to a forum, only if it has at least getOption("forum_member_count_min") members
toggleSupergroupIsForum supergroup_id:int53 is_forum:Bool = Ok;

View File

@ -1357,20 +1357,20 @@ class ToggleParticipantsHiddenQuery final : public Td::ResultHandler {
class ToggleAntiSpamQuery final : public Td::ResultHandler {
Promise<Unit> promise_;
ChannelId channel_id_;
bool is_aggressive_anti_spam_enabled_;
bool has_aggressive_anti_spam_enabled_;
public:
explicit ToggleAntiSpamQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send(ChannelId channel_id, bool is_aggressive_anti_spam_enabled) {
void send(ChannelId channel_id, bool has_aggressive_anti_spam_enabled) {
channel_id_ = channel_id;
is_aggressive_anti_spam_enabled_ = is_aggressive_anti_spam_enabled;
has_aggressive_anti_spam_enabled_ = has_aggressive_anti_spam_enabled;
auto input_channel = td_->contacts_manager_->get_input_channel(channel_id);
CHECK(input_channel != nullptr);
send_query(G()->net_query_creator().create(
telegram_api::channels_toggleAntiSpam(std::move(input_channel), is_aggressive_anti_spam_enabled),
telegram_api::channels_toggleAntiSpam(std::move(input_channel), has_aggressive_anti_spam_enabled),
{{channel_id}}));
}
@ -1387,9 +1387,9 @@ class ToggleAntiSpamQuery final : public Td::ResultHandler {
std::move(ptr),
PromiseCreator::lambda(
[actor_id = G()->contacts_manager(), promise = std::move(promise_), channel_id = channel_id_,
is_aggressive_anti_spam_enabled = is_aggressive_anti_spam_enabled_](Unit result) mutable {
send_closure(actor_id, &ContactsManager::on_update_channel_is_aggressive_anti_spam_enabled, channel_id,
is_aggressive_anti_spam_enabled, std::move(promise));
has_aggressive_anti_spam_enabled = has_aggressive_anti_spam_enabled_](Unit result) mutable {
send_closure(actor_id, &ContactsManager::on_update_channel_has_aggressive_anti_spam_enabled, channel_id,
has_aggressive_anti_spam_enabled, std::move(promise));
}));
}
@ -4964,7 +4964,7 @@ void ContactsManager::ChannelFull::store(StorerT &storer) const {
STORE_FLAG(has_invite_link);
STORE_FLAG(has_bot_commands); // 25
STORE_FLAG(can_be_deleted);
STORE_FLAG(is_aggressive_anti_spam_enabled);
STORE_FLAG(has_aggressive_anti_spam_enabled);
STORE_FLAG(has_hidden_participants);
END_STORE_FLAGS();
if (has_description) {
@ -5069,7 +5069,7 @@ void ContactsManager::ChannelFull::parse(ParserT &parser) {
PARSE_FLAG(has_invite_link);
PARSE_FLAG(has_bot_commands);
PARSE_FLAG(can_be_deleted);
PARSE_FLAG(is_aggressive_anti_spam_enabled);
PARSE_FLAG(has_aggressive_anti_spam_enabled);
PARSE_FLAG(has_hidden_participants);
END_PARSE_FLAGS();
if (has_description) {
@ -7626,7 +7626,7 @@ Status ContactsManager::can_toggle_channel_aggressive_anti_spam(ChannelId channe
if (c->is_gigagroup) {
return Status::Error(400, "Aggressive anti-spam checks can't be enabled in broadcast supergroups");
}
if (channel_full != nullptr && channel_full->is_aggressive_anti_spam_enabled) {
if (channel_full != nullptr && channel_full->has_aggressive_anti_spam_enabled) {
return Status::OK();
}
if (c->has_location || begins_with(c->usernames.get_editable_username(), "translation_")) {
@ -7639,13 +7639,13 @@ Status ContactsManager::can_toggle_channel_aggressive_anti_spam(ChannelId channe
return Status::OK();
}
void ContactsManager::toggle_channel_is_aggressive_anti_spam_enabled(ChannelId channel_id,
bool is_aggressive_anti_spam_enabled,
Promise<Unit> &&promise) {
auto channel_full = get_channel_full_force(channel_id, true, "toggle_channel_is_aggressive_anti_spam_enabled");
void ContactsManager::toggle_channel_has_aggressive_anti_spam_enabled(ChannelId channel_id,
bool has_aggressive_anti_spam_enabled,
Promise<Unit> &&promise) {
auto channel_full = get_channel_full_force(channel_id, true, "toggle_channel_has_aggressive_anti_spam_enabled");
TRY_STATUS_PROMISE(promise, can_toggle_channel_aggressive_anti_spam(channel_id, channel_full));
td_->create_handler<ToggleAntiSpamQuery>(std::move(promise))->send(channel_id, is_aggressive_anti_spam_enabled);
td_->create_handler<ToggleAntiSpamQuery>(std::move(promise))->send(channel_id, has_aggressive_anti_spam_enabled);
}
void ContactsManager::toggle_channel_is_forum(ChannelId channel_id, bool is_forum, Promise<Unit> &&promise) {
@ -12339,7 +12339,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
auto can_set_sticker_set = channel->can_set_stickers_;
auto can_set_location = channel->can_set_location_;
auto is_all_history_available = !channel->hidden_prehistory_;
auto is_aggressive_anti_spam_enabled = channel->antispam_;
auto has_aggressive_anti_spam_enabled = channel->antispam_;
auto can_view_statistics = channel->can_view_stats_;
StickerSetId sticker_set_id;
if (channel->stickerset_ != nullptr) {
@ -12367,7 +12367,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
channel_full->can_view_statistics != can_view_statistics || channel_full->stats_dc_id != stats_dc_id ||
channel_full->sticker_set_id != sticker_set_id ||
channel_full->is_all_history_available != is_all_history_available ||
channel_full->is_aggressive_anti_spam_enabled != is_aggressive_anti_spam_enabled ||
channel_full->has_aggressive_anti_spam_enabled != has_aggressive_anti_spam_enabled ||
channel_full->has_hidden_participants != has_hidden_participants) {
channel_full->participant_count = participant_count;
channel_full->administrator_count = administrator_count;
@ -12382,7 +12382,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
channel_full->stats_dc_id = stats_dc_id;
channel_full->sticker_set_id = sticker_set_id;
channel_full->is_all_history_available = is_all_history_available;
channel_full->is_aggressive_anti_spam_enabled = is_aggressive_anti_spam_enabled;
channel_full->has_aggressive_anti_spam_enabled = has_aggressive_anti_spam_enabled;
channel_full->is_changed = true;
}
@ -15397,16 +15397,16 @@ void ContactsManager::on_update_channel_has_hidden_participants(ChannelId channe
promise.set_value(Unit());
}
void ContactsManager::on_update_channel_is_aggressive_anti_spam_enabled(ChannelId channel_id,
bool is_aggressive_anti_spam_enabled,
Promise<Unit> &&promise) {
void ContactsManager::on_update_channel_has_aggressive_anti_spam_enabled(ChannelId channel_id,
bool has_aggressive_anti_spam_enabled,
Promise<Unit> &&promise) {
TRY_STATUS_PROMISE(promise, G()->close_status());
CHECK(channel_id.is_valid());
auto channel_full = get_channel_full_force(channel_id, true, "on_update_channel_is_aggressive_anti_spam_enabled");
if (channel_full != nullptr && channel_full->is_aggressive_anti_spam_enabled != is_aggressive_anti_spam_enabled) {
channel_full->is_aggressive_anti_spam_enabled = is_aggressive_anti_spam_enabled;
auto channel_full = get_channel_full_force(channel_id, true, "on_update_channel_has_aggressive_anti_spam_enabled");
if (channel_full != nullptr && channel_full->has_aggressive_anti_spam_enabled != has_aggressive_anti_spam_enabled) {
channel_full->has_aggressive_anti_spam_enabled = has_aggressive_anti_spam_enabled;
channel_full->is_changed = true;
update_channel_full(channel_full, channel_id, "on_update_channel_is_aggressive_anti_spam_enabled");
update_channel_full(channel_full, channel_id, "on_update_channel_has_aggressive_anti_spam_enabled");
}
promise.set_value(Unit());
}
@ -18173,7 +18173,7 @@ tl_object_ptr<td_api::supergroupFullInfo> ContactsManager::get_supergroup_full_i
can_hide_channel_participants(channel_id, channel_full).is_ok(), channel_full->can_set_username,
channel_full->can_set_sticker_set, channel_full->can_set_location, channel_full->can_view_statistics,
can_toggle_channel_aggressive_anti_spam(channel_id, channel_full).is_ok(), channel_full->is_all_history_available,
channel_full->is_aggressive_anti_spam_enabled, channel_full->sticker_set_id.get(),
channel_full->has_aggressive_anti_spam_enabled, channel_full->sticker_set_id.get(),
channel_full->location.get_chat_location_object(), channel_full->invite_link.get_chat_invite_link_object(this),
std::move(bot_commands),
get_basic_group_id_object(channel_full->migrated_from_chat_id, "get_supergroup_full_info_object"),

View File

@ -214,8 +214,8 @@ class ContactsManager final : public Actor {
Promise<Unit> &&promise);
void on_update_channel_has_hidden_participants(ChannelId channel_id, bool has_hidden_participants,
Promise<Unit> &&promise);
void on_update_channel_is_aggressive_anti_spam_enabled(ChannelId channel_id, bool is_aggressive_anti_spam_enabled,
Promise<Unit> &&promise);
void on_update_channel_has_aggressive_anti_spam_enabled(ChannelId channel_id, bool has_aggressive_anti_spam_enabled,
Promise<Unit> &&promise);
void on_update_channel_default_permissions(ChannelId channel_id, RestrictedRights default_permissions);
void on_update_channel_administrator_count(ChannelId channel_id, int32 administrator_count);
@ -411,8 +411,8 @@ class ContactsManager final : public Actor {
void toggle_channel_has_hidden_participants(ChannelId channel_id, bool has_hidden_participants,
Promise<Unit> &&promise);
void toggle_channel_is_aggressive_anti_spam_enabled(ChannelId channel_id, bool is_aggressive_anti_spam_enabled,
Promise<Unit> &&promise);
void toggle_channel_has_aggressive_anti_spam_enabled(ChannelId channel_id, bool has_aggressive_anti_spam_enabled,
Promise<Unit> &&promise);
void toggle_channel_is_forum(ChannelId channel_id, bool is_forum, Promise<Unit> &&promise);
@ -1009,7 +1009,7 @@ class ContactsManager final : public Actor {
bool can_view_statistics = false;
bool is_can_view_statistics_inited = false;
bool is_all_history_available = true;
bool is_aggressive_anti_spam_enabled = false;
bool has_aggressive_anti_spam_enabled = false;
bool can_be_deleted = false;
bool is_slow_mode_next_send_date_changed = true;

View File

@ -419,7 +419,7 @@ static td_api::object_ptr<td_api::ChatEventAction> get_chat_event_action_object(
}
case telegram_api::channelAdminLogEventActionToggleAntiSpam::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionToggleAntiSpam>(action_ptr);
return td_api::make_object<td_api::chatEventIsAggressiveAntiSpamEnabledToggled>(action->new_value_);
return td_api::make_object<td_api::chatEventHasAggressiveAntiSpamEnabledToggled>(action->new_value_);
}
default:
UNREACHABLE();

View File

@ -7048,11 +7048,11 @@ void Td::on_request(uint64 id, const td_api::toggleSupergroupHasHiddenMembers &r
request.has_hidden_members_, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::toggleSupergroupIsAggressiveAntiSpamEnabled &request) {
void Td::on_request(uint64 id, const td_api::toggleSupergroupHasAggressiveAntiSpamEnabled &request) {
CHECK_IS_USER();
CREATE_OK_REQUEST_PROMISE();
contacts_manager_->toggle_channel_is_aggressive_anti_spam_enabled(
ChannelId(request.supergroup_id_), request.is_aggressive_anti_spam_enabled_, std::move(promise));
contacts_manager_->toggle_channel_has_aggressive_anti_spam_enabled(
ChannelId(request.supergroup_id_), request.has_aggressive_anti_spam_enabled_, std::move(promise));
}
void Td::on_request(uint64 id, const td_api::toggleSupergroupIsForum &request) {

View File

@ -1124,7 +1124,7 @@ class Td final : public Actor {
void on_request(uint64 id, const td_api::toggleSupergroupHasHiddenMembers &request);
void on_request(uint64 id, const td_api::toggleSupergroupIsAggressiveAntiSpamEnabled &request);
void on_request(uint64 id, const td_api::toggleSupergroupHasAggressiveAntiSpamEnabled &request);
void on_request(uint64 id, const td_api::toggleSupergroupIsForum &request);

View File

@ -4691,10 +4691,10 @@ class CliClient final : public Actor {
has_hidden_members));
} else if (op == "tsgas") {
string supergroup_id;
bool is_aggressive_anti_spam_enabled;
get_args(args, supergroup_id, is_aggressive_anti_spam_enabled);
send_request(td_api::make_object<td_api::toggleSupergroupIsAggressiveAntiSpamEnabled>(
as_supergroup_id(supergroup_id), is_aggressive_anti_spam_enabled));
bool has_aggressive_anti_spam_enabled;
get_args(args, supergroup_id, has_aggressive_anti_spam_enabled);
send_request(td_api::make_object<td_api::toggleSupergroupHasAggressiveAntiSpamEnabled>(
as_supergroup_id(supergroup_id), has_aggressive_anti_spam_enabled));
} else if (op == "tsgif") {
string supergroup_id;
bool is_forum;