From a83a851fe42c393cd34ffd8fcb9ef9ebe3e7db0c Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 9 Jul 2026 23:47:40 +0300 Subject: Support updateCommunity in getCurrentState. --- td/telegram/CommunityManager.cpp | 12 ++++++++++++ td/telegram/CommunityManager.h | 2 ++ td/telegram/Requests.cpp | 3 +++ 3 files changed, 17 insertions(+) diff --git a/td/telegram/CommunityManager.cpp b/td/telegram/CommunityManager.cpp index c28e997ed..ba601b9a1 100644 --- a/td/telegram/CommunityManager.cpp +++ b/td/telegram/CommunityManager.cpp @@ -599,4 +599,16 @@ td_api::object_ptr CommunityManager::get_update_unknown td_api::make_object(community_id.get(), false, string(), nullptr, 0)); } +void CommunityManager::get_current_state(vector> &updates) const { + for (auto community_id : unknown_communities_) { + if (!have_community(community_id)) { + updates.push_back(get_update_unknown_community_object(community_id)); + } + } + + communities_.foreach([&](const CommunityId &community_id, const unique_ptr &community) { + updates.push_back(get_update_community_object(community_id, community.get())); + }); +} + } // namespace td diff --git a/td/telegram/CommunityManager.h b/td/telegram/CommunityManager.h index e9df07d79..ce208caa0 100644 --- a/td/telegram/CommunityManager.h +++ b/td/telegram/CommunityManager.h @@ -41,6 +41,8 @@ class CommunityManager final : public Actor { void on_binlog_community_event(BinlogEvent &&event); + void get_current_state(vector> &updates) const; + private: struct Community { int64 access_hash = 0; diff --git a/td/telegram/Requests.cpp b/td/telegram/Requests.cpp index 661f4c742..8dc583335 100644 --- a/td/telegram/Requests.cpp +++ b/td/telegram/Requests.cpp @@ -43,6 +43,7 @@ #include "td/telegram/ChatId.h" #include "td/telegram/ChatManager.h" #include "td/telegram/CommonDialogManager.h" +#include "td/telegram/CommunityManager.h" #include "td/telegram/ConfigManager.h" #include "td/telegram/ConnectionStateManager.h" #include "td/telegram/CountryInfoManager.h" @@ -2198,6 +2199,8 @@ void Requests::on_request(uint64 id, const td_api::getCurrentState &request) { td_->connection_state_manager_->get_current_state(updates); if (td_->auth_manager_->is_authorized()) { + td_->community_manager_->get_current_state(updates); + td_->user_manager_->get_current_state(updates); td_->chat_manager_->get_current_state(updates); -- cgit v1.2.3