mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Removed unused MTP::Error from callbacks on fail.
This commit is contained in:
parent
287a35d208
commit
3647241f71
62 changed files with 158 additions and 182 deletions
|
@ -59,7 +59,7 @@ void AttachedStickers::request(
|
|||
strongController->show(
|
||||
Box<StickerSetBox>(strongController, setId),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
if (const auto strongController = weak.get()) {
|
||||
strongController->show(
|
||||
|
|
|
@ -132,7 +132,7 @@ void Authorizations::reload() {
|
|||
}) | ranges::to<List>;
|
||||
_listChanges.fire({});
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ void Authorizations::updateTTL(int days) {
|
|||
MTP_int(days)
|
||||
)).done([=](const MTPBool &result) {
|
||||
_ttlRequestId = 0;
|
||||
}).fail([=](const MTP::Error &result) {
|
||||
}).fail([=] {
|
||||
_ttlRequestId = 0;
|
||||
}).send();
|
||||
_ttlDays = days;
|
||||
|
@ -218,7 +218,7 @@ void Authorizations::toggleCallsDisabled(uint64 hash, bool disabled) {
|
|||
MTP_bool(disabled)
|
||||
)).done([=](const MTPBool &) {
|
||||
_toggleCallsDisabledRequests.remove(hash);
|
||||
}).fail([=](const MTP::Error &) {
|
||||
}).fail([=] {
|
||||
_toggleCallsDisabledRequests.remove(hash);
|
||||
}).send();
|
||||
_toggleCallsDisabledRequests.emplace(hash, id);
|
||||
|
|
|
@ -90,7 +90,7 @@ void BlockedPeers::block(not_null<PeerData*> peer) {
|
|||
++_slice->total;
|
||||
_changes.fire_copy(*_slice);
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_blockRequests.erase(peer);
|
||||
}).send();
|
||||
|
||||
|
@ -128,7 +128,7 @@ void BlockedPeers::unblock(not_null<PeerData*> peer, Fn<void()> onDone) {
|
|||
if (onDone) {
|
||||
onDone();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_blockRequests.erase(peer);
|
||||
}).send();
|
||||
_blockRequests.emplace(peer, requestId);
|
||||
|
@ -165,7 +165,7 @@ void BlockedPeers::request(int offset, Fn<void(BlockedPeers::Slice)> onDone) {
|
|||
)).done([=](const MTPcontacts_Blocked &result) {
|
||||
_requestId = 0;
|
||||
onDone(TLToSlice(result, _session->data()));
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ void ChatParticipants::requestLast(not_null<ChannelData*> channel) {
|
|||
LOG(("API Error: "
|
||||
"channels.channelParticipantsNotModified received!"));
|
||||
});
|
||||
}).fail([this, channel](const MTP::Error &error) {
|
||||
}).fail([this, channel] {
|
||||
_participantsRequests.remove(channel);
|
||||
}).send();
|
||||
|
||||
|
@ -416,7 +416,7 @@ void ChatParticipants::requestBots(not_null<ChannelData*> channel) {
|
|||
LOG(("API Error: "
|
||||
"channels.channelParticipantsNotModified received!"));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_botsRequests.remove(channel);
|
||||
}).send();
|
||||
|
||||
|
@ -445,7 +445,7 @@ void ChatParticipants::requestAdmins(not_null<ChannelData*> channel) {
|
|||
LOG(("API Error: "
|
||||
"channels.channelParticipantsNotModified received!"));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_adminsRequests.remove(channel);
|
||||
}).send();
|
||||
|
||||
|
@ -638,7 +638,7 @@ void ChatParticipants::kick(
|
|||
|
||||
_kickRequests.remove(KickRequest(channel, participant));
|
||||
channel->applyEditBanned(participant, currentRights, rights);
|
||||
}).fail([this, kick](const MTP::Error &error) {
|
||||
}).fail([this, kick] {
|
||||
_kickRequests.remove(kick);
|
||||
}).send();
|
||||
|
||||
|
@ -666,7 +666,7 @@ void ChatParticipants::unblock(
|
|||
} else {
|
||||
channel->updateFullForced();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_kickRequests.remove(kick);
|
||||
}).send();
|
||||
|
||||
|
|
|
@ -36,17 +36,17 @@ void CloudPassword::reload() {
|
|||
}
|
||||
_stateChanges.fire_copy(*_state);
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
||||
void CloudPassword::clearUnconfirmedPassword() {
|
||||
_requestId = _api.request(MTPaccount_CancelPasswordEmail(
|
||||
)).done([=](const MTPBool &result) {
|
||||
)).done([=] {
|
||||
_requestId = 0;
|
||||
reload();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
reload();
|
||||
}).send();
|
||||
|
|
|
@ -33,7 +33,7 @@ void GlobalPrivacy::reload(Fn<void()> callback) {
|
|||
for (const auto &callback : base::take(_callbacks)) {
|
||||
callback();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
for (const auto &callback : base::take(_callbacks)) {
|
||||
callback();
|
||||
|
@ -86,7 +86,7 @@ void GlobalPrivacy::update(bool archiveAndMute) {
|
|||
)).done([=](const MTPGlobalPrivacySettings &result) {
|
||||
_requestId = 0;
|
||||
apply(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
_archiveAndMute = archiveAndMute;
|
||||
|
|
|
@ -128,7 +128,7 @@ void InviteLinks::performCreate(
|
|||
callback(link);
|
||||
}
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_createCallbacks.erase(peer);
|
||||
}).send();
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ void InviteLinks::performEdit(
|
|||
prepend(peer, admin, data.vnew_invite());
|
||||
}
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_editCallbacks.erase(key);
|
||||
}).send();
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ void InviteLinks::destroy(
|
|||
.admin = admin,
|
||||
.was = key.link,
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_deleteCallbacks.erase(key);
|
||||
}).send();
|
||||
}
|
||||
|
@ -405,7 +405,6 @@ void InviteLinks::destroyAllRevoked(
|
|||
}
|
||||
}
|
||||
_allRevokedDestroyed.fire({ peer, admin });
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
@ -446,7 +445,7 @@ void InviteLinks::requestMyLinks(not_null<PeerData*> peer) {
|
|||
i->second.count = std::max(slice.count, int(existing.size()));
|
||||
}
|
||||
notify(peer);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_firstSliceRequests.remove(peer);
|
||||
}).send();
|
||||
_firstSliceRequests.emplace(peer, requestId);
|
||||
|
@ -507,7 +506,7 @@ void InviteLinks::processRequest(
|
|||
done();
|
||||
}
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
if (const auto callbacks = _processRequests.take({ peer, user })) {
|
||||
if (const auto &fail = callbacks->fail) {
|
||||
fail();
|
||||
|
@ -608,7 +607,7 @@ void InviteLinks::requestJoinedFirstSlice(LinkKey key) {
|
|||
_firstJoinedRequests.remove(key);
|
||||
_firstJoined[key] = ParseJoinedByLinkSlice(key.peer, result);
|
||||
_joinedFirstSliceLoaded.fire_copy(key);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_firstJoinedRequests.remove(key);
|
||||
}).send();
|
||||
_firstJoinedRequests.emplace(key, requestId);
|
||||
|
@ -771,7 +770,7 @@ void InviteLinks::requestMoreLinks(
|
|||
MTP_int(kPerPage)
|
||||
)).done([=](const MTPmessages_ExportedChatInvites &result) {
|
||||
done(parseSlice(peer, result));
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
done(Links());
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ void Polls::sendVotes(
|
|||
_pollVotesRequestIds.erase(itemId);
|
||||
hideSending();
|
||||
_session->updates().applyUpdates(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_pollVotesRequestIds.erase(itemId);
|
||||
hideSending();
|
||||
}).send();
|
||||
|
@ -179,7 +179,7 @@ void Polls::close(not_null<HistoryItem*> item) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_pollCloseRequestIds.erase(itemId);
|
||||
_session->updates().applyUpdates(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_pollCloseRequestIds.erase(itemId);
|
||||
}).send();
|
||||
_pollCloseRequestIds.emplace(itemId, requestId);
|
||||
|
@ -196,7 +196,7 @@ void Polls::reloadResults(not_null<HistoryItem*> item) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_pollReloadRequestIds.erase(itemId);
|
||||
_session->updates().applyUpdates(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_pollReloadRequestIds.erase(itemId);
|
||||
}).send();
|
||||
_pollReloadRequestIds.emplace(itemId, requestId);
|
||||
|
|
|
@ -25,7 +25,7 @@ void SelfDestruct::reload() {
|
|||
result.match([&](const MTPDaccountDaysTTL &data) {
|
||||
_days = data.vdays().v;
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ void SelfDestruct::update(int days) {
|
|||
MTP_accountDaysTTL(MTP_int(days))
|
||||
)).done([=](const MTPBool &result) {
|
||||
_requestId = 0;
|
||||
}).fail([=](const MTP::Error &result) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
_days = days;
|
||||
|
|
|
@ -36,7 +36,7 @@ void SensitiveContent::reload() {
|
|||
_enabled = data.is_sensitive_enabled();
|
||||
_canChange = data.is_sensitive_can_change();
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void SensitiveContent::update(bool enabled) {
|
|||
MTP_flags(enabled ? Flag::f_sensitive_enabled : Flag(0))
|
||||
)).done([=](const MTPBool &result) {
|
||||
_requestId = 0;
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
_enabled = enabled;
|
||||
|
|
|
@ -117,7 +117,7 @@ std::optional<HistoryItem*> SingleMessageSearch::performLookupByChannel(
|
|||
} else {
|
||||
fail();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
fail();
|
||||
}).send();
|
||||
|
||||
|
@ -154,7 +154,7 @@ std::optional<HistoryItem*> SingleMessageSearch::performLookupById(
|
|||
fail();
|
||||
}
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
fail();
|
||||
}).send();
|
||||
|
||||
|
@ -198,7 +198,7 @@ std::optional<HistoryItem*> SingleMessageSearch::performLookupByUsername(
|
|||
fail();
|
||||
}
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
fail();
|
||||
}).send();
|
||||
|
||||
|
|
|
@ -769,7 +769,7 @@ void Updates::channelRangeDifferenceSend(
|
|||
)).done([=](const MTPupdates_ChannelDifference &result) {
|
||||
_rangeDifferenceRequests.remove(channel);
|
||||
channelRangeDifferenceDone(channel, range, result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_rangeDifferenceRequests.remove(channel);
|
||||
}).send();
|
||||
_rangeDifferenceRequests.emplace(channel, requestId);
|
||||
|
@ -921,7 +921,7 @@ void Updates::updateOnline(crl::time lastNonIdleTime, bool gotOtherOffline) {
|
|||
MTP_bool(!isOnline)
|
||||
)).done([=](const MTPBool &result) {
|
||||
Core::App().quitPreventFinished();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
Core::App().quitPreventFinished();
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ void UserPrivacy::save(
|
|||
_privacySaveRequests.remove(keyTypeId);
|
||||
apply(keyTypeId, data.vrules(), true);
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_privacySaveRequests.remove(keyTypeId);
|
||||
}).send();
|
||||
|
||||
|
@ -277,7 +277,7 @@ void UserPrivacy::reload(Key key) {
|
|||
_session->data().processChats(data.vchats());
|
||||
pushPrivacy(key, data.vrules());
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_privacyRequestIds.erase(key);
|
||||
}).send();
|
||||
_privacyRequestIds.emplace(key, requestId);
|
||||
|
|
|
@ -164,7 +164,7 @@ struct State {
|
|||
peers.push_back(UserId(id));
|
||||
}
|
||||
entry.list = std::move(peers);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
auto &entry = context->cache(item);
|
||||
entry.requestId = 0;
|
||||
if (ListUnknown(entry.list.current(), item)) {
|
||||
|
|
|
@ -226,7 +226,7 @@ void ApiWrap::refreshTopPromotion() {
|
|||
)).done([=](const MTPhelp_PromoData &result) {
|
||||
_topPromotionRequestId = 0;
|
||||
topPromotionDone(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_topPromotionRequestId = 0;
|
||||
const auto now = base::unixtime::now();
|
||||
const auto next = _topPromotionNextRequestTime = now
|
||||
|
@ -276,7 +276,7 @@ void ApiWrap::requestDeepLinkInfo(
|
|||
if (result.type() == mtpc_help_deepLinkInfo) {
|
||||
callback(result.c_help_deepLinkInfo());
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_deepLinkInfoRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ void ApiWrap::requestTermsUpdate() {
|
|||
} break;
|
||||
default: Unexpected("Type in requestTermsUpdate().");
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_termsUpdateRequestId = 0;
|
||||
_termsUpdateSendAt = crl::now() + kTermsUpdateTimeoutMin;
|
||||
requestTermsUpdate();
|
||||
|
@ -455,7 +455,7 @@ void ApiWrap::toggleHistoryArchived(
|
|||
if (isPinned) {
|
||||
_session->data().notifyPinnedDialogsOrderUpdated();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_historyArchivedRequests.remove(history);
|
||||
}).send();
|
||||
_historyArchivedRequests.emplace(history, requestId, callback);
|
||||
|
@ -736,7 +736,7 @@ void ApiWrap::requestContacts() {
|
|||
}
|
||||
}
|
||||
_session->data().contactsLoaded() = true;
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_contactsRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -810,7 +810,7 @@ void ApiWrap::requestMoreDialogs(Data::Folder *folder) {
|
|||
}
|
||||
requestMoreDialogsIfNeeded();
|
||||
_session->data().chatsListChanged(folder);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
dialogsLoadState(folder)->requestId = 0;
|
||||
}).send();
|
||||
|
||||
|
@ -955,7 +955,7 @@ void ApiWrap::requestPinnedDialogs(Data::Folder *folder) {
|
|||
_session->data().chatsListChanged(folder);
|
||||
_session->data().notifyPinnedDialogsOrderUpdated();
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
finalize();
|
||||
}).send();
|
||||
}
|
||||
|
@ -1138,7 +1138,7 @@ void ApiWrap::requestPeer(not_null<PeerData*> peer) {
|
|||
}
|
||||
|
||||
const auto requestId = [&] {
|
||||
const auto failHandler = [=](const MTP::Error &error) {
|
||||
const auto failHandler = [=] {
|
||||
_peerRequests.remove(peer);
|
||||
};
|
||||
const auto chatHandler = [=](const MTPmessages_Chats &result) {
|
||||
|
@ -1183,7 +1183,7 @@ void ApiWrap::requestPeerSettings(not_null<PeerData*> peer) {
|
|||
peer->setSettings(data.vsettings());
|
||||
_requestedPeerSettings.erase(peer);
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestedPeerSettings.erase(peer);
|
||||
}).send();
|
||||
}
|
||||
|
@ -1437,7 +1437,7 @@ void ApiWrap::requestStickerSets() {
|
|||
MTP_int(0) // hash
|
||||
)).done([=, setId = i.key()](const MTPmessages_StickerSet &result) {
|
||||
gotStickerSet(setId, result);
|
||||
}).fail([=, setId = i.key()](const MTP::Error &error) {
|
||||
}).fail([=, setId = i.key()] {
|
||||
_stickerSetRequests.remove(setId);
|
||||
}).afterDelay(waitMs).send();
|
||||
}
|
||||
|
@ -1480,7 +1480,7 @@ void ApiWrap::saveStickerSets(
|
|||
MTP_vector<MTPlong>(mtpOrder)
|
||||
)).done([=](const MTPBool &result) {
|
||||
reorderRequestId() = 0;
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
reorderRequestId() = 0;
|
||||
if (setsMasks) {
|
||||
_session->data().stickers().setLastMasksUpdate(0);
|
||||
|
@ -1553,7 +1553,7 @@ void ApiWrap::saveStickerSets(
|
|||
MTP_flags(flags)
|
||||
)).done([=](const MTPBool &result) {
|
||||
finish();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
finish();
|
||||
}).send();
|
||||
continue;
|
||||
|
@ -1755,7 +1755,7 @@ void ApiWrap::leaveChannel(not_null<ChannelData*> channel) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_channelAmInRequests.remove(channel);
|
||||
applyUpdates(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_channelAmInRequests.remove(channel);
|
||||
}).send();
|
||||
|
||||
|
@ -1797,7 +1797,7 @@ void ApiWrap::requestNotifySettings(const MTPInputNotifyPeer &peer) {
|
|||
)).done([=](const MTPPeerNotifySettings &result) {
|
||||
applyNotifySettings(peer, result);
|
||||
_notifySettingRequests.erase(key);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
applyNotifySettings(
|
||||
peer,
|
||||
MTP_peerNotifySettings(
|
||||
|
@ -1879,7 +1879,7 @@ void ApiWrap::updatePrivacyLastSeens() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
}).fail([this] {
|
||||
_contactsStatusesRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -1913,7 +1913,7 @@ void ApiWrap::deleteConversation(not_null<PeerData*> peer, bool revoke) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
applyUpdates(result);
|
||||
deleteHistory(peer, false, revoke);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
deleteHistory(peer, false, revoke);
|
||||
}).send();
|
||||
} else {
|
||||
|
@ -2337,7 +2337,7 @@ void ApiWrap::requestFileReference(
|
|||
for (auto &handler : handlers) {
|
||||
handler(parsed);
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
const auto i = _fileReferenceHandlers.find(origin);
|
||||
Assert(i != end(_fileReferenceHandlers));
|
||||
auto handlers = std::move(i->second);
|
||||
|
@ -2590,7 +2590,7 @@ void ApiWrap::requestStickers(TimeId now) {
|
|||
};
|
||||
_stickersUpdateRequest = request(MTPmessages_GetAllStickers(
|
||||
MTP_long(Api::CountStickersHash(_session, true))
|
||||
)).done(done).fail([=](const MTP::Error &error) {
|
||||
)).done(done).fail([=] {
|
||||
LOG(("App Fail: Failed to get stickers!"));
|
||||
done(MTP_messages_allStickersNotModified());
|
||||
}).send();
|
||||
|
@ -2614,7 +2614,7 @@ void ApiWrap::requestMasks(TimeId now) {
|
|||
};
|
||||
_masksUpdateRequest = request(MTPmessages_GetMaskStickers(
|
||||
MTP_long(Api::CountMasksHash(_session, true))
|
||||
)).done(done).fail([=](const MTP::Error &error) {
|
||||
)).done(done).fail([=] {
|
||||
LOG(("App Fail: Failed to get masks!"));
|
||||
done(MTP_messages_allStickersNotModified());
|
||||
}).send();
|
||||
|
@ -2674,7 +2674,7 @@ void ApiWrap::requestRecentStickersWithHash(uint64 hash, bool attached) {
|
|||
} return;
|
||||
default: Unexpected("Type in ApiWrap::recentStickersDone()");
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
finish();
|
||||
|
||||
LOG(("App Fail: Failed to get recent stickers!"));
|
||||
|
@ -2705,7 +2705,7 @@ void ApiWrap::requestFavedStickers(TimeId now) {
|
|||
} return;
|
||||
default: Unexpected("Type in ApiWrap::favedStickersDone()");
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_session->data().stickers().setLastFavedUpdate(crl::now());
|
||||
_favedStickersUpdateRequest = 0;
|
||||
|
||||
|
@ -2735,7 +2735,7 @@ void ApiWrap::requestFeaturedStickers(TimeId now) {
|
|||
} return;
|
||||
default: Unexpected("Type in ApiWrap::featuredStickersDone()");
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_session->data().stickers().setLastFeaturedUpdate(crl::now());
|
||||
_featuredStickersUpdateRequest = 0;
|
||||
|
||||
|
@ -2764,7 +2764,7 @@ void ApiWrap::requestSavedGifs(TimeId now) {
|
|||
} return;
|
||||
default: Unexpected("Type in ApiWrap::savedGifsDone()");
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_session->data().stickers().setLastSavedGifsUpdate(crl::now());
|
||||
_savedGifsUpdateRequest = 0;
|
||||
|
||||
|
@ -2923,7 +2923,7 @@ void ApiWrap::preloadEnoughUnreadMentions(not_null<History*> history) {
|
|||
auto requestId = request(MTPmessages_GetUnreadMentions(history->peer->input, MTP_int(offsetId), MTP_int(addOffset), MTP_int(limit), MTP_int(maxId), MTP_int(minId))).done([this, history](const MTPmessages_Messages &result) {
|
||||
_unreadMentionsRequests.remove(history);
|
||||
history->addUnreadMentionsSlice(result);
|
||||
}).fail([this, history](const MTP::Error &error) {
|
||||
}).fail([this, history] {
|
||||
_unreadMentionsRequests.remove(history);
|
||||
}).send();
|
||||
_unreadMentionsRequests.emplace(history, requestId);
|
||||
|
@ -2982,7 +2982,7 @@ void ApiWrap::requestSharedMedia(
|
|||
_sharedMediaRequests.remove(key);
|
||||
sharedMediaDone(peer, type, messageId, slice, result);
|
||||
finish();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_sharedMediaRequests.remove(key);
|
||||
finish();
|
||||
}).send();
|
||||
|
@ -3031,7 +3031,7 @@ void ApiWrap::requestUserPhotos(
|
|||
)).done([this, user, afterId](const MTPphotos_Photos &result) {
|
||||
_userPhotosRequests.remove(user);
|
||||
userPhotosDone(user, afterId, result);
|
||||
}).fail([this, user](const MTP::Error &error) {
|
||||
}).fail([this, user] {
|
||||
_userPhotosRequests.remove(user);
|
||||
}).send();
|
||||
_userPhotosRequests.emplace(user, requestId);
|
||||
|
@ -3823,7 +3823,7 @@ void ApiWrap::uploadAlbumMedia(
|
|||
sendAlbumWithUploaded(item, groupId, media);
|
||||
} break;
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
failed();
|
||||
}).send();
|
||||
}
|
||||
|
@ -4034,7 +4034,7 @@ void ApiWrap::reloadContactSignupSilent() {
|
|||
const auto silent = mtpIsTrue(result);
|
||||
_contactSignupSilent = silent;
|
||||
_contactSignupSilentChanges.fire_copy(silent);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_contactSignupSilentRequestId = 0;
|
||||
}).send();
|
||||
_contactSignupSilentRequestId = requestId;
|
||||
|
@ -4060,7 +4060,7 @@ void ApiWrap::saveContactSignupSilent(bool silent) {
|
|||
_contactSignupSilentRequestId = 0;
|
||||
_contactSignupSilent = silent;
|
||||
_contactSignupSilentChanges.fire_copy(silent);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_contactSignupSilentRequestId = 0;
|
||||
}).send();
|
||||
_contactSignupSilentRequestId = requestId;
|
||||
|
@ -4085,7 +4085,7 @@ void ApiWrap::saveSelfBio(const QString &text) {
|
|||
|
||||
_session->data().processUser(result);
|
||||
_session->user()->setAbout(_bio.requestedText);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_bio.requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -478,10 +478,6 @@ void PasscodeBox::closeReplacedBy() {
|
|||
}
|
||||
}
|
||||
|
||||
void PasscodeBox::setPasswordFail(const MTP::Error &error) {
|
||||
setPasswordFail(error.type());
|
||||
}
|
||||
|
||||
void PasscodeBox::setPasswordFail(const QString &type) {
|
||||
if (MTP::IsFloodError(type)) {
|
||||
closeReplacedBy();
|
||||
|
@ -533,7 +529,7 @@ void PasscodeBox::setPasswordFail(
|
|||
|
||||
validateEmail(email, codeLength, newPasswordBytes);
|
||||
} else {
|
||||
setPasswordFail(error);
|
||||
setPasswordFail(error.type());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -582,7 +578,7 @@ void PasscodeBox::validateEmail(
|
|||
)).done([=](const MTPBool &result) {
|
||||
_setRequest = 0;
|
||||
resent->fire(tr::lng_cloud_password_resent(tr::now));
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_setRequest = 0;
|
||||
errors->fire(Lang::Hard::ServerError());
|
||||
}).send();
|
||||
|
@ -942,7 +938,7 @@ void PasscodeBox::changeCloudPassword(
|
|||
});
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
setPasswordFail(error);
|
||||
setPasswordFail(error.type());
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
||||
|
@ -1419,7 +1415,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
|
|||
)).done([=](const MTPBool &result) {
|
||||
*requestId = 0;
|
||||
resent->fire(tr::lng_cloud_password_resent(tr::now));
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
*requestId = 0;
|
||||
errors->fire(Lang::Hard::ServerError());
|
||||
}).send();
|
||||
|
|
|
@ -98,7 +98,6 @@ private:
|
|||
void recoverPasswordDone(
|
||||
const QByteArray &newPasswordBytes,
|
||||
const MTPauth_Authorization &result);
|
||||
void setPasswordFail(const MTP::Error &error);
|
||||
void setPasswordFail(const QString &type);
|
||||
void setPasswordFail(
|
||||
const QByteArray &newPasswordBytes,
|
||||
|
|
|
@ -490,7 +490,7 @@ void AddSpecialBoxController::loadMoreRows() {
|
|||
setDescriptionText(tr::lng_blocked_list_not_found(tr::now));
|
||||
}
|
||||
delegate()->peerListRefreshRows();
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
}).fail([this] {
|
||||
_loadRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ bool AddSpecialBoxController::checkInfoLoaded(
|
|||
Api::ChatParticipant(data.vparticipant(), channel));
|
||||
});
|
||||
callback();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_additional.setExternal(participant);
|
||||
callback();
|
||||
}).send();
|
||||
|
|
|
@ -73,7 +73,6 @@ void SendRequest(
|
|||
lt_user,
|
||||
first));
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ void RemoveAdmin(
|
|||
if (onDone) {
|
||||
onDone();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
if (onFail) {
|
||||
onFail();
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ void SaveChannelRestriction(
|
|||
if (onDone) {
|
||||
onDone();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
if (onFail) {
|
||||
onFail();
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ void SaveChatParticipantKick(
|
|||
if (onDone) {
|
||||
onDone();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
if (onFail) {
|
||||
onFail();
|
||||
}
|
||||
|
@ -1418,7 +1418,7 @@ void ParticipantsBoxController::loadMoreRows() {
|
|||
_onlineSorter->sort();
|
||||
}
|
||||
delegate()->peerListRefreshRows();
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
}).fail([this] {
|
||||
_loadRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ void ShowEditPermissions(
|
|||
const auto api = &peer->session().api();
|
||||
api->migrateChat(chat, [=](not_null<ChannelData*> channel) {
|
||||
save(channel, result);
|
||||
}, [=](const MTP::Error &error) {
|
||||
}, [=](const MTP::Error &) {
|
||||
*saving = false;
|
||||
});
|
||||
}, box->lifetime());
|
||||
|
@ -685,7 +685,7 @@ void Controller::showEditLinkedChatBox() {
|
|||
std::move(chats),
|
||||
callback),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_linkedChatsRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -1361,7 +1361,7 @@ void Controller::saveLinkedChat() {
|
|||
)).done([=](const MTPBool &result) {
|
||||
channel->setLinkedChat(*_savingData.linkedChat);
|
||||
continueSave();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
cancelSave();
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -689,7 +689,7 @@ void Controller::loadMoreRows() {
|
|||
auto slice = Api::ParseJoinedByLinkSlice(_peer, result);
|
||||
_allLoaded = slice.users.empty();
|
||||
appendSlice(slice);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
_allLoaded = true;
|
||||
}).send();
|
||||
|
|
|
@ -327,7 +327,7 @@ Fn<void()> AboutGigagroupCallback(not_null<ChannelData*> channel) {
|
|||
channel->session().api().applyUpdates(result);
|
||||
Ui::hideSettingsAndLayer();
|
||||
Ui::Toast::Show(tr::lng_gigagroup_done(tr::now));
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
*converting = false;
|
||||
}).send();
|
||||
};
|
||||
|
|
|
@ -340,7 +340,7 @@ void RequestsBoxController::loadMoreRows() {
|
|||
refreshDescription();
|
||||
}
|
||||
delegate()->peerListRefreshRows();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_loadRequestId = 0;
|
||||
_allLoaded = true;
|
||||
}).send();
|
||||
|
|
|
@ -123,7 +123,7 @@ void PinMessageBox::pinMessage() {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
Ui::hideLayer();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
Ui::hideLayer();
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -371,7 +371,7 @@ StickerSetBox::Inner::Inner(
|
|||
MTP_int(0) // hash
|
||||
)).done([=](const MTPmessages_StickerSet &result) {
|
||||
gotSet(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_loaded = true;
|
||||
_errors.fire(Error::NotFound);
|
||||
}).send();
|
||||
|
@ -934,7 +934,7 @@ void StickerSetBox::Inner::install() {
|
|||
MTP_bool(false)
|
||||
)).done([=](const MTPmessages_StickerSetInstallResult &result) {
|
||||
installDone(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_errors.fire(Error::NotFound);
|
||||
}).send();
|
||||
}
|
||||
|
@ -947,7 +947,7 @@ void StickerSetBox::Inner::archiveStickers() {
|
|||
if (result.type() == mtpc_messages_stickerSetInstallResultSuccess) {
|
||||
_setArchived.fire_copy(_setId);
|
||||
}
|
||||
}).fail([](const MTP::Error &error) {
|
||||
}).fail([] {
|
||||
Ui::Toast::Show(Lang::Hard::ServerError());
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -1897,7 +1897,7 @@ void StickersBox::Inner::handleMegagroupSetAddressChange() {
|
|||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_megagroupSetRequestId = 0;
|
||||
setMegagroupSelectedSet({});
|
||||
}).send();
|
||||
|
|
|
@ -67,7 +67,7 @@ void UrlAuthBox::Activate(
|
|||
Request(data, item, row, column);
|
||||
}
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
const auto button = HistoryMessageMarkupButton::Get(
|
||||
&session->data(),
|
||||
itemId,
|
||||
|
@ -105,7 +105,7 @@ void UrlAuthBox::Activate(
|
|||
}, [&](const MTPDurlAuthResultRequest &data) {
|
||||
Request(data, session, url, context);
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
HiddenUrlClickHandler::Open(url, context);
|
||||
}).send();
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ void UrlAuthBox::Request(
|
|||
return url;
|
||||
});
|
||||
finishWithUrl(to);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
finishWithUrl(url);
|
||||
}).send();
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ void UrlAuthBox::Request(
|
|||
return url;
|
||||
});
|
||||
finishWithUrl(to);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
finishWithUrl(url);
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -344,7 +344,7 @@ void BoxController::loadMoreRows() {
|
|||
} break;
|
||||
default: Unexpected("Type of messages.Messages (Calls::BoxController::preloadRows)");
|
||||
}
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
}).fail([this] {
|
||||
_loadRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -1209,7 +1209,7 @@ void Call::finish(FinishType type, const MTPPhoneCallDiscardReason &reason) {
|
|||
// updates being handled, but in a guarded way.
|
||||
crl::on_main(weak, [=] { setState(finalState); });
|
||||
session->api().applyUpdates(result);
|
||||
}).fail(crl::guard(weak, [this, finalState](const MTP::Error &error) {
|
||||
}).fail(crl::guard(weak, [this, finalState] {
|
||||
setState(finalState);
|
||||
})).send();
|
||||
}
|
||||
|
|
|
@ -332,7 +332,7 @@ void Instance::refreshDhConfig() {
|
|||
} else {
|
||||
_delegate->callFailed(call);
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
const auto call = weak.get();
|
||||
if (!call) {
|
||||
return;
|
||||
|
@ -391,7 +391,7 @@ void Instance::refreshServerConfig(not_null<Main::Session*> session) {
|
|||
|
||||
const auto &json = result.c_dataJSON().vdata().v;
|
||||
UpdateConfig(std::string(json.data(), json.size()));
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_serverConfigRequestSession = nullptr;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -467,7 +467,7 @@ void ChooseJoinAsProcess::start(
|
|||
|
||||
_request->box = box.data();
|
||||
_request->showBox(std::move(box));
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
finish({
|
||||
.peer = _request->peer,
|
||||
.joinAs = _request->peer->session().user(),
|
||||
|
|
|
@ -1604,7 +1604,7 @@ void GroupCall::discard() {
|
|||
// updates being handled, but in a guarded way.
|
||||
crl::on_main(this, [=] { hangup(); });
|
||||
_peer->session().api().applyUpdates(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
hangup();
|
||||
}).send();
|
||||
}
|
||||
|
@ -1672,7 +1672,7 @@ void GroupCall::leave() {
|
|||
// updates being handled, but in a guarded way.
|
||||
crl::on_main(weak, [=] { setState(finalState); });
|
||||
session->api().applyUpdates(result);
|
||||
}).fail(crl::guard(weak, [=](const MTP::Error &error) {
|
||||
}).fail(crl::guard(weak, [=] {
|
||||
setState(finalState);
|
||||
})).send();
|
||||
}
|
||||
|
@ -2225,7 +2225,6 @@ void GroupCall::changeTitle(const QString &title) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
_titleChanged.fire({});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
@ -2258,7 +2257,7 @@ void GroupCall::toggleRecording(
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
_recordingStoppedByMe = false;
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_recordingStoppedByMe = false;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -400,7 +400,7 @@ void EmojiKeywords::LangPack::refresh() {
|
|||
_requestId = 0;
|
||||
_lastRefreshTime = crl::now();
|
||||
applyDifference(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
_lastRefreshTime = crl::now();
|
||||
}).send();
|
||||
|
@ -670,7 +670,7 @@ void EmojiKeywords::refreshRemoteList() {
|
|||
});
|
||||
}) | ranges::to_vector);
|
||||
_langsRequestId = 0;
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_langsRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -854,7 +854,7 @@ void GifsListWidget::sendInlineRequest() {
|
|||
MTP_string(nextOffset)
|
||||
)).done([this](const MTPmessages_BotResults &result) {
|
||||
inlineResultsDone(result);
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
}).fail([this] {
|
||||
// show error?
|
||||
_footer->setLoading(false);
|
||||
_inlineRequestId = 0;
|
||||
|
|
|
@ -160,7 +160,7 @@ void SetupUnreadMentionsMenu(
|
|||
)).done([=](const MTPmessages_AffectedHistory &result) {
|
||||
state->sentForPeers.remove(peer);
|
||||
peer->session().api().applyAffectedHistory(peer, result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
state->sentForPeers.remove(peer);
|
||||
}).send();
|
||||
});
|
||||
|
|
|
@ -55,7 +55,7 @@ void DicePack::load() {
|
|||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ void EmojiPack::refreshAnimations() {
|
|||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_animationsRequestId = 0;
|
||||
refreshDelayed();
|
||||
}).send();
|
||||
|
|
|
@ -1106,7 +1106,6 @@ void StickersListWidget::preloadMoreOfficial() {
|
|||
});
|
||||
resizeToWidth(width());
|
||||
update();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
@ -1276,7 +1275,7 @@ void StickersListWidget::sendSearchRequest() {
|
|||
MTP_long(hash)
|
||||
)).done([=](const MTPmessages_FoundStickerSets &result) {
|
||||
searchResultsDone(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
// show error?
|
||||
_footer->setLoading(false);
|
||||
_searchRequestId = 0;
|
||||
|
@ -3149,7 +3148,7 @@ void StickersListWidget::sendInstallRequest(
|
|||
session().data().stickers().applyArchivedResult(
|
||||
result.c_messages_stickerSetInstallResultArchive());
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
notInstalledLocally(setId);
|
||||
session().data().stickers().undoInstallLocally(setId);
|
||||
}).send();
|
||||
|
|
|
@ -256,7 +256,7 @@ void ChatFilters::load(bool force) {
|
|||
)).done([=](const MTPVector<MTPDialogFilter> &result) {
|
||||
received(result.v);
|
||||
_loadRequestId = 0;
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_loadRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ bool ChatFilters::loadNextExceptions(bool chatsListLoaded) {
|
|||
_exceptionsLoadRequestId = 0;
|
||||
_owner->session().data().histories().applyPeerDialogs(result);
|
||||
_owner->session().api().requestMoreDialogsIfNeeded();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_exceptionsLoadRequestId = 0;
|
||||
_owner->session().api().requestMoreDialogsIfNeeded();
|
||||
}).send();
|
||||
|
@ -594,7 +594,7 @@ void ChatFilters::requestSuggested() {
|
|||
}) | ranges::to_vector;
|
||||
|
||||
_suggestedUpdated.fire({});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_suggestedRequestId = 0;
|
||||
_suggestedLastReceived = crl::now() + kRefreshSuggestedTimeout / 2;
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ void CloudThemes::reloadCurrent() {
|
|||
MTP_long(fields.documentId)
|
||||
)).done([=](const MTPTheme &result) {
|
||||
applyUpdate(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_reloadCurrentTimer.callOnce(kReloadTimeout);
|
||||
}).send();
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ void CloudThemes::refresh() {
|
|||
_updates.fire({});
|
||||
}, [](const MTPDaccount_themesNotModified &) {
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_refreshRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ void CloudThemes::refreshChatThemes() {
|
|||
_chatThemesUpdates.fire({});
|
||||
}, [](const MTPDaccount_themesNotModified &) {
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_chatThemesRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ void GroupCall::requestParticipants() {
|
|||
_participantsReloaded.fire({});
|
||||
}
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_participantsRequestId = 0;
|
||||
const auto reloaded = processSavedFullCall();
|
||||
setServerParticipantsCount(_participants.size());
|
||||
|
@ -511,7 +511,7 @@ void GroupCall::reload() {
|
|||
}
|
||||
_reloadRequestId = 0;
|
||||
processFullCall(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_reloadRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -898,7 +898,7 @@ void GroupCall::requestUnknownParticipants() {
|
|||
_participantsResolved.fire(&ssrcs);
|
||||
}
|
||||
requestUnknownParticipants();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_unknownParticipantPeersRequestId = 0;
|
||||
for (const auto &[ssrc, when] : ssrcs) {
|
||||
_unknownSpokenSsrcs.remove(ssrc);
|
||||
|
|
|
@ -268,7 +268,7 @@ void Histories::requestDialogEntry(not_null<Data::Folder*> folder) {
|
|||
)).done([=](const MTPmessages_PeerDialogs &result) {
|
||||
applyPeerDialogs(result);
|
||||
_dialogFolderRequests.remove(folder);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_dialogFolderRequests.remove(folder);
|
||||
}).send();
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ void Histories::sendDialogRequests() {
|
|||
)).done([=](const MTPmessages_PeerDialogs &result) {
|
||||
applyPeerDialogs(result);
|
||||
finalize();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
finalize();
|
||||
}).send();
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ void Histories::requestFakeChatListMessage(
|
|||
_fakeChatListRequests.erase(history);
|
||||
history->setFakeChatListMessageFrom(result);
|
||||
finish();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_fakeChatListRequests.erase(history);
|
||||
history->setFakeChatListMessageFrom(MTP_messages_messages(
|
||||
MTP_vector<MTPMessage>(0),
|
||||
|
@ -472,7 +472,7 @@ void Histories::requestGroupAround(not_null<HistoryItem*> item) {
|
|||
history->channelId(),
|
||||
result);
|
||||
finish();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_chatListGroupRequests.remove(history);
|
||||
finish();
|
||||
}).send();
|
||||
|
@ -555,7 +555,7 @@ void Histories::sendReadRequest(not_null<History*> history, State &state) {
|
|||
MTP_int(tillId)
|
||||
)).done([=](const MTPBool &result) {
|
||||
finished();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
finished();
|
||||
}).send();
|
||||
} else {
|
||||
|
@ -565,7 +565,7 @@ void Histories::sendReadRequest(not_null<History*> history, State &state) {
|
|||
)).done([=](const MTPmessages_AffectedMessages &result) {
|
||||
session().api().applyAffectedMessages(history->peer, result);
|
||||
finished();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
finished();
|
||||
}).send();
|
||||
}
|
||||
|
@ -610,20 +610,17 @@ void Histories::deleteMessages(
|
|||
finish();
|
||||
history->requestChatListMessage();
|
||||
};
|
||||
const auto fail = [=](const MTP::Error &error) {
|
||||
finish();
|
||||
};
|
||||
if (const auto channel = history->peer->asChannel()) {
|
||||
return session().api().request(MTPchannels_DeleteMessages(
|
||||
channel->inputChannel,
|
||||
MTP_vector<MTPint>(ids)
|
||||
)).done(done).fail(fail).send();
|
||||
)).done(done).fail(finish).send();
|
||||
} else {
|
||||
using Flag = MTPmessages_DeleteMessages::Flag;
|
||||
return session().api().request(MTPmessages_DeleteMessages(
|
||||
MTP_flags(revoke ? Flag::f_revoke : Flag(0)),
|
||||
MTP_vector<MTPint>(ids)
|
||||
)).done(done).fail(fail).send();
|
||||
)).done(done).fail(finish).send();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -635,9 +632,6 @@ void Histories::deleteAllMessages(
|
|||
bool revoke) {
|
||||
sendRequest(history, RequestType::Delete, [=](Fn<void()> finish) {
|
||||
const auto peer = history->peer;
|
||||
const auto fail = [=](const MTP::Error &error) {
|
||||
finish();
|
||||
};
|
||||
const auto chat = peer->asChat();
|
||||
const auto channel = peer->asChannel();
|
||||
if (!justClear && revoke && channel && channel->canDelete()) {
|
||||
|
@ -656,7 +650,7 @@ void Histories::deleteAllMessages(
|
|||
MTP_int(deleteTillId)
|
||||
)).done([=](const MTPBool &result) {
|
||||
finish();
|
||||
}).fail(fail).send();
|
||||
}).fail(finish).send();
|
||||
} else if (revoke && chat && chat->amCreator()) {
|
||||
return session().api().request(MTPmessages_DeleteChat(
|
||||
chat->inputChat
|
||||
|
@ -704,7 +698,7 @@ void Histories::deleteAllMessages(
|
|||
revoke);
|
||||
}
|
||||
finish();
|
||||
}).fail(fail).send();
|
||||
}).fail(finish).send();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -734,9 +728,6 @@ void Histories::deleteMessagesByDates(
|
|||
bool revoke) {
|
||||
sendRequest(history, RequestType::Delete, [=](Fn<void()> finish) {
|
||||
const auto peer = history->peer;
|
||||
const auto fail = [=](const MTP::Error &error) {
|
||||
finish();
|
||||
};
|
||||
using Flag = MTPmessages_DeleteHistory::Flag;
|
||||
const auto flags = Flag::f_just_clear
|
||||
| Flag::f_min_date
|
||||
|
@ -756,7 +747,7 @@ void Histories::deleteMessagesByDates(
|
|||
deleteMessagesByDates(history, minDate, maxDate, revoke);
|
||||
}
|
||||
finish();
|
||||
}).fail(fail).send();
|
||||
}).fail(finish).send();
|
||||
});
|
||||
history->destroyMessagesByDates(minDate, maxDate);
|
||||
}
|
||||
|
|
|
@ -461,7 +461,7 @@ void RepliesList::loadAround(MsgId id) {
|
|||
_skippedBefore = 0;
|
||||
}
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_beforeId = 0;
|
||||
_loadingAround = std::nullopt;
|
||||
finish();
|
||||
|
@ -509,7 +509,7 @@ void RepliesList::loadBefore() {
|
|||
_fullCount = _list.size();
|
||||
}
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_beforeId = 0;
|
||||
finish();
|
||||
}).send();
|
||||
|
@ -553,7 +553,7 @@ void RepliesList::loadAfter() {
|
|||
_fullCount = _list.size();
|
||||
}
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_afterId = 0;
|
||||
finish();
|
||||
}).send();
|
||||
|
|
|
@ -389,7 +389,7 @@ void ScheduledMessages::request(not_null<History*> history) {
|
|||
MTP_long(hash))
|
||||
).done([=](const MTPmessages_Messages &result) {
|
||||
parse(history, result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requests.remove(history);
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -391,7 +391,7 @@ void SearchController::requestMore(
|
|||
parsed.noSkipRange,
|
||||
parsed.fullCount);
|
||||
finish();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
finish();
|
||||
}).send();
|
||||
});
|
||||
|
|
|
@ -124,7 +124,7 @@ void SponsoredMessages::request(not_null<History*> history) {
|
|||
channel->inputChannel)
|
||||
).done([=](const MTPmessages_sponsoredMessages &result) {
|
||||
parse(history, result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requests.remove(history);
|
||||
}).send();
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ void SponsoredMessages::view(const FullMsgId &fullId) {
|
|||
auto &request = _viewRequests[randomId];
|
||||
request.lastReceived = crl::now();
|
||||
request.requestId = 0;
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_viewRequests.remove(randomId);
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -539,7 +539,7 @@ void Stickers::requestSetToPushFaved(not_null<DocumentData*> document) {
|
|||
}, [](const MTPDmessages_stickerSetNotModified &) {
|
||||
LOG(("API Error: Unexpected messages.stickerSetNotModified."));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
// Perhaps this is a deleted sticker pack. Add anyway.
|
||||
addAnyway({});
|
||||
}).send();
|
||||
|
|
|
@ -767,7 +767,7 @@ void InnerWidget::preloadMore(Direction direction) {
|
|||
if (!loadedFlag) {
|
||||
addEvents(direction, results.vevents().v);
|
||||
}
|
||||
}).fail([this, &requestId, &loadedFlag](const MTP::Error &error) {
|
||||
}).fail([this, &requestId, &loadedFlag] {
|
||||
requestId = 0;
|
||||
loadedFlag = true;
|
||||
update();
|
||||
|
@ -1431,7 +1431,7 @@ void InnerWidget::suggestRestrictParticipant(
|
|||
|| (type == mtpc_channelParticipantCreator);
|
||||
editRestrictions(hasAdminRights, ChatRestrictionsInfo());
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
editRestrictions(false, ChatRestrictionsInfo());
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -321,7 +321,7 @@ void FastShareMessage(not_null<HistoryItem*> item) {
|
|||
Ui::hideLayer();
|
||||
}
|
||||
finish();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
finish();
|
||||
}).afterRequest(history->sendRequestId).send();
|
||||
return history->sendRequestId;
|
||||
|
|
|
@ -78,7 +78,7 @@ void AutoDeleteSettingsBox(
|
|||
if (const auto strong = state->weak.data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
state->savingRequestId = 0;
|
||||
}).send();
|
||||
};
|
||||
|
|
|
@ -1124,7 +1124,6 @@ void SendReport(
|
|||
MTP_string(comment)
|
||||
)).done([=](const MTPBool &result) {
|
||||
Ui::Toast::Show(tr::lng_report_thanks(tr::now));
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
} else {
|
||||
auto apiIds = QVector<MTPint>();
|
||||
|
@ -1139,7 +1138,6 @@ void SendReport(
|
|||
MTP_string(comment)
|
||||
)).done([=](const MTPBool &result) {
|
||||
Ui::Toast::Show(tr::lng_report_thanks(tr::now));
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ void ListController::loadMoreRows() {
|
|||
delegate()->peerListRefreshRows();
|
||||
}
|
||||
_loadRequestId = 0;
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_loadRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -447,7 +447,7 @@ void Widget::onInlineRequest() {
|
|||
MTP_string(nextOffset)
|
||||
)).done([=](const MTPmessages_BotResults &result) {
|
||||
inlineResultsDone(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
// show error?
|
||||
_requesting.fire(false);
|
||||
_inlineRequestId = 0;
|
||||
|
|
|
@ -166,7 +166,7 @@ void Step::finish(const MTPUser &user, QImage &&photo) {
|
|||
api().request(MTPmessages_GetDialogFilters(
|
||||
)).done([=](const MTPVector<MTPDialogFilter> &result) {
|
||||
createSession(user, photo, result.v);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
createSession(user, photo, QVector<MTPDialogFilter>());
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ void CloudManager::requestLangPackDifference(Pack pack) {
|
|||
)).done([=](const MTPLangPackDifference &result) {
|
||||
packRequestId(pack) = 0;
|
||||
applyLangPackDifference(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
packRequestId(pack) = 0;
|
||||
}).send();
|
||||
} else {
|
||||
|
@ -244,7 +244,7 @@ void CloudManager::requestLangPackDifference(Pack pack) {
|
|||
)).done([=](const MTPLangPackDifference &result) {
|
||||
packRequestId(pack) = 0;
|
||||
applyLangPackDifference(result);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
packRequestId(pack) = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ void CloudManager::requestLanguageList() {
|
|||
_languageListChanged.fire({});
|
||||
}
|
||||
_languagesRequestId = 0;
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_languagesRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ void CloudManager::switchToLanguage(const Language &data) {
|
|||
tr::lng_cancel(tr::now),
|
||||
[=] { performSwitchAndRestart(data); }),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_getKeysForSwitchRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ void AppConfig::refresh() {
|
|||
DEBUG_LOG(("getAppConfig result handled."));
|
||||
}
|
||||
_refreshed.fire({});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_requestId = 0;
|
||||
refreshDelayed();
|
||||
}).send();
|
||||
|
|
|
@ -1038,7 +1038,7 @@ void FormController::cancelPassword() {
|
|||
)).done([=](const MTPBool &result) {
|
||||
_passwordRequestId = 0;
|
||||
reloadPassword();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
_passwordRequestId = 0;
|
||||
reloadPassword();
|
||||
}).send();
|
||||
|
@ -1259,7 +1259,7 @@ rpl::producer<EditDocumentCountry> FormController::preferredLanguage(
|
|||
});
|
||||
consumer.put_next({ countryCode, findLang() });
|
||||
consumer.put_done();
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
consumer.put_next({ countryCode, QString() });
|
||||
consumer.put_done();
|
||||
}).send();
|
||||
|
|
|
@ -329,7 +329,7 @@ void SetupHelp(
|
|||
Ui::showPeerHistory(user, ShowAtUnreadMsgId);
|
||||
}
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
*requestId = 0;
|
||||
}).send();
|
||||
});
|
||||
|
|
|
@ -263,7 +263,7 @@ Helper::Helper(not_null<Main::Session*> session)
|
|||
result.match([&](const MTPDhelp_supportName &data) {
|
||||
setSupportName(qs(data.vname()));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
setSupportName(
|
||||
qsl("[rand^")
|
||||
+ QString::number(Core::Sandbox::Instance().installationTag())
|
||||
|
@ -529,7 +529,7 @@ void Helper::saveInfo(
|
|||
)).done([=](const MTPhelp_UserInfo &result) {
|
||||
applyInfo(user, result);
|
||||
done(true);
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
done(false);
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -743,7 +743,7 @@ void SaveTheme(
|
|||
result.match([&](const MTPDtheme &data) {
|
||||
save(CloudTheme::Parse(&window->account().session(), data));
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).fail([=] {
|
||||
save(CloudTheme());
|
||||
}).send();
|
||||
} else {
|
||||
|
|
|
@ -240,9 +240,7 @@ void SessionNavigation::resolveChannelById(
|
|||
fail();
|
||||
}
|
||||
});
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
fail();
|
||||
}).send();
|
||||
}).fail(fail).send();
|
||||
}
|
||||
|
||||
void SessionNavigation::showPeerByLinkResolved(
|
||||
|
@ -301,9 +299,7 @@ void SessionNavigation::showPeerByLinkResolved(
|
|||
} else {
|
||||
bad();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
bad();
|
||||
}).send();
|
||||
}).fail(bad).send();
|
||||
}).send();
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue