diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2011-08-13 17:37:31 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2011-08-22 13:02:08 +0200 |
commit | da19aee307221dd2e6bdd00393124587654d0206 (patch) | |
tree | a49472a8024d1bbe9209f746d3d0e6e96ebdb7f2 | |
parent | d2c0b4905abd895b87d5ed9b8769b1a60d692970 (diff) | |
download | minetest-da19aee307221dd2e6bdd00393124587654d0206.tar.gz minetest-da19aee307221dd2e6bdd00393124587654d0206.tar.bz2 minetest-da19aee307221dd2e6bdd00393124587654d0206.zip |
Server now supports replies without prefix
-rw-r--r-- | src/server.cpp | 12 | ||||
-rw-r--r-- | src/servercommand.h | 1 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/server.cpp b/src/server.cpp index fabfbc84e..f66592047 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -3247,13 +3247,11 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) // Parse commands if(message[0] == L'/') { - line += L"Server: "; - size_t strip_size = 1; if (message[1] == L'#') // support old-style commans ++strip_size; message = message.substr(strip_size); - + WStrfnd f1(message); f1.next(L" "); // Skip over /#whatever std::wstring paramstring = f1.next(L""); @@ -3266,9 +3264,15 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) player, privs); - line += processServerCommand(ctx); + std::wstring reply(processServerCommand(ctx)); send_to_sender = ctx->flags & SEND_TO_SENDER; send_to_others = ctx->flags & SEND_TO_OTHERS; + + if (ctx->flags & SEND_NO_PREFIX) + line += reply; + else + line += L"Server: " + reply; + delete ctx; } diff --git a/src/servercommand.h b/src/servercommand.h index 15679f333..648a57332 100644 --- a/src/servercommand.h +++ b/src/servercommand.h @@ -27,6 +27,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #define SEND_TO_SENDER (1<<0) #define SEND_TO_OTHERS (1<<1) +#define SEND_NO_PREFIX (1<<2) struct ServerCommandContext { |