diff options
author | Stijn Buys <ingar@osirion.org> | 2008-11-08 12:58:05 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-11-08 12:58:05 +0000 |
commit | dbb28ef3422bf2442e15d75fd52180cfb9b40102 (patch) | |
tree | 16b9f8bb8b5bfa64f9676e4eed134dbe15299c90 /src/core/netserver.cc | |
parent | e3512a1b55e97b2eba62847e6e28065eec24c92f (diff) |
adds rcon, rconpassword and sv_password
Diffstat (limited to 'src/core/netserver.cc')
-rw-r--r-- | src/core/netserver.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/core/netserver.cc b/src/core/netserver.cc index cdcdad7..c6214c9 100644 --- a/src/core/netserver.cc +++ b/src/core/netserver.cc @@ -613,6 +613,33 @@ void NetServer::parse_incoming_message(NetClient *client, const std::string & me return; } + if (command == "rcon") { + if ((message.size() > command.size()+1) && Cvar::sv_password->str().size()) { + if ((Cvar::sv_password->str().compare(client->player()->rconpassword()) == 0)) { + con_print << "^B" << client->player()->name() << "^F rcon: " << message.substr(command.size()+1) << std::endl; + + core::CommandBuffer::exec(); + core::console()->set_rcon(true); + + core::cmd() << message.substr(command.size()+1) << "\n"; + core::CommandBuffer::exec(); + + while(console()->rconbuf().size()) { + server()->send(client->player(), (*console()->rconbuf().begin())); + core::console()->rconbuf().pop_front(); + } + + // disable rcon buffering + console()->set_rcon(false); + + } else { + server()->send(client->player(), "rcon access denied"); + con_print << "^B" << client->player()->name() << "^W rcon access denied" << std::endl; + } + } + return; + + } // cup - client update entity if (command == "cup") { //con_debug << message << "\n"; |