aboutsummaryrefslogtreecommitdiffhomepage
path: root/td/telegram
diff options
context:
space:
mode:
Diffstat (limited to 'td/telegram')
-rw-r--r--td/telegram/CommunityManager.cpp5
-rw-r--r--td/telegram/DialogParticipant.cpp12
-rw-r--r--td/telegram/DialogParticipant.h4
3 files changed, 19 insertions, 2 deletions
diff --git a/td/telegram/CommunityManager.cpp b/td/telegram/CommunityManager.cpp
index ba601b9a1..1eaf09c4c 100644
--- a/td/telegram/CommunityManager.cpp
+++ b/td/telegram/CommunityManager.cpp
@@ -582,7 +582,7 @@ td_api::object_ptr<td_api::community> CommunityManager::get_community_object(Com
}
return td_api::make_object<td_api::community>(community_id.get(), c->access_hash != 0, c->title,
get_chat_photo_info_object(td_->file_manager_.get(), &c->photo),
- c->date);
+ c->date, c->default_permissions.get_community_permissions_object());
}
td_api::object_ptr<td_api::updateCommunity> CommunityManager::get_update_community_object(CommunityId community_id,
@@ -596,7 +596,8 @@ td_api::object_ptr<td_api::updateCommunity> CommunityManager::get_update_communi
td_api::object_ptr<td_api::updateCommunity> CommunityManager::get_update_unknown_community_object(
CommunityId community_id) const {
return td_api::make_object<td_api::updateCommunity>(
- td_api::make_object<td_api::community>(community_id.get(), false, string(), nullptr, 0));
+ td_api::make_object<td_api::community>(community_id.get(), false, string(), nullptr, 0,
+ RestrictedRights::restrict_all().get_community_permissions_object()));
}
void CommunityManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
diff --git a/td/telegram/DialogParticipant.cpp b/td/telegram/DialogParticipant.cpp
index 5a83c8841..2a257a901 100644
--- a/td/telegram/DialogParticipant.cpp
+++ b/td/telegram/DialogParticipant.cpp
@@ -215,6 +215,14 @@ RestrictedRights::RestrictedRights(const td_api::object_ptr<td_api::chatPermissi
rights->can_edit_tag_, rights->can_react_to_messages_, false, channel_type);
}
+RestrictedRights::RestrictedRights(const td_api::object_ptr<td_api::communityPermissions> &rights) {
+ if (rights == nullptr) {
+ flags_ = 0;
+ return;
+ }
+ flags_ = (static_cast<uint64>(rights->can_edit_chat_list_) * CAN_MANAGE_LINKED_PEERS);
+}
+
RestrictedRights::RestrictedRights(bool can_send_messages, bool can_send_audios, bool can_send_documents,
bool can_send_photos, bool can_send_videos, bool can_send_video_notes,
bool can_send_voice_notes, bool can_send_stickers, bool can_send_animations,
@@ -262,6 +270,10 @@ td_api::object_ptr<td_api::chatPermissions> RestrictedRights::get_chat_permissio
can_invite_users(), can_pin_messages(), can_manage_topics());
}
+td_api::object_ptr<td_api::communityPermissions> RestrictedRights::get_community_permissions_object() const {
+ return td_api::make_object<td_api::communityPermissions>(can_manage_linked_peers());
+}
+
telegram_api::object_ptr<telegram_api::chatBannedRights> RestrictedRights::get_chat_banned_rights() const {
return telegram_api::make_object<telegram_api::chatBannedRights>(
0, false /*view_messages*/, false /*send_messages*/, false /*send_media*/, !can_send_stickers(),
diff --git a/td/telegram/DialogParticipant.h b/td/telegram/DialogParticipant.h
index 3249e904e..57e13990f 100644
--- a/td/telegram/DialogParticipant.h
+++ b/td/telegram/DialogParticipant.h
@@ -219,6 +219,8 @@ class RestrictedRights {
RestrictedRights(const td_api::object_ptr<td_api::chatPermissions> &rights, ChannelType channel_type);
+ RestrictedRights(const td_api::object_ptr<td_api::communityPermissions> &rights);
+
RestrictedRights(bool can_send_messages, bool can_send_audios, bool can_send_documents, bool can_send_photos,
bool can_send_videos, bool can_send_video_notes, bool can_send_voice_notes, bool can_send_stickers,
bool can_send_animations, bool can_send_games, bool can_use_inline_bots,
@@ -230,6 +232,8 @@ class RestrictedRights {
td_api::object_ptr<td_api::chatPermissions> get_chat_permissions_object() const;
+ td_api::object_ptr<td_api::communityPermissions> get_community_permissions_object() const;
+
tl_object_ptr<telegram_api::chatBannedRights> get_chat_banned_rights() const;
bool can_change_info_and_settings() const {