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

Method requestStories

Telegram/SourceFiles/export/export_api_wrap.cpp:962–989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

960}
961
962void ApiWrap::requestStories(
963 FnMut<bool(Data::StoriesInfo&&)> start,
964 Fn<bool(DownloadProgress)> progress,
965 Fn<bool(Data::StoriesSlice&&)> slice,
966 FnMut<void()> finish) {
967 Expects(_storiesProcess == nullptr);
968
969 _storiesProcess = std::make_unique<StoriesProcess>();
970 _storiesProcess->start = std::move(start);
971 _storiesProcess->fileProgress = std::move(progress);
972 _storiesProcess->handleSlice = std::move(slice);
973 _storiesProcess->finish = std::move(finish);
974
975 mainRequest(MTPstories_GetStoriesArchive(
976 MTP_inputPeerSelf(),
977 MTP_int(_storiesProcess->offsetId),
978 MTP_int(kStoriesSliceLimit)
979 )).done([=](const MTPstories_Stories &result) mutable {
980 Expects(_storiesProcess != nullptr);
981
982 auto startInfo = Data::StoriesInfo{ result.data().vcount().v };
983 if (!_storiesProcess->start(std::move(startInfo))) {
984 return;
985 }
986
987 handleStoriesSlice(result);
988 }).send();
989}
990
991void ApiWrap::handleStoriesSlice(const MTPstories_Stories &result) {
992 Expects(_storiesProcess != nullptr);

Callers 1

exportStoriesMethod · 0.80

Calls 5

MTP_intFunction · 0.50
sendMethod · 0.45
doneMethod · 0.45
dataMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected