1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

CSM: add requested CSM_RF_READ_PLAYERINFO (#8007)

* CSM: add requested CSM_RF_READ_PLAYERINFO

This new CSM limit permit to limit PLAYERINFO read from server.

It affects get_player_names call
This commit is contained in:
Loïc Blot 2018-12-24 10:51:10 +01:00 committed by GitHub
parent 9080d7c990
commit a5197eaebc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 6 deletions

View file

@ -116,6 +116,13 @@ int ModApiClient::l_clear_out_chat_queue(lua_State *L)
// get_player_names()
int ModApiClient::l_get_player_names(lua_State *L)
{
// clang-format off
if (getClient(L)->checkCSMRestrictionFlag(
CSMRestrictionFlags::CSM_RF_READ_PLAYERINFO)) {
return 0;
}
// clang-format on
const std::list<std::string> &plist = getClient(L)->getConnectedPlayerNames();
lua_createtable(L, plist.size(), 0);
int newTable = lua_gettop(L);