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

Method exportTopic

Telegram/SourceFiles/export/export_controller.cpp:764–808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

762}
763
764void ControllerObject::exportTopic() {
765 auto topicInfo = Data::DialogInfo();
766 topicInfo.type = Data::DialogInfo::Type::PublicSupergroup;
767 topicInfo.name = _topicTitle.toUtf8();
768 topicInfo.peerId = PeerId(_topicPeerId);
769 topicInfo.relativePath = QString();
770
771 if (ioCatchError(_writer->writeDialogStart(topicInfo))) {
772 return;
773 }
774
775 _api.requestTopicMessages(
776 PeerId(_topicPeerId),
777 _settings.singlePeer,
778 _topicRootId,
779 [=](int count) {
780 _messagesWritten = 0;
781 _messagesCount = count;
782 setState(stateTopic(DownloadProgress()));
783 return true;
784 },
785 [=](DownloadProgress progress) {
786 setState(stateTopic(progress));
787 return true;
788 },
789 [=](Data::MessagesSlice &&slice) {
790 if (ioCatchError(_writer->writeDialogSlice(slice))) {
791 return false;
792 }
793 _messagesWritten += slice.list.size();
794 setState(stateTopic(DownloadProgress()));
795 return true;
796 },
797 [=] {
798 if (ioCatchError(_writer->writeDialogEnd())) {
799 return;
800 }
801 if (ioCatchError(_writer->finish())) {
802 return;
803 }
804 _api.finishExport([=] {
805 setFinishedState();
806 });
807 });
808}
809
810ProcessingState ControllerObject::stateTopic(
811 const DownloadProgress &progress) const {

Callers

nothing calls this directly

Calls 11

PeerIdClass · 0.85
requestTopicMessagesMethod · 0.80
finishExportMethod · 0.80
DialogInfoClass · 0.70
DownloadProgressClass · 0.70
QStringClass · 0.50
writeDialogStartMethod · 0.45
writeDialogSliceMethod · 0.45
sizeMethod · 0.45
writeDialogEndMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected