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

Method readInbox

Telegram/SourceFiles/data/data_histories.cpp:178–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void Histories::readInbox(not_null<History*> history) {
179 DEBUG_LOG(("Reading: readInbox called."));
180 if (history->lastServerMessageKnown()) {
181 const auto last = history->lastServerMessage();
182 DEBUG_LOG(("Reading: last known, reading till %1."
183 ).arg(last ? last->id.bare : 0));
184 readInboxTill(history, last ? last->id : 0);
185 return;
186 } else if (history->loadedAtBottom()) {
187 if (const auto lastId = history->maxMsgId()) {
188 DEBUG_LOG(("Reading: loaded at bottom, maxMsgId %1."
189 ).arg(lastId.bare));
190 readInboxTill(history, lastId);
191 return;
192 } else if (history->loadedAtTop()) {
193 DEBUG_LOG(("Reading: loaded at bottom, loaded at top."));
194 readInboxTill(history, 0);
195 return;
196 }
197 DEBUG_LOG(("Reading: loaded at bottom, but requesting entry."));
198 }
199 requestDialogEntry(history, [=] {
200 Expects(history->lastServerMessageKnown());
201
202 const auto last = history->lastServerMessage();
203 DEBUG_LOG(("Reading: got entry, reading till %1."
204 ).arg(last ? last->id.bare : 0));
205 readInboxTill(history, last ? last->id : 0);
206 });
207}
208
209void Histories::readInboxTill(not_null<HistoryItem*> item) {
210 const auto history = item->history();

Callers 3

sendActionMethod · 0.80
forwardMessagesMethod · 0.80
MarkAsReadThreadFunction · 0.80

Calls 5

maxMsgIdMethod · 0.80
lastServerMessageMethod · 0.45
loadedAtBottomMethod · 0.45
loadedAtTopMethod · 0.45

Tested by

no test coverage detected