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

Pass MTP::Instance to MTP::Sender.

This commit is contained in:
John Preston
2019-11-27 11:02:56 +03:00
parent a0152557ec
commit e943264823
65 changed files with 406 additions and 275 deletions

View File

@@ -22,6 +22,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/localstorage.h"
#include "lang/lang_keys.h"
#include "mainwindow.h"
#include "apiwrap.h"
#include "window/window_session_controller.h"
#include "history/view/history_view_cursor_state.h"
#include "facades.h"
@@ -130,6 +131,7 @@ GifsListWidget::GifsListWidget(
QWidget *parent,
not_null<Window::SessionController*> controller)
: Inner(parent, controller)
, _api(controller->session().api().instance())
, _section(Section::Gifs)
, _updateInlineItems([=] { updateInlineItems(); })
, _previewTimer([=] { showPreview(); }) {
@@ -217,7 +219,7 @@ GifsListWidget::~GifsListWidget() {
void GifsListWidget::cancelGifsSearch() {
_footer->setLoading(false);
if (_inlineRequestId) {
request(_inlineRequestId).cancel();
_api.request(_inlineRequestId).cancel();
_inlineRequestId = 0;
}
_inlineRequestTimer.stop();
@@ -840,7 +842,7 @@ void GifsListWidget::searchForGifs(const QString &query) {
if (_inlineQuery != query) {
_footer->setLoading(false);
if (_inlineRequestId) {
request(_inlineRequestId).cancel();
_api.request(_inlineRequestId).cancel();
_inlineRequestId = 0;
}
if (_inlineCache.find(query) != _inlineCache.cend()) {
@@ -855,7 +857,7 @@ void GifsListWidget::searchForGifs(const QString &query) {
if (!_searchBot && !_searchBotRequestId) {
auto username = str_const_toString(kSearchBotUsername);
_searchBotRequestId = request(MTPcontacts_ResolveUsername(
_searchBotRequestId = _api.request(MTPcontacts_ResolveUsername(
MTP_string(username)
)).done([=](const MTPcontacts_ResolvedPeer &result) {
Expects(result.type() == mtpc_contacts_resolvedPeer);
@@ -905,7 +907,7 @@ void GifsListWidget::sendInlineRequest() {
}
_footer->setLoading(true);
_inlineRequestId = request(MTPmessages_GetInlineBotResults(
_inlineRequestId = _api.request(MTPmessages_GetInlineBotResults(
MTP_flags(0),
_searchBot->inputUser,
_inlineQueryPeer->input,