2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Use getters in MTP classes.

This commit is contained in:
John Preston
2019-07-05 15:38:38 +02:00
parent 3ca28c0cf9
commit 567bf60644
100 changed files with 2807 additions and 2672 deletions

View File

@@ -228,16 +228,18 @@ void GifsListWidget::inlineResultsDone(const MTPmessages_BotResults &result) {
auto adding = (it != _inlineCache.cend());
if (result.type() == mtpc_messages_botResults) {
auto &d = result.c_messages_botResults();
Auth().data().processUsers(d.vusers);
Auth().data().processUsers(d.vusers());
auto &v = d.vresults.v;
auto queryId = d.vquery_id.v;
auto &v = d.vresults().v;
auto queryId = d.vquery_id().v;
if (it == _inlineCache.cend()) {
it = _inlineCache.emplace(_inlineQuery, std::make_unique<InlineCacheEntry>()).first;
it = _inlineCache.emplace(
_inlineQuery,
std::make_unique<InlineCacheEntry>()).first;
}
auto entry = it->second.get();
entry->nextOffset = qs(d.vnext_offset);
entry->nextOffset = qs(d.vnext_offset().value_or_empty());
if (auto count = v.size()) {
entry->results.reserve(entry->results.size() + count);
}
@@ -853,9 +855,9 @@ void GifsListWidget::searchForGifs(const QString &query) {
Expects(result.type() == mtpc_contacts_resolvedPeer);
auto &data = result.c_contacts_resolvedPeer();
Auth().data().processUsers(data.vusers);
Auth().data().processChats(data.vchats);
if (auto peer = Auth().data().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;
}