summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorred-001 <red-001@outlook.ie>2017-04-08 19:03:57 +0100
committerSmallJoker <SmallJoker@users.noreply.github.com>2017-04-08 20:03:57 +0200
commitd4e9dd4643607192f5adebeecda86f25074f02cd (patch)
tree14683abebf623f29a7d198d9feb94b800fd84947 /src/server.cpp
parentfb4c730708a4140f05d2161c27e6c58bb0f72a9b (diff)
downloadminetest-d4e9dd4643607192f5adebeecda86f25074f02cd.tar.gz
minetest-d4e9dd4643607192f5adebeecda86f25074f02cd.tar.bz2
minetest-d4e9dd4643607192f5adebeecda86f25074f02cd.zip
Move chat command handling code from C++ to Lua (#5528)
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 224af47a7..02e365718 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -2820,25 +2820,14 @@ std::wstring Server::handleChat(const std::string &name, const std::wstring &wna
// Whether to send line to the player that sent the message, or to all players
bool broadcast_line = true;
- // Commands are implemented in Lua, so only catch invalid
- // commands that were not "eaten" and send an error back
- if (wmessage[0] == L'/') {
- std::wstring wcmd = wmessage.substr(1);
+ if (check_shout_priv && !checkPriv(name, "shout")) {
+ line += L"-!- You don't have permission to shout.";
broadcast_line = false;
- if (wcmd.length() == 0)
- line += L"-!- Empty command";
- else
- line += L"-!- Invalid command: " + str_split(wcmd, L' ')[0];
} else {
- if (check_shout_priv && !checkPriv(name, "shout")) {
- line += L"-!- You don't have permission to shout.";
- broadcast_line = false;
- } else {
- line += L"<";
- line += wname;
- line += L"> ";
- line += wmessage;
- }
+ line += L"<";
+ line += wname;
+ line += L"> ";
+ line += wmessage;
}
/*