/* 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_entry.h" #include "data/data_messages.h" class ChannelData; class AuthSession; namespace Data { class Session; class Folder; enum class FolderUpdateFlag { List, }; struct FolderUpdate { not_null folder; FolderUpdateFlag flag; }; //MessagePosition FeedPositionFromMTP(const MTPFeedPosition &position); // #feed class Folder : public Dialogs::Entry { public: static constexpr auto kId = 1; Folder(not_null owner, FolderId id); Folder(const Folder &) = delete; Folder &operator=(const Folder &) = delete; Data::Session &owner() const; AuthSession &session() const; FolderId id() const; void registerOne(not_null history); void unregisterOne(not_null history); void updateChatListMessage(not_null item); void messageRemoved(not_null item); void historyCleared(not_null history); void applyDialog(const MTPDdialogFolder &data); void setUnreadCounts(int unreadNonMutedCount, int unreadMutedCount); //void setUnreadPosition(const MessagePosition &position); // #feed void unreadCountChanged( int unreadCountDelta, int mutedCountDelta); rpl::producer unreadCountValue() const; //MessagePosition unreadPosition() const; // #feed //rpl::producer unreadPositionChanges() const; // #feed //void setUnreadMark(bool unread); //bool unreadMark() const; //int unreadCountForBadge() const; // unreadCount || unreadMark ? 1 : 0. int unreadCount() const; bool unreadCountKnown() const; bool useProxyPromotion() const override; bool toImportant() const override; bool shouldBeInChatList() const override; int chatListUnreadCount() const override; bool chatListUnreadMark() const override; bool chatListMutedBadge() const override; HistoryItem *chatListMessage() const override; bool chatListMessageKnown() const override; void requestChatListMessage() override; const QString &chatListName() const override; const base::flat_set &chatListNameWords() const override; const base::flat_set &chatListFirstLetters() const override; void changedInChatListHook(Dialogs::Mode list, bool added) override; void loadUserpic() override; void paintUserpic( Painter &p, int x, int y, int size) const override; const std::vector> &histories() const; bool historiesLoaded() const; void setHistoriesLoaded(bool loaded); //int32 chatsHash() const; //void setChats(std::vector> chats); // #feed private: void indexNameParts(); void recountChatListMessage(); void setChatListMessageFromChannels(); bool justUpdateChatListMessage(not_null item); void updateChatListDate(); void changeChatsList( const std::vector> &add, const std::vector> &remove); template void updateUnreadCounts(PerformUpdate &&performUpdate); FolderId _id = 0; not_null _owner; std::vector> _histories; bool _settingHistories = false; bool _historiesLoaded = false; QString _name; base::flat_set _nameWords; base::flat_set _nameFirstLetters; std::optional _chatListMessage; rpl::variable _unreadPosition; std::optional _unreadCount; rpl::event_stream _unreadCountChanges; int _unreadMutedCount = 0; //bool _unreadMark = false; }; } // namespace Data