From e9fd249c5a344308a695a186e0e1cce3099462be Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 10 Aug 2022 13:23:37 +0300 Subject: [PATCH] Remove some unused ApiWrap methods. --- Telegram/SourceFiles/apiwrap.cpp | 101 ------------------------------- Telegram/SourceFiles/apiwrap.h | 5 -- 2 files changed, 106 deletions(-) diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index b89078fc2..a751682a3 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -1125,62 +1125,6 @@ void ApiWrap::gotUserFull( Data::PeerUpdate::Flag::FullInfo); } -void ApiWrap::requestPeer(not_null peer) { - if (_fullPeerRequests.contains(peer) || _peerRequests.contains(peer)) { - return; - } - - const auto requestId = [&] { - const auto failHandler = [=] { - _peerRequests.remove(peer); - }; - const auto chatHandler = [=](const MTPmessages_Chats &result) { - _peerRequests.remove(peer); - const auto &chats = result.match([](const auto &data) { - return data.vchats(); - }); - _session->data().applyMaximumChatVersions(chats); - _session->data().processChats(chats); - }; - if (const auto user = peer->asUser()) { - return request(MTPusers_GetUsers( - MTP_vector(1, user->inputUser) - )).done([=](const MTPVector &result) { - _peerRequests.remove(user); - _session->data().processUsers(result); - }).fail(failHandler).send(); - } else if (const auto chat = peer->asChat()) { - return request(MTPmessages_GetChats( - MTP_vector(1, chat->inputChat) - )).done(chatHandler).fail(failHandler).send(); - } else if (const auto channel = peer->asChannel()) { - return request(MTPchannels_GetChannels( - MTP_vector(1, channel->inputChannel) - )).done(chatHandler).fail(failHandler).send(); - } - Unexpected("Peer type in requestPeer."); - }(); - _peerRequests.emplace(peer, requestId); -} - -void ApiWrap::requestPeerSettings(not_null peer) { - if (!_requestedPeerSettings.emplace(peer).second) { - return; - } - request(MTPmessages_GetPeerSettings( - peer->input - )).done([=](const MTPmessages_PeerSettings &result) { - result.match([&](const MTPDmessages_peerSettings &data) { - _session->data().processUsers(data.vusers()); - _session->data().processChats(data.vchats()); - peer->setSettings(data.vsettings()); - _requestedPeerSettings.erase(peer); - }); - }).fail([=] { - _requestedPeerSettings.erase(peer); - }).send(); -} - void ApiWrap::migrateChat( not_null chat, FnMut)> done, @@ -1319,51 +1263,6 @@ void ApiWrap::markContentsRead(not_null item) { } } -void ApiWrap::requestPeers(const QList &peers) { - QVector chats; - QVector channels; - QVector users; - chats.reserve(peers.size()); - channels.reserve(peers.size()); - users.reserve(peers.size()); - for (const auto peer : peers) { - if (!peer - || _fullPeerRequests.contains(peer) - || _peerRequests.contains(peer)) { - continue; - } - if (const auto user = peer->asUser()) { - users.push_back(user->inputUser); - } else if (const auto chat = peer->asChat()) { - chats.push_back(chat->inputChat); - } else if (const auto channel = peer->asChannel()) { - channels.push_back(channel->inputChannel); - } - } - const auto handleChats = [=](const MTPmessages_Chats &result) { - _session->data().processChats(result.match([](const auto &data) { - return data.vchats(); - })); - }; - if (!chats.isEmpty()) { - request(MTPmessages_GetChats( - MTP_vector(chats) - )).done(handleChats).send(); - } - if (!channels.isEmpty()) { - request(MTPchannels_GetChannels( - MTP_vector(channels) - )).done(handleChats).send(); - } - if (!users.isEmpty()) { - request(MTPusers_GetUsers( - MTP_vector(users) - )).done([=](const MTPVector &result) { - _session->data().processUsers(result); - }).send(); - } -} - void ApiWrap::deleteAllFromParticipant( not_null channel, not_null from) { diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index 1caa1d763..20f1807df 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -174,9 +174,6 @@ public: Fn fail); void requestFullPeer(not_null peer); - void requestPeer(not_null peer); - void requestPeers(const QList &peers); - void requestPeerSettings(not_null peer); using UpdatedFileReferences = Data::UpdatedFileReferences; using FileReferencesHandler = FnMut; @@ -538,8 +535,6 @@ private: using PeerRequests = base::flat_map; PeerRequests _fullPeerRequests; - PeerRequests _peerRequests; - base::flat_set> _requestedPeerSettings; base::flat_map< not_null,