diff options
author | est31 <MTest31@outlook.com> | 2015-07-25 07:43:32 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-11-06 08:51:14 +0100 |
commit | 5e507c9829942c434a6f1ae7a4f3a488c7e50bef (patch) | |
tree | e7bd38e0dabc494e077f37a5cb16dae3dededea7 /src/CMakeLists.txt | |
parent | 1384108f8c32f309852c1d1665a613f2a3e3fcc2 (diff) | |
download | minetest-5e507c9829942c434a6f1ae7a4f3a488c7e50bef.tar.gz minetest-5e507c9829942c434a6f1ae7a4f3a488c7e50bef.tar.bz2 minetest-5e507c9829942c434a6f1ae7a4f3a488c7e50bef.zip |
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.
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 72b52436c..55f5d4ad8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -160,6 +160,20 @@ find_package(Lua REQUIRED) find_package(GMP REQUIRED) +option(ENABLE_CURSES "Enable ncurses console" TRUE) +set(USE_CURSES FALSE) + +if(ENABLE_CURSES) + find_package(Ncursesw) + if(CURSES_FOUND) + set(USE_CURSES TRUE) + message(STATUS "ncurses console enabled.") + include_directories(${CURSES_INCLUDE_DIRS}) + else() + message(STATUS "ncurses not found!") + endif() +endif(ENABLE_CURSES) + option(ENABLE_LEVELDB "Enable LevelDB backend" TRUE) set(USE_LEVELDB FALSE) @@ -322,6 +336,7 @@ set(common_SRCS areastore.cpp ban.cpp cavegen.cpp + chat.cpp clientiface.cpp collision.cpp content_abm.cpp @@ -387,6 +402,7 @@ set(common_SRCS sound.cpp staticobject.cpp subgame.cpp + terminal_chat_console.cpp tool.cpp treegen.cpp version.cpp @@ -431,7 +447,6 @@ set(client_SRCS ${sound_SRCS} ${client_network_SRCS} camera.cpp - chat.cpp client.cpp clientmap.cpp clientmedia.cpp @@ -558,6 +573,9 @@ if(BUILD_CLIENT) ${CGUITTFONT_LIBRARY} ) endif() + if (USE_CURSES) + target_link_libraries(${PROJECT_NAME} ${CURSES_LIBRARIES}) + endif() if (USE_LEVELDB) target_link_libraries(${PROJECT_NAME} ${LEVELDB_LIBRARY}) endif() @@ -585,6 +603,9 @@ if(BUILD_SERVER) ) set_target_properties(${PROJECT_NAME}server PROPERTIES COMPILE_DEFINITIONS "SERVER") + if (USE_CURSES) + target_link_libraries(${PROJECT_NAME}server ${CURSES_LIBRARIES}) + endif() if (USE_LEVELDB) target_link_libraries(${PROJECT_NAME}server ${LEVELDB_LIBRARY}) endif() |