summaryrefslogtreecommitdiff
path: root/src/chatServer.cpp
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-03-20 22:38:46 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-03-22 15:02:46 +0800
commitf25eec7a0ba4a8a868eb87c76ec8b88f76f3a124 (patch)
treea3f7c6e07b895327beee62d5f83602b6b083df33 /src/chatServer.cpp
parent45ca296a55332a4d79319f8a706f332aa8feb336 (diff)
feat: inputManager and commandHandler (#7)
server now have ability to send chat like any clients. can also run commands(registered in commands.cpp)
Diffstat (limited to 'src/chatServer.cpp')
-rw-r--r--src/chatServer.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/chatServer.cpp b/src/chatServer.cpp
index 8e9a3ab..56caf4b 100644
--- a/src/chatServer.cpp
+++ b/src/chatServer.cpp
@@ -1,5 +1,8 @@
#include "chatServer.hpp"
#include "chatManager.hpp"
+#include "commandHandler.hpp"
+#include "commands.hpp"
+#include "inputManager.hpp"
#include "log.hpp"
#include "server.hpp"
#include "sessionManager.hpp"
@@ -23,6 +26,8 @@ void CChatServer::cleanup() {
// m_sessionManagerThread.join();
g_pSessionManager.reset();
g_pServer.reset();
+ g_pCommandHandler.reset();
+ g_pInputManager.reset();
}
void CChatServer::initManagers() {
@@ -33,15 +38,20 @@ void CChatServer::initManagers() {
g_pSessionManager = std::make_shared<CSessionManager>();
log(LOG, "Creating ChatManager");
g_pChatManager = std::make_unique<CChatManager>();
+ log(LOG, "Creating InputManager");
+ g_pInputManager = std::make_unique<CInputManager>();
}
void CChatServer::start() {
initManagers();
+ log(LOG, "Creating CommandHandler");
+ g_pCommandHandler = std::make_unique<CCommandHandler>();
+ registerCommands();
+
// will await while waiting for accept() to return a new client
m_sessionManagerThread = std::jthread(&CSessionManager::run, g_pSessionManager.get());
m_sessionManagerThread.detach();
- while (true) {
- }
+ g_pInputManager->run();
}