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

Method poll

Telegram/SourceFiles/data/data_message_reactions.cpp:1523–1546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1521}
1522
1523void Reactions::poll(not_null<HistoryItem*> item, crl::time now) {
1524 // Group them by one second.
1525 const auto last = item->lastReactionsRefreshTime();
1526 const auto grouped = ((last + 999) / 1000) * 1000;
1527 if (!grouped || item->history()->peer->isUser()) {
1528 // First reaction always edits message.
1529 return;
1530 } else if (const auto left = grouped + kPollEach - now; left > 0) {
1531 if (!_repaintItems.contains(item)) {
1532 _repaintItems.emplace(item, grouped + kPollEach);
1533 if (!_repaintTimer.isActive()
1534 || _repaintTimer.remainingTime() > left) {
1535 _repaintTimer.callOnce(left);
1536 }
1537 }
1538 } else if (!_pollingItems.contains(item)) {
1539 if (_pollItems.empty() && !_pollRequestId) {
1540 crl::on_main(&_owner->session(), [=] {
1541 pollCollected();
1542 });
1543 }
1544 _pollItems.emplace(item);
1545 }
1546}
1547
1548void Reactions::updateAllInHistory(not_null<PeerData*> peer, bool enabled) {
1549 if (const auto history = _owner->historyLoaded(peer)) {

Callers

nothing calls this directly

Calls 8

emplaceMethod · 0.80
isUserMethod · 0.45
historyMethod · 0.45
containsMethod · 0.45
isActiveMethod · 0.45
emptyMethod · 0.45
sessionMethod · 0.45

Tested by

no test coverage detected