This commit is contained in:
WolverinDEV 2020-01-30 12:06:39 +01:00
parent 7693f962ca
commit 8d186c18cd
4 changed files with 22 additions and 10 deletions

View File

@ -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/)
add_subdirectory(MusicBot/)

View File

@ -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)

View File

@ -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};
}

2
shared

@ -1 +1 @@
Subproject commit 4aec154ff161bedaa4080387ad3cf0450f1db1d3
Subproject commit a8843f53113f814e7218f76683190072851b17df