diff options
Diffstat (limited to 'td/telegram/UpdatesManager.cpp')
| -rw-r--r-- | td/telegram/UpdatesManager.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index 09562db8c..fe7769342 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -20,6 +20,7 @@ #include "td/telegram/ChannelType.h" #include "td/telegram/ChatId.h" #include "td/telegram/ChatManager.h" +#include "td/telegram/CommunityManager.h" #include "td/telegram/ConfigManager.h" #include "td/telegram/DialogAction.h" #include "td/telegram/DialogActionManager.h" @@ -722,6 +723,11 @@ bool UpdatesManager::is_acceptable_channel(ChannelId channel_id) const { return td_->chat_manager_->have_channel_force(channel_id, "is_acceptable_channel"); } +bool UpdatesManager::is_acceptable_community(CommunityId community_id) const { + return td_->community_manager_->have_community_force(community_id, "is_acceptable_community") && + td_->community_manager_->have_accessible_community(community_id); +} + bool UpdatesManager::is_acceptable_peer(const tl_object_ptr<telegram_api::Peer> &peer) const { if (peer == nullptr) { return true; @@ -992,7 +998,6 @@ bool UpdatesManager::is_acceptable_message(const telegram_api::Message *message_ case telegram_api::messageActionPollAppendAnswer::ID: case telegram_api::messageActionPollDeleteAnswer::ID: case telegram_api::messageActionManagedBotCreated::ID: - case telegram_api::messageActionChangeCommunity::ID: break; case telegram_api::messageActionChatCreate::ID: { auto action = static_cast<const telegram_api::messageActionChatCreate *>(action_ptr); @@ -1110,6 +1115,13 @@ bool UpdatesManager::is_acceptable_message(const telegram_api::Message *message_ } break; } + case telegram_api::messageActionChangeCommunity::ID: { + auto action = static_cast<const telegram_api::messageActionChangeCommunity *>(action_ptr); + if (action->community_id_ != 0 && !is_acceptable_community(CommunityId(action->community_id_))) { + return false; + } + break; + } default: UNREACHABLE(); return false; |
