/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "boxes/peer_list_controllers.h" #include "data/data_chat_participant_status.h" class AddBotToGroupBoxController : public ChatsListBoxController , public base::has_weak_ptr { public: enum class Scope { None, GroupAdmin, ChannelAdmin, All, }; static void Start( not_null controller, not_null bot, Scope scope = Scope::All, const QString &token = QString(), ChatAdminRights requestedRights = {}); AddBotToGroupBoxController( not_null controller, not_null bot, Scope scope, const QString &token, ChatAdminRights requestedRights); Main::Session &session() const override; void rowClicked(not_null row) override; protected: std::unique_ptr createRow(not_null history) override; void prepareViewHook() override; QString emptyBoxText() const override; private: [[nodiscard]] object_ptr prepareAdminnedChats(); [[nodiscard]] bool onlyAdminToGroup() const; [[nodiscard]] bool onlyAdminToChannel() const; bool needToCreateRow(not_null peer) const; QString noResultsText() const; void updateLabels(); void addBotToGroup(not_null chat); void requestExistingRights(not_null channel); const not_null _controller; const not_null _bot; const Scope _scope = Scope::None; const QString _token; const ChatAdminRights _requestedRights; ChannelData *_existingRightsChannel = nullptr; mtpRequestId _existingRightsRequestId = 0; std::optional _existingRights; QString _existingRank; rpl::event_stream> _groups; rpl::event_stream> _channels; bool _adminToGroup = false; bool _adminToChannel = false; bool _memberToGroup = false; }; void AddBotToGroup( not_null bot, not_null chat, const QString &startToken);