#pragma once #include "../debug/format.hpp" #include "../misc/memory.hpp" #include "chatManager.hpp" #include "session.hpp" #include #include class CSessionManager { public: CSessionManager(); ~CSessionManager(); void newSession(); void run(); void broadcast(const std::string &msg, std::optional> self = std::nullopt) const; // second param only specified when we want to exclude the sender void kick(WP session, const bool kill = false, const std::string &reason = ""); void addSession(const CSession &session); bool nameExists(const std::string &name); void shutdownSessions(); SP getByName(const std::string &name) const; SP getByIp(const std::string &ip) const; std::vector> getSessions() const; private: void broadcast(const CChatManager::SMessage &msg) const; std::vector>> m_vSessions; friend class CChatManager; }; inline SP g_pSessionManager;