From bc5a3d2cec6473082b7af57b22cb1b6ab56b445b Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 5 Dec 2020 19:43:57 +0300 Subject: [PATCH] Add supergroup.is_voice_chat_empty flag. --- td/generate/scheme/td_api.tl | 9 +++--- td/generate/scheme/td_api.tlo | Bin 189608 -> 189652 bytes td/generate/scheme/telegram_api.tl | 2 +- td/generate/scheme/telegram_api.tlo | Bin 222892 -> 222940 bytes td/telegram/ContactsManager.cpp | 42 ++++++++++++++++++++-------- td/telegram/ContactsManager.h | 2 ++ 6 files changed, 38 insertions(+), 17 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index d53228e2b..4b357bbe9 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -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 = 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 = Ok; //@description Informs TDLib that a group call member speaking state has changed @group_call_id Group call identifier diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index f0041a91045c083d4ad372680ae42a38680bae64..9c5118e63a60ca5e638989ed993012a10a1781f9 100644 GIT binary patch delta 153 zcmZ2+lKaX@?hQ}0SxV1bm1=&Wz5RtY>%8y(qu5fC0px{$UBD#N+@k zf$4Abm=q>Y2;-POL5xvmlDop>m@>`j3%4?siwI{H$Cu@2Ca1=~1#vWrZbGpDKMuqKrUNQce0pTBTV6uQH`q9j^Apro(oIwl# delta 109 zcmca|l6%ET?hQ}0Sr)iNS2w@V-u^#NF54JCfVFJ5*v{Bv%nFicoc{14qx|+4uNeQ#0Lx7eXkoH|s8VTR+K>PMPMI!! diff --git a/td/generate/scheme/telegram_api.tl b/td/generate/scheme/telegram_api.tl index f75c5da86..0e3bd8875 100644 --- a/td/generate/scheme/telegram_api.tl +++ b/td/generate/scheme/telegram_api.tl @@ -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 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 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 pinned_msg_id:flags.6?int folder_id:flags.11?int = ChatFull; diff --git a/td/generate/scheme/telegram_api.tlo b/td/generate/scheme/telegram_api.tlo index 524a4537ff7fd22073334e69386e48ba7d559ba1..f27e58ff0301e608233fe2fb13d9a45ded6addb9 100644 GIT binary patch delta 58 zcmV-A0LA~T%?;em4X{{d0UMK%V^fnLvk-va_6 QgRp3auxJ6duxJAO{ok4yc>n+a delta 37 vcmV+=0NVfD%?+&04X{{d0UDE$V^fn*vkhas_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 &&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 ContactsManager::get_update_unknown ChannelId channel_id) { return td_api::make_object(td_api::make_object( 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 ContactsManager::get_supergroup_object(Channel } return td_api::make_object( 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); } diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index a0b639475..b5635011c 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -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;