From d960ac2828e87e7b80e7248e96fa06b48e740b47 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 10 Apr 2016 09:55:48 +0400 Subject: [PATCH] Allowing only switch button in inline bot results. 9040124 closed beta. --- Telegram/SourceFiles/config.h | 4 ++-- Telegram/SourceFiles/dropdown.cpp | 15 +++++++++++++-- Telegram/Telegram.rc | 8 ++++---- Telegram/Version | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 688e3553e..1658ba1e1 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org static const int32 AppVersion = 9040; static const wchar_t *AppVersionStr = L"0.9.40"; static const bool DevVersion = false; -#define BETA_VERSION (9040123ULL) // just comment this line to build public version +#define BETA_VERSION (9040124ULL) // just comment this line to build public version static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; static const wchar_t *AppName = L"Telegram Desktop"; @@ -295,7 +295,7 @@ static const char *ApiHash = "344583e45741c457fe1862106095a5eb"; #else static const char *BetaPrivateKey = ""; #undef BETA_VERSION -#define BETA_VERSION 0 +#define BETA_VERSION (0) #endif inline const char *cApiDeviceModel() { diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp index 8e9537bfd..6682ac4ee 100644 --- a/Telegram/SourceFiles/dropdown.cpp +++ b/Telegram/SourceFiles/dropdown.cpp @@ -1931,7 +1931,18 @@ void StickerPanInner::refreshSwitchPmButton(const InlineCacheEntry *entry) { int StickerPanInner::refreshInlineRows(UserData *bot, const InlineCacheEntry *entry, bool resultsDeleted) { _inlineBot = bot; refreshSwitchPmButton(entry); - if (!entry || (entry->results.isEmpty() && (!_inlineBot || _inlineBot->username != cInlineGifBotUsername()))) { + auto clearResults = [this, entry]() { + if (!entry) { + return true; + } + if (entry->results.isEmpty() && entry->switchPmText.isEmpty()) { + if (!_inlineBot || _inlineBot->username != cInlineGifBotUsername()) { + return true; + } + } + return false; + }; + if (clearResults()) { if (resultsDeleted) { clearInlineRows(true); } @@ -3780,7 +3791,7 @@ bool EmojiPan::refreshInlineRows(int32 *added) { auto i = _inlineCache.constFind(_inlineQuery); const internal::InlineCacheEntry *entry = nullptr; if (i != _inlineCache.cend()) { - if (!i.value()->results.isEmpty()) { + if (!i.value()->results.isEmpty() || !i.value()->switchPmText.isEmpty()) { entry = i.value(); } _inlineNextOffset = i.value()->nextOffset; diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc index 5f39f0467..246a516cc 100644 --- a/Telegram/Telegram.rc +++ b/Telegram/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "Resources\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,9,40,123 - PRODUCTVERSION 0,9,40,123 + FILEVERSION 0,9,40,124 + PRODUCTVERSION 0,9,40,124 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.9.40.123" + VALUE "FileVersion", "0.9.40.124" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.9.40.123" + VALUE "ProductVersion", "0.9.40.124" END END BLOCK "VarFileInfo" diff --git a/Telegram/Version b/Telegram/Version index b5f81b1fd..226fa757e 100644 --- a/Telegram/Version +++ b/Telegram/Version @@ -3,4 +3,4 @@ AppVersionStrMajor 0.9 AppVersionStrSmall 0.9.40 AppVersionStr 0.9.40 DevChannel 0 -BetaVersion 9040123 +BetaVersion 9040124