aboutsummaryrefslogtreecommitdiffhomepage
path: root/td/telegram/CommunityManager.cpp
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2026-07-10 15:42:29 +0300
committerlevlam <levlam@telegram.org>2026-07-10 15:42:29 +0300
commit565e77f595527b3fd5ba5fd8a8e58d769c781426 (patch)
treea6319b473b2ddff2e8e93afa4db4130a1dbb693d /td/telegram/CommunityManager.cpp
parenta9893647d03486061da77c5a005141bdb2aee573 (diff)
Add CommunityManager::get_input_community.
Diffstat (limited to 'td/telegram/CommunityManager.cpp')
-rw-r--r--td/telegram/CommunityManager.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/td/telegram/CommunityManager.cpp b/td/telegram/CommunityManager.cpp
index fc7e9ed32..6e1fca02e 100644
--- a/td/telegram/CommunityManager.cpp
+++ b/td/telegram/CommunityManager.cpp
@@ -605,6 +605,20 @@ td_api::object_ptr<td_api::updateCommunity> CommunityManager::get_update_unknown
RestrictedRights::restrict_all().get_community_permissions_object()));
}
+telegram_api::object_ptr<telegram_api::InputChannel> CommunityManager::get_input_community(
+ CommunityId community_id) const {
+ int64 access_hash = 0;
+ const Community *c = get_community(community_id);
+ if (c == nullptr) {
+ if (!td_->auth_manager_->is_bot() || !community_id.is_valid()) {
+ return nullptr;
+ }
+ } else {
+ access_hash = c->access_hash;
+ }
+ return telegram_api::make_object<telegram_api::inputChannel>(community_id.get(), access_hash);
+}
+
void CommunityManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
for (auto community_id : unknown_communities_) {
if (!have_community(community_id)) {