2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Move some calls from App namespace.

This commit is contained in:
John Preston
2019-01-18 16:27:37 +04:00
parent e7804d014d
commit 4111da1dd0
74 changed files with 896 additions and 852 deletions

View File

@@ -223,7 +223,7 @@ void GifsListWidget::inlineResultsDone(const MTPmessages_BotResults &result) {
auto adding = (it != _inlineCache.cend());
if (result.type() == mtpc_messages_botResults) {
auto &d = result.c_messages_botResults();
App::feedUsers(d.vusers);
Auth().data().processUsers(d.vusers);
auto &v = d.vresults.v;
auto queryId = d.vquery_id.v;
@@ -842,12 +842,15 @@ void GifsListWidget::searchForGifs(const QString &query) {
if (!_searchBot && !_searchBotRequestId) {
auto username = str_const_toString(kSearchBotUsername);
_searchBotRequestId = request(MTPcontacts_ResolveUsername(MTP_string(username))).done([this](const MTPcontacts_ResolvedPeer &result) {
_searchBotRequestId = request(MTPcontacts_ResolveUsername(
MTP_string(username)
)).done([=](const MTPcontacts_ResolvedPeer &result) {
Expects(result.type() == mtpc_contacts_resolvedPeer);
auto &data = result.c_contacts_resolvedPeer();
App::feedUsers(data.vusers);
App::feedChats(data.vchats);
if (auto peer = App::peerLoaded(peerFromMTP(data.vpeer))) {
Auth().data().processUsers(data.vusers);
Auth().data().processChats(data.vchats);
if (auto peer = Auth().data().peerLoaded(peerFromMTP(data.vpeer))) {
if (auto user = peer->asUser()) {
_searchBot = user;
}

View File

@@ -480,9 +480,9 @@ void SpecialSetReceived(
auto custom = sets.find(CustomSetId);
auto pack = Pack();
pack.reserve(items.size());
for_const (auto &mtpDocument, items) {
for (const auto &item : items) {
++dateIndex;
auto document = Auth().data().document(mtpDocument);
const auto document = Auth().data().processDocument(item);
if (!document->sticker()) {
continue;
}
@@ -662,10 +662,11 @@ void GifsReceived(const QVector<MTPDocument> &items, int32 hash) {
saved.clear();
saved.reserve(items.size());
for_const (auto &gif, items) {
auto document = Auth().data().document(gif);
for (const auto &item : items) {
const auto document = Auth().data().processDocument(item);
if (!document->isGifv()) {
LOG(("API Error: bad document returned in HistoryWidget::savedGifsGot!"));
LOG(("API Error: "
"bad document returned in HistoryWidget::savedGifsGot!"));
continue;
}
@@ -917,13 +918,13 @@ Set *FeedSetFull(const MTPmessages_StickerSet &data) {
auto pack = Pack();
pack.reserve(d_docs.size());
for (auto i = 0, l = d_docs.size(); i != l; ++i) {
auto doc = Auth().data().document(d_docs.at(i));
if (!doc->sticker()) continue;
for (const auto &item : d_docs) {
const auto document = Auth().data().processDocument(item);
if (!document->sticker()) continue;
pack.push_back(doc);
pack.push_back(document);
if (custom != sets.cend()) {
auto index = custom->stickers.indexOf(doc);
const auto index = custom->stickers.indexOf(document);
if (index >= 0) {
custom->stickers.removeAt(index);
}

View File

@@ -1092,7 +1092,7 @@ void StickersListWidget::searchResultsDone(
setData = &d.vset.c_stickerSet();
}
for (const auto &cover : d.vcovers.v) {
const auto document = Auth().data().document(cover);
const auto document = Auth().data().processDocument(cover);
if (document->sticker()) {
covers.push_back(document);
}