/* 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 class PeerData; namespace Main { class Session; class SendAsPeers final { public: explicit SendAsPeers(not_null session); bool shouldChoose(not_null peer); void refresh(not_null peer); [[nodiscard]] const std::vector> &list( not_null peer) const; [[nodiscard]] rpl::producer> updated() const; void saveChosen(not_null peer, not_null chosen); void setChosen(not_null peer, PeerId chosenId); [[nodiscard]] PeerId chosen(not_null peer) const; [[nodiscard]] not_null resolveChosen( not_null peer) const; [[nodiscard]] static not_null ResolveChosen( not_null peer, const std::vector> &list, PeerId chosen); private: void request(not_null peer); const not_null _session; const std::vector> _onlyMe; base::flat_map< not_null, std::vector>> _lists; base::flat_map, crl::time> _lastRequestTime; base::flat_map, PeerId> _chosen; rpl::event_stream> _updates; }; } // namespace Main