From 786cbf990cc45168c3eee66a78e8fb0d8f793251 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 19 Dec 2022 20:29:33 +0300 Subject: [PATCH] Add supergroupFullInfo.has_hidden_members. --- td/generate/scheme/td_api.tl | 5 +++-- td/telegram/ContactsManager.cpp | 21 +++++++++++++-------- td/telegram/ContactsManager.h | 2 ++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index cd9e95718..554ca02bf 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -871,7 +871,8 @@ supergroup id:int53 usernames:usernames date:int32 status:ChatMemberStatus membe //@linked_chat_id Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown //@slow_mode_delay Delay between consecutive sent messages for non-administrator supergroup members, in seconds //@slow_mode_delay_expires_in Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero -//@can_get_members True, if members of the chat can be retrieved +//@can_get_members True, if members of the chat can be retrieved via getSupergroupMembers or searchChatMembers +//@has_hidden_members True, if non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers //@can_set_username True, if the chat username can be changed //@can_set_sticker_set True, if the supergroup sticker set can be changed //@can_set_location True, if the supergroup location can be changed @@ -886,7 +887,7 @@ supergroup id:int53 usernames:usernames date:int32 status:ChatMemberStatus membe //@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 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 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_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 upgraded_from_basic_group_id:int53 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 3aa2b247d..c552550ee 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -4908,6 +4908,7 @@ void ContactsManager::ChannelFull::store(StorerT &storer) const { STORE_FLAG(has_bot_commands); // 25 STORE_FLAG(can_be_deleted); STORE_FLAG(is_aggressive_anti_spam_enabled); + STORE_FLAG(has_hidden_participants); END_STORE_FLAGS(); if (has_description) { store(description, storer); @@ -5012,6 +5013,7 @@ void ContactsManager::ChannelFull::parse(ParserT &parser) { PARSE_FLAG(has_bot_commands); PARSE_FLAG(can_be_deleted); PARSE_FLAG(is_aggressive_anti_spam_enabled); + PARSE_FLAG(has_hidden_participants); END_PARSE_FLAGS(); if (has_description) { parse(description, parser); @@ -12203,6 +12205,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr &&c auto restricted_count = channel->banned_count_; auto banned_count = channel->kicked_count_; auto can_get_participants = channel->can_view_participants_; + auto has_hidden_participants = channel->participants_hidden_; auto can_set_username = channel->can_set_username_; auto can_set_sticker_set = channel->can_set_stickers_; auto can_set_location = channel->can_set_location_; @@ -12235,12 +12238,14 @@ void ContactsManager::on_get_chat_full(tl_object_ptr &&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->is_aggressive_anti_spam_enabled != is_aggressive_anti_spam_enabled || + channel_full->has_hidden_participants != has_hidden_participants) { channel_full->participant_count = participant_count; channel_full->administrator_count = administrator_count; channel_full->restricted_count = restricted_count; channel_full->banned_count = banned_count; channel_full->can_get_participants = can_get_participants; + channel_full->has_hidden_participants = has_hidden_participants; channel_full->can_set_username = can_set_username; channel_full->can_set_sticker_set = can_set_sticker_set; channel_full->can_set_location = can_set_location; @@ -12322,7 +12327,7 @@ void ContactsManager::on_get_chat_full(tl_object_ptr &&c DialogId(channel_id), default_send_message_as_dialog_id, false); } - if (participant_count >= 190 || !can_get_participants) { + if (participant_count >= 190 || !can_get_participants || has_hidden_participants) { td_->messages_manager_->on_update_dialog_online_member_count(DialogId(channel_id), channel->online_count_, true); } @@ -18041,12 +18046,12 @@ tl_object_ptr ContactsManager::get_supergroup_full_i get_chat_photo_object(td_->file_manager_.get(), channel_full->photo), channel_full->description, channel_full->participant_count, channel_full->administrator_count, channel_full->restricted_count, channel_full->banned_count, DialogId(channel_full->linked_channel_id).get(), channel_full->slow_mode_delay, - slow_mode_delay_expires_in, channel_full->can_get_participants, 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->location.get_chat_location_object(), channel_full->invite_link.get_chat_invite_link_object(this), - std::move(bot_commands), + slow_mode_delay_expires_in, channel_full->can_get_participants, channel_full->has_hidden_participants, + 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->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"), channel_full->migrated_from_max_message_id.get()); } diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index a20d8b363..5adad098f 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -999,6 +999,7 @@ class ContactsManager final : public Actor { vector bot_user_ids; bool can_get_participants = false; + bool has_hidden_participants = false; bool can_set_username = false; bool can_set_sticker_set = false; bool can_set_location = false; @@ -1236,6 +1237,7 @@ class ContactsManager final : public Actor { static constexpr int32 CHANNEL_FULL_FLAG_HAS_DEFAULT_SEND_AS = 1 << 29; static constexpr int32 CHANNEL_FULL_FLAG_HAS_AVAILABLE_REACTIONS = 1 << 30; static constexpr int32 CHANNEL_FULL_FLAG2_HAS_ANTISPAM = 1 << 1; + static constexpr int32 CHANNEL_FULL_FLAG2_ARE_PARTICIPANTS_HIDDEN = 1 << 2; static constexpr int32 USER_FULL_EXPIRE_TIME = 60; static constexpr int32 CHANNEL_FULL_EXPIRE_TIME = 60;