From 3e19bf603af0ac01f6690afe7cf59702a4a5cc02 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 21 Mar 2025 18:09:05 +0800 Subject: feat(commands): client execute commands (#8) refactor(session): writeChat, unify written chat internal: removed `CChatManager::broadcastMessage`, just use `g_pSessionManager->broadcastChat(msg)` --- src/session.hpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/session.hpp') diff --git a/src/session.hpp b/src/session.hpp index 18c587d..1b7b8db 100644 --- a/src/session.hpp +++ b/src/session.hpp @@ -1,6 +1,7 @@ #pragma once #include "FileDescriptor.hpp" +#include "chatManager.hpp" #include "format.hpp" #include #include @@ -32,12 +33,15 @@ class CSession { bool write(std::format_string fmt, Args &&...args); template bool write(eFormatType type, std::format_string fmt, Args &&...args); + void writeChat(const CChatManager::SMessage &msg); void run(); bool isValid(); private: + constexpr static char m_adminIps[1][INET_ADDRSTRLEN] = {"127.0.0.1"}; + enum eEventType : std::uint8_t { READ, WRITE @@ -50,6 +54,7 @@ class CSession { std::string m_name; char m_ip[INET_ADDRSTRLEN]; int m_port; + bool m_isAdmin = false; bool m_isReading = false; -- cgit v1.2.3