From 0a2162019449bf573900771148299ff340274e2d Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 30 Mar 2024 02:56:24 +0300 Subject: [PATCH] Remove extract_group_invite_privacy_forbidden_updates. --- td/telegram/DialogParticipantManager.cpp | 15 +----------- td/telegram/MessagesManager.cpp | 7 ------ td/telegram/MessagesManager.h | 1 - td/telegram/UpdatesManager.cpp | 30 ------------------------ td/telegram/UpdatesManager.h | 3 --- 5 files changed, 1 insertion(+), 55 deletions(-) diff --git a/td/telegram/DialogParticipantManager.cpp b/td/telegram/DialogParticipantManager.cpp index d93ee1b76..9130dc001 100644 --- a/td/telegram/DialogParticipantManager.cpp +++ b/td/telegram/DialogParticipantManager.cpp @@ -596,20 +596,7 @@ class InviteToChannelQuery final : public Td::ResultHandler { auto ptr = result_ptr.move_as_ok(); LOG(INFO) << "Receive result for InviteToChannelQuery: " << to_string(ptr); td_->contacts_manager_->invalidate_channel_full(channel_id_, false, "InviteToChannelQuery"); - auto user_ids = td_->updates_manager_->extract_group_invite_privacy_forbidden_updates(ptr->updates_); - auto promise = PromiseCreator::lambda([dialog_id = DialogId(channel_id_), user_ids = std::move(user_ids), - promise = std::move(promise_)](Result &&result) mutable { - if (result.is_error()) { - return promise.set_error(result.move_as_error()); - } - promise.set_value(Unit()); - if (!user_ids.empty()) { - send_closure(G()->dialog_participant_manager(), - &DialogParticipantManager::send_update_add_chat_members_privacy_forbidden, dialog_id, - std::move(user_ids), "InviteToChannelQuery"); - } - }); - td_->updates_manager_->on_get_updates(std::move(std::move(ptr->updates_)), std::move(promise)); + td_->updates_manager_->on_get_updates(std::move(std::move(ptr->updates_)), std::move(promise_)); } void on_error(Status status) final { diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 73d07a9c3..f9d610028 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -13678,11 +13678,6 @@ MessageFullId MessagesManager::on_get_message(MessageInfo &&message_info, const pending_created_dialogs_.erase(it); pending_created_dialog.promise_.set_value(get_chat_object(d, "on_get_message")); - if (!pending_created_dialog.group_invite_privacy_forbidden_user_ids_.empty()) { - send_closure(G()->dialog_participant_manager(), - &DialogParticipantManager::send_update_add_chat_members_privacy_forbidden, dialog_id, - std::move(pending_created_dialog.group_invite_privacy_forbidden_user_ids_), "on_get_message"); - } } } @@ -30860,8 +30855,6 @@ void MessagesManager::on_create_new_dialog(telegram_api::object_ptrupdates_manager_->extract_group_invite_privacy_forbidden_updates(updates); pending_created_dialogs_.emplace(dialog_id, std::move(pending_created_dialog)); } else { LOG(ERROR) << "Receive twice " << dialog_id << " as result of chat creation"; diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index e1ae6385f..d1c147d43 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -3197,7 +3197,6 @@ class MessagesManager final : public Actor { struct PendingCreatedDialog { Promise> promise_; - vector group_invite_privacy_forbidden_user_ids_; }; FlatHashMap pending_created_dialogs_; diff --git a/td/telegram/UpdatesManager.cpp b/td/telegram/UpdatesManager.cpp index bfefc7a16..b56e59215 100644 --- a/td/telegram/UpdatesManager.cpp +++ b/td/telegram/UpdatesManager.cpp @@ -1384,36 +1384,6 @@ bool UpdatesManager::are_empty_updates(const telegram_api::Updates *updates_ptr) } } -vector UpdatesManager::extract_group_invite_privacy_forbidden_updates( - tl_object_ptr &updates_ptr) { - return {}; - /* - auto updates = get_updates(updates_ptr.get()); - if (updates == nullptr) { - LOG(ERROR) << "Can't find updateGroupInvitePrivacyForbidden updates"; - return {}; - } - LOG(INFO) << "Extract updateGroupInvitePrivacyForbidden updates from " << updates->size() << " updates"; - vector user_ids; - for (auto &update_ptr : *updates) { - if (update_ptr->get_id() != telegram_api::updateGroupInvitePrivacyForbidden::ID) { - continue; - } - auto update = telegram_api::move_object_as(update_ptr); - UserId user_id(update->user_id_); - if (!user_id.is_valid()) { - LOG(ERROR) << "Receive " << to_string(update); - continue; - } - user_ids.push_back(user_id); - } - if (!user_ids.empty()) { - td::remove_if(*updates, [](auto &update) { return update == nullptr; }); - } - return user_ids; -*/ -} - FlatHashSet UpdatesManager::get_sent_messages_random_ids(const telegram_api::Updates *updates_ptr) { FlatHashSet random_ids; auto updates = get_updates(updates_ptr); diff --git a/td/telegram/UpdatesManager.h b/td/telegram/UpdatesManager.h index 04f0f5a59..78c657445 100644 --- a/td/telegram/UpdatesManager.h +++ b/td/telegram/UpdatesManager.h @@ -104,9 +104,6 @@ class UpdatesManager final : public Actor { static bool are_empty_updates(const telegram_api::Updates *updates_ptr); - static vector extract_group_invite_privacy_forbidden_updates( - tl_object_ptr &updates_ptr); - static FlatHashSet get_sent_messages_random_ids(const telegram_api::Updates *updates_ptr); static const telegram_api::Message *get_message_by_random_id(const telegram_api::Updates *updates_ptr,