#pragma once #include "format.hpp" #include "session.hpp" #include #include #include class CSessionManager { public: CSessionManager(); ~CSessionManager(); std::pair> *newSession(); void run(); void broadcast(const std::string &msg) const; void kick(const CSession *session, const std::string &reason = "") const; void addSession(const CSession &session); void removeSession(std::pair> *session, const bool &kill = false); bool nameExists(const std::string &name); void shutdownSessions(); const CSession *getByName(const std::string &name) const; const CSession *getByIp(const char m_ip[INET_ADDRSTRLEN]) const; private: void broadcastChat(const std::string &msg, const std::string &username) const; std::vector>> m_vSessions; friend class CChatManager; }; inline std::shared_ptr g_pSessionManager;