aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-08-22 14:46:54 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-08-22 14:46:54 +0300
commit5415256a529eca1317b835ceea54a6ee6633cb97 (patch)
tree85e53482194f189437bc848cbb225a235ac7fcac /src/server.cpp
parent836e43db60ff1f3c9d160d0d58ba5a631c4293fc (diff)
parent9c94538fb7a7d7712d8da21d16790359a853f575 (diff)
downloadminetest-5415256a529eca1317b835ceea54a6ee6633cb97.tar.gz
minetest-5415256a529eca1317b835ceea54a6ee6633cb97.tar.bz2
minetest-5415256a529eca1317b835ceea54a6ee6633cb97.zip
Merge remote-tracking branch 'oblomov/me_cmd'
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 5b657bc2e..f66592047 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -3245,13 +3245,13 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
u64 privs = getPlayerPrivs(player);
// Parse commands
- std::wstring commandprefix = L"/#";
- if(message.substr(0, commandprefix.size()) == commandprefix)
+ 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);
- message = message.substr(commandprefix.size());
-
WStrfnd f1(message);
f1.next(L" "); // Skip over /#whatever
std::wstring paramstring = f1.next(L"");
@@ -3264,9 +3264,15 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id)
player,
privs);
- line += processServerCommand(ctx);
- send_to_sender = ctx->flags & 1;
- send_to_others = ctx->flags & 2;
+ 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;
}