2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Scheme updated, support for via @bot added to stickers.

This commit is contained in:
John Preston
2016-04-07 14:03:10 +04:00
parent 1bc834bd5e
commit db387d50b8
16 changed files with 534 additions and 265 deletions

View File

@@ -3629,7 +3629,7 @@ void EmojiPan::inlineBotChanged() {
Notify::inlineBotRequesting(false);
}
#include <memory>
void EmojiPan::inlineResultsDone(const MTPmessages_BotResults &result) {
_inlineRequestId = 0;
Notify::inlineBotRequesting(false);
@@ -3638,7 +3638,7 @@ void EmojiPan::inlineResultsDone(const MTPmessages_BotResults &result) {
bool adding = (it != _inlineCache.cend());
if (result.type() == mtpc_messages_botResults) {
const MTPDmessages_botResults &d(result.c_messages_botResults());
const auto &d(result.c_messages_botResults());
const QVector<MTPBotInlineResult> &v(d.vresults.c_vector().v);
uint64 queryId(d.vquery_id.v);
@@ -3646,13 +3646,18 @@ void EmojiPan::inlineResultsDone(const MTPmessages_BotResults &result) {
it = _inlineCache.insert(_inlineQuery, new InlineCacheEntry());
}
it.value()->nextOffset = qs(d.vnext_offset);
if (d.has_switch_pm() && d.vswitch_pm.type() == mtpc_inlineBotSwitchPM) {
const auto &switchPm = d.vswitch_pm.c_inlineBotSwitchPM();
it.value()->switchPmText = qs(switchPm.vtext);
it.value()->switchPmStartParam = qs(switchPm.vstart_param);
}
int32 count = v.size(), added = 0;
if (count) {
if (int count = v.size()) {
it.value()->results.reserve(it.value()->results.size() + count);
}
for (int32 i = 0; i < count; ++i) {
if (UniquePointer<InlineBots::Result> result = InlineBots::Result::create(queryId, v.at(i))) {
int added = 0;
for_const (const MTPBotInlineResult &res, v) {
if (UniquePointer<InlineBots::Result> result = InlineBots::Result::create(queryId, res)) {
++added;
it.value()->results.push_back(result.release());
}