diff options
| author | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2025-05-21 11:33:19 +0000 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-05-21 22:49:45 +0800 |
| commit | 99fa221f86cb8a2a5d9f4d03c2a7937d4fca4e6c (patch) | |
| tree | a4cf43a5a0e073e2c11bbeac61f4c250909458fc | |
| parent | 554a0a88b805dbee8361908538e072302c3ebfa8 (diff) | |
style: clang-format
| -rw-r--r-- | src/IOManager.hpp | 6 | ||||
| -rw-r--r-- | src/commandHandler.cpp | 4 | ||||
| -rw-r--r-- | src/commandHandler.hpp | 4 | ||||
| -rw-r--r-- | src/session.hpp | 2 | ||||
| -rw-r--r-- | src/sessionManager.cpp | 4 | ||||
| -rw-r--r-- | src/sessionManager.hpp | 2 |
6 files changed, 11 insertions, 11 deletions
diff --git a/src/IOManager.hpp b/src/IOManager.hpp index cc21a90..670e597 100644 --- a/src/IOManager.hpp +++ b/src/IOManager.hpp @@ -15,14 +15,14 @@ class CIOManager { }; struct SIO { // once a time - std::optional<CChatManager::SMessage> msg = std::nullopt; - std::optional<SLog> log = std::nullopt; + std::optional<CChatManager::SMessage> msg = std::nullopt; + std::optional<SLog> log = std::nullopt; std::optional<std::pair<std::string, std::string>> custom = std::nullopt; }; const std::vector<SIO> &getIO() const; void addLog(const SLog &log); - void addMessage(const CChatManager::SMessage &msg); + void addMessage(const CChatManager::SMessage &msg); void addCustom(const std::pair<std::string, std::string> &custom); private: diff --git a/src/commandHandler.cpp b/src/commandHandler.cpp index 7ca559d..731ea3f 100644 --- a/src/commandHandler.cpp +++ b/src/commandHandler.cpp @@ -56,7 +56,7 @@ CCommandHandler::SResult CCommandHandler::exeCommand(const SCommand &command, co return command.exe(parsed); } -CCommandHandler::SResult CCommandHandler::newCommand(const std::string &command, const std::string &args, CSession* const user) const { +CCommandHandler::SResult CCommandHandler::newCommand(const std::string &command, const std::string &args, CSession *const user) const { if (!validCommand(command)) return {.result = "Invalid command", .good = false}; @@ -67,7 +67,7 @@ CCommandHandler::SResult CCommandHandler::newCommand(const std::string &command, return exeCommand(*cmd, args); } -void CCommandHandler::handleCommand(std::string input, CSession* const user) const { +void CCommandHandler::handleCommand(std::string input, CSession *const user) const { input = input.substr(1); std::string command; diff --git a/src/commandHandler.hpp b/src/commandHandler.hpp index f446574..bce93d2 100644 --- a/src/commandHandler.hpp +++ b/src/commandHandler.hpp @@ -34,8 +34,8 @@ class CCommandHandler { bool validCommand(const std::string &command) const; // return false if command struct is invalid bool registerCommand(const SCommand &command); - SResult newCommand(const std::string &command, const std::string &args, CSession* const user) const; - void handleCommand(std::string input, CSession* const user = nullptr) const; + SResult newCommand(const std::string &command, const std::string &args, CSession *const user) const; + void handleCommand(std::string input, CSession *const user = nullptr) const; template <typename T> struct SMakeCommandArgs { diff --git a/src/session.hpp b/src/session.hpp index e33635d..ad2cc24 100644 --- a/src/session.hpp +++ b/src/session.hpp @@ -24,7 +24,7 @@ class CSession { const std::string &getName() const; const std::string &getIp() const; - bool isAdmin() const; + bool isAdmin() const; void setSelf(std::pair<std::jthread, std::shared_ptr<CSession>> *self); std::unique_ptr<SRecvData> read(); diff --git a/src/sessionManager.cpp b/src/sessionManager.cpp index 4f68e2e..a7cbaf6 100644 --- a/src/sessionManager.cpp +++ b/src/sessionManager.cpp @@ -1,12 +1,12 @@ #include "sessionManager.hpp" #include "IOManager.hpp" +#include "chatServer.hpp" #include "log.hpp" #include "session.hpp" #include <algorithm> #include <ranges> #include <unistd.h> #include <utility> -#include "chatServer.hpp" void CSessionManager::shutdownSessions() { if (m_vSessions.empty()) @@ -48,7 +48,7 @@ void CSessionManager::run() { newSession(); } -void CSessionManager::broadcast(const std::string &msg, std::optional<const CSession* const> self) const { +void CSessionManager::broadcast(const std::string &msg, std::optional<const CSession *const> self) const { for (const auto &[thread, session] : m_vSessions) if (!self || (self && session.get() != *self)) session->write(msg); diff --git a/src/sessionManager.hpp b/src/sessionManager.hpp index 6d3750e..3aa4b19 100644 --- a/src/sessionManager.hpp +++ b/src/sessionManager.hpp @@ -15,7 +15,7 @@ class CSessionManager { std::pair<std::jthread, std::shared_ptr<CSession>> *newSession(); void run(); - void broadcast(const std::string &msg, std::optional<const CSession* const> self = std::nullopt) const; // second param only specified when we want to exclude the sender + void broadcast(const std::string &msg, std::optional<const CSession *const> self = std::nullopt) const; // second param only specified when we want to exclude the sender void kick(CSession *session, const bool kill = false, const std::string &reason = ""); void kick(std::pair<std::jthread, std::shared_ptr<CSession>> *session, const bool kill = false, const std::string &reason = ""); void addSession(const CSession &session); |
