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

Function SortByOnlineValue

Telegram/SourceFiles/data/data_peer_values.cpp:413–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413TimeId SortByOnlineValue(not_null<UserData*> user, TimeId now) {
414 if (user->isServiceUser() || user->isBot()) {
415 return -1;
416 }
417 const auto lastseen = user->lastseen();
418 if (const auto till = lastseen.onlineTill()) {
419 return till;
420 } else if (lastseen.isRecently()) {
421 return now - 3 * kSecondsInDay;
422 } else if (lastseen.isWithinWeek()) {
423 return now - 7 * kSecondsInDay;
424 } else if (lastseen.isWithinMonth()) {
425 return now - 30 * kSecondsInDay;
426 } else {
427 return 0;
428 }
429}
430
431crl::time OnlineChangeTimeout(Data::LastseenStatus status, TimeId now) {
432 const auto result = OnlinePhraseChangeInSeconds(status, now);

Callers 2

sortMethod · 0.85
updateFilteredMethod · 0.85

Calls 7

isServiceUserMethod · 0.80
lastseenMethod · 0.80
onlineTillMethod · 0.80
isRecentlyMethod · 0.80
isWithinWeekMethod · 0.80
isWithinMonthMethod · 0.80
isBotMethod · 0.45

Tested by

no test coverage detected