MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / tryResolveWindow

Method tryResolveWindow

Telegram/SourceFiles/main/main_session.cpp:584–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

582}
583
584Window::SessionController *Session::tryResolveWindow(
585 PeerData *forPeer) const {
586 if (forPeer) {
587 auto primary = (Window::SessionController*)nullptr;
588 for (const auto &window : _windows) {
589 const auto thread = window->windowId().thread;
590 if (thread && thread->peer() == forPeer) {
591 return window;
592 } else if (window->isPrimary()) {
593 primary = window;
594 }
595 }
596 if (primary) {
597 return primary;
598 }
599 }
600 if (_windows.empty() || forPeer) {
601 domain().activate(_account);
602 if (_windows.empty()) {
603 return nullptr;
604 }
605 }
606 for (const auto &window : _windows) {
607 if (window->isPrimary()) {
608 return window;
609 }
610 }
611 return _windows.front();
612}
613
614auto Session::colorIndicesValue()
615-> rpl::producer<Ui::ColorIndicesCompressed> {

Callers 15

MakeChannelPostHandlerFunction · 0.80
GiftReleasedByHandlerFunction · 0.80
saveMethod · 0.80
handleClickMethod · 0.80
rowClickedMethod · 0.80
updateButtonsMethod · 0.80
AddBotToGroupFunction · 0.80
OpenRichMessageChannelFunction · 0.80
JoinRichMessageChannelFunction · 0.80
showOpenedPageMethod · 0.80

Calls 6

frontMethod · 0.80
windowIdMethod · 0.45
peerMethod · 0.45
isPrimaryMethod · 0.45
emptyMethod · 0.45
activateMethod · 0.45

Tested by

no test coverage detected