| 1327 | } |
| 1328 | |
| 1329 | bool MainWidget::showHistoryInDifferentWindow( |
| 1330 | PeerId peerId, |
| 1331 | const SectionShow ¶ms, |
| 1332 | MsgId showAtMsgId) { |
| 1333 | if (!peerId) { |
| 1334 | // In case we don't have dialogs, we can't clear section stack. |
| 1335 | return !_dialogs; |
| 1336 | } |
| 1337 | const auto peer = session().data().peer(peerId); |
| 1338 | if (const auto separateChat = _controller->windowId().chat()) { |
| 1339 | if (const auto history = separateChat->asHistory()) { |
| 1340 | if (history->peer == peer) { |
| 1341 | return false; |
| 1342 | } |
| 1343 | } |
| 1344 | } |
| 1345 | const auto window = Core::App().windowForShowingHistory(peer); |
| 1346 | if (window == &_controller->window()) { |
| 1347 | return false; |
| 1348 | } else if (window) { |
| 1349 | window->sessionController()->showPeerHistory( |
| 1350 | peerId, |
| 1351 | params, |
| 1352 | showAtMsgId); |
| 1353 | window->activate(); |
| 1354 | return true; |
| 1355 | } else if (windowId().hasChatsList()) { |
| 1356 | return false; |
| 1357 | } |
| 1358 | const auto account = not_null(&session().account()); |
| 1359 | auto primary = Core::App().separateWindowFor(account); |
| 1360 | if (!primary) { |
| 1361 | Core::App().domain().activate(account); |
| 1362 | primary = Core::App().separateWindowFor(account); |
| 1363 | } |
| 1364 | if (primary && &primary->account() == account) { |
| 1365 | primary->sessionController()->showPeerHistory( |
| 1366 | peerId, |
| 1367 | params, |
| 1368 | showAtMsgId); |
| 1369 | primary->activate(); |
| 1370 | } |
| 1371 | return true; |
| 1372 | } |
| 1373 | |
| 1374 | void MainWidget::showHistory( |
| 1375 | PeerId peerId, |
nothing calls this directly
no test coverage detected