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

Method channelDifferenceDone

Telegram/SourceFiles/api/api_updates.cpp:388–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386}
387
388void Updates::channelDifferenceDone(
389 not_null<ChannelData*> channel,
390 const MTPupdates_ChannelDifference &difference) {
391 _channelFailDifferenceTimeout.remove(channel);
392
393 const auto timeout = difference.match([&](const auto &data) {
394 return data.vtimeout().value_or_empty();
395 });
396 const auto isFinal = difference.match([&](const auto &data) {
397 return data.is_final();
398 });
399 difference.match([&](const MTPDupdates_channelDifferenceEmpty &data) {
400 channel->ptsInit(data.vpts().v);
401 }, [&](const MTPDupdates_channelDifferenceTooLong &data) {
402 session().data().processUsers(data.vusers());
403 session().data().processChats(data.vchats());
404 const auto history = session().data().historyLoaded(channel->id);
405 if (history) {
406 history->setNotLoadedAtBottom();
407 requestChannelRangeDifference(history);
408 }
409 data.vdialog().match([&](const MTPDdialog &data) {
410 if (const auto pts = data.vpts()) {
411 channel->ptsInit(pts->v);
412 }
413 }, [&](const MTPDdialogFolder &) {
414 });
415 session().data().applyDialogs(
416 nullptr,
417 data.vmessages().v,
418 QVector<MTPDialog>(1, data.vdialog()));
419 session().data().channelDifferenceTooLong(channel);
420 if (const auto forum = channel->forum()) {
421 forum->reloadTopics();
422 }
423 }, [&](const MTPDupdates_channelDifference &data) {
424 feedChannelDifference(data);
425 channel->ptsInit(data.vpts().v);
426 });
427
428 channel->ptsSetRequesting(false);
429
430 if (!isFinal) {
431 MTP_LOG(0, ("getChannelDifference "
432 "{ good - after not final channelDifference was received }%1"
433 ).arg(_session->mtp().isTestMode() ? " TESTMODE" : ""));
434 getChannelDifference(channel);
435 } else if (inActiveChats(channel)) {
436 channel->ptsSetWaitingForShortPoll(timeout
437 ? (timeout * crl::time(1000))
438 : kWaitForChannelGetDifference);
439 } else {
440 channel->ptsSetWaitingForShortPoll(-1);
441 }
442}
443
444void Updates::feedChannelDifference(
445 const MTPDupdates_channelDifference &data) {

Callers

nothing calls this directly

Calls 14

ptsInitMethod · 0.80
processUsersMethod · 0.80
processChatsMethod · 0.80
setNotLoadedAtBottomMethod · 0.80
applyDialogsMethod · 0.80
reloadTopicsMethod · 0.80
ptsSetRequestingMethod · 0.80
removeMethod · 0.45
dataMethod · 0.45
historyLoadedMethod · 0.45

Tested by

no test coverage detected