mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Scheme updated. Inline geo sending requests without geo.
This commit is contained in:
parent
18caf2e2f6
commit
ff839bd978
Telegram/SourceFiles
@ -3719,19 +3719,20 @@ bool EmojiPan::inlineResultsFail(const RPCError &error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void EmojiPan::queryInlineBot(UserData *bot, QString query) {
|
||||
void EmojiPan::queryInlineBot(UserData *bot, PeerData *peer, QString query) {
|
||||
bool force = false;
|
||||
_inlineQueryPeer = peer;
|
||||
if (bot != _inlineBot) {
|
||||
inlineBotChanged();
|
||||
_inlineBot = bot;
|
||||
force = true;
|
||||
if (_inlineBot->isBotInlineGeo()) {
|
||||
Ui::showLayer(new InformBox(lang(lng_bot_inline_geo_unavailable)));
|
||||
}
|
||||
}
|
||||
if (_inlineBot && _inlineBot->isBotInlineGeo()) {
|
||||
return;
|
||||
//if (_inlineBot->isBotInlineGeo()) {
|
||||
// Ui::showLayer(new InformBox(lang(lng_bot_inline_geo_unavailable)));
|
||||
//}
|
||||
}
|
||||
//if (_inlineBot && _inlineBot->isBotInlineGeo()) {
|
||||
// return;
|
||||
//}
|
||||
|
||||
if (_inlineQuery != query || force) {
|
||||
if (_inlineRequestId) {
|
||||
@ -3751,7 +3752,7 @@ void EmojiPan::queryInlineBot(UserData *bot, QString query) {
|
||||
}
|
||||
|
||||
void EmojiPan::onInlineRequest() {
|
||||
if (_inlineRequestId || !_inlineBot) return;
|
||||
if (_inlineRequestId || !_inlineBot || !_inlineQueryPeer) return;
|
||||
_inlineQuery = _inlineNextQuery;
|
||||
|
||||
QString nextOffset;
|
||||
@ -3762,7 +3763,7 @@ void EmojiPan::onInlineRequest() {
|
||||
}
|
||||
Notify::inlineBotRequesting(true);
|
||||
MTPmessages_GetInlineBotResults::Flags flags = 0;
|
||||
_inlineRequestId = MTP::send(MTPmessages_GetInlineBotResults(MTP_flags(flags), _inlineBot->inputUser, MTPInputGeoPoint(), MTP_string(_inlineQuery), MTP_string(nextOffset)), rpcDone(&EmojiPan::inlineResultsDone), rpcFail(&EmojiPan::inlineResultsFail));
|
||||
_inlineRequestId = MTP::send(MTPmessages_GetInlineBotResults(MTP_flags(flags), _inlineBot->inputUser, _inlineQueryPeer->input, MTPInputGeoPoint(), MTP_string(_inlineQuery), MTP_string(nextOffset)), rpcDone(&EmojiPan::inlineResultsDone), rpcFail(&EmojiPan::inlineResultsFail));
|
||||
}
|
||||
|
||||
void EmojiPan::onEmptyInlineRows() {
|
||||
|
@ -594,7 +594,7 @@ public:
|
||||
bool eventFilter(QObject *obj, QEvent *e);
|
||||
void stickersInstalled(uint64 setId);
|
||||
|
||||
void queryInlineBot(UserData *bot, QString query);
|
||||
void queryInlineBot(UserData *bot, PeerData *peer, QString query);
|
||||
void clearInlineBot();
|
||||
|
||||
bool overlaps(const QRect &globalRect) {
|
||||
@ -731,6 +731,7 @@ private:
|
||||
void recountContentMaxHeight();
|
||||
bool refreshInlineRows(int32 *added = 0);
|
||||
UserData *_inlineBot;
|
||||
PeerData *_inlineQueryPeer = nullptr;
|
||||
QString _inlineQuery, _inlineNextQuery, _inlineNextOffset;
|
||||
mtpRequestId _inlineRequestId;
|
||||
void inlineResultsDone(const MTPmessages_BotResults &result);
|
||||
|
@ -4616,8 +4616,11 @@ const QString HistoryDocument::inDialogsText() const {
|
||||
QString result;
|
||||
if (Has<HistoryDocumentVoice>()) {
|
||||
result = lang(lng_in_dlg_audio);
|
||||
} else if (_data->song()) {
|
||||
result = lang(lng_in_dlg_audio_file);
|
||||
} else if (auto song = _data->song()) {
|
||||
result = documentName(_data);
|
||||
if (result.isEmpty()) {
|
||||
result = lang(lng_in_dlg_audio_file);
|
||||
}
|
||||
} else {
|
||||
auto named = Get<HistoryDocumentNamed>();
|
||||
result = (!named || named->_name.isEmpty()) ? lang(lng_in_dlg_file) : named->_name;
|
||||
|
@ -2910,7 +2910,7 @@ void HistoryWidget::updateInlineBotQuery() {
|
||||
if (_inlineBot->username == cInlineGifBotUsername() && query.isEmpty()) {
|
||||
_emojiPan.clearInlineBot();
|
||||
} else {
|
||||
_emojiPan.queryInlineBot(_inlineBot, query);
|
||||
_emojiPan.queryInlineBot(_inlineBot, _peer, query);
|
||||
}
|
||||
if (!_attachMention.isHidden()) {
|
||||
_attachMention.hideStart();
|
||||
|
@ -798,7 +798,7 @@ messages.getDocumentByHash#338e2464 sha256:bytes size:int mime_type:string = Doc
|
||||
messages.searchGifs#bf9a776b q:string offset:int = messages.FoundGifs;
|
||||
messages.getSavedGifs#83bf3d52 hash:int = messages.SavedGifs;
|
||||
messages.saveGif#327a30cb id:InputDocument unsave:Bool = Bool;
|
||||
messages.getInlineBotResults#94e7b170 flags:# bot:InputUser geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults;
|
||||
messages.getInlineBotResults#514e999d flags:# bot:InputUser peer:InputPeer geo_point:flags.0?InputGeoPoint query:string offset:string = messages.BotResults;
|
||||
messages.setInlineBotResults#eb5ea206 flags:# gallery:flags.0?true private:flags.1?true query_id:long results:Vector<InputBotInlineResult> cache_time:int next_offset:flags.2?string switch_pm:flags.3?InlineBotSwitchPM = Bool;
|
||||
messages.sendInlineBotResult#b16e06fe flags:# broadcast:flags.4?true silent:flags.5?true background:flags.6?true peer:InputPeer reply_to_msg_id:flags.0?int random_id:long query_id:long id:string = Updates;
|
||||
messages.getMessageEditData#fda68d36 peer:InputPeer id:int = messages.MessageEditData;
|
||||
|
@ -7846,9 +7846,10 @@ void _serialize_messages_getInlineBotResults(MTPStringLogger &to, int32 stage, i
|
||||
switch (stage) {
|
||||
case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 1: to.add(" bot: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" geo_point: "); ++stages.back(); if (flag & MTPmessages_getInlineBotResults::Flag::f_geo_point) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break;
|
||||
case 3: to.add(" query: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 4: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 2: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 3: to.add(" geo_point: "); ++stages.back(); if (flag & MTPmessages_getInlineBotResults::Flag::f_geo_point) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break;
|
||||
case 4: to.add(" query: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
case 5: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
|
||||
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
|
||||
}
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ enum {
|
||||
mtpc_messages_searchGifs = 0xbf9a776b,
|
||||
mtpc_messages_getSavedGifs = 0x83bf3d52,
|
||||
mtpc_messages_saveGif = 0x327a30cb,
|
||||
mtpc_messages_getInlineBotResults = 0x94e7b170,
|
||||
mtpc_messages_getInlineBotResults = 0x514e999d,
|
||||
mtpc_messages_setInlineBotResults = 0xeb5ea206,
|
||||
mtpc_messages_sendInlineBotResult = 0xb16e06fe,
|
||||
mtpc_messages_getMessageEditData = 0xfda68d36,
|
||||
@ -19373,6 +19373,7 @@ public:
|
||||
|
||||
MTPflags<MTPmessages_getInlineBotResults::Flags> vflags;
|
||||
MTPInputUser vbot;
|
||||
MTPInputPeer vpeer;
|
||||
MTPInputGeoPoint vgeo_point;
|
||||
MTPstring vquery;
|
||||
MTPstring voffset;
|
||||
@ -19382,11 +19383,11 @@ public:
|
||||
MTPmessages_getInlineBotResults(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getInlineBotResults) {
|
||||
read(from, end, cons);
|
||||
}
|
||||
MTPmessages_getInlineBotResults(const MTPflags<MTPmessages_getInlineBotResults::Flags> &_flags, const MTPInputUser &_bot, const MTPInputGeoPoint &_geo_point, const MTPstring &_query, const MTPstring &_offset) : vflags(_flags), vbot(_bot), vgeo_point(_geo_point), vquery(_query), voffset(_offset) {
|
||||
MTPmessages_getInlineBotResults(const MTPflags<MTPmessages_getInlineBotResults::Flags> &_flags, const MTPInputUser &_bot, const MTPInputPeer &_peer, const MTPInputGeoPoint &_geo_point, const MTPstring &_query, const MTPstring &_offset) : vflags(_flags), vbot(_bot), vpeer(_peer), vgeo_point(_geo_point), vquery(_query), voffset(_offset) {
|
||||
}
|
||||
|
||||
uint32 innerLength() const {
|
||||
return vflags.innerLength() + vbot.innerLength() + (has_geo_point() ? vgeo_point.innerLength() : 0) + vquery.innerLength() + voffset.innerLength();
|
||||
return vflags.innerLength() + vbot.innerLength() + vpeer.innerLength() + (has_geo_point() ? vgeo_point.innerLength() : 0) + vquery.innerLength() + voffset.innerLength();
|
||||
}
|
||||
mtpTypeId type() const {
|
||||
return mtpc_messages_getInlineBotResults;
|
||||
@ -19394,6 +19395,7 @@ public:
|
||||
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_getInlineBotResults) {
|
||||
vflags.read(from, end);
|
||||
vbot.read(from, end);
|
||||
vpeer.read(from, end);
|
||||
if (has_geo_point()) { vgeo_point.read(from, end); } else { vgeo_point = MTPInputGeoPoint(); }
|
||||
vquery.read(from, end);
|
||||
voffset.read(from, end);
|
||||
@ -19401,6 +19403,7 @@ public:
|
||||
void write(mtpBuffer &to) const {
|
||||
vflags.write(to);
|
||||
vbot.write(to);
|
||||
vpeer.write(to);
|
||||
if (has_geo_point()) vgeo_point.write(to);
|
||||
vquery.write(to);
|
||||
voffset.write(to);
|
||||
@ -19418,7 +19421,7 @@ public:
|
||||
}
|
||||
MTPmessages_GetInlineBotResults(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_getInlineBotResults>(from, end, cons) {
|
||||
}
|
||||
MTPmessages_GetInlineBotResults(const MTPflags<MTPmessages_getInlineBotResults::Flags> &_flags, const MTPInputUser &_bot, const MTPInputGeoPoint &_geo_point, const MTPstring &_query, const MTPstring &_offset) : MTPBoxed<MTPmessages_getInlineBotResults>(MTPmessages_getInlineBotResults(_flags, _bot, _geo_point, _query, _offset)) {
|
||||
MTPmessages_GetInlineBotResults(const MTPflags<MTPmessages_getInlineBotResults::Flags> &_flags, const MTPInputUser &_bot, const MTPInputPeer &_peer, const MTPInputGeoPoint &_geo_point, const MTPstring &_query, const MTPstring &_offset) : MTPBoxed<MTPmessages_getInlineBotResults>(MTPmessages_getInlineBotResults(_flags, _bot, _peer, _geo_point, _query, _offset)) {
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user