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

Method setupUserIsContactViewer

Telegram/SourceFiles/data/data_session.cpp:1727–1755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1725}
1726
1727void Session::setupUserIsContactViewer() {
1728 session().changes().peerUpdates(
1729 PeerUpdate::Flag::IsContact
1730 ) | rpl::map([](const PeerUpdate &update) {
1731 return update.peer->asUser();
1732 }) | rpl::on_next([=](not_null<UserData*> user) {
1733 const auto i = _contactViews.find(peerToUser(user->id));
1734 if (i != _contactViews.end()) {
1735 for (const auto &view : i->second) {
1736 requestViewResize(view);
1737 }
1738 }
1739 if (!user->isLoaded()) {
1740 LOG(("API Error: "
1741 "userIsContactChanged() called for a not loaded user!"));
1742 return;
1743 }
1744 if (user->isContact()) {
1745 const auto history = this->history(user->id);
1746 _contactsList.addByName(history);
1747 if (!history->inChatList()) {
1748 _contactsNoChatsList.addByName(history);
1749 }
1750 } else if (const auto history = historyLoaded(user)) {
1751 _contactsNoChatsList.remove(history);
1752 _contactsList.remove(history);
1753 }
1754 }, _lifetime);
1755}
1756
1757Session::~Session() = default;
1758

Callers

nothing calls this directly

Calls 12

historyMethod · 0.95
peerToUserFunction · 0.85
peerUpdatesMethod · 0.80
asUserMethod · 0.80
isLoadedMethod · 0.80
isContactMethod · 0.80
inChatListMethod · 0.80
changesMethod · 0.45
findMethod · 0.45
endMethod · 0.45
addByNameMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected