Fix wrong clearing of a bot start token when returning to chat. #2417

This commit is contained in:
John Preston 2016-10-20 12:46:16 +03:00
parent 143cfe0d0f
commit 951d93832c
3 changed files with 11 additions and 8 deletions

View File

@ -119,7 +119,7 @@ std_::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult
switch (message->type()) { switch (message->type()) {
case mtpc_botInlineMessageMediaAuto: { case mtpc_botInlineMessageMediaAuto: {
const auto &r(message->c_botInlineMessageMediaAuto()); auto &r = message->c_botInlineMessageMediaAuto();
if (result->_type == Type::Photo) { if (result->_type == Type::Photo) {
result->createPhoto(); result->createPhoto();
result->sendData.reset(new internal::SendPhoto(result->_photo, qs(r.vcaption))); result->sendData.reset(new internal::SendPhoto(result->_photo, qs(r.vcaption)));
@ -136,7 +136,7 @@ std_::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult
} break; } break;
case mtpc_botInlineMessageText: { 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(); 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())); result->sendData.reset(new internal::SendText(qs(r.vmessage), entities, r.is_no_webpage()));
if (result->_type == Type::Photo) { if (result->_type == Type::Photo) {
@ -150,7 +150,7 @@ std_::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult
} break; } break;
case mtpc_botInlineMessageMediaGeo: { case mtpc_botInlineMessageMediaGeo: {
const auto &r(message->c_botInlineMessageMediaGeo()); auto &r = message->c_botInlineMessageMediaGeo();
if (r.vgeo.type() == mtpc_geoPoint) { if (r.vgeo.type() == mtpc_geoPoint) {
result->sendData.reset(new internal::SendGeo(r.vgeo.c_geoPoint())); result->sendData.reset(new internal::SendGeo(r.vgeo.c_geoPoint()));
} else { } else {
@ -162,7 +162,7 @@ std_::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult
} break; } break;
case mtpc_botInlineMessageMediaVenue: { case mtpc_botInlineMessageMediaVenue: {
const auto &r(message->c_botInlineMessageMediaVenue()); auto &r = message->c_botInlineMessageMediaVenue();
if (r.vgeo.type() == mtpc_geoPoint) { 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))); result->sendData.reset(new internal::SendVenue(r.vgeo.c_geoPoint(), qs(r.vvenue_id), qs(r.vprovider), qs(r.vtitle), qs(r.vaddress)));
} else { } else {
@ -174,7 +174,7 @@ std_::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult
} break; } break;
case mtpc_botInlineMessageMediaContact: { 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))); result->sendData.reset(new internal::SendContact(qs(r.vfirst_name), qs(r.vlast_name), qs(r.vphone_number)));
if (r.has_reply_markup()) { if (r.has_reply_markup()) {
result->_mtpKeyboard = std_::make_unique<MTPReplyMarkup>(r.vreply_markup); result->_mtpKeyboard = std_::make_unique<MTPReplyMarkup>(r.vreply_markup);

View File

@ -2106,10 +2106,11 @@ void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, Ui::Show
for (int i = 0, s = _stack.size(); i < s; ++i) { for (int i = 0, s = _stack.size(); i < s; ++i) {
if (_stack.at(i)->type() == HistoryStackItem && _stack.at(i)->peer->id == peerId) { if (_stack.at(i)->type() == HistoryStackItem && _stack.at(i)->peer->id == peerId) {
foundInStack = true; foundInStack = true;
while (_stack.size() > i) { while (_stack.size() > i + 1) {
clearBotStartToken(_stack.back()->peer); clearBotStartToken(_stack.back()->peer);
_stack.pop_back(); _stack.pop_back();
} }
_stack.pop_back();
if (!back) { if (!back) {
back = true; 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))) { if (!_a_show.animating() && ((_history->isHidden() && (_wideSection || _overview)) || (Adaptive::OneColumn() && (_history->isHidden() || !peerId)) || back || (way == Ui::ShowWay::Forward))) {
animationParams = prepareHistoryAnimation(peerId); animationParams = prepareHistoryAnimation(peerId);
} }
if (_history->peer() && _history->peer()->id != peerId) { if (_history->peer() && _history->peer()->id != peerId && way != Ui::ShowWay::Forward) {
clearBotStartToken(_history->peer()); clearBotStartToken(_history->peer());
} }
_history->showHistory(peerId, showAtMsgId); _history->showHistory(peerId, showAtMsgId);

View File

@ -92,7 +92,9 @@ echo Version %AppVersionStrFull% build successfull. Preparing..
echo . echo .
echo Dumping debug symbols.. 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" 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! echo Done!
set "PATH=%PATH%;C:\Program Files\7-Zip;C:\Program Files (x86)\Inno Setup 5" 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% 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 mkdir %DropboxSymbolsPath%\%BinaryName%.exe.pdb
if not exist %DropboxSymbolsPath%\%BinaryName%.exe.pdb\%SymbolsHash% mkdir %DropboxSymbolsPath%\%BinaryName%.exe.pdb\%SymbolsHash% 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! echo Done!
if not exist "%ReleasePath%\deploy" mkdir "%ReleasePath%\deploy" if not exist "%ReleasePath%\deploy" mkdir "%ReleasePath%\deploy"