aboutsummaryrefslogtreecommitdiff
path: root/NetConsole/netconsole.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'NetConsole/netconsole.cpp')
-rw-r--r--NetConsole/netconsole.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/NetConsole/netconsole.cpp b/NetConsole/netconsole.cpp
index cfdd31e1..3a59c5be 100644
--- a/NetConsole/netconsole.cpp
+++ b/NetConsole/netconsole.cpp
@@ -95,23 +95,29 @@ void CNetCon::UserInput(void)
size_t nPos = svInput.find(" ");
if (!svInput.empty() && nPos > 0 && nPos < svInput.size() && nPos != svInput.size())
{
- std::string svReqVal = svInput.substr(nPos + 1);
- std::string svReqBuf = svInput.erase(svInput.find(" "));
+ std::string svSecondArg = svInput.substr(nPos + 1);
+ std::string svFirstArg = svInput;
+ svFirstArg = svFirstArg.erase(svFirstArg.find(" "));
- if (strcmp(svReqBuf.c_str(), "PASS") == 0) // Auth with RCON server.
+ if (strcmp(svFirstArg.c_str(), "PASS") == 0) // Auth with RCON server.
{
- std::string svSerialized = this->Serialize(svReqBuf, svReqVal, cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
+ std::string svSerialized = this->Serialize(svSecondArg, "", cl_rcon::request_t::SERVERDATA_REQUEST_AUTH);
this->Send(svSerialized);
}
- else // This is a ConVar.
+ else if (strcmp(svFirstArg.c_str(), "SET") == 0) // Set value query.
{
- std::string svSerialized = this->Serialize(svReqBuf, svReqVal, cl_rcon::request_t::SERVERDATA_REQUEST_SETVALUE);
+ std::string svSerialized = this->Serialize(svFirstArg, svSecondArg, cl_rcon::request_t::SERVERDATA_REQUEST_SETVALUE);
+ this->Send(svSerialized);
+ }
+ else // Execute command query.
+ {
+ std::string svSerialized = this->Serialize(svInput.c_str(), "", cl_rcon::request_t::SERVERDATA_REQUEST_EXECCOMMAND);
this->Send(svSerialized);
}
}
- else // This is a ConCommand.
+ else // Single arg command query.
{
- std::string svSerialized = this->Serialize(svInput, "", cl_rcon::request_t::SERVERDATA_REQUEST_EXECCOMMAND);
+ std::string svSerialized = this->Serialize(svInput.c_str(), "", cl_rcon::request_t::SERVERDATA_REQUEST_EXECCOMMAND);
this->Send(svSerialized);
}
}