#pragma once #include "chatManager.hpp" #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(CSession *session, const bool kill = false, const std::string &reason = ""); void kick(std::pair> *session, const bool kill = false, const std::string &reason = ""); void addSession(const CSession &session); bool nameExists(const std::string &name); void shutdownSessions(); CSession *getByName(const std::string &name) const; CSession *getByIp(const char m_ip[INET_ADDRSTRLEN]) const; std::vector> getSessions() const; private: void broadcastChat(const CChatManager::SMessage &msg) const; std::vector>> m_vSessions; friend class CChatManager; }; inline std::shared_ptr g_pSessionManager;