/* 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 "mtproto/sender.h" #include "base/timer.h" class ApiWrap; class ChannelData; struct ChatRestrictionsInfo; namespace Main { class Session; } // namespace Main namespace Api { class ChatParticipants final { public: explicit ChatParticipants(not_null api); void requestLast(not_null channel); void requestBots(not_null channel); void requestAdmins(not_null channel); void requestCountDelayed(not_null channel); void parse( not_null channel, const MTPchannels_ChannelParticipants &result, Fn &list)> callbackList, Fn callbackNotModified = nullptr); void parseRecent( not_null channel, const MTPchannels_ChannelParticipants &result, Fn &list)> callbackList = nullptr, Fn callbackNotModified = nullptr); void add( not_null peer, const std::vector> &users, Fn done = nullptr); void requestSelf(not_null channel); void requestForAdd( not_null channel, Fn callback); void kick( not_null chat, not_null participant); void kick( not_null channel, not_null participant, ChatRestrictionsInfo currentRights); void unblock( not_null channel, not_null participant); private: void applyLastList( not_null channel, int availableCount, const QVector &list); void applyBotsList( not_null channel, int availableCount, const QVector &list); void refreshChannelAdmins( not_null channel, const QVector &participants); const not_null _session; MTP::Sender _api; using PeerRequests = base::flat_map; PeerRequests _participantsRequests; PeerRequests _botsRequests; PeerRequests _adminsRequests; base::DelayedCallTimer _participantsCountRequestTimer; ChannelData *_channelMembersForAdd = nullptr; mtpRequestId _channelMembersForAddRequestId = 0; Fn _channelMembersForAddCallback; base::flat_set> _selfParticipantRequests; using KickRequest = std::pair< not_null, not_null>; base::flat_map _kickRequests; }; } // namespace Api