void ApiWrap::requestLastParticipants(ChannelData *peer, bool fromStart) { if (!peer || !peer->isMegagroup()) return; bool needAdmins = peer->amEditor(), adminsOutdated = (peer->mgInfo->lastParticipantsStatus & MegagroupInfo::LastParticipantsAdminsOutdated); if ((needAdmins && adminsOutdated) || peer->lastParticipantsCountOutdated()) { fromStart = true; } QMap<PeerData*, mtpRequestId>::iterator i = _participantsRequests.find(peer); if (i != _participantsRequests.cend()) { if (fromStart && i.value() < 0) { // was not loading from start _participantsRequests.erase(i); } else { return; } } mtpRequestId req = MTP::send(MTPchannels_GetParticipants(peer->inputChannel, MTP_channelParticipantsRecent(), MTP_int(fromStart ? 0 : peer->mgInfo->lastParticipants.size()), MTP_int(cMaxGroupCount())), rpcDone(&ApiWrap::lastParticipantsDone, peer), rpcFail(&ApiWrap::lastParticipantsFail, peer)); _participantsRequests.insert(peer, fromStart ? req : -req); }
void ApiWrap::requestBots(ChannelData *peer) { if (!peer || !peer->isMegagroup() || _botsRequests.contains(peer)) return; _botsRequests.insert(peer, MTP::send(MTPchannels_GetParticipants(peer->inputChannel, MTP_channelParticipantsBots(), MTP_int(0), MTP_int(cMaxGroupCount())), rpcDone(&ApiWrap::lastParticipantsDone, peer), rpcFail(&ApiWrap::lastParticipantsFail, peer))); }
void MembersBox::Inner::load() { if (!_loadingRequestId) { _loadingRequestId = MTP::send(MTPchannels_GetParticipants(_channel->inputChannel, (_filter == MembersFilter::Recent) ? MTP_channelParticipantsRecent() : MTP_channelParticipantsAdmins(), MTP_int(0), MTP_int(Global::ChatSizeMax())), rpcDone(&Inner::membersReceived), rpcFail(&Inner::membersFailed)); } }