| 762 | } |
| 763 | |
| 764 | void 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 | |
| 810 | ProcessingState ControllerObject::stateTopic( |
| 811 | const DownloadProgress &progress) const { |
nothing calls this directly
no test coverage detected