From 951d93832cdb8dcbc1c3a1d9b96b19d8ff7c843b Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 20 Oct 2016 12:46:16 +0300 Subject: [PATCH] Fix wrong clearing of a bot start token when returning to chat. #2417 --- Telegram/SourceFiles/inline_bots/inline_bot_result.cpp | 10 +++++----- Telegram/SourceFiles/mainwidget.cpp | 5 +++-- Telegram/build/build.bat | 4 +++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp index b2825281cd..ce7928f41c 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_result.cpp @@ -119,7 +119,7 @@ std_::unique_ptr Result::create(uint64 queryId, const MTPBotInlineResult switch (message->type()) { case mtpc_botInlineMessageMediaAuto: { - const auto &r(message->c_botInlineMessageMediaAuto()); + auto &r = message->c_botInlineMessageMediaAuto(); if (result->_type == Type::Photo) { result->createPhoto(); result->sendData.reset(new internal::SendPhoto(result->_photo, qs(r.vcaption))); @@ -136,7 +136,7 @@ std_::unique_ptr Result::create(uint64 queryId, const MTPBotInlineResult } break; case mtpc_botInlineMessageText: { - const auto &r(message->c_botInlineMessageText()); + auto &r = message->c_botInlineMessageText(); EntitiesInText entities = r.has_entities() ? entitiesFromMTP(r.ventities.c_vector().v) : EntitiesInText(); result->sendData.reset(new internal::SendText(qs(r.vmessage), entities, r.is_no_webpage())); if (result->_type == Type::Photo) { @@ -150,7 +150,7 @@ std_::unique_ptr Result::create(uint64 queryId, const MTPBotInlineResult } break; case mtpc_botInlineMessageMediaGeo: { - const auto &r(message->c_botInlineMessageMediaGeo()); + auto &r = message->c_botInlineMessageMediaGeo(); if (r.vgeo.type() == mtpc_geoPoint) { result->sendData.reset(new internal::SendGeo(r.vgeo.c_geoPoint())); } else { @@ -162,7 +162,7 @@ std_::unique_ptr Result::create(uint64 queryId, const MTPBotInlineResult } break; case mtpc_botInlineMessageMediaVenue: { - const auto &r(message->c_botInlineMessageMediaVenue()); + auto &r = message->c_botInlineMessageMediaVenue(); if (r.vgeo.type() == mtpc_geoPoint) { result->sendData.reset(new internal::SendVenue(r.vgeo.c_geoPoint(), qs(r.vvenue_id), qs(r.vprovider), qs(r.vtitle), qs(r.vaddress))); } else { @@ -174,7 +174,7 @@ std_::unique_ptr Result::create(uint64 queryId, const MTPBotInlineResult } break; case mtpc_botInlineMessageMediaContact: { - const auto &r(message->c_botInlineMessageMediaContact()); + auto &r = message->c_botInlineMessageMediaContact(); result->sendData.reset(new internal::SendContact(qs(r.vfirst_name), qs(r.vlast_name), qs(r.vphone_number))); if (r.has_reply_markup()) { result->_mtpKeyboard = std_::make_unique(r.vreply_markup); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index ce9e06ba22..a8fc33e8ea 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2106,10 +2106,11 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, Ui::Show for (int i = 0, s = _stack.size(); i < s; ++i) { if (_stack.at(i)->type() == HistoryStackItem && _stack.at(i)->peer->id == peerId) { foundInStack = true; - while (_stack.size() > i) { + while (_stack.size() > i + 1) { clearBotStartToken(_stack.back()->peer); _stack.pop_back(); } + _stack.pop_back(); if (!back) { back = true; } @@ -2144,7 +2145,7 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, Ui::Show if (!_a_show.animating() && ((_history->isHidden() && (_wideSection || _overview)) || (Adaptive::OneColumn() && (_history->isHidden() || !peerId)) || back || (way == Ui::ShowWay::Forward))) { animationParams = prepareHistoryAnimation(peerId); } - if (_history->peer() && _history->peer()->id != peerId) { + if (_history->peer() && _history->peer()->id != peerId && way != Ui::ShowWay::Forward) { clearBotStartToken(_history->peer()); } _history->showHistory(peerId, showAtMsgId); diff --git a/Telegram/build/build.bat b/Telegram/build/build.bat index 993a9285de..249d22b76a 100644 --- a/Telegram/build/build.bat +++ b/Telegram/build/build.bat @@ -92,7 +92,9 @@ echo Version %AppVersionStrFull% build successfull. Preparing.. echo . echo Dumping debug symbols.. +xcopy "%ReleasePath%\%BinaryName%.exe" "%ReleasePath%\%BinaryName%.exe.exe" call "%SolutionPath%\..\Libraries\breakpad\src\tools\windows\dump_syms\Release\dump_syms.exe" "%ReleasePath%\%BinaryName%.exe.pdb" > "%ReleasePath%\%BinaryName%.exe.sym" +del "%ReleasePath%\%BinaryName%.exe.exe" echo Done! set "PATH=%PATH%;C:\Program Files\7-Zip;C:\Program Files (x86)\Inno Setup 5" @@ -143,7 +145,7 @@ FOR /F "tokens=1,2,3,4* delims= " %%i in ("%SymbolsHashLine%") do set "SymbolsHa echo Copying %BinaryName%.exe.sym to %DropboxSymbolsPath%\%BinaryName%.exe.pdb\%SymbolsHash% if not exist %DropboxSymbolsPath%\%BinaryName%.exe.pdb mkdir %DropboxSymbolsPath%\%BinaryName%.exe.pdb if not exist %DropboxSymbolsPath%\%BinaryName%.exe.pdb\%SymbolsHash% mkdir %DropboxSymbolsPath%\%BinaryName%.exe.pdb\%SymbolsHash% -xcopy "%ReleasePath%\%BinaryName%.exe.sym" %DropboxSymbolsPath%\%BinaryName%.exe.pdb\%SymbolsHash%\ +move "%ReleasePath%\%BinaryName%.exe.sym" %DropboxSymbolsPath%\%BinaryName%.exe.pdb\%SymbolsHash%\ echo Done! if not exist "%ReleasePath%\deploy" mkdir "%ReleasePath%\deploy"