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

Method peerSourceState

Telegram/SourceFiles/data/data_stories.cpp:2361–2383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2359}
2360
2361std::optional<Stories::PeerSourceState> Stories::peerSourceState(
2362 not_null<PeerData*> peer,
2363 const MTPRecentStory &recent) {
2364 const auto &data = recent.data();
2365 const auto maxId = data.vmax_id().value_or_empty();
2366 const auto live = data.is_live();
2367 const auto i = _readTill.find(peer->id);
2368 if (_readTillReceived || (i != end(_readTill))) {
2369 return PeerSourceState{
2370 .maxId = maxId,
2371 .readTill = std::min(
2372 maxId,
2373 (i != end(_readTill)) ? i->second : 0),
2374 .hasVideoStream = live,
2375 };
2376 }
2377 requestReadTills();
2378 _pendingPeerRecentState[peer] = RecentState{
2379 .maxId = maxId,
2380 .hasVideoStream = live,
2381 };
2382 return std::nullopt;
2383}
2384
2385void Stories::requestReadTills() {
2386 if (_readTillReceived || _readTillsRequestId) {

Callers 2

processUserMethod · 0.80
processChatMethod · 0.80

Calls 2

dataMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected