2024-04-09 15:04:18 +00:00
|
|
|
/*
|
|
|
|
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
|
|
|
|
|
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
|
|
|
|
class RecentPeers final {
|
|
|
|
public:
|
|
|
|
explicit RecentPeers(not_null<Main::Session*> session);
|
|
|
|
~RecentPeers();
|
|
|
|
|
2024-04-11 14:30:14 +00:00
|
|
|
[[nodiscard]] const std::vector<not_null<PeerData*>> &list() const;
|
|
|
|
[[nodiscard]] rpl::producer<> updates() const;
|
|
|
|
|
|
|
|
void remove(not_null<PeerData*> peer);
|
|
|
|
void bump(not_null<PeerData*> peer);
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
[[nodiscard]] QByteArray serialize() const;
|
|
|
|
void applyLocal(QByteArray serialized);
|
|
|
|
|
2024-04-09 15:04:18 +00:00
|
|
|
private:
|
|
|
|
const not_null<Main::Session*> _session;
|
|
|
|
|
2024-04-11 14:30:14 +00:00
|
|
|
std::vector<not_null<PeerData*>> _list;
|
|
|
|
rpl::event_stream<> _updates;
|
|
|
|
|
2024-04-09 15:04:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Data
|