/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once #include "dialogs/dialogs_main_list.h" class History; class ChannelData; namespace Window { class SessionController; } // namespace Window; namespace Data { class Forum final { public: explicit Forum(not_null history); ~Forum(); [[nodiscard]] not_null history() const; [[nodiscard]] not_null channel() const; [[nodiscard]] not_null topicsList(); void requestTopics(); [[nodiscard]] rpl::producer<> chatsListChanges() const; [[nodiscard]] rpl::producer<> chatsListLoadedEvents() const; void applyTopicAdded( MsgId rootId, const QString &title, DocumentId iconId); void applyTopicRemoved(MsgId rootId); [[nodiscard]] ForumTopic *topicFor(not_null item); [[nodiscard]] ForumTopic *topicFor(MsgId rootId); void applyReceivedTopics(const MTPmessages_ForumTopics &topics); [[nodiscard]] MsgId reserveCreatingId( const QString &title, DocumentId iconId); void discardCreatingId(MsgId rootId); [[nodiscard]] bool creating(MsgId rootId) const; private: void applyReceivedTopics( const MTPmessages_ForumTopics &topics, bool updateOffset); const not_null _history; base::flat_map> _topics; Dialogs::MainList _topicsList; mtpRequestId _requestId = 0; TimeId _offsetDate = 0; MsgId _offsetId = 0; MsgId _offsetTopicId = 0; bool _allLoaded = false; base::flat_set _creatingRootIds; rpl::event_stream<> _chatsListChanges; rpl::event_stream<> _chatsListLoadedEvents; }; } // namespace Data