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

Method requestDialogsCount

Telegram/SourceFiles/export/export_api_wrap.cpp:604–653  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602}
603
604void ApiWrap::requestDialogsCount() {
605 Expects(_startProcess != nullptr);
606
607 if (_settings->onlySinglePeer()) {
608 _startProcess->info.dialogsCount
609 = (_settings->singlePeer.type() == mtpc_inputPeerChannel
610 ? 1
611 : _splits.size());
612 sendNextStartRequest();
613 return;
614 }
615
616 const auto offsetDate = 0;
617 const auto offsetId = 0;
618 const auto offsetPeer = MTP_inputPeerEmpty();
619 const auto limit = 1;
620 const auto hash = uint64(0);
621 splitRequest(_startProcess->splitIndex, MTPmessages_GetDialogs(
622 MTP_flags(0),
623 MTPint(), // folder_id
624 MTP_int(offsetDate),
625 MTP_int(offsetId),
626 offsetPeer,
627 MTP_int(limit),
628 MTP_long(hash)
629 )).done([=](const MTPmessages_Dialogs &result) {
630 Expects(_settings != nullptr);
631 Expects(_startProcess != nullptr);
632
633 const auto count = result.match(
634 [](const MTPDmessages_dialogs &data) {
635 return int(data.vdialogs().v.size());
636 }, [](const MTPDmessages_dialogsSlice &data) {
637 return data.vcount().v;
638 }, [](const MTPDmessages_dialogsNotModified &data) {
639 return -1;
640 });
641 if (count < 0) {
642 error("Unexpected dialogsNotModified received.");
643 return;
644 }
645 _startProcess->info.dialogsCount += count;
646
647 if (++_startProcess->splitIndex >= _splits.size()) {
648 sendNextStartRequest();
649 } else {
650 requestDialogsCount();
651 }
652 }).send();
653}
654
655void ApiWrap::requestLeftChannelsCount() {
656 Expects(_startProcess != nullptr);

Callers

nothing calls this directly

Calls 9

MTP_flagsFunction · 0.85
MTP_longFunction · 0.85
errorFunction · 0.85
onlySinglePeerMethod · 0.80
MTP_intFunction · 0.50
typeMethod · 0.45
sizeMethod · 0.45
sendMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected