2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-23 10:47:11 +00:00

58 lines
1.3 KiB
C
Raw Normal View History

/*
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
2022-09-20 22:12:30 +04:00
#include "dialogs/dialogs_main_list.h"
class History;
class ChannelData;
namespace Window {
class SessionController;
} // namespace Window;
namespace Data {
class Forum final {
public:
2022-09-20 22:12:30 +04:00
explicit Forum(not_null<History*> forum);
~Forum();
2022-09-20 22:12:30 +04:00
[[nodiscard]] not_null<Dialogs::MainList*> topicsList();
void requestTopics();
[[nodiscard]] rpl::producer<> chatsListChanges() const;
[[nodiscard]] rpl::producer<> chatsListLoadedEvents() const;
void applyTopicAdded(MsgId rootId, const QString &title);
void applyTopicRemoved(MsgId rootId);
[[nodiscard]] ForumTopic *topicFor(not_null<HistoryItem*> item);
2022-09-20 22:12:30 +04:00
private:
2022-09-20 22:12:30 +04:00
const not_null<History*> _forum;
base::flat_map<MsgId, std::unique_ptr<ForumTopic>> _topics;
Dialogs::MainList _topicsList;
mtpRequestId _requestId = 0;
TimeId _offsetDate = 0;
MsgId _offsetId = 0;
MsgId _offsetTopicId = 0;
bool _allLoaded = false;
rpl::event_stream<> _chatsListChanges;
rpl::event_stream<> _chatsListLoadedEvents;
};
2022-09-20 22:12:30 +04:00
void ShowAddForumTopic(
not_null<Window::SessionController*> controller,
not_null<ChannelData*> forum);
} // namespace Data