Add can_manage_calls admin right.
This commit is contained in:
parent
59e0f03b5f
commit
3e13b0cd31
@ -458,8 +458,9 @@ chatMemberStatusCreator custom_title:string is_anonymous:Bool is_member:Bool = C
|
||||
//@can_restrict_members True, if the administrator can restrict, ban, or unban chat members
|
||||
//@can_pin_messages True, if the administrator can pin messages; applicable to groups only
|
||||
//@can_promote_members True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them
|
||||
//@can_manage_calls True, if the administrator can manage group calls; applicable to supergroups only
|
||||
//@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only
|
||||
chatMemberStatusAdministrator custom_title:string can_be_edited:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_promote_members:Bool is_anonymous:Bool = ChatMemberStatus;
|
||||
chatMemberStatusAdministrator custom_title:string can_be_edited:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_promote_members:Bool can_manage_calls:Bool is_anonymous:Bool = ChatMemberStatus;
|
||||
|
||||
//@description The user is a member of a chat, without any additional privileges or restrictions
|
||||
chatMemberStatusMember = ChatMemberStatus;
|
||||
|
Binary file not shown.
@ -38,7 +38,8 @@ DialogParticipantStatus DialogParticipantStatus::Administrator(bool is_anonymous
|
||||
bool can_change_info, bool can_post_messages,
|
||||
bool can_edit_messages, bool can_delete_messages,
|
||||
bool can_invite_users, bool can_restrict_members,
|
||||
bool can_pin_messages, bool can_promote_members) {
|
||||
bool can_pin_messages, bool can_promote_members,
|
||||
bool can_manage_calls) {
|
||||
uint32 flags = (static_cast<uint32>(can_be_edited) * CAN_BE_EDITED) |
|
||||
(static_cast<uint32>(can_change_info) * CAN_CHANGE_INFO_AND_SETTINGS_ADMIN) |
|
||||
(static_cast<uint32>(can_post_messages) * CAN_POST_MESSAGES) |
|
||||
@ -48,6 +49,7 @@ DialogParticipantStatus DialogParticipantStatus::Administrator(bool is_anonymous
|
||||
(static_cast<uint32>(can_restrict_members) * CAN_RESTRICT_MEMBERS) |
|
||||
(static_cast<uint32>(can_pin_messages) * CAN_PIN_MESSAGES_ADMIN) |
|
||||
(static_cast<uint32>(can_promote_members) * CAN_PROMOTE_MEMBERS) |
|
||||
(static_cast<uint32>(can_manage_calls) * CAN_MANAGE_CALLS) |
|
||||
(static_cast<uint32>(is_anonymous) * IS_ANONYMOUS);
|
||||
if (flags == 0 || flags == CAN_BE_EDITED) {
|
||||
return Member();
|
||||
@ -90,14 +92,14 @@ DialogParticipantStatus DialogParticipantStatus::Banned(int32 banned_until_date)
|
||||
}
|
||||
|
||||
DialogParticipantStatus DialogParticipantStatus::GroupAdministrator(bool is_creator) {
|
||||
return Administrator(false, string(), is_creator, true, false, false, true, true, true, true, false);
|
||||
return Administrator(false, string(), is_creator, true, false, false, true, true, true, true, false, false);
|
||||
}
|
||||
|
||||
DialogParticipantStatus DialogParticipantStatus::ChannelAdministrator(bool is_creator, bool is_megagroup) {
|
||||
if (is_megagroup) {
|
||||
return Administrator(false, string(), is_creator, true, false, false, true, true, true, true, false);
|
||||
return Administrator(false, string(), is_creator, true, false, false, true, true, true, true, false, false);
|
||||
} else {
|
||||
return Administrator(false, string(), is_creator, false, true, true, true, false, true, false, false);
|
||||
return Administrator(false, string(), is_creator, false, true, true, true, false, true, false, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,7 +117,7 @@ tl_object_ptr<td_api::ChatMemberStatus> DialogParticipantStatus::get_chat_member
|
||||
return td_api::make_object<td_api::chatMemberStatusAdministrator>(
|
||||
rank_, can_be_edited(), can_change_info_and_settings(), can_post_messages(), can_edit_messages(),
|
||||
can_delete_messages(), can_invite_users(), can_restrict_members(), can_pin_messages(), can_promote_members(),
|
||||
is_anonymous());
|
||||
can_manage_calls(), is_anonymous());
|
||||
case Type::Member:
|
||||
return td_api::make_object<td_api::chatMemberStatusMember>();
|
||||
case Type::Restricted:
|
||||
@ -157,6 +159,9 @@ tl_object_ptr<telegram_api::chatAdminRights> DialogParticipantStatus::get_chat_a
|
||||
if (can_promote_members()) {
|
||||
flags |= telegram_api::chatAdminRights::ADD_ADMINS_MASK;
|
||||
}
|
||||
if (can_manage_calls()) {
|
||||
flags |= telegram_api::chatAdminRights::MANAGE_CALL_MASK;
|
||||
}
|
||||
if (is_anonymous()) {
|
||||
flags |= telegram_api::chatAdminRights::ANONYMOUS_MASK;
|
||||
}
|
||||
@ -314,6 +319,9 @@ StringBuilder &operator<<(StringBuilder &string_builder, const DialogParticipant
|
||||
if (status.can_promote_members()) {
|
||||
string_builder << "(promote)";
|
||||
}
|
||||
if (status.can_manage_calls()) {
|
||||
string_builder << "(call)";
|
||||
}
|
||||
if (!status.rank_.empty()) {
|
||||
string_builder << " [" << status.rank_ << "]";
|
||||
}
|
||||
@ -396,7 +404,7 @@ DialogParticipantStatus get_dialog_participant_status(const tl_object_ptr<td_api
|
||||
return DialogParticipantStatus::Administrator(
|
||||
st->is_anonymous_, st->custom_title_, true /*st->can_be_edited_*/, st->can_change_info_,
|
||||
st->can_post_messages_, st->can_edit_messages_, st->can_delete_messages_, st->can_invite_users_,
|
||||
st->can_restrict_members_, st->can_pin_messages_, st->can_promote_members_);
|
||||
st->can_restrict_members_, st->can_pin_messages_, st->can_promote_members_, st->can_manage_calls_);
|
||||
}
|
||||
case td_api::chatMemberStatusMember::ID:
|
||||
return DialogParticipantStatus::Member();
|
||||
@ -437,10 +445,12 @@ DialogParticipantStatus get_dialog_participant_status(bool can_be_edited,
|
||||
bool can_restrict_members = (admin_rights->flags_ & telegram_api::chatAdminRights::BAN_USERS_MASK) != 0;
|
||||
bool can_pin_messages = (admin_rights->flags_ & telegram_api::chatAdminRights::PIN_MESSAGES_MASK) != 0;
|
||||
bool can_promote_members = (admin_rights->flags_ & telegram_api::chatAdminRights::ADD_ADMINS_MASK) != 0;
|
||||
bool can_manage_calls = (admin_rights->flags_ & telegram_api::chatAdminRights::MANAGE_CALL_MASK) != 0;
|
||||
bool is_anonymous = (admin_rights->flags_ & telegram_api::chatAdminRights::ANONYMOUS_MASK) != 0;
|
||||
return DialogParticipantStatus::Administrator(
|
||||
is_anonymous, std::move(rank), can_be_edited, can_change_info, can_post_messages, can_edit_messages,
|
||||
can_delete_messages, can_invite_users, can_restrict_members, can_pin_messages, can_promote_members);
|
||||
return DialogParticipantStatus::Administrator(is_anonymous, std::move(rank), can_be_edited, can_change_info,
|
||||
can_post_messages, can_edit_messages, can_delete_messages,
|
||||
can_invite_users, can_restrict_members, can_pin_messages,
|
||||
can_promote_members, can_manage_calls);
|
||||
}
|
||||
|
||||
DialogParticipantStatus get_dialog_participant_status(
|
||||
|
@ -118,6 +118,7 @@ class DialogParticipantStatus {
|
||||
static constexpr uint32 CAN_RESTRICT_MEMBERS = 1 << 6;
|
||||
static constexpr uint32 CAN_PIN_MESSAGES_ADMIN = 1 << 7;
|
||||
static constexpr uint32 CAN_PROMOTE_MEMBERS = 1 << 8;
|
||||
static constexpr uint32 CAN_MANAGE_CALLS = 1 << 9;
|
||||
|
||||
static constexpr uint32 CAN_BE_EDITED = 1 << 15;
|
||||
|
||||
@ -143,7 +144,7 @@ class DialogParticipantStatus {
|
||||
|
||||
static constexpr uint32 ALL_ADMINISTRATOR_RIGHTS =
|
||||
CAN_CHANGE_INFO_AND_SETTINGS_ADMIN | CAN_POST_MESSAGES | CAN_EDIT_MESSAGES | CAN_DELETE_MESSAGES |
|
||||
CAN_INVITE_USERS_ADMIN | CAN_RESTRICT_MEMBERS | CAN_PIN_MESSAGES_ADMIN | CAN_PROMOTE_MEMBERS;
|
||||
CAN_INVITE_USERS_ADMIN | CAN_RESTRICT_MEMBERS | CAN_PIN_MESSAGES_ADMIN | CAN_PROMOTE_MEMBERS | CAN_MANAGE_CALLS;
|
||||
|
||||
static constexpr uint32 ALL_ADMIN_PERMISSION_RIGHTS =
|
||||
CAN_CHANGE_INFO_AND_SETTINGS_BANNED | CAN_INVITE_USERS_BANNED | CAN_PIN_MESSAGES_BANNED;
|
||||
@ -171,7 +172,7 @@ class DialogParticipantStatus {
|
||||
static DialogParticipantStatus Administrator(bool is_anonymous, string rank, bool can_be_edited, bool can_change_info,
|
||||
bool can_post_messages, bool can_edit_messages, bool can_delete_messages,
|
||||
bool can_invite_users, bool can_restrict_members, bool can_pin_messages,
|
||||
bool can_promote_members);
|
||||
bool can_promote_members, bool can_manage_calls);
|
||||
|
||||
static DialogParticipantStatus Member();
|
||||
|
||||
@ -237,6 +238,10 @@ class DialogParticipantStatus {
|
||||
return (flags_ & CAN_PROMOTE_MEMBERS) != 0;
|
||||
}
|
||||
|
||||
bool can_manage_calls() const {
|
||||
return (flags_ & CAN_MANAGE_CALLS) != 0;
|
||||
}
|
||||
|
||||
bool can_be_edited() const {
|
||||
return (flags_ & CAN_BE_EDITED) != 0;
|
||||
}
|
||||
|
@ -3835,25 +3835,25 @@ class CliClient final : public Actor {
|
||||
status = td_api::make_object<td_api::chatMemberStatusCreator>("", false, false);
|
||||
} else if (status_str == "anon") {
|
||||
status = td_api::make_object<td_api::chatMemberStatusAdministrator>("anon", true, true, true, true, true, true,
|
||||
true, true, true, true);
|
||||
true, true, true, false, true);
|
||||
} else if (status_str == "anonadmin") {
|
||||
status = td_api::make_object<td_api::chatMemberStatusAdministrator>("anon", false, false, false, false, false,
|
||||
false, false, false, false, true);
|
||||
false, false, false, false, false, true);
|
||||
} else if (status_str == "addadmin") {
|
||||
status = td_api::make_object<td_api::chatMemberStatusAdministrator>("anon", false, false, false, false, false,
|
||||
false, false, false, true, false);
|
||||
false, false, false, true, false, false);
|
||||
} else if (status_str == "admin") {
|
||||
status = td_api::make_object<td_api::chatMemberStatusAdministrator>("", true, true, true, true, true, true,
|
||||
true, true, true, false);
|
||||
true, true, true, false, false);
|
||||
} else if (status_str == "adminq") {
|
||||
status = td_api::make_object<td_api::chatMemberStatusAdministrator>("title", true, true, true, true, true, true,
|
||||
true, true, true, false);
|
||||
true, true, true, false, false);
|
||||
} else if (status_str == "minadmin") {
|
||||
status = td_api::make_object<td_api::chatMemberStatusAdministrator>("", true, true, false, false, false, false,
|
||||
false, false, false, false);
|
||||
false, false, false, false, false);
|
||||
} else if (status_str == "unadmin") {
|
||||
status = td_api::make_object<td_api::chatMemberStatusAdministrator>("", true, false, false, false, false, false,
|
||||
false, false, false, false);
|
||||
false, false, false, false, false);
|
||||
} else if (status_str == "rest") {
|
||||
status = td_api::make_object<td_api::chatMemberStatusRestricted>(
|
||||
true, static_cast<int32>(120 + std::time(nullptr)),
|
||||
|
Loading…
Reference in New Issue
Block a user