aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--td/telegram/ChatManager.cpp4
-rw-r--r--td/telegram/DialogParticipant.cpp17
-rw-r--r--td/telegram/DialogParticipant.h11
-rw-r--r--td/telegram/MessageContent.cpp2
-rw-r--r--td/telegram/UserManager.cpp4
5 files changed, 24 insertions, 14 deletions
diff --git a/td/telegram/ChatManager.cpp b/td/telegram/ChatManager.cpp
index 7b52cf8be..455bec494 100644
--- a/td/telegram/ChatManager.cpp
+++ b/td/telegram/ChatManager.cpp
@@ -1931,7 +1931,7 @@ void ChatManager::Chat::parse(ParserT &parser) {
}
default_permissions = RestrictedRights(true, true, true, true, true, true, true, true, true, true, true, true, true,
everyone_is_administrator, everyone_is_administrator,
- everyone_is_administrator, false, false, true, ChannelType::Unknown);
+ everyone_is_administrator, false, false, true, false, ChannelType::Unknown);
}
if (has_default_permissions_version) {
parse(default_permissions_version, parser);
@@ -2303,7 +2303,7 @@ void ChatManager::Channel::parse(ParserT &parser) {
} else {
default_permissions =
RestrictedRights(true, true, true, true, true, true, true, true, true, true, true, true, true, false,
- anyone_can_invite, false, false, false, true, ChannelType::Megagroup);
+ anyone_can_invite, false, false, false, true, false, ChannelType::Megagroup);
}
}
if (has_cache_version) {
diff --git a/td/telegram/DialogParticipant.cpp b/td/telegram/DialogParticipant.cpp
index 323ec8dbc..5a83c8841 100644
--- a/td/telegram/DialogParticipant.cpp
+++ b/td/telegram/DialogParticipant.cpp
@@ -196,7 +196,7 @@ RestrictedRights::RestrictedRights(const tl_object_ptr<telegram_api::chatBannedR
!rights->send_stickers_, !rights->send_gifs_, !rights->send_games_, !rights->send_inline_,
!rights->embed_links_, !rights->send_polls_, !rights->change_info_, !rights->invite_users_,
!rights->pin_messages_, !rights->manage_topics_, !rights->edit_rank_,
- !rights->send_reactions_, channel_type);
+ !rights->send_reactions_, !rights->manage_linked_peers_, channel_type);
}
RestrictedRights::RestrictedRights(const td_api::object_ptr<td_api::chatPermissions> &rights,
@@ -212,7 +212,7 @@ RestrictedRights::RestrictedRights(const td_api::object_ptr<td_api::chatPermissi
rights->can_send_other_messages_, rights->can_send_other_messages_, rights->can_send_other_messages_,
rights->can_send_other_messages_, rights->can_add_link_previews_, rights->can_send_polls_,
rights->can_change_info_, rights->can_invite_users_, rights->can_pin_messages_, rights->can_create_topics_,
- rights->can_edit_tag_, rights->can_react_to_messages_, channel_type);
+ rights->can_edit_tag_, rights->can_react_to_messages_, false, channel_type);
}
RestrictedRights::RestrictedRights(bool can_send_messages, bool can_send_audios, bool can_send_documents,
@@ -221,7 +221,7 @@ RestrictedRights::RestrictedRights(bool can_send_messages, bool can_send_audios,
bool can_send_games, bool can_use_inline_bots, bool can_add_web_page_previews,
bool can_send_polls, bool can_change_info_and_settings, bool can_invite_users,
bool can_pin_messages, bool can_manage_topics, bool can_edit_rank,
- bool can_send_reactions, ChannelType channel_type) {
+ bool can_send_reactions, bool can_manage_linked_peers, ChannelType channel_type) {
if (channel_type == ChannelType::Broadcast) {
flags_ = 0;
return;
@@ -244,7 +244,8 @@ RestrictedRights::RestrictedRights(bool can_send_messages, bool can_send_audios,
(static_cast<uint64>(can_pin_messages) * CAN_PIN_MESSAGES) |
(static_cast<uint64>(can_manage_topics) * CAN_MANAGE_TOPICS) |
(static_cast<uint64>(can_edit_rank) * CAN_EDIT_RANK) |
- (static_cast<uint64>(can_send_reactions) * CAN_SEND_REACTIONS);
+ (static_cast<uint64>(can_send_reactions) * CAN_SEND_REACTIONS) |
+ (static_cast<uint64>(can_manage_linked_peers) * CAN_MANAGE_LINKED_PEERS);
}
RestrictedRights RestrictedRights::restrict_all() {
@@ -268,7 +269,7 @@ telegram_api::object_ptr<telegram_api::chatBannedRights> RestrictedRights::get_c
!can_send_polls(), !can_change_info_and_settings(), !can_invite_users(), !can_pin_messages(),
!can_manage_topics(), !can_send_photos(), !can_send_videos(), !can_send_video_notes(), !can_send_audios(),
!can_send_voice_notes(), !can_send_documents(), !can_send_messages(), !can_edit_rank(), !can_send_reactions(),
- false, 0);
+ !can_manage_linked_peers(), 0);
}
bool operator==(const RestrictedRights &lhs, const RestrictedRights &rhs) {
@@ -338,6 +339,9 @@ StringBuilder &operator<<(StringBuilder &string_builder, const RestrictedRights
if (!status.can_send_reactions()) {
string_builder << "(reactions)";
}
+ if (!status.can_manage_linked_peers()) {
+ string_builder << "(manage_linked_peers)";
+ }
return string_builder;
}
@@ -445,7 +449,8 @@ RestrictedRights DialogParticipantStatus::get_effective_restricted_rights() cons
can_send_videos(), can_send_video_notes(), can_send_voice_notes(), can_send_stickers(),
can_send_animations(), can_send_games(), can_use_inline_bots(), can_add_web_page_previews(),
can_send_polls(), can_change_info_and_settings(), can_invite_users(), can_pin_messages(),
- can_create_topics(), can_edit_rank(), can_send_reactions(), ChannelType::Unknown);
+ can_create_topics(), can_edit_rank(), can_send_reactions(), can_manage_linked_peers(),
+ ChannelType::Unknown);
}
td_api::object_ptr<td_api::ChatMemberStatus> DialogParticipantStatus::get_chat_member_status_object(
diff --git a/td/telegram/DialogParticipant.h b/td/telegram/DialogParticipant.h
index 776c2dc5a..3249e904e 100644
--- a/td/telegram/DialogParticipant.h
+++ b/td/telegram/DialogParticipant.h
@@ -196,9 +196,10 @@ class RestrictedRights {
static constexpr uint64 CAN_MANAGE_TOPICS = 1 << 12;
static constexpr uint64 CAN_EDIT_RANK = static_cast<uint64>(1) << 38;
static constexpr uint64 CAN_SEND_REACTIONS = static_cast<uint64>(1) << 39;
+ static constexpr uint64 CAN_MANAGE_LINKED_PEERS = static_cast<uint64>(1) << 40;
static constexpr uint64 ALL_ADMIN_PERMISSION_RIGHTS =
- CAN_CHANGE_INFO_AND_SETTINGS | CAN_INVITE_USERS | CAN_PIN_MESSAGES | CAN_MANAGE_TOPICS;
+ CAN_CHANGE_INFO_AND_SETTINGS | CAN_INVITE_USERS | CAN_PIN_MESSAGES | CAN_MANAGE_TOPICS | CAN_MANAGE_LINKED_PEERS;
static constexpr uint64 ALL_RESTRICTED_RIGHTS =
CAN_SEND_MESSAGES | CAN_SEND_STICKERS | CAN_SEND_ANIMATIONS | CAN_SEND_GAMES | CAN_USE_INLINE_BOTS |
@@ -223,7 +224,7 @@ class RestrictedRights {
bool can_send_animations, bool can_send_games, bool can_use_inline_bots,
bool can_add_web_page_previews, bool can_send_polls, bool can_change_info_and_settings,
bool can_invite_users, bool can_pin_messages, bool can_manage_topics, bool can_edit_rank,
- bool can_send_reactions, ChannelType channel_type);
+ bool can_send_reactions, bool can_manage_linked_peers, ChannelType channel_type);
static RestrictedRights restrict_all();
@@ -307,6 +308,10 @@ class RestrictedRights {
return (flags_ & CAN_SEND_REACTIONS) != 0;
}
+ bool can_manage_linked_peers() const {
+ return (flags_ & CAN_MANAGE_LINKED_PEERS) != 0;
+ }
+
template <class StorerT>
void store(StorerT &storer) const {
td::store(flags_, storer);
@@ -501,7 +506,7 @@ class DialogParticipantStatus {
}
bool can_manage_linked_peers() const {
- return get_administrator_rights().can_manage_linked_peers();
+ return get_administrator_rights().can_manage_linked_peers() || get_restricted_rights().can_manage_linked_peers();
}
bool can_be_edited() const {
diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp
index 29fd349fd..e84b60b61 100644
--- a/td/telegram/MessageContent.cpp
+++ b/td/telegram/MessageContent.cpp
@@ -6113,7 +6113,7 @@ Status can_send_message_content(DialogId dialog_id, const MessageContent *conten
RestrictedRights permissions = [&] {
if (!check_permissions) {
return RestrictedRights(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
- true, true, true, true, ChannelType::Unknown);
+ true, true, true, true, true, ChannelType::Unknown);
}
switch (dialog_type) {
case DialogType::User:
diff --git a/td/telegram/UserManager.cpp b/td/telegram/UserManager.cpp
index 9739c8f7f..4b973e4bb 100644
--- a/td/telegram/UserManager.cpp
+++ b/td/telegram/UserManager.cpp
@@ -5560,7 +5560,7 @@ RestrictedRights UserManager::get_user_default_permissions(UserId user_id) const
return RestrictedRights::restrict_all();
}
return RestrictedRights(true, true, true, true, true, true, true, true, true, true, true, true, true, false, false,
- true, false, false, true, ChannelType::Unknown);
+ true, false, false, true, false, ChannelType::Unknown);
}
RestrictedRights UserManager::get_secret_chat_default_permissions(SecretChatId secret_chat_id) const {
@@ -5569,7 +5569,7 @@ RestrictedRights UserManager::get_secret_chat_default_permissions(SecretChatId s
return RestrictedRights::restrict_all();
}
return RestrictedRights(true, true, true, true, true, true, true, true, true, true, true, true, true, false, false,
- false, false, false, false, ChannelType::Unknown);
+ false, false, false, false, false, ChannelType::Unknown);
}
td_api::object_ptr<td_api::emojiStatus> UserManager::get_user_emoji_status_object(UserId user_id) const {