From d580a4468a26f6b47b4dfe7c9171e680c788be41 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Thu, 13 Mar 2025 16:43:14 +0800 Subject: NFormatter: no more prefix support for socket write NFormatter: remove CHAT prefix --- src/session.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/session.cpp') diff --git a/src/session.cpp b/src/session.cpp index a990e08..2a25db2 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -84,7 +84,7 @@ CSession::SRecvData CSession::read() { } CSession::SRecvData CSession::read(const std::string &msg) { - write({}, "{}", msg, false); + write("{}", msg, false); m_isReading = true; return read(); } @@ -102,13 +102,13 @@ bool CSession::registerSession() { return false; if (recvData.data[0] == '\n' || recvData.data[0] == ' ') { - write("Name cannot be empty", ERR); + write("Name cannot be empty"); return registerSession(); } *std::remove(recvData.data, recvData.data + strlen(recvData.data), '\n') = '\0'; if (g_pSessionManager->nameExists(recvData.data)) { - write("Name already exists", ERR); + write("Name already exists"); return registerSession(); } @@ -130,8 +130,8 @@ bool CSession::isValid() { } template -bool CSession::write(eFormatType type, std::format_string fmt, Args &&...args) { - std::string msg = NFormatter::fmt(type, fmt, std::forward(args)...); +bool CSession::write(std::format_string fmt, Args &&...args) { + std::string msg = NFormatter::fmt(NONE, fmt, std::forward(args)...); if (m_isReading) msg.insert(0, "\n"); @@ -143,8 +143,8 @@ bool CSession::write(eFormatType type, std::format_string fmt, Args &&. return true; } -bool CSession::write(const std::string &msg, eFormatType type) { - return write(type, "{}", msg); +bool CSession::write(const std::string &msg) { + return write("{}", msg); } std::string CSession::getName() { @@ -156,6 +156,6 @@ void CSession::setSelf(std::pair> *self) } void CSession::onShutdown() { - write(SYS, "Shutting down, bye"); + write("Shutting down, bye"); g_pSessionManager->removeSession(self); } -- cgit v1.2.3