diff --git a/CMakeLists.txt b/CMakeLists.txt index 1aca011..6422900 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,12 +63,21 @@ find_package(spdlog REQUIRED) find_package(Jemalloc REQUIRED) find_package(Protobuf REQUIRED) + # LibEvent fucks up the CMAKE_FIND_LIBRARY_SUFFIXES variable -function(find_event) - set(LIBEVENT_STATIC_LINK TRUE) - find_package(Libevent REQUIRED) -endfunction() -find_event() +macro(find_event static) + set(_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if (${static}) + set(LIBEVENT_STATIC_LINK TRUE) + message("Use static libevent") + endif () + find_package(Libevent 2.2 REQUIRED COMPONENTS core pthreads) + if (NOT Libevent_FOUND) + message(FATAL_ERROR "Failed to find libevent (Variable: ${LIBEVENT_FOUND})") + endif () + message("Libevent version: ${Libevent_FOUND}") +endmacro() +find_event(TRUE) #FIXME: Use module for this include_directories(${breakpad_INCLUDE_DIR}) @@ -79,8 +88,8 @@ include_directories(${LIBEVENT_INCLUDE_DIRS}) include_directories(${StringVariable_INCLUDE_DIR}) add_definitions(-DINET -DINET6) +add_subdirectory(music/) add_subdirectory(shared/) add_subdirectory(server/) add_subdirectory(license/) -add_subdirectory(MusicBot/) -add_subdirectory(music/) \ No newline at end of file +add_subdirectory(MusicBot/) \ No newline at end of file diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index b589150..ee3926d 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -13,6 +13,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/environment/) #disable for debug #add_definitions(-DRELEASE_MODE) +find_event(ON) include_directories(../music/include/) include_directories(../shared/src) diff --git a/server/src/client/command_handler/misc.cpp b/server/src/client/command_handler/misc.cpp index b6291f0..301fb75 100644 --- a/server/src/client/command_handler/misc.cpp +++ b/server/src/client/command_handler/misc.cpp @@ -695,7 +695,8 @@ command_result ConnectedClient::handleCommandBanAdd(Command &cmd) { } auto max_ban_time = server->calculate_permission(permission::i_client_ban_max_bantime, this->getClientDatabaseId(), this->getType(), 0); - if (max_ban_time.has_value && !max_ban_time.has_infinite_power()) { + if(!max_ban_time.has_value) return command_result{permission::i_client_ban_max_bantime}; + if (!max_ban_time.has_infinite_power()) { if (max_ban_time.value < time) return command_result{permission::i_client_ban_max_bantime}; } @@ -844,7 +845,8 @@ command_result ConnectedClient::handleCommandBanClient(Command &cmd) { auto b_ban_hwid = permission::v2::permission_granted(1, this->calculate_permission(permission::b_client_ban_hwid, 0), false); auto max_ban_time = this->calculate_permission(permission::i_client_ban_max_bantime, 0); - if (max_ban_time.has_value && !max_ban_time.has_infinite_power()) { + if(!max_ban_time.has_value) return command_result{permission::i_client_ban_max_bantime}; + if (!max_ban_time.has_infinite_power()) { if (max_ban_time.value < time) return command_result{permission::i_client_ban_max_bantime}; } diff --git a/shared b/shared index 4aec154..a8843f5 160000 --- a/shared +++ b/shared @@ -1 +1 @@ -Subproject commit 4aec154ff161bedaa4080387ad3cf0450f1db1d3 +Subproject commit a8843f53113f814e7218f76683190072851b17df