minetest/src/script/lua_api/l_server.h
est31 5e507c9829 Add server side ncurses terminal
This adds a chat console the server owner can use for administration
or to talk with players.
It runs in its own thread, which makes the user interface immune to
the server's lag, behaving just like a client, except timeout.
As it uses the same console code as the f10 console, things like nick
completion or a scroll buffer basically come for free.
The terminal itself is written in a general way so that adding a
client version later on is just about implementing an interface.

Fatal errors are printed after the console exists and the ncurses
terminal buffer gets cleaned up with endwin(), so that the error still
remains visible.

The server owner can chose their username their entered text will
have in chat and where players can send PMs to.
Once the username is secured with a password to prevent anybody to
take over the server, the owner can execute admin tasks over the
console.

This change includes a contribution by @kahrl who has improved ncurses
library detection.
2015-11-06 08:51:14 +01:00

111 lines
2.8 KiB
C++

/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef L_SERVER_H_
#define L_SERVER_H_
#include "lua_api/l_base.h"
class ModApiServer : public ModApiBase {
private:
// request_shutdown([message], [reconnect])
static int l_request_shutdown(lua_State *L);
// get_server_status()
static int l_get_server_status(lua_State *L);
// get_worldpath()
static int l_get_worldpath(lua_State *L);
// is_singleplayer()
static int l_is_singleplayer(lua_State *L);
// get_current_modname()
static int l_get_current_modname(lua_State *L);
// get_modpath(modname)
static int l_get_modpath(lua_State *L);
// get_modnames()
// the returned list is sorted alphabetically for you
static int l_get_modnames(lua_State *L);
// print(text)
static int l_print(lua_State *L);
// chat_send_all(text)
static int l_chat_send_all(lua_State *L);
// chat_send_player(name, text)
static int l_chat_send_player(lua_State *L);
// show_formspec(playername,formname,formspec)
static int l_show_formspec(lua_State *L);
// sound_play(spec, parameters)
static int l_sound_play(lua_State *L);
// sound_stop(handle)
static int l_sound_stop(lua_State *L);
// get_player_privs(name, text)
static int l_get_player_privs(lua_State *L);
// get_player_ip()
static int l_get_player_ip(lua_State *L);
// get_player_information()
static int l_get_player_information(lua_State *L);
// get_ban_list()
static int l_get_ban_list(lua_State *L);
// get_ban_description()
static int l_get_ban_description(lua_State *L);
// ban_player()
static int l_ban_player(lua_State *L);
// unban_player_or_ip()
static int l_unban_player_or_ip(lua_State *L);
// kick_player(name, [message]) -> success
static int l_kick_player(lua_State *L);
// notify_authentication_modified(name)
static int l_notify_authentication_modified(lua_State *L);
// get_last_run_mod()
static int l_get_last_run_mod(lua_State *L);
// set_last_run_mod(modname)
static int l_set_last_run_mod(lua_State *L);
#ifndef NDEBUG
// cause_error(type_of_error)
static int l_cause_error(lua_State *L);
#endif
public:
static void Initialize(lua_State *L, int top);
};
#endif /* L_SERVER_H_ */