summaryrefslogtreecommitdiff
path: root/src/commandHandler.cpp
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-04-04 11:53:03 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-04-07 16:32:07 +0800
commit4c904905f5f0667786d4c4b32d150b3d4328cfc2 (patch)
treea397604070be947ea051f0db3555c34e604686df /src/commandHandler.cpp
parent48c6f2384592c42a0fdbb6e420c77f6e10209f24 (diff)
session: use std::string for m_ip instead of c char
Diffstat (limited to 'src/commandHandler.cpp')
-rw-r--r--src/commandHandler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/commandHandler.cpp b/src/commandHandler.cpp
index 6340625..7c04f68 100644
--- a/src/commandHandler.cpp
+++ b/src/commandHandler.cpp
@@ -61,7 +61,7 @@ CCommandHandler::SResult CCommandHandler::newCommand(const std::string &command,
return exeCommand(*getCommand(command), args);
}
-void CCommandHandler::handleCommand(std::string input, const char ip[INET_ADDRSTRLEN]) const {
+void CCommandHandler::handleCommand(std::string input, const std::string &ip) const {
input = input.substr(1);
std::string command;
@@ -84,7 +84,7 @@ void CCommandHandler::handleCommand(std::string input, const char ip[INET_ADDRST
std::function<void(eFormatType, const std::string &)> outputter = [](eFormatType type, const std::string &msg) { log(type, "{}", msg); };
- if (ip != nullptr)
+ if (!ip.empty())
if (auto session = g_pSessionManager->getByIp(ip))
outputter = [session](eFormatType, const std::string &msg) { session->write(msg); };