From da19aee307221dd2e6bdd00393124587654d0206 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 13 Aug 2011 17:37:31 +0200 Subject: [PATCH] Server now supports replies without prefix --- src/server.cpp | 12 ++++++++---- 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 { -- 2.25.1