aboutsummaryrefslogtreecommitdiffhomepage
path: root/td
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2026-07-09 23:47:40 +0300
committerlevlam <levlam@telegram.org>2026-07-09 23:47:40 +0300
commita83a851fe42c393cd34ffd8fcb9ef9ebe3e7db0c (patch)
tree6c667599cf872b1f29b2ea7c3c6f13dfabfefab4 /td
parentc0983b4c1dd7c01abd6553dd114b2d940beab070 (diff)
Support updateCommunity in getCurrentState.
Diffstat (limited to 'td')
-rw-r--r--td/telegram/CommunityManager.cpp12
-rw-r--r--td/telegram/CommunityManager.h2
-rw-r--r--td/telegram/Requests.cpp3
3 files changed, 17 insertions, 0 deletions
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<td_api::updateCommunity> CommunityManager::get_update_unknown
td_api::make_object<td_api::community>(community_id.get(), false, string(), nullptr, 0));
}
+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)) {
+ updates.push_back(get_update_unknown_community_object(community_id));
+ }
+ }
+
+ communities_.foreach([&](const CommunityId &community_id, const unique_ptr<Community> &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<td_api::object_ptr<td_api::Update>> &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);