mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 06:37:24 +02:00
Removed some methods with MTP signature from history widget.
This commit is contained in:
parent
3403b3c471
commit
8347318c90
2 changed files with 28 additions and 41 deletions
|
@ -1398,9 +1398,35 @@ void HistoryWidget::updateInlineBotQuery() {
|
|||
_inlineBotResolveRequestId = _api.request(MTPcontacts_ResolveUsername(
|
||||
MTP_string(username)
|
||||
)).done([=](const MTPcontacts_ResolvedPeer &result) {
|
||||
inlineBotResolveDone(result);
|
||||
Expects(result.type() == mtpc_contacts_resolvedPeer);
|
||||
|
||||
const auto &data = result.c_contacts_resolvedPeer();
|
||||
const auto resolvedBot = [&]() -> UserData* {
|
||||
if (const auto user = session().data().processUsers(
|
||||
data.vusers())) {
|
||||
if (user->isBot()
|
||||
&& !user->botInfo->inlinePlaceholder.isEmpty()) {
|
||||
return user;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}();
|
||||
session().data().processChats(data.vchats());
|
||||
|
||||
_inlineBotResolveRequestId = 0;
|
||||
const auto query = parseInlineBotQuery();
|
||||
if (_inlineBotUsername == query.username) {
|
||||
applyInlineBotQuery(
|
||||
query.lookingUpBot ? resolvedBot : query.bot,
|
||||
query.query);
|
||||
} else {
|
||||
clearInlineBot();
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
inlineBotResolveFail(error, username);
|
||||
_inlineBotResolveRequestId = 0;
|
||||
if (username == _inlineBotUsername) {
|
||||
clearInlineBot();
|
||||
}
|
||||
}).send();
|
||||
} else {
|
||||
applyInlineBotQuery(query.bot, query.query);
|
||||
|
@ -4271,42 +4297,6 @@ void HistoryWidget::handleSupportSwitch(not_null<History*> updated) {
|
|||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::inlineBotResolveDone(
|
||||
const MTPcontacts_ResolvedPeer &result) {
|
||||
Expects(result.type() == mtpc_contacts_resolvedPeer);
|
||||
|
||||
_inlineBotResolveRequestId = 0;
|
||||
const auto &data = result.c_contacts_resolvedPeer();
|
||||
const auto resolvedBot = [&]() -> UserData* {
|
||||
if (const auto result = session().data().processUsers(data.vusers())) {
|
||||
if (result->isBot()
|
||||
&& !result->botInfo->inlinePlaceholder.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}();
|
||||
session().data().processChats(data.vchats());
|
||||
|
||||
const auto query = parseInlineBotQuery();
|
||||
if (_inlineBotUsername == query.username) {
|
||||
applyInlineBotQuery(
|
||||
query.lookingUpBot ? resolvedBot : query.bot,
|
||||
query.query);
|
||||
} else {
|
||||
clearInlineBot();
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::inlineBotResolveFail(
|
||||
const MTP::Error &error,
|
||||
const QString &username) {
|
||||
_inlineBotResolveRequestId = 0;
|
||||
if (username == _inlineBotUsername) {
|
||||
clearInlineBot();
|
||||
}
|
||||
}
|
||||
|
||||
bool HistoryWidget::isBotStart() const {
|
||||
const auto user = _peer ? _peer->asUser() : nullptr;
|
||||
if (!user
|
||||
|
|
|
@ -594,9 +594,6 @@ private:
|
|||
void checkSupportPreload(bool force = false);
|
||||
void handleSupportSwitch(not_null<History*> updated);
|
||||
|
||||
void inlineBotResolveDone(const MTPcontacts_ResolvedPeer &result);
|
||||
void inlineBotResolveFail(const MTP::Error &error, const QString &username);
|
||||
|
||||
[[nodiscard]] bool isRecording() const;
|
||||
[[nodiscard]] bool isSearching() const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue