mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 07:07:08 +02:00
Rename RPCError to MTP::Error.
This commit is contained in:
parent
5794679277
commit
68b0a85369
130 changed files with 609 additions and 594 deletions
Telegram/SourceFiles
api
api_attached_stickers.cppapi_authorizations.cppapi_authorizations.hapi_bot.cppapi_chat_invite.cppapi_editing.cppapi_editing.hapi_global_privacy.cppapi_invite_links.cppapi_self_destruct.cppapi_sending.cppapi_sensitive_content.cppapi_single_message_search.cppapi_toggling_media.cppapi_updates.cppapi_updates.h
apiwrap.cppapiwrap.hboxes
add_contact_box.cppadd_contact_box.hbackground_preview_box.cppchange_phone_box.cppconfirm_box.cppconfirm_phone_box.cppconfirm_phone_box.hedit_caption_box.cpppasscode_box.cpppasscode_box.hpeer_list_controllers.cpp
peers
add_participants_box.cppedit_contact_box.cppedit_participant_box.cppedit_participant_box.hedit_participants_box.cppedit_peer_info_box.cppedit_peer_invite_link.cppedit_peer_permissions_box.cppedit_peer_type_box.cpp
rate_call_box.cppsessions_box.cppshare_box.cppshare_box.hsticker_set_box.cppstickers_box.cppstickers_box.hurl_auth_box.cppusername_box.cppusername_box.hcalls
calls_box_controller.cppcalls_call.cppcalls_call.hcalls_choose_join_as.cppcalls_group_call.cppcalls_group_call.hcalls_instance.cpp
chat_helpers
emoji_keywords.cppgifs_list_widget.cppstickers_dice_pack.cppstickers_emoji_pack.cppstickers_list_widget.cpp
core
data
data_chat_filters.cppdata_cloud_themes.cppdata_group_call.cppdata_histories.cppdata_replies_list.cppdata_scheduled_messages.cppdata_search_controller.cpp
stickers
dialogs
export
history
info/polls
inline_bots
intro
|
@ -55,7 +55,7 @@ void AttachedStickers::request(
|
|||
Ui::show(
|
||||
Box<StickerSetBox>(strongController, setId),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
Ui::show(Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
}).send();
|
||||
|
|
|
@ -112,7 +112,7 @@ void Authorizations::reload() {
|
|||
}) | ranges::to<List>;
|
||||
_listChanges.fire({});
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ void Authorizations::cancelCurrentRequest() {
|
|||
|
||||
void Authorizations::requestTerminate(
|
||||
Fn<void(const MTPBool &result)> &&done,
|
||||
Fn<void(const RPCError &error)> &&fail,
|
||||
Fn<void(const MTP::Error &error)> &&fail,
|
||||
std::optional<uint64> hash) {
|
||||
const auto send = [&](auto request) {
|
||||
_api.request(
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
void cancelCurrentRequest();
|
||||
void requestTerminate(
|
||||
Fn<void(const MTPBool &result)> &&done,
|
||||
Fn<void(const RPCError &error)> &&fail,
|
||||
Fn<void(const MTP::Error &error)> &&fail,
|
||||
std::optional<uint64> hash = std::nullopt);
|
||||
|
||||
[[nodiscard]] crl::time lastReceivedTime();
|
||||
|
|
|
@ -34,7 +34,7 @@ void SendBotCallbackData(
|
|||
int row,
|
||||
int column,
|
||||
std::optional<MTPInputCheckPasswordSRP> password = std::nullopt,
|
||||
Fn<void(const RPCError &)> handleError = nullptr) {
|
||||
Fn<void(const MTP::Error &)> handleError = nullptr) {
|
||||
if (!IsServerMsgId(item->id)) {
|
||||
return;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ void SendBotCallbackData(
|
|||
Ui::hideLayer();
|
||||
}
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto item = owner->message(fullId);
|
||||
if (!item) {
|
||||
return;
|
||||
|
@ -170,7 +170,7 @@ void SendBotCallbackDataWithPassword(
|
|||
return;
|
||||
}
|
||||
api->reloadPasswordState();
|
||||
SendBotCallbackData(item, row, column, MTP_inputCheckPasswordEmpty(), [=](const RPCError &error) {
|
||||
SendBotCallbackData(item, row, column, MTP_inputCheckPasswordEmpty(), [=](const MTP::Error &error) {
|
||||
auto box = PrePasswordErrorBox(
|
||||
error,
|
||||
session,
|
||||
|
@ -212,7 +212,7 @@ void SendBotCallbackDataWithPassword(
|
|||
return;
|
||||
}
|
||||
if (const auto item = owner->message(fullId)) {
|
||||
SendBotCallbackData(item, row, column, result.result, [=](const RPCError &error) {
|
||||
SendBotCallbackData(item, row, column, result.result, [=](const MTP::Error &error) {
|
||||
if (*box) {
|
||||
(*box)->handleCustomCheckError(error);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ void CheckChatInvite(
|
|||
}
|
||||
}
|
||||
});
|
||||
}, [=](const RPCError &error) {
|
||||
}, [=](const MTP::Error &error) {
|
||||
if (error.code() != 400) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_item.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "main/main_session.h"
|
||||
#include "mtproto/mtproto_rpc_sender.h"
|
||||
#include "mtproto/mtproto_response.h"
|
||||
|
||||
namespace Api {
|
||||
namespace {
|
||||
|
@ -131,7 +131,7 @@ void EditMessageWithUploadedMedia(
|
|||
item->setIsLocalUpdateMedia(false);
|
||||
}
|
||||
};
|
||||
const auto fail = [=](const RPCError &error) {
|
||||
const auto fail = [=](const MTP::Error &error) {
|
||||
const auto err = error.type();
|
||||
const auto session = &item->history()->session();
|
||||
const auto notModified = (err == u"MESSAGE_NOT_MODIFIED"_q);
|
||||
|
@ -189,7 +189,7 @@ mtpRequestId EditCaption(
|
|||
const TextWithEntities &caption,
|
||||
SendOptions options,
|
||||
Fn<void(const MTPUpdates &)> done,
|
||||
Fn<void(const RPCError &)> fail) {
|
||||
Fn<void(const MTP::Error &)> fail) {
|
||||
return EditMessage(item, caption, options, done, fail);
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ mtpRequestId EditTextMessage(
|
|||
const TextWithEntities &caption,
|
||||
SendOptions options,
|
||||
Fn<void(const MTPUpdates &, mtpRequestId requestId)> done,
|
||||
Fn<void(const RPCError &, mtpRequestId requestId)> fail) {
|
||||
Fn<void(const MTP::Error &, mtpRequestId requestId)> fail) {
|
||||
const auto callback = [=](
|
||||
const auto &result,
|
||||
Fn<void()> applyUpdates,
|
||||
|
|
|
@ -8,7 +8,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#pragma once
|
||||
|
||||
class HistoryItem;
|
||||
class RPCError;
|
||||
|
||||
namespace MTP {
|
||||
class Error;
|
||||
} // namespace MTP
|
||||
|
||||
namespace Api {
|
||||
|
||||
|
@ -40,13 +43,13 @@ mtpRequestId EditCaption(
|
|||
const TextWithEntities &caption,
|
||||
SendOptions options,
|
||||
Fn<void(const MTPUpdates &)> done,
|
||||
Fn<void(const RPCError &)> fail);
|
||||
Fn<void(const MTP::Error &)> fail);
|
||||
|
||||
mtpRequestId EditTextMessage(
|
||||
not_null<HistoryItem*> item,
|
||||
const TextWithEntities &caption,
|
||||
SendOptions options,
|
||||
Fn<void(const MTPUpdates &, mtpRequestId requestId)> done,
|
||||
Fn<void(const RPCError &, mtpRequestId requestId)> fail);
|
||||
Fn<void(const MTP::Error &, mtpRequestId requestId)> fail);
|
||||
|
||||
} // namespace Api
|
||||
|
|
|
@ -33,7 +33,7 @@ void GlobalPrivacy::reload(Fn<void()> callback) {
|
|||
for (const auto &callback : base::take(_callbacks)) {
|
||||
callback();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_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 RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
_archiveAndMute = archiveAndMute;
|
||||
|
|
|
@ -110,7 +110,7 @@ void InviteLinks::performCreate(
|
|||
callback(link);
|
||||
}
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_createCallbacks.erase(peer);
|
||||
}).send();
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ void InviteLinks::performEdit(
|
|||
prepend(peer, admin, data.vnew_invite());
|
||||
}
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_editCallbacks.erase(key);
|
||||
}).send();
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ void InviteLinks::destroy(
|
|||
.admin = admin,
|
||||
.was = key.link,
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_deleteCallbacks.erase(key);
|
||||
}).send();
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ void InviteLinks::destroyAllRevoked(
|
|||
}
|
||||
}
|
||||
_allRevokedDestroyed.fire({ peer, admin });
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
@ -415,7 +415,7 @@ void InviteLinks::requestMyLinks(not_null<PeerData*> peer) {
|
|||
i->second.count = std::max(slice.count, int(existing.size()));
|
||||
}
|
||||
notify(peer);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_firstSliceRequests.remove(peer);
|
||||
}).send();
|
||||
_firstSliceRequests.emplace(peer, requestId);
|
||||
|
@ -493,7 +493,7 @@ void InviteLinks::requestJoinedFirstSlice(LinkKey key) {
|
|||
_firstJoinedRequests.remove(key);
|
||||
_firstJoined[key] = ParseJoinedByLinkSlice(key.peer, result);
|
||||
_joinedFirstSliceLoaded.fire_copy(key);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_firstJoinedRequests.remove(key);
|
||||
}).send();
|
||||
_firstJoinedRequests.emplace(key, requestId);
|
||||
|
@ -653,7 +653,7 @@ void InviteLinks::requestMoreLinks(
|
|||
MTP_int(kPerPage)
|
||||
)).done([=](const MTPmessages_ExportedChatInvites &result) {
|
||||
done(parseSlice(peer, result));
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
done(Links());
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ void SelfDestruct::reload() {
|
|||
result.match([&](const MTPDaccountDaysTTL &data) {
|
||||
_days = data.vdays().v;
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_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 RPCError &result) {
|
||||
}).fail([=](const MTP::Error &result) {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
_days = days;
|
||||
|
|
|
@ -150,7 +150,7 @@ void SendExistingMedia(
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
api->applyUpdates(result, randomId);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.code() == 400
|
||||
&& error.type().startsWith(qstr("FILE_REFERENCE_"))) {
|
||||
api->refreshFileReference(origin, [=](const auto &result) {
|
||||
|
@ -324,7 +324,7 @@ bool SendDice(Api::MessageToSend &message) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
api->applyUpdates(result, randomId);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
api->sendMessageFail(error, peer, randomId, newId);
|
||||
finish();
|
||||
}).afterRequest(history->sendRequestId
|
||||
|
|
|
@ -36,7 +36,7 @@ void SensitiveContent::reload() {
|
|||
_enabled = data.is_sensitive_enabled();
|
||||
_canChange = data.is_sensitive_can_change();
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_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 RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
_enabled = enabled;
|
||||
|
|
|
@ -117,7 +117,7 @@ std::optional<HistoryItem*> SingleMessageSearch::performLookupByChannel(
|
|||
} else {
|
||||
fail();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
fail();
|
||||
}).send();
|
||||
|
||||
|
@ -154,7 +154,7 @@ std::optional<HistoryItem*> SingleMessageSearch::performLookupById(
|
|||
fail();
|
||||
}
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
fail();
|
||||
}).send();
|
||||
|
||||
|
@ -198,7 +198,7 @@ std::optional<HistoryItem*> SingleMessageSearch::performLookupByUsername(
|
|||
fail();
|
||||
}
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
fail();
|
||||
}).send();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ void ToggleExistingMedia(
|
|||
if (mtpIsTrue(result)) {
|
||||
done();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.code() == 400
|
||||
&& error.type().startsWith(u"FILE_REFERENCE_"_q)) {
|
||||
auto refreshed = [=](const Data::UpdatedFileReferences &d) {
|
||||
|
|
|
@ -398,7 +398,7 @@ void Updates::feedChannelDifference(
|
|||
|
||||
void Updates::channelDifferenceFail(
|
||||
not_null<ChannelData*> channel,
|
||||
const RPCError &error) {
|
||||
const MTP::Error &error) {
|
||||
LOG(("RPC Error in getChannelDifference: %1 %2: %3"
|
||||
).arg(error.code()
|
||||
).arg(error.type()
|
||||
|
@ -556,7 +556,7 @@ void Updates::feedDifference(
|
|||
feedUpdateVector(other, true);
|
||||
}
|
||||
|
||||
void Updates::differenceFail(const RPCError &error) {
|
||||
void Updates::differenceFail(const MTP::Error &error) {
|
||||
LOG(("RPC Error in getDifference: %1 %2: %3"
|
||||
).arg(error.code()
|
||||
).arg(error.type()
|
||||
|
@ -643,7 +643,7 @@ void Updates::getDifference() {
|
|||
MTP_int(_updatesQts)
|
||||
)).done([=](const MTPupdates_Difference &result) {
|
||||
differenceDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
differenceFail(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -678,7 +678,7 @@ void Updates::getChannelDifference(
|
|||
MTP_int(kChannelGetDifferenceLimit)
|
||||
)).done([=](const MTPupdates_ChannelDifference &result) {
|
||||
channelDifferenceDone(channel, result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
channelDifferenceFail(channel, error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -742,7 +742,7 @@ void Updates::channelRangeDifferenceSend(
|
|||
)).done([=](const MTPupdates_ChannelDifference &result) {
|
||||
_rangeDifferenceRequests.remove(channel);
|
||||
channelRangeDifferenceDone(channel, range, result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_rangeDifferenceRequests.remove(channel);
|
||||
}).send();
|
||||
_rangeDifferenceRequests.emplace(channel, requestId);
|
||||
|
@ -862,7 +862,7 @@ void Updates::updateOnline(bool gotOtherOffline) {
|
|||
MTP_bool(!isOnline)
|
||||
)).done([=](const MTPBool &result) {
|
||||
Core::App().quitPreventFinished();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
Core::App().quitPreventFinished();
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -10,10 +10,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_pts_waiter.h"
|
||||
#include "base/timer.h"
|
||||
|
||||
class RPCError;
|
||||
class ApiWrap;
|
||||
class History;
|
||||
|
||||
namespace MTP {
|
||||
class Error;
|
||||
} // namespace MTP
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
@ -89,7 +92,7 @@ private:
|
|||
not_null<ChannelData*> channel,
|
||||
ChannelDifferenceRequest from = ChannelDifferenceRequest::Unknown);
|
||||
void differenceDone(const MTPupdates_Difference &result);
|
||||
void differenceFail(const RPCError &error);
|
||||
void differenceFail(const MTP::Error &error);
|
||||
void feedDifference(
|
||||
const MTPVector<MTPUser> &users,
|
||||
const MTPVector<MTPChat> &chats,
|
||||
|
@ -102,7 +105,7 @@ private:
|
|||
const MTPupdates_ChannelDifference &diff);
|
||||
void channelDifferenceFail(
|
||||
not_null<ChannelData*> channel,
|
||||
const RPCError &error);
|
||||
const MTP::Error &error);
|
||||
void failDifferenceStartTimerFor(ChannelData *channel);
|
||||
void feedChannelDifference(const MTPDupdates_channelDifference &data);
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ void ApiWrap::refreshTopPromotion() {
|
|||
)).done([=](const MTPhelp_PromoData &result) {
|
||||
_topPromotionRequestId = 0;
|
||||
topPromotionDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_topPromotionRequestId = 0;
|
||||
const auto now = base::unixtime::now();
|
||||
const auto next = _topPromotionNextRequestTime = now
|
||||
|
@ -329,7 +329,7 @@ void ApiWrap::requestDeepLinkInfo(
|
|||
if (result.type() == mtpc_help_deepLinkInfo) {
|
||||
callback(result.c_help_deepLinkInfo());
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_deepLinkInfoRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ void ApiWrap::requestTermsUpdate() {
|
|||
} break;
|
||||
default: Unexpected("Type in requestTermsUpdate().");
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_termsUpdateRequestId = 0;
|
||||
_termsUpdateSendAt = crl::now() + kTermsUpdateTimeoutMin;
|
||||
requestTermsUpdate();
|
||||
|
@ -394,7 +394,7 @@ void ApiWrap::acceptTerms(bytes::const_span id) {
|
|||
void ApiWrap::checkChatInvite(
|
||||
const QString &hash,
|
||||
FnMut<void(const MTPChatInvite &)> done,
|
||||
Fn<void(const RPCError &)> fail) {
|
||||
Fn<void(const MTP::Error &)> fail) {
|
||||
request(base::take(_checkInviteRequestId)).cancel();
|
||||
_checkInviteRequestId = request(MTPmessages_CheckChatInvite(
|
||||
MTP_string(hash)
|
||||
|
@ -436,7 +436,7 @@ void ApiWrap::importChatInvite(const QString &hash) {
|
|||
LOG(("API Error: unexpected update cons %1 "
|
||||
"(ApiWrap::importChatInvite)").arg(result.type()));
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (type == qstr("CHANNELS_TOO_MUCH")) {
|
||||
Ui::show(Box<InformBox>(tr::lng_join_channel_error(tr::now)));
|
||||
|
@ -501,14 +501,14 @@ void ApiWrap::toggleHistoryArchived(
|
|||
if (isPinned) {
|
||||
_session->data().notifyPinnedDialogsOrderUpdated();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_historyArchivedRequests.remove(history);
|
||||
}).send();
|
||||
_historyArchivedRequests.emplace(history, requestId, callback);
|
||||
}
|
||||
|
||||
void ApiWrap::sendMessageFail(
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
not_null<PeerData*> peer,
|
||||
uint64 randomId,
|
||||
FullMsgId itemId) {
|
||||
|
@ -591,7 +591,7 @@ void ApiWrap::resolveMessageDatas() {
|
|||
MTP_vector<MTPInputMessage>(ids)
|
||||
)).done([this](const MTPmessages_Messages &result, mtpRequestId requestId) {
|
||||
gotMessageDatas(nullptr, result, requestId);
|
||||
}).fail([this](const RPCError &error, mtpRequestId requestId) {
|
||||
}).fail([this](const MTP::Error &error, mtpRequestId requestId) {
|
||||
finalizeMessageDataRequest(nullptr, requestId);
|
||||
}).afterDelay(kSmallDelayMs).send();
|
||||
for (auto &request : _messageDataRequests) {
|
||||
|
@ -612,7 +612,7 @@ void ApiWrap::resolveMessageDatas() {
|
|||
MTP_vector<MTPInputMessage>(ids)
|
||||
)).done([=](const MTPmessages_Messages &result, mtpRequestId requestId) {
|
||||
gotMessageDatas(channel, result, requestId);
|
||||
}).fail([=](const RPCError &error, mtpRequestId requestId) {
|
||||
}).fail([=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
finalizeMessageDataRequest(channel, requestId);
|
||||
}).afterDelay(kSmallDelayMs).send();
|
||||
|
||||
|
@ -782,7 +782,7 @@ void ApiWrap::requestContacts() {
|
|||
}
|
||||
}
|
||||
_session->data().contactsLoaded() = true;
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_contactsRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -856,7 +856,7 @@ void ApiWrap::requestMoreDialogs(Data::Folder *folder) {
|
|||
}
|
||||
requestMoreDialogsIfNeeded();
|
||||
_session->data().chatsListChanged(folder);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
dialogsLoadState(folder)->requestId = 0;
|
||||
}).send();
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ void ApiWrap::requestPinnedDialogs(Data::Folder *folder) {
|
|||
_session->data().chatsListChanged(folder);
|
||||
_session->data().notifyPinnedDialogsOrderUpdated();
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
finalize();
|
||||
}).send();
|
||||
}
|
||||
|
@ -1029,7 +1029,7 @@ rpl::producer<bool> ApiWrap::dialogsLoadBlockedByDate() const {
|
|||
void ApiWrap::requestWallPaper(
|
||||
const QString &slug,
|
||||
Fn<void(const Data::WallPaper &)> done,
|
||||
Fn<void(const RPCError &)> fail) {
|
||||
Fn<void(const MTP::Error &)> fail) {
|
||||
if (_wallPaperSlug != slug) {
|
||||
_wallPaperSlug = slug;
|
||||
if (_wallPaperRequestId) {
|
||||
|
@ -1051,9 +1051,9 @@ void ApiWrap::requestWallPaper(
|
|||
done(*paper);
|
||||
}
|
||||
} else if (const auto fail = base::take(_wallPaperFail)) {
|
||||
fail(RPCError::Local("BAD_DOCUMENT", "In a wallpaper."));
|
||||
fail(MTP::Error::Local("BAD_DOCUMENT", "In a wallpaper."));
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_wallPaperRequestId = 0;
|
||||
_wallPaperSlug = QString();
|
||||
if (const auto fail = base::take(_wallPaperFail)) {
|
||||
|
@ -1068,7 +1068,7 @@ void ApiWrap::requestFullPeer(not_null<PeerData*> peer) {
|
|||
}
|
||||
|
||||
const auto requestId = [&] {
|
||||
const auto failHandler = [=](const RPCError &error) {
|
||||
const auto failHandler = [=](const MTP::Error &error) {
|
||||
_fullPeerRequests.remove(peer);
|
||||
migrateFail(peer, error);
|
||||
};
|
||||
|
@ -1180,7 +1180,7 @@ void ApiWrap::requestPeer(not_null<PeerData*> peer) {
|
|||
}
|
||||
|
||||
const auto requestId = [&] {
|
||||
const auto failHandler = [=](const RPCError &error) {
|
||||
const auto failHandler = [=](const MTP::Error &error) {
|
||||
_peerRequests.remove(peer);
|
||||
};
|
||||
const auto chatHandler = [=](const MTPmessages_Chats &result) {
|
||||
|
@ -1223,7 +1223,7 @@ void ApiWrap::requestPeerSettings(not_null<PeerData*> peer) {
|
|||
return data.vflags().v;
|
||||
}));
|
||||
_requestedPeerSettings.erase(peer);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestedPeerSettings.erase(peer);
|
||||
}).send();
|
||||
}
|
||||
|
@ -1231,7 +1231,7 @@ void ApiWrap::requestPeerSettings(not_null<PeerData*> peer) {
|
|||
void ApiWrap::migrateChat(
|
||||
not_null<ChatData*> chat,
|
||||
FnMut<void(not_null<ChannelData*>)> done,
|
||||
Fn<void(const RPCError &)> fail) {
|
||||
Fn<void(const MTP::Error &)> fail) {
|
||||
const auto callback = [&] {
|
||||
return MigrateCallbacks{ std::move(done), std::move(fail) };
|
||||
};
|
||||
|
@ -1252,7 +1252,7 @@ void ApiWrap::migrateChat(
|
|||
crl::on_main([=] {
|
||||
migrateFail(
|
||||
chat,
|
||||
RPCError::Local(
|
||||
MTP::Error::Local(
|
||||
"BAD_MIGRATION",
|
||||
"Chat is already deactivated"));
|
||||
});
|
||||
|
@ -1261,7 +1261,7 @@ void ApiWrap::migrateChat(
|
|||
crl::on_main([=] {
|
||||
migrateFail(
|
||||
chat,
|
||||
RPCError::Local(
|
||||
MTP::Error::Local(
|
||||
"BAD_MIGRATION",
|
||||
"Current user is not the creator of that chat"));
|
||||
});
|
||||
|
@ -1282,9 +1282,9 @@ void ApiWrap::migrateChat(
|
|||
} else {
|
||||
migrateFail(
|
||||
chat,
|
||||
RPCError::Local("MIGRATION_FAIL", "No channel"));
|
||||
MTP::Error::Local("MIGRATION_FAIL", "No channel"));
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
migrateFail(chat, error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -1302,7 +1302,7 @@ void ApiWrap::migrateDone(
|
|||
}
|
||||
}
|
||||
|
||||
void ApiWrap::migrateFail(not_null<PeerData*> peer, const RPCError &error) {
|
||||
void ApiWrap::migrateFail(not_null<PeerData*> peer, const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (type == qstr("CHANNELS_TOO_MUCH")) {
|
||||
Ui::show(Box<InformBox>(tr::lng_migrate_error(tr::now)));
|
||||
|
@ -1446,7 +1446,7 @@ void ApiWrap::requestLastParticipants(not_null<ChannelData*> channel) {
|
|||
availableCount,
|
||||
list);
|
||||
});
|
||||
}).fail([this, channel](const RPCError &error) {
|
||||
}).fail([this, channel](const MTP::Error &error) {
|
||||
_participantsRequests.remove(channel);
|
||||
}).send();
|
||||
|
||||
|
@ -1476,7 +1476,7 @@ void ApiWrap::requestBots(not_null<ChannelData*> channel) {
|
|||
availableCount,
|
||||
list);
|
||||
});
|
||||
}).fail([this, channel](const RPCError &error) {
|
||||
}).fail([this, channel](const MTP::Error &error) {
|
||||
_botsRequests.remove(channel);
|
||||
}).send();
|
||||
|
||||
|
@ -1503,7 +1503,7 @@ void ApiWrap::requestAdmins(not_null<ChannelData*> channel) {
|
|||
}, [&](const MTPDchannels_channelParticipantsNotModified &) {
|
||||
LOG(("API Error: channels.channelParticipantsNotModified received!"));
|
||||
});
|
||||
}).fail([this, channel](const RPCError &error) {
|
||||
}).fail([this, channel](const MTP::Error &error) {
|
||||
_adminsRequests.remove(channel);
|
||||
}).send();
|
||||
|
||||
|
@ -1687,7 +1687,7 @@ void ApiWrap::requestSelfParticipant(not_null<ChannelData*> channel) {
|
|||
finalize(-1, 0);
|
||||
});
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_selfParticipantRequests.erase(channel);
|
||||
if (error.type() == qstr("CHANNEL_PRIVATE")) {
|
||||
channel->privateErrorReceived();
|
||||
|
@ -1725,7 +1725,7 @@ void ApiWrap::kickParticipant(
|
|||
|
||||
_kickRequests.remove(KickRequest(channel, user));
|
||||
channel->applyEditBanned(user, currentRights, rights);
|
||||
}).fail([this, kick](const RPCError &error) {
|
||||
}).fail([this, kick](const MTP::Error &error) {
|
||||
_kickRequests.remove(kick);
|
||||
}).send();
|
||||
|
||||
|
@ -1753,7 +1753,7 @@ void ApiWrap::unblockParticipant(
|
|||
} else {
|
||||
channel->updateFullForced();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_kickRequests.remove(kick);
|
||||
}).send();
|
||||
|
||||
|
@ -1818,7 +1818,7 @@ void ApiWrap::requestChannelMembersForAdd(
|
|||
base::take(_channelMembersForAddRequestId);
|
||||
base::take(_channelMembersForAdd);
|
||||
base::take(_channelMembersForAddCallback)(result);
|
||||
}).fail([this](const RPCError &error) {
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
base::take(_channelMembersForAddRequestId);
|
||||
base::take(_channelMembersForAdd);
|
||||
base::take(_channelMembersForAddCallback);
|
||||
|
@ -1839,7 +1839,7 @@ void ApiWrap::requestStickerSets() {
|
|||
auto waitMs = (j == e) ? 0 : kSmallDelayMs;
|
||||
i.value().second = request(MTPmessages_GetStickerSet(MTP_inputStickerSetID(MTP_long(i.key()), MTP_long(i.value().first)))).done([this, setId = i.key()](const MTPmessages_StickerSet &result) {
|
||||
gotStickerSet(setId, result);
|
||||
}).fail([this, setId = i.key()](const RPCError &error) {
|
||||
}).fail([this, setId = i.key()](const MTP::Error &error) {
|
||||
_stickerSetRequests.remove(setId);
|
||||
}).afterDelay(waitMs).send();
|
||||
}
|
||||
|
@ -1876,7 +1876,7 @@ void ApiWrap::saveStickerSets(
|
|||
MTP_flags(0)
|
||||
)).done([this](const MTPBool &result) {
|
||||
_stickersClearRecentRequestId = 0;
|
||||
}).fail([this](const RPCError &error) {
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
_stickersClearRecentRequestId = 0;
|
||||
}).send();
|
||||
continue;
|
||||
|
@ -1898,7 +1898,7 @@ void ApiWrap::saveStickerSets(
|
|||
|
||||
auto requestId = request(MTPmessages_UninstallStickerSet(setId)).done([this](const MTPBool &result, mtpRequestId requestId) {
|
||||
stickerSetDisenabled(requestId);
|
||||
}).fail([this](const RPCError &error, mtpRequestId requestId) {
|
||||
}).fail([this](const MTP::Error &error, mtpRequestId requestId) {
|
||||
stickerSetDisenabled(requestId);
|
||||
}).afterDelay(kSmallDelayMs).send();
|
||||
|
||||
|
@ -1944,7 +1944,7 @@ void ApiWrap::saveStickerSets(
|
|||
mtpRequestId requestId) {
|
||||
stickerSetDisenabled(requestId);
|
||||
}).fail([=](
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
mtpRequestId requestId) {
|
||||
stickerSetDisenabled(requestId);
|
||||
}).afterDelay(kSmallDelayMs).send();
|
||||
|
@ -2006,7 +2006,7 @@ void ApiWrap::joinChannel(not_null<ChannelData*> channel) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_channelAmInRequests.remove(channel);
|
||||
applyUpdates(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("CHANNEL_PRIVATE")
|
||||
&& channel->invitePeekExpires()) {
|
||||
channel->privateErrorReceived();
|
||||
|
@ -2039,7 +2039,7 @@ void ApiWrap::leaveChannel(not_null<ChannelData*> channel) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_channelAmInRequests.remove(channel);
|
||||
applyUpdates(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_channelAmInRequests.remove(channel);
|
||||
}).send();
|
||||
|
||||
|
@ -2065,7 +2065,7 @@ void ApiWrap::blockPeer(not_null<PeerData*> peer) {
|
|||
++_blockedPeersSlice->total;
|
||||
_blockedPeersChanges.fire_copy(*_blockedPeersSlice);
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_blockRequests.erase(peer);
|
||||
}).send();
|
||||
|
||||
|
@ -2103,7 +2103,7 @@ void ApiWrap::unblockPeer(not_null<PeerData*> peer, Fn<void()> onDone) {
|
|||
if (onDone) {
|
||||
onDone();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_blockRequests.erase(peer);
|
||||
}).send();
|
||||
_blockRequests.emplace(peer, requestId);
|
||||
|
@ -2143,7 +2143,7 @@ void ApiWrap::requestNotifySettings(const MTPInputNotifyPeer &peer) {
|
|||
)).done([=](const MTPPeerNotifySettings &result) {
|
||||
applyNotifySettings(peer, result);
|
||||
_notifySettingRequests.erase(key);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
applyNotifySettings(
|
||||
peer,
|
||||
MTP_peerNotifySettings(
|
||||
|
@ -2203,7 +2203,7 @@ void ApiWrap::savePrivacy(
|
|||
handlePrivacyChange(*key, data.vrules());
|
||||
}
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_privacySaveRequests.remove(keyTypeId);
|
||||
}).send();
|
||||
|
||||
|
@ -2263,7 +2263,7 @@ void ApiWrap::updatePrivacyLastSeens(const QVector<MTPPrivacyRule> &rules) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}).fail([this](const RPCError &error) {
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
_contactsStatusesRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -2297,7 +2297,7 @@ void ApiWrap::deleteConversation(not_null<PeerData*> peer, bool revoke) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
applyUpdates(result);
|
||||
deleteHistory(peer, false, revoke);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
deleteHistory(peer, false, revoke);
|
||||
}).send();
|
||||
} else {
|
||||
|
@ -2472,7 +2472,7 @@ void ApiWrap::saveDraftsToCloud() {
|
|||
_draftsSaveRequestIds.erase(history);
|
||||
checkQuitPreventFinished();
|
||||
}
|
||||
}).fail([=](const RPCError &error, const MTP::Response &response) {
|
||||
}).fail([=](const MTP::Error &error, const MTP::Response &response) {
|
||||
history->finishSavingCloudDraft(
|
||||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
|
||||
|
@ -2724,7 +2724,7 @@ void ApiWrap::requestFileReference(
|
|||
for (auto &handler : handlers) {
|
||||
handler(parsed);
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto i = _fileReferenceHandlers.find(origin);
|
||||
Assert(i != end(_fileReferenceHandlers));
|
||||
auto handlers = std::move(i->second);
|
||||
|
@ -2881,7 +2881,7 @@ void ApiWrap::stickersSaveOrder() {
|
|||
MTP_vector<MTPlong>(mtpOrder)
|
||||
)).done([=](const MTPBool &result) {
|
||||
_stickersReorderRequestId = 0;
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_stickersReorderRequestId = 0;
|
||||
_session->data().stickers().setLastUpdate(0);
|
||||
updateStickers();
|
||||
|
@ -2979,7 +2979,7 @@ void ApiWrap::requestStickers(TimeId now) {
|
|||
};
|
||||
_stickersUpdateRequest = request(MTPmessages_GetAllStickers(
|
||||
MTP_int(Api::CountStickersHash(_session, true))
|
||||
)).done(onDone).fail([=](const RPCError &error) {
|
||||
)).done(onDone).fail([=](const MTP::Error &error) {
|
||||
LOG(("App Fail: Failed to get stickers!"));
|
||||
onDone(MTP_messages_allStickersNotModified());
|
||||
}).send();
|
||||
|
@ -3018,7 +3018,7 @@ void ApiWrap::requestRecentStickersWithHash(int32 hash) {
|
|||
} return;
|
||||
default: Unexpected("Type in ApiWrap::recentStickersDone()");
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_session->data().stickers().setLastRecentUpdate(crl::now());
|
||||
_recentStickersUpdateRequest = 0;
|
||||
|
||||
|
@ -3050,7 +3050,7 @@ void ApiWrap::requestFavedStickers(TimeId now) {
|
|||
} return;
|
||||
default: Unexpected("Type in ApiWrap::favedStickersDone()");
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_session->data().stickers().setLastFavedUpdate(crl::now());
|
||||
_favedStickersUpdateRequest = 0;
|
||||
|
||||
|
@ -3080,7 +3080,7 @@ void ApiWrap::requestFeaturedStickers(TimeId now) {
|
|||
} return;
|
||||
default: Unexpected("Type in ApiWrap::featuredStickersDone()");
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_session->data().stickers().setLastFeaturedUpdate(crl::now());
|
||||
_featuredStickersUpdateRequest = 0;
|
||||
|
||||
|
@ -3109,7 +3109,7 @@ void ApiWrap::requestSavedGifs(TimeId now) {
|
|||
} return;
|
||||
default: Unexpected("Type in ApiWrap::savedGifsDone()");
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_session->data().stickers().setLastSavedGifsUpdate(crl::now());
|
||||
_savedGifsUpdateRequest = 0;
|
||||
|
||||
|
@ -3340,7 +3340,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 RPCError &error) {
|
||||
}).fail([this, history](const MTP::Error &error) {
|
||||
_unreadMentionsRequests.remove(history);
|
||||
}).send();
|
||||
_unreadMentionsRequests.emplace(history, requestId);
|
||||
|
@ -3375,7 +3375,7 @@ void ApiWrap::addChatParticipants(
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
applyUpdates(result);
|
||||
if (done) done(true);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
ShowAddParticipantsError(error.type(), peer, { 1, user });
|
||||
if (done) done(false);
|
||||
}).afterDelay(crl::time(5)).send();
|
||||
|
@ -3397,7 +3397,7 @@ void ApiWrap::addChatParticipants(
|
|||
applyUpdates(result);
|
||||
requestParticipantsCountDelayed(channel);
|
||||
if (callback) callback(true);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
ShowAddParticipantsError(error.type(), peer, users);
|
||||
if (callback) callback(false);
|
||||
}).afterDelay(crl::time(5)).send();
|
||||
|
@ -3454,7 +3454,7 @@ void ApiWrap::requestSharedMedia(
|
|||
_sharedMediaRequests.remove(key);
|
||||
sharedMediaDone(peer, type, messageId, slice, result);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_sharedMediaRequests.remove(key);
|
||||
finish();
|
||||
}).send();
|
||||
|
@ -3503,7 +3503,7 @@ void ApiWrap::requestUserPhotos(
|
|||
)).done([this, user, afterId](const MTPphotos_Photos &result) {
|
||||
_userPhotosRequests.remove(user);
|
||||
userPhotosDone(user, afterId, result);
|
||||
}).fail([this, user](const RPCError &error) {
|
||||
}).fail([this, user](const MTP::Error &error) {
|
||||
_userPhotosRequests.remove(user);
|
||||
}).send();
|
||||
_userPhotosRequests.emplace(user, requestId);
|
||||
|
@ -3644,7 +3644,7 @@ void ApiWrap::forwardMessages(
|
|||
shared->callback();
|
||||
}
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (idsCopy) {
|
||||
for (const auto &[randomId, itemId] : *idsCopy) {
|
||||
sendMessageFail(error, peer, randomId, itemId);
|
||||
|
@ -4098,7 +4098,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
|||
}
|
||||
finish();
|
||||
}).fail([=](
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
const MTP::Response &response) {
|
||||
if (error.type() == qstr("MESSAGE_EMPTY")) {
|
||||
lastMessage->destroy();
|
||||
|
@ -4144,7 +4144,7 @@ void ApiWrap::sendBotStart(not_null<UserData*> bot, PeerData *chat) {
|
|||
MTP_string(base::take(token))
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
applyUpdates(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (chat) {
|
||||
ShowAddParticipantsError(error.type(), chat, { 1, bot });
|
||||
}
|
||||
|
@ -4227,7 +4227,7 @@ void ApiWrap::sendInlineResult(
|
|||
UnixtimeFromMsgId(response.outerMsgId));
|
||||
finish();
|
||||
}).fail([=](
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
const MTP::Response &response) {
|
||||
sendMessageFail(error, peer, randomId, newId);
|
||||
history->finishSavingCloudDraft(
|
||||
|
@ -4311,7 +4311,7 @@ void ApiWrap::uploadAlbumMedia(
|
|||
sendAlbumWithUploaded(item, groupId, media);
|
||||
} break;
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
failed();
|
||||
}).send();
|
||||
}
|
||||
|
@ -4373,7 +4373,7 @@ void ApiWrap::sendMediaWithRandomId(
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
applyUpdates(result);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
sendMessageFail(error, peer, randomId, itemId);
|
||||
finish();
|
||||
}).afterRequest(
|
||||
|
@ -4472,7 +4472,7 @@ void ApiWrap::sendAlbumIfReady(not_null<SendingAlbum*> album) {
|
|||
_sendingAlbums.remove(groupId);
|
||||
applyUpdates(result);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (const auto album = _sendingAlbums.take(groupId)) {
|
||||
for (const auto &item : (*album)->items) {
|
||||
sendMessageFail(error, peer, item.randomId, item.msgId);
|
||||
|
@ -4609,7 +4609,7 @@ void ApiWrap::reloadPasswordState() {
|
|||
}
|
||||
_passwordStateChanges.fire_copy(*_passwordState);
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_passwordRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -4619,7 +4619,7 @@ void ApiWrap::clearUnconfirmedPassword() {
|
|||
)).done([=](const MTPBool &result) {
|
||||
_passwordRequestId = 0;
|
||||
reloadPasswordState();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_passwordRequestId = 0;
|
||||
reloadPasswordState();
|
||||
}).send();
|
||||
|
@ -4648,7 +4648,7 @@ void ApiWrap::reloadContactSignupSilent() {
|
|||
const auto silent = mtpIsTrue(result);
|
||||
_contactSignupSilent = silent;
|
||||
_contactSignupSilentChanges.fire_copy(silent);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_contactSignupSilentRequestId = 0;
|
||||
}).send();
|
||||
_contactSignupSilentRequestId = requestId;
|
||||
|
@ -4674,7 +4674,7 @@ void ApiWrap::saveContactSignupSilent(bool silent) {
|
|||
_contactSignupSilentRequestId = 0;
|
||||
_contactSignupSilent = silent;
|
||||
_contactSignupSilentChanges.fire_copy(silent);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_contactSignupSilentRequestId = 0;
|
||||
}).send();
|
||||
_contactSignupSilentRequestId = requestId;
|
||||
|
@ -4706,7 +4706,7 @@ void ApiWrap::saveSelfBio(const QString &text, FnMut<void()> done) {
|
|||
if (_saveBioDone) {
|
||||
_saveBioDone();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_saveBioRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -4724,7 +4724,7 @@ void ApiWrap::reloadPrivacy(Privacy::Key key) {
|
|||
_session->data().processChats(data.vchats());
|
||||
pushPrivacy(key, data.vrules().v);
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_privacyRequestIds.erase(key);
|
||||
}).send();
|
||||
_privacyRequestIds.emplace(key, requestId);
|
||||
|
@ -4867,7 +4867,7 @@ void ApiWrap::reloadBlockedPeers() {
|
|||
_session->data().processUsers(data.vusers());
|
||||
push(0, data.vblocked().v);
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_blockedPeersRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -4909,7 +4909,7 @@ void ApiWrap::createPoll(
|
|||
const PollData &data,
|
||||
const SendAction &action,
|
||||
Fn<void()> done,
|
||||
Fn<void(const RPCError &error)> fail) {
|
||||
Fn<void(const MTP::Error &error)> fail) {
|
||||
sendAction(action);
|
||||
|
||||
const auto history = action.history;
|
||||
|
@ -4962,7 +4962,7 @@ void ApiWrap::createPoll(
|
|||
done();
|
||||
finish();
|
||||
}).fail([=](
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
const MTP::Response &response) mutable {
|
||||
if (clearCloudDraft) {
|
||||
history->finishSavingCloudDraft(
|
||||
|
@ -5017,7 +5017,7 @@ void ApiWrap::sendPollVotes(
|
|||
_pollVotesRequestIds.erase(itemId);
|
||||
hideSending();
|
||||
applyUpdates(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_pollVotesRequestIds.erase(itemId);
|
||||
hideSending();
|
||||
}).send();
|
||||
|
@ -5046,7 +5046,7 @@ void ApiWrap::closePoll(not_null<HistoryItem*> item) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_pollCloseRequestIds.erase(itemId);
|
||||
applyUpdates(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_pollCloseRequestIds.erase(itemId);
|
||||
}).send();
|
||||
_pollCloseRequestIds.emplace(itemId, requestId);
|
||||
|
@ -5064,7 +5064,7 @@ void ApiWrap::reloadPollResults(not_null<HistoryItem*> item) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_pollReloadRequestIds.erase(itemId);
|
||||
applyUpdates(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_pollReloadRequestIds.erase(itemId);
|
||||
}).send();
|
||||
_pollReloadRequestIds.emplace(itemId, requestId);
|
||||
|
|
|
@ -192,7 +192,7 @@ public:
|
|||
void requestWallPaper(
|
||||
const QString &slug,
|
||||
Fn<void(const Data::WallPaper &)> done,
|
||||
Fn<void(const RPCError &)> fail);
|
||||
Fn<void(const MTP::Error &)> fail);
|
||||
|
||||
void requestFullPeer(not_null<PeerData*> peer);
|
||||
void requestPeer(not_null<PeerData*> peer);
|
||||
|
@ -227,7 +227,7 @@ public:
|
|||
void checkChatInvite(
|
||||
const QString &hash,
|
||||
FnMut<void(const MTPChatInvite &)> done,
|
||||
Fn<void(const RPCError &)> fail);
|
||||
Fn<void(const MTP::Error &)> fail);
|
||||
void importChatInvite(const QString &hash);
|
||||
|
||||
void requestChannelMembersForAdd(
|
||||
|
@ -243,7 +243,7 @@ public:
|
|||
void migrateChat(
|
||||
not_null<ChatData*> chat,
|
||||
FnMut<void(not_null<ChannelData*>)> done,
|
||||
Fn<void(const RPCError &)> fail = nullptr);
|
||||
Fn<void(const MTP::Error &)> fail = nullptr);
|
||||
|
||||
void markMediaRead(const base::flat_set<not_null<HistoryItem*>> &items);
|
||||
void markMediaRead(not_null<HistoryItem*> item);
|
||||
|
@ -416,7 +416,7 @@ public:
|
|||
not_null<InlineBots::Result*> data,
|
||||
const SendAction &action);
|
||||
void sendMessageFail(
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
not_null<PeerData*> peer,
|
||||
uint64 randomId = 0,
|
||||
FullMsgId itemId = FullMsgId());
|
||||
|
@ -453,7 +453,7 @@ public:
|
|||
const PollData &data,
|
||||
const SendAction &action,
|
||||
Fn<void()> done,
|
||||
Fn<void(const RPCError &error)> fail);
|
||||
Fn<void(const MTP::Error &error)> fail);
|
||||
void sendPollVotes(
|
||||
FullMsgId itemId,
|
||||
const std::vector<QByteArray> &options);
|
||||
|
@ -628,7 +628,7 @@ private:
|
|||
void migrateDone(
|
||||
not_null<PeerData*> peer,
|
||||
not_null<ChannelData*> channel);
|
||||
void migrateFail(not_null<PeerData*> peer, const RPCError &error);
|
||||
void migrateFail(not_null<PeerData*> peer, const MTP::Error &error);
|
||||
|
||||
not_null<Main::Session*> _session;
|
||||
|
||||
|
@ -742,11 +742,11 @@ private:
|
|||
|
||||
mtpRequestId _checkInviteRequestId = 0;
|
||||
FnMut<void(const MTPChatInvite &result)> _checkInviteDone;
|
||||
Fn<void(const RPCError &error)> _checkInviteFail;
|
||||
Fn<void(const MTP::Error &error)> _checkInviteFail;
|
||||
|
||||
struct MigrateCallbacks {
|
||||
FnMut<void(not_null<ChannelData*>)> done;
|
||||
Fn<void(const RPCError&)> fail;
|
||||
Fn<void(const MTP::Error&)> fail;
|
||||
};
|
||||
base::flat_map<
|
||||
not_null<PeerData*>,
|
||||
|
@ -786,7 +786,7 @@ private:
|
|||
mtpRequestId _wallPaperRequestId = 0;
|
||||
QString _wallPaperSlug;
|
||||
Fn<void(const Data::WallPaper &)> _wallPaperDone;
|
||||
Fn<void(const RPCError &)> _wallPaperFail;
|
||||
Fn<void(const MTP::Error &)> _wallPaperFail;
|
||||
|
||||
mtpRequestId _contactSignupSilentRequestId = 0;
|
||||
std::optional<bool> _contactSignupSilent;
|
||||
|
|
|
@ -586,7 +586,7 @@ void GroupInfoBox::createGroup(
|
|||
|
||||
Ui::hideLayer(); // Destroys 'this'.
|
||||
ChatCreateDone(navigation, std::move(image), result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_creationRequestId = 0;
|
||||
if (error.type() == qstr("NO_CHAT_TITLE")) {
|
||||
auto weak = Ui::MakeWeak(this);
|
||||
|
@ -703,7 +703,7 @@ void GroupInfoBox::createChannel(const QString &title, const QString &descriptio
|
|||
LOG(("API Error: channel not found in updates (GroupInfoBox::creationDone)"));
|
||||
closeBox();
|
||||
}
|
||||
}).fail([this](const RPCError &error) {
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
_creationRequestId = 0;
|
||||
if (error.type() == "NO_CHAT_TITLE") {
|
||||
_title->setFocus();
|
||||
|
@ -824,7 +824,7 @@ void SetupChannelBox::prepare() {
|
|||
_checkRequestId = _api.request(MTPchannels_CheckUsername(
|
||||
_channel->inputChannel,
|
||||
MTP_string("preston")
|
||||
)).fail([=](const RPCError &error) {
|
||||
)).fail([=](const MTP::Error &error) {
|
||||
firstCheckFail(error);
|
||||
}).send();
|
||||
|
||||
|
@ -983,7 +983,7 @@ void SetupChannelBox::save() {
|
|||
MTP_string(_sentUsername)
|
||||
)).done([=](const MTPBool &result) {
|
||||
updateDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
updateFail(error);
|
||||
}).send();
|
||||
};
|
||||
|
@ -1055,7 +1055,7 @@ void SetupChannelBox::check() {
|
|||
MTP_string(link)
|
||||
)).done([=](const MTPBool &result) {
|
||||
checkDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
checkFail(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -1095,7 +1095,7 @@ void SetupChannelBox::updateDone(const MTPBool &result) {
|
|||
closeBox();
|
||||
}
|
||||
|
||||
void SetupChannelBox::updateFail(const RPCError &error) {
|
||||
void SetupChannelBox::updateFail(const MTP::Error &error) {
|
||||
_saveRequestId = 0;
|
||||
QString err(error.type());
|
||||
if (err == "USERNAME_NOT_MODIFIED"
|
||||
|
@ -1130,7 +1130,7 @@ void SetupChannelBox::checkDone(const MTPBool &result) {
|
|||
}
|
||||
}
|
||||
|
||||
void SetupChannelBox::checkFail(const RPCError &error) {
|
||||
void SetupChannelBox::checkFail(const MTP::Error &error) {
|
||||
_checkRequestId = 0;
|
||||
QString err(error.type());
|
||||
if (err == qstr("CHANNEL_PUBLIC_GROUP_NA")) {
|
||||
|
@ -1171,7 +1171,7 @@ void SetupChannelBox::showRevokePublicLinkBoxForEdit() {
|
|||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void SetupChannelBox::firstCheckFail(const RPCError &error) {
|
||||
void SetupChannelBox::firstCheckFail(const MTP::Error &error) {
|
||||
_checkRequestId = 0;
|
||||
const auto &type = error.type();
|
||||
if (type == qstr("CHANNEL_PUBLIC_GROUP_NA")) {
|
||||
|
@ -1281,7 +1281,7 @@ void EditNameBox::save() {
|
|||
MTPstring()
|
||||
)).done([=](const MTPUser &result) {
|
||||
saveSelfDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
saveSelfFail(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -1291,7 +1291,7 @@ void EditNameBox::saveSelfDone(const MTPUser &user) {
|
|||
closeBox();
|
||||
}
|
||||
|
||||
void EditNameBox::saveSelfFail(const RPCError &error) {
|
||||
void EditNameBox::saveSelfFail(const MTP::Error &error) {
|
||||
auto err = error.type();
|
||||
auto first = TextUtilities::SingleLine(_first->getLastText().trimmed());
|
||||
auto last = TextUtilities::SingleLine(_last->getLastText().trimmed());
|
||||
|
|
|
@ -179,11 +179,11 @@ private:
|
|||
void save();
|
||||
|
||||
void updateDone(const MTPBool &result);
|
||||
void updateFail(const RPCError &error);
|
||||
void updateFail(const MTP::Error &error);
|
||||
|
||||
void checkDone(const MTPBool &result);
|
||||
void checkFail(const RPCError &error);
|
||||
void firstCheckFail(const RPCError &error);
|
||||
void checkFail(const MTP::Error &error);
|
||||
void firstCheckFail(const MTP::Error &error);
|
||||
|
||||
void updateMaxHeight();
|
||||
|
||||
|
@ -229,7 +229,7 @@ private:
|
|||
void submit();
|
||||
void save();
|
||||
void saveSelfDone(const MTPUser &user);
|
||||
void saveSelfFail(const RPCError &error);
|
||||
void saveSelfFail(const MTP::Error &error);
|
||||
|
||||
const not_null<UserData*> _user;
|
||||
MTP::Sender _api;
|
||||
|
|
|
@ -785,7 +785,7 @@ bool BackgroundPreviewBox::Start(
|
|||
Ui::show(Box<BackgroundPreviewBox>(
|
||||
controller,
|
||||
result.withUrlParams(params)));
|
||||
}), [](const RPCError &error) {
|
||||
}), [](const MTP::Error &error) {
|
||||
Ui::show(Box<InformBox>(tr::lng_background_bad_link(tr::now)));
|
||||
});
|
||||
return true;
|
||||
|
|
|
@ -78,7 +78,7 @@ protected:
|
|||
private:
|
||||
void submit();
|
||||
void sendPhoneDone(const MTPauth_SentCode &result, const QString &phoneNumber);
|
||||
void sendPhoneFail(const RPCError &error, const QString &phoneNumber);
|
||||
void sendPhoneFail(const MTP::Error &error, const QString &phoneNumber);
|
||||
void showError(const QString &text);
|
||||
void hideError() {
|
||||
showError(QString());
|
||||
|
@ -114,7 +114,7 @@ private:
|
|||
void submit();
|
||||
void sendCall();
|
||||
void updateCall();
|
||||
void sendCodeFail(const RPCError &error);
|
||||
void sendCodeFail(const MTP::Error &error);
|
||||
void showError(const QString &text);
|
||||
void hideError() {
|
||||
showError(QString());
|
||||
|
@ -180,7 +180,7 @@ void ChangePhoneBox::EnterPhone::submit() {
|
|||
MTP_codeSettings(MTP_flags(0))
|
||||
)).done([=](const MTPauth_SentCode &result) {
|
||||
sendPhoneDone(result, phoneNumber);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
sendPhoneFail(error, phoneNumber);
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -222,9 +222,9 @@ void ChangePhoneBox::EnterPhone::sendPhoneDone(
|
|||
Ui::LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void ChangePhoneBox::EnterPhone::sendPhoneFail(const RPCError &error, const QString &phoneNumber) {
|
||||
void ChangePhoneBox::EnterPhone::sendPhoneFail(const MTP::Error &error, const QString &phoneNumber) {
|
||||
_requestId = 0;
|
||||
if (MTP::isFloodError(error)) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
showError(tr::lng_flood_error(tr::now));
|
||||
} else if (error.type() == qstr("PHONE_NUMBER_INVALID")) {
|
||||
showError(tr::lng_bad_phone(tr::now));
|
||||
|
@ -320,7 +320,7 @@ void ChangePhoneBox::EnterCode::submit() {
|
|||
Ui::hideLayer();
|
||||
}
|
||||
Ui::Toast::Show(tr::lng_change_phone_success(tr::now));
|
||||
}).fail(crl::guard(this, [=](const RPCError &error) {
|
||||
}).fail(crl::guard(this, [=](const MTP::Error &error) {
|
||||
sendCodeFail(error);
|
||||
})).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -354,9 +354,9 @@ void ChangePhoneBox::EnterCode::showError(const QString &text) {
|
|||
}
|
||||
}
|
||||
|
||||
void ChangePhoneBox::EnterCode::sendCodeFail(const RPCError &error) {
|
||||
void ChangePhoneBox::EnterCode::sendCodeFail(const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
if (MTP::isFloodError(error)) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
showError(tr::lng_flood_error(tr::now));
|
||||
} else if (error.type() == qstr("PHONE_CODE_EMPTY") || error.type() == qstr("PHONE_CODE_INVALID")) {
|
||||
showError(tr::lng_bad_code(tr::now));
|
||||
|
|
|
@ -536,7 +536,7 @@ void PinMessageBox::pinMessage() {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
Ui::hideLayer();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
Ui::hideLayer();
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ void ConfirmPhoneBox::checkPhoneAndHash() {
|
|||
MTP_codeSettings(MTP_flags(0))
|
||||
)).done([=](const MTPauth_SentCode &result) {
|
||||
sendCodeDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
sendCodeFail(error);
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -278,9 +278,9 @@ void ConfirmPhoneBox::sendCodeDone(const MTPauth_SentCode &result) {
|
|||
});
|
||||
}
|
||||
|
||||
void ConfirmPhoneBox::sendCodeFail(const RPCError &error) {
|
||||
void ConfirmPhoneBox::sendCodeFail(const MTP::Error &error) {
|
||||
auto errorText = Lang::Hard::ServerError();
|
||||
if (MTP::isFloodError(error)) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
errorText = tr::lng_flood_error(tr::now);
|
||||
} else if (error.code() == 400) {
|
||||
errorText = tr::lng_confirm_phone_link_invalid(tr::now);
|
||||
|
@ -348,7 +348,7 @@ void ConfirmPhoneBox::sendCode() {
|
|||
MTP_string(code)
|
||||
)).done([=](const MTPBool &result) {
|
||||
confirmDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
confirmFail(error);
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -358,9 +358,9 @@ void ConfirmPhoneBox::confirmDone(const MTPBool &result) {
|
|||
Ui::show(Box<InformBox>(tr::lng_confirm_phone_success(tr::now, lt_phone, App::formatPhone(_phone))));
|
||||
}
|
||||
|
||||
void ConfirmPhoneBox::confirmFail(const RPCError &error) {
|
||||
void ConfirmPhoneBox::confirmFail(const MTP::Error &error) {
|
||||
auto errorText = Lang::Hard::ServerError();
|
||||
if (MTP::isFloodError(error)) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
errorText = tr::lng_flood_error(tr::now);
|
||||
} else {
|
||||
auto &errorType = error.type();
|
||||
|
|
|
@ -121,12 +121,12 @@ private:
|
|||
void checkPhoneAndHash();
|
||||
|
||||
void sendCodeDone(const MTPauth_SentCode &result);
|
||||
void sendCodeFail(const RPCError &error);
|
||||
void sendCodeFail(const MTP::Error &error);
|
||||
|
||||
void callDone(const MTPauth_SentCode &result);
|
||||
|
||||
void confirmDone(const MTPBool &result);
|
||||
void confirmFail(const RPCError &error);
|
||||
void confirmFail(const MTP::Error &error);
|
||||
|
||||
QString getPhone() const {
|
||||
return _phone;
|
||||
|
|
|
@ -1061,7 +1061,7 @@ void EditCaptionBox::save() {
|
|||
closeBox();
|
||||
});
|
||||
|
||||
const auto fail = crl::guard(this, [=](const RPCError &error) {
|
||||
const auto fail = crl::guard(this, [=](const MTP::Error &error) {
|
||||
_saveRequestId = 0;
|
||||
const auto &type = error.type();
|
||||
if (ranges::contains(Api::kDefaultEditMessagesErrors, type)) {
|
||||
|
|
|
@ -360,8 +360,8 @@ void PasscodeBox::closeReplacedBy() {
|
|||
}
|
||||
}
|
||||
|
||||
void PasscodeBox::setPasswordFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
void PasscodeBox::setPasswordFail(const MTP::Error &error) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
closeReplacedBy();
|
||||
_setRequest = 0;
|
||||
|
||||
|
@ -402,7 +402,7 @@ void PasscodeBox::setPasswordFail(const RPCError &error) {
|
|||
void PasscodeBox::setPasswordFail(
|
||||
const QByteArray &newPasswordBytes,
|
||||
const QString &email,
|
||||
const RPCError &error) {
|
||||
const MTP::Error &error) {
|
||||
const auto prefix = qstr("EMAIL_UNCONFIRMED_");
|
||||
if (error.type().startsWith(prefix)) {
|
||||
const auto codeLength = error.type().mid(prefix.size()).toInt();
|
||||
|
@ -432,9 +432,9 @@ void PasscodeBox::validateEmail(
|
|||
)).done([=](const MTPBool &result) {
|
||||
*set = true;
|
||||
setPasswordDone(newPasswordBytes);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_setRequest = 0;
|
||||
if (MTP::isFloodError(error)) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
errors->fire(tr::lng_flood_error(tr::now));
|
||||
} else if (error.type() == qstr("CODE_INVALID")) {
|
||||
errors->fire(tr::lng_signin_wrong_code(tr::now));
|
||||
|
@ -461,7 +461,7 @@ void PasscodeBox::validateEmail(
|
|||
)).done([=](const MTPBool &result) {
|
||||
_setRequest = 0;
|
||||
resent->fire(tr::lng_cloud_password_resent(tr::now));
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_setRequest = 0;
|
||||
errors->fire(Lang::Hard::ServerError());
|
||||
}).send();
|
||||
|
@ -681,9 +681,9 @@ void PasscodeBox::serverError() {
|
|||
closeBox();
|
||||
}
|
||||
|
||||
bool PasscodeBox::handleCustomCheckError(const RPCError &error) {
|
||||
bool PasscodeBox::handleCustomCheckError(const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (MTP::isFloodError(error)
|
||||
if (MTP::IsFloodError(error)
|
||||
|| type == qstr("PASSWORD_HASH_INVALID")
|
||||
|| type == qstr("SRP_PASSWORD_CHANGED")
|
||||
|| type == qstr("SRP_ID_INVALID")) {
|
||||
|
@ -714,7 +714,7 @@ void PasscodeBox::sendClearCloudPassword(
|
|||
MTPSecureSecretSettings())
|
||||
)).done([=](const MTPBool &result) {
|
||||
setPasswordDone({});
|
||||
}).fail([=](const RPCError &error) mutable {
|
||||
}).fail([=](const MTP::Error &error) mutable {
|
||||
setPasswordFail({}, QString(), error);
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -745,7 +745,7 @@ void PasscodeBox::setNewCloudPassword(const QString &newPassword) {
|
|||
MTPSecureSecretSettings())
|
||||
)).done([=](const MTPBool &result) {
|
||||
setPasswordDone(newPasswordBytes);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
setPasswordFail(newPasswordBytes, email, error);
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ void PasscodeBox::changeCloudPassword(
|
|||
sendChangeCloudPassword(check, newPassword, secureSecret);
|
||||
});
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
setPasswordFail(error);
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -842,7 +842,7 @@ void PasscodeBox::resetSecret(
|
|||
const auto empty = QByteArray();
|
||||
sendChangeCloudPassword(check, newPassword, empty);
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_setRequest = 0;
|
||||
if (error.type() == qstr("SRP_ID_INVALID")) {
|
||||
handleSrpIdInvalid();
|
||||
|
@ -891,7 +891,7 @@ void PasscodeBox::sendChangeCloudPassword(
|
|||
MTP_long(newSecureSecretId)))
|
||||
)).done([=](const MTPBool &result) {
|
||||
setPasswordDone(newPasswordBytes);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
setPasswordFail(newPasswordBytes, QString(), error);
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -939,7 +939,7 @@ void PasscodeBox::recoverByEmail() {
|
|||
_api.request(MTPauth_RequestPasswordRecovery(
|
||||
)).done([=](const MTPauth_PasswordRecovery &result) {
|
||||
recoverStarted(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
recoverStartFail(error);
|
||||
}).send();
|
||||
} else {
|
||||
|
@ -977,7 +977,7 @@ void PasscodeBox::recoverStarted(const MTPauth_PasswordRecovery &result) {
|
|||
recover();
|
||||
}
|
||||
|
||||
void PasscodeBox::recoverStartFail(const RPCError &error) {
|
||||
void PasscodeBox::recoverStartFail(const MTP::Error &error) {
|
||||
_pattern = QString();
|
||||
closeBox();
|
||||
}
|
||||
|
@ -1055,7 +1055,7 @@ void RecoverBox::submit() {
|
|||
MTP_string(code)
|
||||
)).done([=](const MTPauth_Authorization &result) {
|
||||
codeSubmitDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
codeSubmitFail(error);
|
||||
}).handleFloodErrors().send();
|
||||
});
|
||||
|
@ -1087,8 +1087,8 @@ void RecoverBox::codeSubmitDone(const MTPauth_Authorization &result) {
|
|||
Ui::LayerOption::CloseOther);
|
||||
}
|
||||
|
||||
void RecoverBox::codeSubmitFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
void RecoverBox::codeSubmitFail(const MTP::Error &error) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
_submitRequest = 0;
|
||||
_error = tr::lng_flood_error(tr::now);
|
||||
update();
|
||||
|
@ -1149,9 +1149,9 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
|
|||
Box<InformBox>(tr::lng_cloud_password_was_set(tr::now)),
|
||||
Ui::LayerOption::CloseOther);
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
*requestId = 0;
|
||||
if (MTP::isFloodError(error)) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
errors->fire(tr::lng_flood_error(tr::now));
|
||||
} else if (error.type() == qstr("CODE_INVALID")) {
|
||||
errors->fire(tr::lng_signin_wrong_code(tr::now));
|
||||
|
@ -1177,7 +1177,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
|
|||
)).done([=](const MTPBool &result) {
|
||||
*requestId = 0;
|
||||
resent->fire(tr::lng_cloud_password_resent(tr::now));
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
*requestId = 0;
|
||||
errors->fire(Lang::Hard::ServerError());
|
||||
}).send();
|
||||
|
@ -1196,7 +1196,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
|
|||
}
|
||||
|
||||
[[nodiscard]] object_ptr<Ui::GenericBox> PrePasswordErrorBox(
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
not_null<Main::Session*> session,
|
||||
TextWithEntities &&about) {
|
||||
const auto type = [&] {
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
rpl::producer<> passwordReloadNeeded() const;
|
||||
rpl::producer<> clearUnconfirmedPassword() const;
|
||||
|
||||
bool handleCustomCheckError(const RPCError &error);
|
||||
bool handleCustomCheckError(const MTP::Error &error);
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
@ -81,18 +81,18 @@ private:
|
|||
bool onlyCheckCurrent() const;
|
||||
|
||||
void setPasswordDone(const QByteArray &newPasswordBytes);
|
||||
void setPasswordFail(const RPCError &error);
|
||||
void setPasswordFail(const MTP::Error &error);
|
||||
void setPasswordFail(
|
||||
const QByteArray &newPasswordBytes,
|
||||
const QString &email,
|
||||
const RPCError &error);
|
||||
const MTP::Error &error);
|
||||
void validateEmail(
|
||||
const QString &email,
|
||||
int codeLength,
|
||||
const QByteArray &newPasswordBytes);
|
||||
|
||||
void recoverStarted(const MTPauth_PasswordRecovery &result);
|
||||
void recoverStartFail(const RPCError &error);
|
||||
void recoverStartFail(const MTP::Error &error);
|
||||
|
||||
void recover();
|
||||
void submitOnlyCheckCloudPassword(const QString &oldPassword);
|
||||
|
@ -189,7 +189,7 @@ private:
|
|||
void submit();
|
||||
void codeChanged();
|
||||
void codeSubmitDone(const MTPauth_Authorization &result);
|
||||
void codeSubmitFail(const RPCError &error);
|
||||
void codeSubmitFail(const MTP::Error &error);
|
||||
|
||||
MTP::Sender _api;
|
||||
mtpRequestId _submitRequest = 0;
|
||||
|
@ -216,6 +216,6 @@ struct RecoveryEmailValidation {
|
|||
const QString &pattern);
|
||||
|
||||
[[nodiscard]] object_ptr<Ui::GenericBox> PrePasswordErrorBox(
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
not_null<Main::Session*> session,
|
||||
TextWithEntities &&about);
|
||||
|
|
|
@ -54,7 +54,7 @@ void ShareBotGame(not_null<UserData*> bot, not_null<PeerData*> chat) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
api->applyUpdates(result, randomId);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
api->sendMessageFail(error, chat);
|
||||
finish();
|
||||
}).afterRequest(
|
||||
|
@ -195,7 +195,7 @@ void PeerListGlobalSearchController::searchOnServer() {
|
|||
MTP_int(SearchPeopleLimit)
|
||||
)).done([=](const MTPcontacts_Found &result, mtpRequestId requestId) {
|
||||
searchDone(result, requestId);
|
||||
}).fail([=](const RPCError &error, mtpRequestId requestId) {
|
||||
}).fail([=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
if (_requestId == requestId) {
|
||||
_requestId = 0;
|
||||
delegate()->peerListSearchRefreshRows();
|
||||
|
|
|
@ -485,7 +485,7 @@ void AddSpecialBoxController::loadMoreRows() {
|
|||
setDescriptionText(tr::lng_blocked_list_not_found(tr::now));
|
||||
}
|
||||
delegate()->peerListRefreshRows();
|
||||
}).fail([this](const RPCError &error) {
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
_loadRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -520,7 +520,7 @@ bool AddSpecialBoxController::checkInfoLoaded(
|
|||
channel->owner().processUsers(participant.vusers());
|
||||
_additional.applyParticipant(participant.vparticipant());
|
||||
callback();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_additional.setExternal(user);
|
||||
callback();
|
||||
}).send();
|
||||
|
@ -976,7 +976,7 @@ void AddSpecialBoxSearchController::requestParticipants() {
|
|||
const MTPchannels_ChannelParticipants &result,
|
||||
mtpRequestId requestId) {
|
||||
searchParticipantsDone(requestId, result, perPage);
|
||||
}).fail([=](const RPCError &error, mtpRequestId requestId) {
|
||||
}).fail([=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
if (_requestId == requestId) {
|
||||
_requestId = 0;
|
||||
_participantsLoaded = true;
|
||||
|
@ -1059,7 +1059,7 @@ void AddSpecialBoxSearchController::requestGlobal() {
|
|||
MTP_int(perPage)
|
||||
)).done([=](const MTPcontacts_Found &result, mtpRequestId requestId) {
|
||||
searchGlobalDone(requestId, result);
|
||||
}).fail([=](const RPCError &error, mtpRequestId requestId) {
|
||||
}).fail([=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
if (_requestId == requestId) {
|
||||
_requestId = 0;
|
||||
_globalLoaded = true;
|
||||
|
|
|
@ -75,7 +75,7 @@ void SendRequest(
|
|||
lt_user,
|
||||
first));
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
|
|
@ -444,7 +444,7 @@ void EditAdminBox::transferOwnership() {
|
|||
channel,
|
||||
MTP_inputUserEmpty(),
|
||||
MTP_inputCheckPasswordEmpty()
|
||||
)).fail([=](const RPCError &error) {
|
||||
)).fail([=](const MTP::Error &error) {
|
||||
_checkTransferRequestId = 0;
|
||||
if (!handleTransferPasswordError(error)) {
|
||||
getDelegate()->show(Box<ConfirmBox>(
|
||||
|
@ -461,7 +461,7 @@ void EditAdminBox::transferOwnership() {
|
|||
}).send();
|
||||
}
|
||||
|
||||
bool EditAdminBox::handleTransferPasswordError(const RPCError &error) {
|
||||
bool EditAdminBox::handleTransferPasswordError(const MTP::Error &error) {
|
||||
const auto session = &user()->session();
|
||||
auto about = tr::lng_rights_transfer_check_about(
|
||||
tr::now,
|
||||
|
@ -533,7 +533,7 @@ void EditAdminBox::sendTransferRequestFrom(
|
|||
lt_user,
|
||||
user->shortName()));
|
||||
Ui::hideLayer();
|
||||
}).fail(crl::guard(this, [=](const RPCError &error) {
|
||||
}).fail(crl::guard(this, [=](const MTP::Error &error) {
|
||||
if (weak) {
|
||||
_transferRequestId = 0;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "boxes/abstract_box.h"
|
||||
#include "base/unique_qptr.h"
|
||||
|
||||
class RPCError;
|
||||
namespace MTP {
|
||||
class Error;
|
||||
} // namespace MTP
|
||||
|
||||
namespace Ui {
|
||||
class FlatLabel;
|
||||
|
@ -94,7 +96,7 @@ private:
|
|||
not_null<Ui::InputField*> addRankInput();
|
||||
void transferOwnership();
|
||||
void transferOwnershipChecked();
|
||||
bool handleTransferPasswordError(const RPCError &error);
|
||||
bool handleTransferPasswordError(const MTP::Error &error);
|
||||
void requestTransferPassword(not_null<ChannelData*> channel);
|
||||
void sendTransferRequestFrom(
|
||||
QPointer<PasscodeBox> box,
|
||||
|
|
|
@ -58,7 +58,7 @@ void RemoveAdmin(
|
|||
if (onDone) {
|
||||
onDone();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (onFail) {
|
||||
onFail();
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ void AddChatParticipant(
|
|||
if (onDone) {
|
||||
onDone();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
ShowAddParticipantsError(error.type(), chat, { 1, user });
|
||||
if (onFail) {
|
||||
onFail();
|
||||
|
@ -103,7 +103,7 @@ void SaveChatAdmin(
|
|||
if (onDone) {
|
||||
onDone();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (retryOnNotParticipant
|
||||
&& isAdmin
|
||||
|
@ -136,7 +136,7 @@ void SaveChannelAdmin(
|
|||
if (onDone) {
|
||||
onDone();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
ShowAddParticipantsError(error.type(), channel, { 1, user });
|
||||
if (onFail) {
|
||||
onFail();
|
||||
|
@ -161,7 +161,7 @@ void SaveChannelRestriction(
|
|||
if (onDone) {
|
||||
onDone();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (onFail) {
|
||||
onFail();
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ void SaveChatParticipantKick(
|
|||
if (onDone) {
|
||||
onDone();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (onFail) {
|
||||
onFail();
|
||||
}
|
||||
|
@ -1336,7 +1336,7 @@ void ParticipantsBoxController::loadMoreRows() {
|
|||
_onlineSorter->sort();
|
||||
}
|
||||
delegate()->peerListRefreshRows();
|
||||
}).fail([this](const RPCError &error) {
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
_loadRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -2071,7 +2071,7 @@ bool ParticipantsBoxSearchController::loadMoreRows() {
|
|||
const MTPchannels_ChannelParticipants &result,
|
||||
mtpRequestId requestId) {
|
||||
searchDone(requestId, result, perPage);
|
||||
}).fail([=](const RPCError &error, mtpRequestId requestId) {
|
||||
}).fail([=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
if (_requestId == requestId) {
|
||||
_requestId = 0;
|
||||
_allLoaded = true;
|
||||
|
|
|
@ -153,7 +153,7 @@ void SaveDefaultRestrictions(
|
|||
api->clearModifyRequest(key);
|
||||
api->applyUpdates(result);
|
||||
done();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
api->clearModifyRequest(key);
|
||||
if (error.type() != qstr("CHAT_NOT_MODIFIED")) {
|
||||
return;
|
||||
|
@ -186,7 +186,7 @@ void SaveSlowmodeSeconds(
|
|||
api->applyUpdates(result);
|
||||
channel->setSlowmodeSeconds(seconds);
|
||||
done();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
api->clearModifyRequest(key);
|
||||
if (error.type() != qstr("CHAT_NOT_MODIFIED")) {
|
||||
return;
|
||||
|
@ -235,7 +235,7 @@ void ShowEditPermissions(
|
|||
const auto api = &peer->session().api();
|
||||
api->migrateChat(chat, [=](not_null<ChannelData*> channel) {
|
||||
save(channel, result);
|
||||
}, [=](const RPCError &error) {
|
||||
}, [=](const MTP::Error &error) {
|
||||
*saving = false;
|
||||
});
|
||||
}, box->lifetime());
|
||||
|
@ -278,7 +278,7 @@ void ShowEditInviteLinks(
|
|||
const auto api = &peer->session().api();
|
||||
api->migrateChat(chat, [=](not_null<ChannelData*> channel) {
|
||||
save(channel, result);
|
||||
}, [=](const RPCError &error) {
|
||||
}, [=](const MTP::Error &error) {
|
||||
*saving = false;
|
||||
});
|
||||
}, box->lifetime());
|
||||
|
@ -716,7 +716,7 @@ void Controller::showEditLinkedChatBox() {
|
|||
std::move(chats),
|
||||
callback),
|
||||
Ui::LayerOption::KeepOther);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_linkedChatsRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -1290,7 +1290,7 @@ void Controller::saveUsername() {
|
|||
TextUtilities::SingleLine(channel->name),
|
||||
*_savingData.username);
|
||||
continueSave();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (type == qstr("USERNAME_NOT_MODIFIED")) {
|
||||
channel->setName(
|
||||
|
@ -1343,7 +1343,7 @@ void Controller::saveLinkedChat() {
|
|||
)).done([=](const MTPBool &result) {
|
||||
channel->setLinkedChat(*_savingData.linkedChat);
|
||||
continueSave();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
cancelSave();
|
||||
}).send();
|
||||
|
@ -1358,7 +1358,7 @@ void Controller::saveTitle() {
|
|||
_peer->session().api().applyUpdates(result);
|
||||
continueSave();
|
||||
};
|
||||
const auto onFail = [=](const RPCError &error) {
|
||||
const auto onFail = [=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (type == qstr("CHAT_NOT_MODIFIED")
|
||||
|| type == qstr("CHAT_TITLE_NOT_MODIFIED")) {
|
||||
|
@ -1411,7 +1411,7 @@ void Controller::saveDescription() {
|
|||
MTP_string(*_savingData.description)
|
||||
)).done([=](const MTPBool &result) {
|
||||
successCallback();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto &type = error.type();
|
||||
if (type == qstr("CHAT_ABOUT_NOT_MODIFIED")) {
|
||||
successCallback();
|
||||
|
@ -1469,7 +1469,7 @@ void Controller::togglePreHistoryHidden(
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
channel->session().api().applyUpdates(result);
|
||||
apply();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
|
||||
apply();
|
||||
} else {
|
||||
|
@ -1491,7 +1491,7 @@ void Controller::saveSignatures() {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
channel->session().api().applyUpdates(result);
|
||||
continueSave();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("CHAT_NOT_MODIFIED")) {
|
||||
continueSave();
|
||||
} else {
|
||||
|
@ -1546,7 +1546,7 @@ void Controller::deleteChannel() {
|
|||
channel->inputChannel
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
session->api().applyUpdates(result);
|
||||
//}).fail([=](const RPCError &error) {
|
||||
//}).fail([=](const MTP::Error &error) {
|
||||
// if (error.type() == qstr("CHANNEL_TOO_LARGE")) {
|
||||
// Ui::show(Box<InformBox>(tr::lng_cant_delete_channel(tr::now)));
|
||||
// }
|
||||
|
|
|
@ -525,7 +525,7 @@ void Controller::loadMoreRows() {
|
|||
auto slice = Api::ParseJoinedByLinkSlice(_peer, result);
|
||||
_allLoaded = slice.users.empty();
|
||||
appendSlice(slice);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_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 RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
*converting = false;
|
||||
}).send();
|
||||
};
|
||||
|
|
|
@ -452,7 +452,7 @@ void Controller::checkUsernameAvailability() {
|
|||
} else {
|
||||
showUsernameGood();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_checkUsernameRequestId = 0;
|
||||
const auto &type = error.type();
|
||||
_usernameState = UsernameState::Normal;
|
||||
|
|
|
@ -131,7 +131,7 @@ void RateCallBox::send() {
|
|||
)).done([=](const MTPUpdates &updates) {
|
||||
_session->api().applyUpdates(updates);
|
||||
closeBox();
|
||||
}).fail([=](const RPCError &error) { closeBox(); }).send();
|
||||
}).fail([=](const MTP::Error &error) { closeBox(); }).send();
|
||||
}
|
||||
|
||||
void RateCallBox::updateMaxHeight() {
|
||||
|
|
|
@ -275,7 +275,7 @@ void SessionsContent::terminateOne(uint64 hash) {
|
|||
removeByHash(_data.list);
|
||||
_inner->showData(_data);
|
||||
});
|
||||
auto fail = crl::guard(weak, [=](const RPCError &error) {
|
||||
auto fail = crl::guard(weak, [=](const MTP::Error &error) {
|
||||
_inner->terminatingOne(hash, false);
|
||||
});
|
||||
_authorizations->requestTerminate(
|
||||
|
@ -296,7 +296,7 @@ void SessionsContent::terminateAll() {
|
|||
});
|
||||
_authorizations->requestTerminate(
|
||||
[=](const MTPBool &result) { reset(); },
|
||||
[=](const RPCError &result) { reset(); });
|
||||
[=](const MTP::Error &result) { reset(); });
|
||||
_loading = true;
|
||||
};
|
||||
terminate(std::move(callback), tr::lng_settings_reset_sure(tr::now));
|
||||
|
|
|
@ -340,7 +340,7 @@ bool ShareBox::searchByUsername(bool searchCache) {
|
|||
MTP_int(SearchPeopleLimit)
|
||||
)).done([=](const MTPcontacts_Found &result, mtpRequestId requestId) {
|
||||
peopleDone(result, requestId);
|
||||
}).fail([=](const RPCError &error, mtpRequestId requestId) {
|
||||
}).fail([=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
peopleFail(error, requestId);
|
||||
}).send();
|
||||
_peopleQueries.insert(_peopleRequest, _peopleQuery);
|
||||
|
@ -386,7 +386,7 @@ void ShareBox::peopleDone(
|
|||
}
|
||||
}
|
||||
|
||||
void ShareBox::peopleFail(const RPCError &error, mtpRequestId requestId) {
|
||||
void ShareBox::peopleFail(const MTP::Error &error, mtpRequestId requestId) {
|
||||
if (_peopleRequest == requestId) {
|
||||
_peopleRequest = 0;
|
||||
_peopleFull = true;
|
||||
|
|
|
@ -116,7 +116,7 @@ private:
|
|||
void peopleDone(
|
||||
const MTPcontacts_Found &result,
|
||||
mtpRequestId requestId);
|
||||
void peopleFail(const RPCError &error, mtpRequestId requestId);
|
||||
void peopleFail(const MTP::Error &error, mtpRequestId requestId);
|
||||
|
||||
Descriptor _descriptor;
|
||||
MTP::Sender _api;
|
||||
|
|
|
@ -272,7 +272,7 @@ StickerSetBox::Inner::Inner(
|
|||
_input
|
||||
)).done([=](const MTPmessages_StickerSet &result) {
|
||||
gotSet(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_loaded = true;
|
||||
Ui::show(Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
}).send();
|
||||
|
@ -758,7 +758,7 @@ void StickerSetBox::Inner::install() {
|
|||
MTP_bool(false)
|
||||
)).done([=](const MTPmessages_StickerSetInstallResult &result) {
|
||||
installDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
Ui::show(Box<InformBox>(tr::lng_stickers_not_found(tr::now)));
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -778,7 +778,7 @@ void StickersBox::installSet(uint64 setId) {
|
|||
MTP_boolFalse()
|
||||
)).done([=](const MTPmessages_StickerSetInstallResult &result) {
|
||||
installDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
installFail(error, setId);
|
||||
}).send();
|
||||
|
||||
|
@ -793,7 +793,7 @@ void StickersBox::installDone(const MTPmessages_StickerSetInstallResult &result)
|
|||
}
|
||||
}
|
||||
|
||||
void StickersBox::installFail(const RPCError &error, uint64 setId) {
|
||||
void StickersBox::installFail(const MTP::Error &error, uint64 setId) {
|
||||
const auto &sets = session().data().stickers().sets();
|
||||
const auto it = sets.find(setId);
|
||||
if (it == sets.cend()) {
|
||||
|
@ -1765,7 +1765,7 @@ void StickersBox::Inner::handleMegagroupSetAddressChange() {
|
|||
setMegagroupSelectedSet(MTP_inputStickerSetID(
|
||||
MTP_long(set->id),
|
||||
MTP_long(set->access)));
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_megagroupSetRequestId = 0;
|
||||
setMegagroupSelectedSet(MTP_inputStickerSetEmpty());
|
||||
}).send();
|
||||
|
|
|
@ -122,7 +122,7 @@ private:
|
|||
QPixmap grabContentCache();
|
||||
|
||||
void installDone(const MTPmessages_StickerSetInstallResult &result);
|
||||
void installFail(const RPCError &error, uint64 setId);
|
||||
void installFail(const MTP::Error &error, uint64 setId);
|
||||
|
||||
void preloadArchivedSets();
|
||||
void requestArchivedSets();
|
||||
|
|
|
@ -68,7 +68,7 @@ void UrlAuthBox::Activate(
|
|||
Request(data, item, row, column);
|
||||
}
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto button = HistoryMessageMarkupButton::Get(
|
||||
&session->data(),
|
||||
itemId,
|
||||
|
@ -106,7 +106,7 @@ void UrlAuthBox::Activate(
|
|||
}, [&](const MTPDurlAuthResultRequest &data) {
|
||||
Request(data, session, url, context);
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
HiddenUrlClickHandler::Open(url, context);
|
||||
}).send();
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ void UrlAuthBox::Request(
|
|||
return url;
|
||||
});
|
||||
finishWithUrl(to);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
finishWithUrl(url);
|
||||
}).send();
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ void UrlAuthBox::Request(
|
|||
return url;
|
||||
});
|
||||
finishWithUrl(to);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
finishWithUrl(url);
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ void UsernameBox::save() {
|
|||
MTP_string(_sentUsername)
|
||||
)).done([=](const MTPUser &result) {
|
||||
updateDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
updateFail(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void UsernameBox::check() {
|
|||
MTP_string(name)
|
||||
)).done([=](const MTPBool &result) {
|
||||
checkDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
checkFail(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ void UsernameBox::updateDone(const MTPUser &user) {
|
|||
closeBox();
|
||||
}
|
||||
|
||||
void UsernameBox::updateFail(const RPCError &error) {
|
||||
void UsernameBox::updateFail(const MTP::Error &error) {
|
||||
_saveRequestId = 0;
|
||||
const auto self = _session->user();
|
||||
const auto &err = error.type();
|
||||
|
@ -232,7 +232,7 @@ void UsernameBox::checkDone(const MTPBool &result) {
|
|||
}
|
||||
}
|
||||
|
||||
void UsernameBox::checkFail(const RPCError &error) {
|
||||
void UsernameBox::checkFail(const MTP::Error &error) {
|
||||
_checkRequestId = 0;
|
||||
QString err(error.type());
|
||||
if (err == qstr("USERNAME_INVALID")) {
|
||||
|
|
|
@ -32,10 +32,10 @@ protected:
|
|||
|
||||
private:
|
||||
void updateDone(const MTPUser &result);
|
||||
void updateFail(const RPCError &error);
|
||||
void updateFail(const MTP::Error &error);
|
||||
|
||||
void checkDone(const MTPBool &result);
|
||||
void checkFail(const RPCError &error);
|
||||
void checkFail(const MTP::Error &error);
|
||||
|
||||
void save();
|
||||
|
||||
|
|
|
@ -343,7 +343,7 @@ void BoxController::loadMoreRows() {
|
|||
} break;
|
||||
default: Unexpected("Type of messages.Messages (Calls::BoxController::preloadRows)");
|
||||
}
|
||||
}).fail([this](const RPCError &error) {
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
_loadRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ void Call::startOutgoing() {
|
|||
const auto &config = _user->session().serverConfig();
|
||||
_discardByTimeoutTimer.callOnce(config.callReceiveTimeoutMs);
|
||||
handleUpdate(phoneCall);
|
||||
}).fail([this](const RPCError &error) {
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
handleRequestError(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -281,7 +281,7 @@ void Call::startIncoming() {
|
|||
if (_state.current() == State::Starting) {
|
||||
setState(State::WaitingIncoming);
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
handleRequestError(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ void Call::actuallyAnswer() {
|
|||
}
|
||||
|
||||
handleUpdate(call.vphone_call());
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
handleRequestError(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ void Call::sendSignalingData(const QByteArray &data) {
|
|||
if (!mtpIsTrue(result)) {
|
||||
finish(FinishType::Failed);
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
handleRequestError(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ void Call::confirmAcceptedCall(const MTPDphoneCallAccepted &call) {
|
|||
}
|
||||
|
||||
createAndStartController(call.vphone_call().c_phoneCall());
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
handleRequestError(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -1052,7 +1052,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 RPCError &error) {
|
||||
}).fail(crl::guard(weak, [this, finalState](const MTP::Error &error) {
|
||||
setState(finalState);
|
||||
})).send();
|
||||
}
|
||||
|
@ -1069,7 +1069,7 @@ void Call::setFailedQueued(const QString &error) {
|
|||
});
|
||||
}
|
||||
|
||||
void Call::handleRequestError(const RPCError &error) {
|
||||
void Call::handleRequestError(const MTP::Error &error) {
|
||||
if (error.type() == qstr("USER_PRIVACY_RESTRICTED")) {
|
||||
Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, _user->name)));
|
||||
} else if (error.type() == qstr("PARTICIPANT_VERSION_OUTDATED")) {
|
||||
|
|
|
@ -196,7 +196,7 @@ private:
|
|||
Failed,
|
||||
};
|
||||
|
||||
void handleRequestError(const RPCError &error);
|
||||
void handleRequestError(const MTP::Error &error);
|
||||
void handleControllerError(const QString &error);
|
||||
void finish(
|
||||
FinishType type,
|
||||
|
|
|
@ -272,7 +272,7 @@ void ChooseJoinAsProcess::start(
|
|||
|
||||
_request->box = box.data();
|
||||
_request->showBox(std::move(box));
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
finish({
|
||||
.peer = _request->peer,
|
||||
.joinAs = _request->peer->session().user(),
|
||||
|
|
|
@ -332,7 +332,7 @@ void GroupCall::start() {
|
|||
_acceptFields = true;
|
||||
_peer->session().api().applyUpdates(result);
|
||||
_acceptFields = false;
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
LOG(("Call Error: Could not create, error: %1"
|
||||
).arg(error.type()));
|
||||
hangup();
|
||||
|
@ -467,7 +467,7 @@ void GroupCall::rejoin(not_null<PeerData*> as) {
|
|||
applyMeInCallLocally();
|
||||
maybeSendMutedUpdate(wasMuteState);
|
||||
_peer->session().api().applyUpdates(updates);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto type = error.type();
|
||||
LOG(("Call Error: Could not join, error: %1").arg(type));
|
||||
|
||||
|
@ -603,7 +603,7 @@ void GroupCall::discard() {
|
|||
// updates being handled, but in a guarded way.
|
||||
crl::on_main(this, [=] { hangup(); });
|
||||
_peer->session().api().applyUpdates(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
hangup();
|
||||
}).send();
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ void GroupCall::finish(FinishType type) {
|
|||
// updates being handled, but in a guarded way.
|
||||
crl::on_main(weak, [=] { setState(finalState); });
|
||||
session->api().applyUpdates(result);
|
||||
}).fail(crl::guard(weak, [=](const RPCError &error) {
|
||||
}).fail(crl::guard(weak, [=](const MTP::Error &error) {
|
||||
setState(finalState);
|
||||
})).send();
|
||||
}
|
||||
|
@ -911,7 +911,7 @@ void GroupCall::changeTitle(const QString &title) {
|
|||
MTP_string(title)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
@ -938,7 +938,7 @@ void GroupCall::toggleRecording(bool enabled, const QString &title) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
_recordingStoppedByMe = false;
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_recordingStoppedByMe = false;
|
||||
}).send();
|
||||
}
|
||||
|
@ -1060,7 +1060,7 @@ void GroupCall::broadcastPartStart(std::shared_ptr<LoadPartTask> task) {
|
|||
.status = Status::ResyncNeeded,
|
||||
});
|
||||
});
|
||||
}).fail([=](const RPCError &error, const MTP::Response &response) {
|
||||
}).fail([=](const MTP::Error &error, const MTP::Response &response) {
|
||||
if (error.type() == u"GROUPCALL_JOIN_MISSING"_q) {
|
||||
for (const auto &[task, part] : _broadcastParts) {
|
||||
_api.request(part.requestId).cancel();
|
||||
|
@ -1069,7 +1069,7 @@ void GroupCall::broadcastPartStart(std::shared_ptr<LoadPartTask> task) {
|
|||
rejoin();
|
||||
return;
|
||||
}
|
||||
const auto status = MTP::isFloodError(error)
|
||||
const auto status = MTP::IsFloodError(error)
|
||||
? Status::NotReady
|
||||
: Status::ResyncNeeded;
|
||||
finish({
|
||||
|
@ -1248,7 +1248,7 @@ void GroupCall::checkJoined() {
|
|||
} else if (state() == State::Connecting) {
|
||||
_checkJoinedTimer.callOnce(kCheckJoinedTimeout);
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
LOG(("Call Info: Rejoin after error '%1' in checkGroupCall."
|
||||
).arg(error.type()));
|
||||
rejoin();
|
||||
|
@ -1320,7 +1320,7 @@ void GroupCall::sendSelfUpdate(SendUpdateType type) {
|
|||
)).done([=](const MTPUpdates &result) {
|
||||
_updateMuteRequestId = 0;
|
||||
_peer->session().api().applyUpdates(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_updateMuteRequestId = 0;
|
||||
if (error.type() == u"GROUPCALL_FORBIDDEN"_q) {
|
||||
LOG(("Call Info: Rejoin after error '%1' in editGroupCallMember."
|
||||
|
@ -1384,7 +1384,7 @@ void GroupCall::editParticipant(
|
|||
MTPBool()
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_peer->session().api().applyUpdates(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == u"GROUPCALL_FORBIDDEN"_q) {
|
||||
LOG(("Call Info: Rejoin after error '%1' in editGroupCallMember."
|
||||
).arg(error.type()));
|
||||
|
@ -1529,7 +1529,7 @@ void GroupCall::setAudioDuckingEnabled(bool enabled) {
|
|||
}
|
||||
}
|
||||
|
||||
void GroupCall::handleRequestError(const RPCError &error) {
|
||||
void GroupCall::handleRequestError(const MTP::Error &error) {
|
||||
//if (error.type() == qstr("USER_PRIVACY_RESTRICTED")) {
|
||||
// Ui::show(Box<InformBox>(tr::lng_call_error_not_available(tr::now, lt_user, _user->name)));
|
||||
//} else if (error.type() == qstr("PARTICIPANT_VERSION_OUTDATED")) {
|
||||
|
|
|
@ -209,7 +209,7 @@ private:
|
|||
RaiseHand,
|
||||
};
|
||||
|
||||
void handleRequestError(const RPCError &error);
|
||||
void handleRequestError(const MTP::Error &error);
|
||||
void handleControllerError(const QString &error);
|
||||
void ensureControllerCreated();
|
||||
void destroyController();
|
||||
|
|
|
@ -245,7 +245,7 @@ void Instance::refreshDhConfig() {
|
|||
} else {
|
||||
callFailed(call);
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
const auto call = weak.get();
|
||||
if (!call) {
|
||||
return;
|
||||
|
@ -304,7 +304,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 RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_serverConfigRequestSession = nullptr;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -399,7 +399,7 @@ void EmojiKeywords::LangPack::refresh() {
|
|||
_requestId = 0;
|
||||
_lastRefreshTime = crl::now();
|
||||
applyDifference(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
_lastRefreshTime = crl::now();
|
||||
}).send();
|
||||
|
@ -670,7 +670,7 @@ void EmojiKeywords::refreshRemoteList() {
|
|||
});
|
||||
}) | ranges::to_vector);
|
||||
_langsRequestId = 0;
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_langsRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -1001,7 +1001,7 @@ void GifsListWidget::sendInlineRequest() {
|
|||
MTP_string(nextOffset)
|
||||
)).done([this](const MTPmessages_BotResults &result) {
|
||||
inlineResultsDone(result);
|
||||
}).fail([this](const RPCError &error) {
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
// show error?
|
||||
_footer->setLoading(false);
|
||||
_inlineRequestId = 0;
|
||||
|
|
|
@ -52,7 +52,7 @@ void DicePack::load() {
|
|||
result.match([&](const MTPDmessages_stickerSet &data) {
|
||||
applySet(data);
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ void EmojiPack::refresh() {
|
|||
result.match([&](const MTPDmessages_stickerSet &data) {
|
||||
applySet(data);
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
refreshDelayed();
|
||||
}).send();
|
||||
|
|
|
@ -1045,7 +1045,7 @@ void StickersListWidget::preloadMoreOfficial() {
|
|||
});
|
||||
resizeToWidth(width());
|
||||
update();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
@ -1215,7 +1215,7 @@ void StickersListWidget::sendSearchRequest() {
|
|||
MTP_int(hash)
|
||||
)).done([=](const MTPmessages_FoundStickerSets &result) {
|
||||
searchResultsDone(result);
|
||||
}).fail([this](const RPCError &error) {
|
||||
}).fail([this](const MTP::Error &error) {
|
||||
// show error?
|
||||
_footer->setLoading(false);
|
||||
_searchRequestId = 0;
|
||||
|
@ -3066,7 +3066,7 @@ void StickersListWidget::sendInstallRequest(
|
|||
session().data().stickers().applyArchivedResult(
|
||||
result.c_messages_stickerSetInstallResultArchive());
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
notInstalledLocally(setId);
|
||||
session().data().stickers().undoInstallLocally(setId);
|
||||
}).send();
|
||||
|
|
|
@ -183,7 +183,7 @@ private:
|
|||
using FileLocation = MTP::DedicatedLoader::Location;
|
||||
|
||||
using Checker::fail;
|
||||
Fn<void(const RPCError &error)> failHandler();
|
||||
Fn<void(const MTP::Error &error)> failHandler();
|
||||
|
||||
void gotMessage(const MTPmessages_Messages &result);
|
||||
std::optional<FileLocation> parseMessage(
|
||||
|
@ -1002,8 +1002,8 @@ auto MtpChecker::validateLatestLocation(
|
|||
return (availableVersion <= myVersion) ? FileLocation() : location;
|
||||
}
|
||||
|
||||
Fn<void(const RPCError &error)> MtpChecker::failHandler() {
|
||||
return [=](const RPCError &error) {
|
||||
Fn<void(const MTP::Error &error)> MtpChecker::failHandler() {
|
||||
return [=](const MTP::Error &error) {
|
||||
LOG(("Update Error: MTP check failed with '%1'"
|
||||
).arg(QString::number(error.code()) + ':' + error.type()));
|
||||
fail();
|
||||
|
|
|
@ -256,7 +256,7 @@ void ChatFilters::load(bool force) {
|
|||
)).done([=](const MTPVector<MTPDialogFilter> &result) {
|
||||
received(result.v);
|
||||
_loadRequestId = 0;
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_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 RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_exceptionsLoadRequestId = 0;
|
||||
_owner->session().api().requestMoreDialogsIfNeeded();
|
||||
}).send();
|
||||
|
@ -594,7 +594,7 @@ void ChatFilters::requestSuggested() {
|
|||
}) | ranges::to_vector;
|
||||
|
||||
_suggestedUpdated.fire({});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_suggestedRequestId = 0;
|
||||
_suggestedLastReceived = crl::now() + kRefreshSuggestedTimeout / 2;
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ void CloudThemes::reloadCurrent() {
|
|||
MTP_long(fields.documentId)
|
||||
)).done([=](const MTPTheme &result) {
|
||||
applyUpdate(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_reloadCurrentTimer.callOnce(kReloadTimeout);
|
||||
}).send();
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ void CloudThemes::resolve(
|
|||
MTP_long(0)
|
||||
)).done([=](const MTPTheme &result) {
|
||||
showPreview(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == qstr("THEME_FORMAT_INVALID")) {
|
||||
Ui::show(Box<InformBox>(
|
||||
tr::lng_theme_no_desktop(tr::now)));
|
||||
|
@ -261,7 +261,7 @@ void CloudThemes::refresh() {
|
|||
_updates.fire({});
|
||||
}, [](const MTPDaccount_themesNotModified &) {
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_refreshRquestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ void GroupCall::requestParticipants() {
|
|||
_participantsSliceAdded.fire({});
|
||||
_participantsRequestId = 0;
|
||||
changePeerEmptyCallFlag();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_fullCount = _participants.size();
|
||||
_allReceived = true;
|
||||
_participantsRequestId = 0;
|
||||
|
@ -236,7 +236,7 @@ void GroupCall::reload() {
|
|||
_participantsSliceAdded.fire({});
|
||||
});
|
||||
_reloadRequestId = 0;
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_reloadRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ void GroupCall::requestUnknownParticipants() {
|
|||
_unknownSpokenPeerIds.remove(id);
|
||||
}
|
||||
requestUnknownParticipants();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_unknownParticipantPeersRequestId = 0;
|
||||
for (const auto [ssrc, when] : ssrcs) {
|
||||
_unknownSpokenSsrcs.remove(ssrc);
|
||||
|
|
|
@ -266,7 +266,7 @@ void Histories::requestDialogEntry(not_null<Data::Folder*> folder) {
|
|||
)).done([=](const MTPmessages_PeerDialogs &result) {
|
||||
applyPeerDialogs(result);
|
||||
_dialogFolderRequests.remove(folder);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_dialogFolderRequests.remove(folder);
|
||||
}).send();
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ void Histories::sendDialogRequests() {
|
|||
)).done([=](const MTPmessages_PeerDialogs &result) {
|
||||
applyPeerDialogs(result);
|
||||
finalize();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
finalize();
|
||||
}).send();
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ void Histories::requestFakeChatListMessage(
|
|||
_fakeChatListRequests.erase(history);
|
||||
history->setFakeChatListMessageFrom(result);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_fakeChatListRequests.erase(history);
|
||||
history->setFakeChatListMessageFrom(MTP_messages_messages(
|
||||
MTP_vector<MTPMessage>(0),
|
||||
|
@ -510,7 +510,7 @@ void Histories::sendReadRequest(not_null<History*> history, State &state) {
|
|||
MTP_int(tillId)
|
||||
)).done([=](const MTPBool &result) {
|
||||
finished();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
finished();
|
||||
}).send();
|
||||
} else {
|
||||
|
@ -520,7 +520,7 @@ void Histories::sendReadRequest(not_null<History*> history, State &state) {
|
|||
)).done([=](const MTPmessages_AffectedMessages &result) {
|
||||
session().api().applyAffectedMessages(history->peer, result);
|
||||
finished();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
finished();
|
||||
}).send();
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ void Histories::deleteMessages(
|
|||
finish();
|
||||
history->requestChatListMessage();
|
||||
};
|
||||
const auto fail = [=](const RPCError &error) {
|
||||
const auto fail = [=](const MTP::Error &error) {
|
||||
finish();
|
||||
};
|
||||
if (const auto channel = history->peer->asChannel()) {
|
||||
|
@ -590,7 +590,7 @@ void Histories::deleteAllMessages(
|
|||
bool revoke) {
|
||||
sendRequest(history, RequestType::Delete, [=](Fn<void()> finish) {
|
||||
const auto peer = history->peer;
|
||||
const auto fail = [=](const RPCError &error) {
|
||||
const auto fail = [=](const MTP::Error &error) {
|
||||
finish();
|
||||
};
|
||||
const auto chat = peer->asChat();
|
||||
|
@ -600,7 +600,7 @@ void Histories::deleteAllMessages(
|
|||
channel->inputChannel
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
session().api().applyUpdates(result);
|
||||
//}).fail([=](const RPCError &error) {
|
||||
//}).fail([=](const MTP::Error &error) {
|
||||
// if (error.type() == qstr("CHANNEL_TOO_LARGE")) {
|
||||
// Ui::show(Box<InformBox>(tr::lng_cant_delete_channel(tr::now)));
|
||||
// }
|
||||
|
@ -617,7 +617,7 @@ void Histories::deleteAllMessages(
|
|||
chat->inputChat
|
||||
)).done([=](const MTPBool &result) {
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
if (error.type() == "PEER_ID_INVALID") {
|
||||
// Try to join and delete,
|
||||
// while delete fails for non-joined.
|
||||
|
|
|
@ -412,7 +412,7 @@ void RepliesList::loadAround(MsgId id) {
|
|||
_skippedBefore = 0;
|
||||
}
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_beforeId = 0;
|
||||
_loadingAround = std::nullopt;
|
||||
finish();
|
||||
|
@ -460,7 +460,7 @@ void RepliesList::loadBefore() {
|
|||
_fullCount = _list.size();
|
||||
}
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_beforeId = 0;
|
||||
finish();
|
||||
}).send();
|
||||
|
@ -504,7 +504,7 @@ void RepliesList::loadAfter() {
|
|||
_fullCount = _list.size();
|
||||
}
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_afterId = 0;
|
||||
finish();
|
||||
}).send();
|
||||
|
|
|
@ -383,7 +383,7 @@ void ScheduledMessages::request(not_null<History*> history) {
|
|||
MTP_int(hash))
|
||||
).done([=](const MTPmessages_Messages &result) {
|
||||
parse(history, result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_requests.remove(history);
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -391,7 +391,7 @@ void SearchController::requestMore(
|
|||
parsed.noSkipRange,
|
||||
parsed.fullCount);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
finish();
|
||||
}).send();
|
||||
});
|
||||
|
|
|
@ -545,7 +545,7 @@ void Stickers::requestSetToPushFaved(not_null<DocumentData*> document) {
|
|||
}
|
||||
}
|
||||
addAnyway(std::move(list));
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
// Perhaps this is a deleted sticker pack. Add anyway.
|
||||
addAnyway({});
|
||||
}).send();
|
||||
|
|
|
@ -14,7 +14,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/flags.h"
|
||||
#include "base/object_ptr.h"
|
||||
|
||||
class RPCError;
|
||||
namespace MTP {
|
||||
class Error;
|
||||
} // namespace MTP
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
|
|
|
@ -853,7 +853,7 @@ bool Widget::onSearchMessages(bool searchCache) {
|
|||
_searchInHistoryRequest = 0;
|
||||
searchReceived(type, result, _searchRequest);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_searchInHistoryRequest = 0;
|
||||
searchFailed(type, error, _searchRequest);
|
||||
finish();
|
||||
|
@ -880,7 +880,7 @@ bool Widget::onSearchMessages(bool searchCache) {
|
|||
MTP_int(SearchPerPage)
|
||||
)).done([=](const MTPmessages_Messages &result) {
|
||||
searchReceived(type, result, _searchRequest);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
searchFailed(type, error, _searchRequest);
|
||||
}).send();
|
||||
_searchQueries.emplace(_searchRequest, _searchQuery);
|
||||
|
@ -904,7 +904,7 @@ bool Widget::onSearchMessages(bool searchCache) {
|
|||
MTP_int(SearchPeopleLimit)
|
||||
)).done([=](const MTPcontacts_Found &result, mtpRequestId requestId) {
|
||||
peerSearchReceived(result, requestId);
|
||||
}).fail([=](const RPCError &error, mtpRequestId requestId) {
|
||||
}).fail([=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
peopleFailed(error, requestId);
|
||||
}).send();
|
||||
_peerSearchQueries.emplace(_peerSearchRequest, _peerSearchQuery);
|
||||
|
@ -1011,7 +1011,7 @@ void Widget::onSearchMore() {
|
|||
searchReceived(type, result, _searchRequest);
|
||||
_searchInHistoryRequest = 0;
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
searchFailed(type, error, _searchRequest);
|
||||
_searchInHistoryRequest = 0;
|
||||
finish();
|
||||
|
@ -1044,7 +1044,7 @@ void Widget::onSearchMore() {
|
|||
MTP_int(SearchPerPage)
|
||||
)).done([=](const MTPmessages_Messages &result) {
|
||||
searchReceived(type, result, _searchRequest);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
searchFailed(type, error, _searchRequest);
|
||||
}).send();
|
||||
if (!offsetId) {
|
||||
|
@ -1084,7 +1084,7 @@ void Widget::onSearchMore() {
|
|||
searchReceived(type, result, _searchRequest);
|
||||
_searchInHistoryRequest = 0;
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
searchFailed(type, error, _searchRequest);
|
||||
_searchInHistoryRequest = 0;
|
||||
finish();
|
||||
|
@ -1233,7 +1233,7 @@ void Widget::peerSearchReceived(
|
|||
|
||||
void Widget::searchFailed(
|
||||
SearchRequestType type,
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
mtpRequestId requestId) {
|
||||
if (error.type() == qstr("SEARCH_QUERY_EMPTY")) {
|
||||
searchReceived(
|
||||
|
@ -1253,7 +1253,7 @@ void Widget::searchFailed(
|
|||
}
|
||||
}
|
||||
|
||||
void Widget::peopleFailed(const RPCError &error, mtpRequestId requestId) {
|
||||
void Widget::peopleFailed(const MTP::Error &error, mtpRequestId requestId) {
|
||||
if (_peerSearchRequest == requestId) {
|
||||
_peerSearchRequest = 0;
|
||||
_peerSearchFull = true;
|
||||
|
|
|
@ -15,7 +15,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mtproto/sender.h"
|
||||
#include "api/api_single_message_search.h"
|
||||
|
||||
class RPCError;
|
||||
namespace MTP {
|
||||
class Error;
|
||||
} // namespace MTP
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
|
@ -166,9 +168,9 @@ private:
|
|||
|
||||
void searchFailed(
|
||||
SearchRequestType type,
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
mtpRequestId requestId);
|
||||
void peopleFailed(const RPCError &error, mtpRequestId requestId);
|
||||
void peopleFailed(const MTP::Error &error, mtpRequestId requestId);
|
||||
|
||||
void scrollToTop();
|
||||
void setupScrollUpButton();
|
||||
|
|
|
@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "export/data/export_data_types.h"
|
||||
#include "export/output/export_output_result.h"
|
||||
#include "export/output/export_output_file.h"
|
||||
#include "mtproto/mtproto_rpc_sender.h"
|
||||
#include "mtproto/mtproto_response.h"
|
||||
#include "base/value_ordering.h"
|
||||
#include "base/bytes.h"
|
||||
#include <set>
|
||||
|
@ -249,26 +249,26 @@ public:
|
|||
|
||||
RequestBuilder(
|
||||
Original &&builder,
|
||||
Fn<void(const RPCError&)> commonFailHandler);
|
||||
Fn<void(const MTP::Error&)> commonFailHandler);
|
||||
|
||||
[[nodiscard]] RequestBuilder &done(FnMut<void()> &&handler);
|
||||
[[nodiscard]] RequestBuilder &done(
|
||||
FnMut<void(Response &&)> &&handler);
|
||||
[[nodiscard]] RequestBuilder &fail(
|
||||
Fn<bool(const RPCError&)> &&handler);
|
||||
Fn<bool(const MTP::Error&)> &&handler);
|
||||
|
||||
mtpRequestId send();
|
||||
|
||||
private:
|
||||
Original _builder;
|
||||
Fn<void(const RPCError&)> _commonFailHandler;
|
||||
Fn<void(const MTP::Error&)> _commonFailHandler;
|
||||
|
||||
};
|
||||
|
||||
template <typename Request>
|
||||
ApiWrap::RequestBuilder<Request>::RequestBuilder(
|
||||
Original &&builder,
|
||||
Fn<void(const RPCError&)> commonFailHandler)
|
||||
Fn<void(const MTP::Error&)> commonFailHandler)
|
||||
: _builder(std::move(builder))
|
||||
, _commonFailHandler(std::move(commonFailHandler)) {
|
||||
}
|
||||
|
@ -295,13 +295,13 @@ auto ApiWrap::RequestBuilder<Request>::done(
|
|||
|
||||
template <typename Request>
|
||||
auto ApiWrap::RequestBuilder<Request>::fail(
|
||||
Fn<bool(const RPCError &)> &&handler
|
||||
Fn<bool(const MTP::Error &)> &&handler
|
||||
) -> RequestBuilder& {
|
||||
if (handler) {
|
||||
auto &silence_warning = _builder.fail([
|
||||
common = base::take(_commonFailHandler),
|
||||
specific = std::move(handler)
|
||||
](const RPCError &error) mutable {
|
||||
](const MTP::Error &error) mutable {
|
||||
if (!specific(error)) {
|
||||
common(error);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ auto ApiWrap::mainRequest(Request &&request) {
|
|||
|
||||
return RequestBuilder<MTPInvokeWithTakeout<Request>>(
|
||||
std::move(original),
|
||||
[=](const RPCError &result) { error(result); });
|
||||
[=](const MTP::Error &result) { error(result); });
|
||||
}
|
||||
|
||||
template <typename Request>
|
||||
|
@ -391,7 +391,7 @@ auto ApiWrap::fileRequest(const Data::FileLocation &location, int offset) {
|
|||
location.data,
|
||||
MTP_int(offset),
|
||||
MTP_int(kFileChunkSize))
|
||||
)).fail([=](const RPCError &result) {
|
||||
)).fail([=](const MTP::Error &result) {
|
||||
if (result.type() == qstr("TAKEOUT_FILE_EMPTY")
|
||||
&& _otherDataProcess != nullptr) {
|
||||
filePartDone(
|
||||
|
@ -418,7 +418,7 @@ ApiWrap::ApiWrap(QPointer<MTP::Instance> weak, Fn<void(FnMut<void()>)> runner)
|
|||
, _fileCache(std::make_unique<LoadedFileCache>(kLocationCacheSize)) {
|
||||
}
|
||||
|
||||
rpl::producer<RPCError> ApiWrap::errors() const {
|
||||
rpl::producer<MTP::Error> ApiWrap::errors() const {
|
||||
return _errors.events();
|
||||
}
|
||||
|
||||
|
@ -688,10 +688,10 @@ void ApiWrap::startMainSession(FnMut<void()> done) {
|
|||
return data.vid().v;
|
||||
});
|
||||
done();
|
||||
}).fail([=](const RPCError &result) {
|
||||
}).fail([=](const MTP::Error &result) {
|
||||
error(result);
|
||||
}).toDC(MTP::ShiftDcId(0, MTP::kExportDcShift)).send();
|
||||
}).fail([=](const RPCError &result) {
|
||||
}).fail([=](const MTP::Error &result) {
|
||||
error(result);
|
||||
}).send();
|
||||
}
|
||||
|
@ -1454,7 +1454,7 @@ void ApiWrap::requestChatMessages(
|
|||
MTP_int(0), // max_id
|
||||
MTP_int(0), // min_id
|
||||
MTP_int(0) // hash
|
||||
)).fail([=](const RPCError &error) {
|
||||
)).fail([=](const MTP::Error &error) {
|
||||
Expects(_chatProcess != nullptr);
|
||||
|
||||
if (error.type() == qstr("CHANNEL_PRIVATE")) {
|
||||
|
@ -1875,7 +1875,7 @@ void ApiWrap::filePartRefreshReference(int offset) {
|
|||
MTP_vector<MTPInputMessage>(
|
||||
1,
|
||||
MTP_inputMessageID(MTP_int(origin.messageId)))
|
||||
)).fail([=](const RPCError &error) {
|
||||
)).fail([=](const MTP::Error &error) {
|
||||
filePartUnavailable();
|
||||
return true;
|
||||
}).done([=](const MTPmessages_Messages &result) {
|
||||
|
@ -1886,7 +1886,7 @@ void ApiWrap::filePartRefreshReference(int offset) {
|
|||
MTP_vector<MTPInputMessage>(
|
||||
1,
|
||||
MTP_inputMessageID(MTP_int(origin.messageId)))
|
||||
)).fail([=](const RPCError &error) {
|
||||
)).fail([=](const MTP::Error &error) {
|
||||
filePartUnavailable();
|
||||
return true;
|
||||
}).done([=](const MTPmessages_Messages &result) {
|
||||
|
@ -1945,12 +1945,12 @@ void ApiWrap::filePartUnavailable() {
|
|||
base::take(_fileProcess)->done(QString());
|
||||
}
|
||||
|
||||
void ApiWrap::error(const RPCError &error) {
|
||||
void ApiWrap::error(const MTP::Error &error) {
|
||||
_errors.fire_copy(error);
|
||||
}
|
||||
|
||||
void ApiWrap::error(const QString &text) {
|
||||
error(RPCError(
|
||||
error(MTP::Error(
|
||||
MTP_rpc_error(MTP_int(0), MTP_string("API_ERROR: " + text))));
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ class ApiWrap {
|
|||
public:
|
||||
ApiWrap(QPointer<MTP::Instance> weak, Fn<void(FnMut<void()>)> runner);
|
||||
|
||||
rpl::producer<RPCError> errors() const;
|
||||
rpl::producer<MTP::Error> errors() const;
|
||||
rpl::producer<Output::Result> ioErrors() const;
|
||||
|
||||
struct StartInfo {
|
||||
|
@ -203,7 +203,7 @@ private:
|
|||
const Data::FileLocation &location,
|
||||
int offset);
|
||||
|
||||
void error(const RPCError &error);
|
||||
void error(const MTP::Error &error);
|
||||
void error(const QString &text);
|
||||
void ioError(const Output::Result &result);
|
||||
|
||||
|
@ -226,7 +226,7 @@ private:
|
|||
std::unique_ptr<ChatProcess> _chatProcess;
|
||||
QVector<MTPMessageRange> _splits;
|
||||
|
||||
rpl::event_stream<RPCError> _errors;
|
||||
rpl::event_stream<MTP::Error> _errors;
|
||||
rpl::event_stream<Output::Result> _ioErrors;
|
||||
|
||||
};
|
||||
|
|
|
@ -138,7 +138,7 @@ ControllerObject::ControllerObject(
|
|||
: _api(mtproto, weak.runner())
|
||||
, _state(PasswordCheckState{}) {
|
||||
_api.errors(
|
||||
) | rpl::start_with_next([=](const RPCError &error) {
|
||||
) | rpl::start_with_next([=](const MTP::Error &error) {
|
||||
setState(ApiErrorState{ error });
|
||||
}, _lifetime);
|
||||
|
||||
|
@ -211,7 +211,7 @@ bool ControllerObject::ioCatchError(Output::Result result) {
|
|||
// //)).done([=](const MTPaccount_Password &result) {
|
||||
// // _passwordRequestId = 0;
|
||||
// // passwordStateDone(result);
|
||||
// //}).fail([=](const RPCError &error) {
|
||||
// //}).fail([=](const MTP::Error &error) {
|
||||
// // apiError(error);
|
||||
// //}).send();
|
||||
//}
|
||||
|
|
|
@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#pragma once
|
||||
|
||||
#include "base/variant.h"
|
||||
#include "mtproto/mtproto_rpc_sender.h"
|
||||
#include "mtproto/mtproto_response.h"
|
||||
|
||||
#include <QtCore/QPointer>
|
||||
#include <crl/crl_object_on_queue.h>
|
||||
|
@ -81,7 +81,7 @@ struct ProcessingState {
|
|||
};
|
||||
|
||||
struct ApiErrorState {
|
||||
RPCError data;
|
||||
MTP::Error data;
|
||||
};
|
||||
|
||||
struct OutputErrorState {
|
||||
|
|
|
@ -697,7 +697,7 @@ void InnerWidget::preloadMore(Direction direction) {
|
|||
if (!loadedFlag) {
|
||||
addEvents(direction, results.vevents().v);
|
||||
}
|
||||
}).fail([this, &requestId, &loadedFlag](const RPCError &error) {
|
||||
}).fail([this, &requestId, &loadedFlag](const MTP::Error &error) {
|
||||
requestId = 0;
|
||||
loadedFlag = true;
|
||||
update();
|
||||
|
@ -1326,7 +1326,7 @@ void InnerWidget::suggestRestrictUser(not_null<UserData*> user) {
|
|||
MTP_int(0));
|
||||
editRestrictions(hasAdminRights, bannedRights);
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
auto bannedRights = MTP_chatBannedRights(
|
||||
MTP_flags(0),
|
||||
MTP_int(0));
|
||||
|
|
|
@ -330,7 +330,7 @@ void FastShareMessage(not_null<HistoryItem*> item) {
|
|||
Ui::hideLayer();
|
||||
}
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
finish();
|
||||
}).afterRequest(history->sendRequestId).send();
|
||||
return history->sendRequestId;
|
||||
|
|
|
@ -1235,7 +1235,7 @@ void HistoryWidget::updateInlineBotQuery() {
|
|||
MTP_string(username)
|
||||
)).done([=](const MTPcontacts_ResolvedPeer &result) {
|
||||
inlineBotResolveDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
inlineBotResolveFail(error, username);
|
||||
}).send();
|
||||
} else {
|
||||
|
@ -2476,7 +2476,7 @@ void HistoryWidget::unreadCountUpdated() {
|
|||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::messagesFailed(const RPCError &error, int requestId) {
|
||||
void HistoryWidget::messagesFailed(const MTP::Error &error, int requestId) {
|
||||
if (error.type() == qstr("CHANNEL_PRIVATE")
|
||||
&& _peer->isChannel()
|
||||
&& _peer->asChannel()->invitePeekExpires()) {
|
||||
|
@ -2714,7 +2714,7 @@ void HistoryWidget::firstLoadMessages() {
|
|||
)).done([=](const MTPmessages_Messages &result) {
|
||||
messagesReceived(history->peer, result, _firstLoadRequest);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
messagesFailed(error, _firstLoadRequest);
|
||||
finish();
|
||||
}).send();
|
||||
|
@ -2765,7 +2765,7 @@ void HistoryWidget::loadMessages() {
|
|||
)).done([=](const MTPmessages_Messages &result) {
|
||||
messagesReceived(history->peer, result, _preloadRequest);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
messagesFailed(error, _preloadRequest);
|
||||
finish();
|
||||
}).send();
|
||||
|
@ -2816,7 +2816,7 @@ void HistoryWidget::loadMessagesDown() {
|
|||
)).done([=](const MTPmessages_Messages &result) {
|
||||
messagesReceived(history->peer, result, _preloadDownRequest);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
messagesFailed(error, _preloadDownRequest);
|
||||
finish();
|
||||
}).send();
|
||||
|
@ -2880,7 +2880,7 @@ void HistoryWidget::delayedShowAt(MsgId showAtMsgId) {
|
|||
)).done([=](const MTPmessages_Messages &result) {
|
||||
messagesReceived(history->peer, result, _delayedShowAtRequest);
|
||||
finish();
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
messagesFailed(error, _delayedShowAtRequest);
|
||||
finish();
|
||||
}).send();
|
||||
|
@ -3105,7 +3105,7 @@ void HistoryWidget::saveEditMsg() {
|
|||
}
|
||||
};
|
||||
|
||||
const auto fail = [=](const RPCError &error, mtpRequestId requestId) {
|
||||
const auto fail = [=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
if (const auto editDraft = history->localEditDraft()) {
|
||||
if (editDraft->saveRequestId == requestId) {
|
||||
editDraft->saveRequestId = 0;
|
||||
|
@ -3785,7 +3785,7 @@ void HistoryWidget::inlineBotResolveDone(
|
|||
}
|
||||
|
||||
void HistoryWidget::inlineBotResolveFail(
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
const QString &username) {
|
||||
_inlineBotResolveRequestId = 0;
|
||||
if (username == _inlineBotUsername) {
|
||||
|
|
|
@ -19,12 +19,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/flags.h"
|
||||
#include "base/timer.h"
|
||||
|
||||
class RPCError;
|
||||
struct FileLoadResult;
|
||||
struct SendingAlbum;
|
||||
enum class SendMediaType;
|
||||
class MessageLinksParser;
|
||||
|
||||
namespace MTP {
|
||||
class Error;
|
||||
} // namespace MTP
|
||||
|
||||
namespace Data {
|
||||
enum class PreviewState : char;
|
||||
} // namespace Data
|
||||
|
@ -526,7 +529,7 @@ private:
|
|||
void requestPreview();
|
||||
void gotPreview(QString links, const MTPMessageMedia &media, mtpRequestId req);
|
||||
void messagesReceived(PeerData *peer, const MTPmessages_Messages &messages, int requestId);
|
||||
void messagesFailed(const RPCError &error, int requestId);
|
||||
void messagesFailed(const MTP::Error &error, int requestId);
|
||||
void addMessagesToFront(PeerData *peer, const QVector<MTPMessage> &messages);
|
||||
void addMessagesToBack(PeerData *peer, const QVector<MTPMessage> &messages);
|
||||
|
||||
|
@ -577,7 +580,7 @@ private:
|
|||
void handleSupportSwitch(not_null<History*> updated);
|
||||
|
||||
void inlineBotResolveDone(const MTPcontacts_ResolvedPeer &result);
|
||||
void inlineBotResolveFail(const RPCError &error, const QString &username);
|
||||
void inlineBotResolveFail(const MTP::Error &error, const QString &username);
|
||||
|
||||
bool isRecording() const;
|
||||
|
||||
|
|
|
@ -1577,7 +1577,7 @@ void ComposeControls::inlineBotResolveDone(
|
|||
}
|
||||
|
||||
void ComposeControls::inlineBotResolveFail(
|
||||
const RPCError &error,
|
||||
const MTP::Error &error,
|
||||
const QString &username) {
|
||||
_inlineBotResolveRequestId = 0;
|
||||
if (username == _inlineBotUsername) {
|
||||
|
@ -2360,7 +2360,7 @@ void ComposeControls::updateInlineBotQuery() {
|
|||
MTPcontacts_ResolveUsername(MTP_string(username))
|
||||
).done([=](const MTPcontacts_ResolvedPeer &result) {
|
||||
inlineBotResolveDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
inlineBotResolveFail(error, username);
|
||||
}).send();
|
||||
} else {
|
||||
|
|
|
@ -250,7 +250,7 @@ private:
|
|||
void applyInlineBotQuery(UserData *bot, const QString &query);
|
||||
|
||||
void inlineBotResolveDone(const MTPcontacts_ResolvedPeer &result);
|
||||
void inlineBotResolveFail(const RPCError &error, const QString &username);
|
||||
void inlineBotResolveFail(const MTP::Error &error, const QString &username);
|
||||
|
||||
[[nodiscard]] Data::DraftKey draftKey(
|
||||
DraftType type = DraftType::Normal) const;
|
||||
|
|
|
@ -76,7 +76,7 @@ void AutoDeleteSettingsBox(
|
|||
if (const auto strong = state->weak.data()) {
|
||||
strong->closeBox();
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
state->savingRequestId = 0;
|
||||
}).send();
|
||||
};
|
||||
|
|
|
@ -1109,7 +1109,7 @@ void SendReport(
|
|||
MTP_string(comment)
|
||||
)).done([=](const MTPBool &result) {
|
||||
Ui::Toast::Show(tr::lng_report_thanks(tr::now));
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
} else {
|
||||
auto apiIds = QVector<MTPint>();
|
||||
|
@ -1124,7 +1124,7 @@ void SendReport(
|
|||
MTP_string(comment)
|
||||
)).done([=](const MTPBool &result) {
|
||||
Ui::Toast::Show(tr::lng_report_thanks(tr::now));
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
}).send();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -967,7 +967,7 @@ void RepliesWidget::edit(
|
|||
}
|
||||
};
|
||||
|
||||
const auto fail = [=](const RPCError &error, mtpRequestId requestId) {
|
||||
const auto fail = [=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
if (requestId == *saveEditMsgRequestId) {
|
||||
*saveEditMsgRequestId = 0;
|
||||
}
|
||||
|
|
|
@ -597,7 +597,7 @@ void ScheduledWidget::edit(
|
|||
}
|
||||
};
|
||||
|
||||
const auto fail = [=](const RPCError &error, mtpRequestId requestId) {
|
||||
const auto fail = [=](const MTP::Error &error, mtpRequestId requestId) {
|
||||
if (requestId == *saveEditMsgRequestId) {
|
||||
*saveEditMsgRequestId = 0;
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ void ListController::loadMoreRows() {
|
|||
delegate()->peerListRefreshRows();
|
||||
}
|
||||
_loadRequestId = 0;
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_loadRequestId = 0;
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -448,7 +448,7 @@ void Widget::onInlineRequest() {
|
|||
MTP_string(nextOffset)
|
||||
)).done([=](const MTPmessages_BotResults &result) {
|
||||
inlineResultsDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
// show error?
|
||||
_requesting.fire(false);
|
||||
_inlineRequestId = 0;
|
||||
|
|
|
@ -266,8 +266,8 @@ void CodeWidget::codeSubmitDone(const MTPauth_Authorization &result) {
|
|||
});
|
||||
}
|
||||
|
||||
void CodeWidget::codeSubmitFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
void CodeWidget::codeSubmitFail(const MTP::Error &error) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
stopCheck();
|
||||
_sentRequest = 0;
|
||||
showCodeError(tr::lng_flood_error());
|
||||
|
@ -288,7 +288,7 @@ void CodeWidget::codeSubmitFail(const RPCError &error) {
|
|||
_sentRequest = api().request(MTPaccount_GetPassword(
|
||||
)).done([=](const MTPaccount_Password &result) {
|
||||
gotPassword(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
codeSubmitFail(error);
|
||||
}).handleFloodErrors().send();
|
||||
} else if (Logs::DebugEnabled()) { // internal server error
|
||||
|
@ -391,7 +391,7 @@ void CodeWidget::submit() {
|
|||
MTP_string(_sentCode)
|
||||
)).done([=](const MTPauth_Authorization &result) {
|
||||
codeSubmitDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
codeSubmitFail(error);
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ void CodeWidget::noTelegramCode() {
|
|||
MTP_bytes(getData()->phoneHash)
|
||||
)).done([=](const MTPauth_SentCode &result) {
|
||||
noTelegramCodeDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
noTelegramCodeFail(error);
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -433,8 +433,8 @@ void CodeWidget::noTelegramCodeDone(const MTPauth_SentCode &result) {
|
|||
updateDescText();
|
||||
}
|
||||
|
||||
void CodeWidget::noTelegramCodeFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
void CodeWidget::noTelegramCodeFail(const MTP::Error &error) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
_noTelegramCodeRequestId = 0;
|
||||
showCodeError(tr::lng_flood_error());
|
||||
return;
|
||||
|
|
|
@ -74,14 +74,14 @@ private:
|
|||
void updateControlsGeometry();
|
||||
|
||||
void codeSubmitDone(const MTPauth_Authorization &result);
|
||||
void codeSubmitFail(const RPCError &error);
|
||||
void codeSubmitFail(const MTP::Error &error);
|
||||
|
||||
void showCodeError(rpl::producer<QString> text);
|
||||
void callDone(const MTPauth_SentCode &v);
|
||||
void gotPassword(const MTPaccount_Password &result);
|
||||
|
||||
void noTelegramCodeDone(const MTPauth_SentCode &result);
|
||||
void noTelegramCodeFail(const RPCError &result);
|
||||
void noTelegramCodeFail(const MTP::Error &result);
|
||||
|
||||
void stopCheck();
|
||||
|
||||
|
|
|
@ -133,8 +133,8 @@ void PasswordCheckWidget::pwdSubmitDone(bool recover, const MTPauth_Authorizatio
|
|||
finish(d.vuser());
|
||||
}
|
||||
|
||||
void PasswordCheckWidget::pwdSubmitFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
void PasswordCheckWidget::pwdSubmitFail(const MTP::Error &error) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
_sentRequest = 0;
|
||||
showError(tr::lng_flood_error());
|
||||
_pwdField->showError();
|
||||
|
@ -213,7 +213,7 @@ void PasswordCheckWidget::passwordChecked() {
|
|||
MTPauth_CheckPassword(check.result)
|
||||
).done([=](const MTPauth_Authorization &result) {
|
||||
pwdSubmitDone(false, result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
pwdSubmitFail(error);
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -222,8 +222,8 @@ void PasswordCheckWidget::serverError() {
|
|||
showError(rpl::single(Lang::Hard::ServerError()));
|
||||
}
|
||||
|
||||
void PasswordCheckWidget::codeSubmitFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
void PasswordCheckWidget::codeSubmitFail(const MTP::Error &error) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
showError(tr::lng_flood_error());
|
||||
_codeField->showError();
|
||||
return;
|
||||
|
@ -258,7 +258,7 @@ void PasswordCheckWidget::recoverStarted(const MTPauth_PasswordRecovery &result)
|
|||
updateDescriptionText();
|
||||
}
|
||||
|
||||
void PasswordCheckWidget::recoverStartFail(const RPCError &error) {
|
||||
void PasswordCheckWidget::recoverStartFail(const MTP::Error &error) {
|
||||
_pwdField->show();
|
||||
_pwdHint->show();
|
||||
_codeField->hide();
|
||||
|
@ -287,7 +287,7 @@ void PasswordCheckWidget::toRecover() {
|
|||
MTPauth_RequestPasswordRecovery()
|
||||
).done([=](const MTPauth_PasswordRecovery &result) {
|
||||
recoverStarted(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
recoverStartFail(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ void PasswordCheckWidget::submit() {
|
|||
MTPauth_RecoverPassword(MTP_string(code))
|
||||
).done([=](const MTPauth_Authorization &result) {
|
||||
pwdSubmitDone(true, result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
codeSubmitFail(error);
|
||||
}).handleFloodErrors().send();
|
||||
});
|
||||
|
|
|
@ -49,9 +49,9 @@ private:
|
|||
void updateControlsGeometry();
|
||||
|
||||
void pwdSubmitDone(bool recover, const MTPauth_Authorization &result);
|
||||
void pwdSubmitFail(const RPCError &error);
|
||||
void codeSubmitFail(const RPCError &error);
|
||||
void recoverStartFail(const RPCError &error);
|
||||
void pwdSubmitFail(const MTP::Error &error);
|
||||
void codeSubmitFail(const MTP::Error &error);
|
||||
void recoverStartFail(const MTP::Error &error);
|
||||
|
||||
void recoverStarted(const MTPauth_PasswordRecovery &result);
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ void PhoneWidget::submit() {
|
|||
MTP_codeSettings(MTP_flags(0))
|
||||
)).done([=](const MTPauth_SentCode &result) {
|
||||
phoneSubmitDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
phoneSubmitFail(error);
|
||||
}).handleFloodErrors().send();
|
||||
}
|
||||
|
@ -222,8 +222,8 @@ void PhoneWidget::phoneSubmitDone(const MTPauth_SentCode &result) {
|
|||
goNext<CodeWidget>();
|
||||
}
|
||||
|
||||
void PhoneWidget::phoneSubmitFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
void PhoneWidget::phoneSubmitFail(const MTP::Error &error) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
stopCheck();
|
||||
_sentRequest = 0;
|
||||
showPhoneError(tr::lng_flood_error());
|
||||
|
|
|
@ -50,7 +50,7 @@ private:
|
|||
void countryChanged();
|
||||
|
||||
void phoneSubmitDone(const MTPauth_SentCode &result);
|
||||
void phoneSubmitFail(const RPCError &error);
|
||||
void phoneSubmitFail(const MTP::Error &error);
|
||||
|
||||
QString fullNumber() const;
|
||||
void stopCheck();
|
||||
|
|
|
@ -298,7 +298,7 @@ void QrWidget::refreshCode() {
|
|||
MTP_vector<MTPint>(0)
|
||||
)).done([=](const MTPauth_LoginToken &result) {
|
||||
handleTokenResult(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
showTokenError(error);
|
||||
}).send();
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ void QrWidget::handleTokenResult(const MTPauth_LoginToken &result) {
|
|||
});
|
||||
}
|
||||
|
||||
void QrWidget::showTokenError(const RPCError &error) {
|
||||
void QrWidget::showTokenError(const MTP::Error &error) {
|
||||
_requestId = 0;
|
||||
if (error.type() == qstr("SESSION_PASSWORD_NEEDED")) {
|
||||
sendCheckPasswordRequest();
|
||||
|
@ -345,7 +345,7 @@ void QrWidget::importTo(MTP::DcId dcId, const QByteArray &token) {
|
|||
MTP_bytes(token)
|
||||
)).done([=](const MTPauth_LoginToken &result) {
|
||||
handleTokenResult(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
showTokenError(error);
|
||||
}).toDC(dcId).send();
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ void QrWidget::sendCheckPasswordRequest() {
|
|||
getData()->pwdNotEmptyPassport = data.is_has_secure_values();
|
||||
goReplace<PasswordCheckWidget>(Animate::Forward);
|
||||
});
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
showTokenError(error);
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ private:
|
|||
void checkForTokenUpdate(const MTPUpdates &updates);
|
||||
void checkForTokenUpdate(const MTPUpdate &update);
|
||||
void handleTokenResult(const MTPauth_LoginToken &result);
|
||||
void showTokenError(const RPCError &error);
|
||||
void showTokenError(const MTP::Error &error);
|
||||
void importTo(MTP::DcId dcId, const QByteArray &token);
|
||||
void showToken(const QByteArray &token);
|
||||
void done(const MTPauth_Authorization &authorization);
|
||||
|
|
|
@ -117,8 +117,8 @@ void SignupWidget::nameSubmitDone(const MTPauth_Authorization &result) {
|
|||
finish(d.vuser(), _photo->takeResultImage());
|
||||
}
|
||||
|
||||
void SignupWidget::nameSubmitFail(const RPCError &error) {
|
||||
if (MTP::isFloodError(error)) {
|
||||
void SignupWidget::nameSubmitFail(const MTP::Error &error) {
|
||||
if (MTP::IsFloodError(error)) {
|
||||
showError(tr::lng_flood_error());
|
||||
if (_invertOrder) {
|
||||
_first->setFocus();
|
||||
|
@ -192,7 +192,7 @@ void SignupWidget::submit() {
|
|||
MTP_string(_lastName)
|
||||
)).done([=](const MTPauth_Authorization &result) {
|
||||
nameSubmitDone(result);
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
nameSubmitFail(error);
|
||||
}).handleFloodErrors().send();
|
||||
};
|
||||
|
|
|
@ -40,7 +40,7 @@ private:
|
|||
void updateControlsGeometry();
|
||||
|
||||
void nameSubmitDone(const MTPauth_Authorization &result);
|
||||
void nameSubmitFail(const RPCError &error);
|
||||
void nameSubmitFail(const MTP::Error &error);
|
||||
|
||||
object_ptr<Ui::UserpicButton> _photo;
|
||||
object_ptr<Ui::InputField> _first;
|
||||
|
|
|
@ -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 RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
createSession(user, photo, QVector<MTPDialogFilter>());
|
||||
}).send();
|
||||
}
|
||||
|
|
|
@ -491,7 +491,7 @@ void Widget::resetAccount() {
|
|||
StackAction::Replace,
|
||||
Animate::Forward);
|
||||
}
|
||||
}).fail([=](const RPCError &error) {
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_resetRequest = 0;
|
||||
|
||||
const auto &type = error.type();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue