diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server.cpp | 8 | ||||
-rw-r--r-- | src/server.h | 3 | ||||
-rw-r--r-- | src/servercommand.cpp | 18 |
3 files changed, 27 insertions, 2 deletions
diff --git a/src/server.cpp b/src/server.cpp index 3e22a023a..3e1034f50 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -4148,6 +4148,14 @@ void Server::saveConfig() g_settings->updateConfigFile(m_configpath.c_str()); } +void Server::notifyPlayer(const char *name, const std::wstring msg) +{ + Player *player = m_env.getPlayer(name); + if(!player) + return; + SendChatMessage(player->peer_id, std::wstring(L"Server: -!- ")+msg); +} + v3f findSpawnPos(ServerMap &map) { //return v3f(50,50,50)*BS; diff --git a/src/server.h b/src/server.h index f65bd1957..1e7e41c96 100644 --- a/src/server.h +++ b/src/server.h @@ -472,6 +472,9 @@ public: { return m_con.GetPeerNoEx(peer_id); } + + // Envlock and conlock should be locked when calling this + void notifyPlayer(const char *name, const std::wstring msg); private: diff --git a/src/servercommand.cpp b/src/servercommand.cpp index 98777adcc..3c0e6d510 100644 --- a/src/servercommand.cpp +++ b/src/servercommand.cpp @@ -97,15 +97,29 @@ void cmd_grantrevoke(std::wostringstream &os, u64 privs = ctx->server->getPlayerAuthPrivs(playername); if(ctx->parms[0] == L"grant"){ + privs |= newprivs; actionstream<<ctx->player->getName()<<" grants " <<wide_to_narrow(ctx->parms[2])<<" to " <<playername<<std::endl; - privs |= newprivs; + + std::wstring msg; + msg += narrow_to_wide(ctx->player->getName()); + msg += L" granted you the privilege \""; + msg += ctx->parms[2]; + msg += L"\""; + ctx->server->notifyPlayer(playername.c_str(), msg); } else { + privs &= ~newprivs; actionstream<<ctx->player->getName()<<" revokes " <<wide_to_narrow(ctx->parms[2])<<" from " <<playername<<std::endl; - privs &= ~newprivs; + + std::wstring msg; + msg += narrow_to_wide(ctx->player->getName()); + msg += L" revoked from you the privilege \""; + msg += ctx->parms[2]; + msg += L"\""; + ctx->server->notifyPlayer(playername.c_str(), msg); } ctx->server->setPlayerAuthPrivs(playername, privs); |