Add supergroup.is_voice_chat_empty flag.

This commit is contained in:
levlam 2020-12-05 19:43:57 +03:00
parent c34e7ed6ba
commit bc5a3d2cec
6 changed files with 38 additions and 17 deletions

View File

@ -571,13 +571,14 @@ basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int32 memb
//@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel
//@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup
//@has_voice_chat True, if the supergroup has active voice chat
//@is_voice_chat_empty True, if the supergroup's active voice chat is empty
//@sign_messages True, if messages sent to the channel should contain information about the sender. This field is only applicable to channels
//@is_slow_mode_enabled True, if the slow mode is enabled in the supergroup
//@is_channel True, if the supergroup is a channel
//@is_verified True, if the supergroup or channel is verified
//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted
//@is_scam True, if many users reported this supergroup as a scam
supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool has_voice_chat:Bool sign_messages:Bool is_slow_mode_enabled:Bool is_channel:Bool is_verified:Bool restriction_reason:string is_scam:Bool = Supergroup;
supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool has_voice_chat:Bool is_voice_chat_empty:Bool sign_messages:Bool is_slow_mode_enabled:Bool is_channel:Bool is_verified:Bool restriction_reason:string is_scam:Bool = Supergroup;
//@description Contains full information about a supergroup or channel
//@photo Chat photo; may be null
@ -4200,8 +4201,8 @@ leaveChat chat_id:int53 = Ok;
//@chat_id Chat identifier @user_id Identifier of the user @forward_limit The number of earlier messages from the chat to be forwarded to the new member; up to 100. Ignored for supergroups and channels
addChatMember chat_id:int53 user_id:int32 forward_limit:int32 = Ok;
//@description Adds multiple new members to a chat. Currently this option is only available for supergroups and channels. This option can't be used to join a chat. Members can't be added to a channel if it has more than 200 members. Members will not be added until the chat state has been synchronized with the server
//@chat_id Chat identifier @user_ids Identifiers of the users to be added to the chat
//@description Adds multiple new members to a chat. Currently this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members. Members will not be added until the chat state has been synchronized with the server
//@chat_id Chat identifier @user_ids Identifiers of the users to be added to the chat. The maximum number of added users is 20 for supergroups and 100 for channels
addChatMembers chat_id:int53 user_ids:vector<int32> = Ok;
//@description Changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for adding new members to the chat and transferring chat ownership; instead, use addChatMember or transferChatOwnership. The chat member status will not be changed until it has been synchronized with the server
@ -4341,7 +4342,7 @@ joinGroupCall group_call_id:int32 payload:groupCallPayload source:int32 is_muted
toggleGroupCallMuteNewMembers group_call_id:int32 mute_new_members:Bool = Ok;
//@description Invites users to a group call. Sends a service message of type messageInviteToGroupCall for voice chats
//@group_call_id Group call identifier @user_ids User identifiers
//@group_call_id Group call identifier @user_ids User identifiers. At most 10 users can be invited simultaneously
inviteGroupCallMembers group_call_id:int32 user_ids:vector<int32> = Ok;
//@description Informs TDLib that a group call member speaking state has changed @group_call_id Group call identifier

Binary file not shown.

View File

@ -111,7 +111,7 @@ userStatusLastMonth#77ebc742 = UserStatus;
chatEmpty#9ba2d800 id:int = Chat;
chat#3bda1bde flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
chatForbidden#7328bdb id:int title:string = Chat;
channel#d31a961e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
channel#d31a961e flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat;
chatFull#1b7c9db3 flags:# can_set_username:flags.7?true has_scheduled:flags.8?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int folder_id:flags.11?int = ChatFull;

Binary file not shown.

View File

@ -3561,6 +3561,7 @@ void ContactsManager::Channel::store(StorerT &storer) const {
STORE_FLAG(is_slow_mode_enabled);
STORE_FLAG(has_restriction_reasons);
STORE_FLAG(has_active_group_call);
STORE_FLAG(is_group_call_empty);
END_STORE_FLAGS();
store(status, storer);
@ -3627,6 +3628,7 @@ void ContactsManager::Channel::parse(ParserT &parser) {
PARSE_FLAG(is_slow_mode_enabled);
PARSE_FLAG(has_restriction_reasons);
PARSE_FLAG(has_active_group_call);
PARSE_FLAG(is_group_call_empty);
END_PARSE_FLAGS();
if (use_new_rights) {
@ -5963,6 +5965,7 @@ void ContactsManager::on_create_channel_group_call(ChannelId channel_id, InputGr
CHECK(c != nullptr);
if (!c->has_active_group_call) {
c->has_active_group_call = true;
c->is_group_call_empty = true;
c->is_changed = true;
update_channel(c, channel_id);
}
@ -9664,6 +9667,9 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
LOG(ERROR) << "Receive invalid has_active_group_call flag " << c->has_active_group_call << ", but have "
<< input_group_call_id << " in " << channel_id;
c->has_active_group_call = has_active_group_call;
if (!has_active_group_call) {
c->is_group_call_empty = false;
}
c->is_changed = true;
update_channel(c, channel_id);
}
@ -13930,6 +13936,7 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel, const char
bool has_linked_channel = (channel.flags_ & CHANNEL_FLAG_HAS_LINKED_CHAT) != 0;
bool has_location = (channel.flags_ & CHANNEL_FLAG_HAS_LOCATION) != 0;
bool has_active_group_call = (channel.flags_ & CHANNEL_FLAG_HAS_ACTIVE_GROUP_CALL) != 0;
bool is_group_call_empty = (channel.flags_ & CHANNEL_FLAG_IS_GROUP_CALL_EMPTY) != 0;
bool sign_messages = (channel.flags_ & CHANNEL_FLAG_SIGN_MESSAGES) != 0;
bool is_slow_mode_enabled = (channel.flags_ & CHANNEL_FLAG_IS_SLOW_MODE_ENABLED) != 0;
bool is_megagroup = (channel.flags_ & CHANNEL_FLAG_IS_MEGAGROUP) != 0;
@ -14035,22 +14042,27 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel, const char
bool need_invalidate_channel_full = false;
bool need_drop_active_group_call_id = c->has_active_group_call != has_active_group_call;
if (c->has_linked_channel != has_linked_channel || c->has_location != has_location ||
c->has_active_group_call != has_active_group_call || c->sign_messages != sign_messages ||
c->is_megagroup != is_megagroup || c->is_verified != is_verified ||
c->has_active_group_call != has_active_group_call || c->is_megagroup != is_megagroup ||
c->restriction_reasons != restriction_reasons || c->is_scam != is_scam) {
c->has_linked_channel = has_linked_channel;
c->has_location = has_location;
c->has_active_group_call = has_active_group_call;
c->sign_messages = sign_messages;
c->is_slow_mode_enabled = is_slow_mode_enabled;
c->is_megagroup = is_megagroup;
c->is_verified = is_verified;
c->restriction_reasons = std::move(restriction_reasons);
c->is_scam = is_scam;
c->is_changed = true;
need_invalidate_channel_full = true;
}
if (c->is_group_call_empty != is_group_call_empty || c->sign_messages != sign_messages ||
c->is_verified != is_verified) {
c->is_group_call_empty = is_group_call_empty;
c->sign_messages = sign_messages;
c->is_verified = is_verified;
c->is_changed = true;
}
if (c->cache_version != Channel::CACHE_VERSION) {
c->cache_version = Channel::CACHE_VERSION;
@ -14102,6 +14114,7 @@ void ContactsManager::on_chat_update(telegram_api::channelForbidden &channel, co
on_update_channel_default_permissions(c, channel_id, get_restricted_rights(banned_rights));
bool has_active_group_call = false;
bool is_group_call_empty = false;
bool sign_messages = false;
bool is_slow_mode_enabled = false;
bool is_megagroup = (channel.flags_ & CHANNEL_FLAG_IS_MEGAGROUP) != 0;
@ -14125,22 +14138,27 @@ void ContactsManager::on_chat_update(telegram_api::channelForbidden &channel, co
}
bool need_invalidate_channel_full = false;
if (c->has_active_group_call != has_active_group_call || c->sign_messages != sign_messages ||
c->is_slow_mode_enabled != is_slow_mode_enabled || c->is_megagroup != is_megagroup ||
c->is_verified != is_verified || !c->restriction_reasons.empty() || c->is_scam != is_scam) {
if (c->has_active_group_call != has_active_group_call || c->is_slow_mode_enabled != is_slow_mode_enabled ||
c->is_megagroup != is_megagroup || !c->restriction_reasons.empty() || c->is_scam != is_scam) {
// c->has_linked_channel = has_linked_channel;
// c->has_location = has_location;
c->has_active_group_call = has_active_group_call;
c->sign_messages = sign_messages;
c->is_slow_mode_enabled = is_slow_mode_enabled;
c->is_megagroup = is_megagroup;
c->is_verified = is_verified;
c->restriction_reasons.clear();
c->is_scam = is_scam;
c->is_changed = true;
need_invalidate_channel_full = true;
}
if (c->is_group_call_empty != is_group_call_empty || c->sign_messages != sign_messages ||
c->is_verified != is_verified) {
c->is_group_call_empty = is_group_call_empty;
c->sign_messages = sign_messages;
c->is_verified = is_verified;
c->is_changed = true;
}
if (c->cache_version != Channel::CACHE_VERSION) {
c->cache_version = Channel::CACHE_VERSION;
@ -14356,7 +14374,7 @@ td_api::object_ptr<td_api::updateSupergroup> ContactsManager::get_update_unknown
ChannelId channel_id) {
return td_api::make_object<td_api::updateSupergroup>(td_api::make_object<td_api::supergroup>(
channel_id.get(), string(), 0, DialogParticipantStatus::Banned(0).get_chat_member_status_object(), 0, false,
false, false, false, false, true, false, "", false));
false, false, false, false, false, true, false, "", false));
}
int32 ContactsManager::get_supergroup_id_object(ChannelId channel_id, const char *source) const {
@ -14378,8 +14396,8 @@ tl_object_ptr<td_api::supergroup> ContactsManager::get_supergroup_object(Channel
}
return td_api::make_object<td_api::supergroup>(
channel_id.get(), c->username, c->date, get_channel_status(c).get_chat_member_status_object(),
c->participant_count, c->has_linked_channel, c->has_location, c->has_active_group_call, c->sign_messages,
c->is_slow_mode_enabled, !c->is_megagroup, c->is_verified,
c->participant_count, c->has_linked_channel, c->has_location, c->has_active_group_call, c->is_group_call_empty,
c->sign_messages, c->is_slow_mode_enabled, !c->is_megagroup, c->is_verified,
get_restriction_reason_description(c->restriction_reasons), c->is_scam);
}

View File

@ -795,6 +795,7 @@ class ContactsManager : public Actor {
bool has_linked_channel = false;
bool has_location = false;
bool has_active_group_call = false;
bool is_group_call_empty = false;
bool sign_messages = false;
bool is_slow_mode_enabled = false;
@ -1026,6 +1027,7 @@ class ContactsManager : public Actor {
static constexpr int32 CHANNEL_FLAG_HAS_LOCATION = 1 << 21;
static constexpr int32 CHANNEL_FLAG_IS_SLOW_MODE_ENABLED = 1 << 22;
static constexpr int32 CHANNEL_FLAG_HAS_ACTIVE_GROUP_CALL = 1 << 23;
static constexpr int32 CHANNEL_FLAG_IS_GROUP_CALL_EMPTY = 1 << 24;
static constexpr int32 CHANNEL_FULL_FLAG_HAS_PARTICIPANT_COUNT = 1 << 0;
static constexpr int32 CHANNEL_FULL_FLAG_HAS_ADMINISTRATOR_COUNT = 1 << 1;