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

Move sendMessage and sendInlineResult to ApiWrap.

This commit is contained in:
John Preston
2018-06-26 16:34:38 +01:00
parent ff53404d5b
commit 33095966af
14 changed files with 362 additions and 331 deletions

View File

@@ -860,7 +860,14 @@ void GifsListWidget::sendInlineRequest() {
}
_footer->setLoading(true);
_inlineRequestId = request(MTPmessages_GetInlineBotResults(MTP_flags(0), _searchBot->inputUser, _inlineQueryPeer->input, MTPInputGeoPoint(), MTP_string(_inlineQuery), MTP_string(nextOffset))).done([this](const MTPmessages_BotResults &result, mtpRequestId requestId) {
_inlineRequestId = request(MTPmessages_GetInlineBotResults(
MTP_flags(0),
_searchBot->inputUser,
_inlineQueryPeer->input,
MTPInputGeoPoint(),
MTP_string(_inlineQuery),
MTP_string(nextOffset)
)).done([this](const MTPmessages_BotResults &result) {
inlineResultsDone(result);
}).fail([this](const RPCError &error) {
// show error?

View File

@@ -1011,39 +1011,4 @@ RecentStickerPack &GetRecentPack() {
return cRefRecentStickers();
}
void IncrementRecentHashtag(RecentHashtagPack &recent, const QString &tag) {
auto i = recent.begin(), e = recent.end();
for (; i != e; ++i) {
if (i->first == tag) {
++i->second;
if (qAbs(i->second) > 0x4000) {
for (auto j = recent.begin(); j != e; ++j) {
if (j->second > 1) {
j->second /= 2;
} else if (j->second > 0) {
j->second = 1;
}
}
}
for (; i != recent.begin(); --i) {
if (qAbs((i - 1)->second) > qAbs(i->second)) {
break;
}
qSwap(*i, *(i - 1));
}
break;
}
}
if (i == e) {
while (recent.size() >= 64) recent.pop_back();
recent.push_back(qMakePair(tag, 1));
for (i = recent.end() - 1; i != recent.begin(); --i) {
if ((i - 1)->second > i->second) {
break;
}
qSwap(*i, *(i - 1));
}
}
}
} // namespace Stickers

View File

@@ -99,6 +99,4 @@ QString GetSetTitle(const MTPDstickerSet &s);
RecentStickerPack &GetRecentPack();
void IncrementRecentHashtag(RecentHashtagPack &recent, const QString &tag);
} // namespace Stickers