From 84c1f94f30e0c9642982a4948221f6798123d0be Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Mon, 11 Nov 2019 21:37:28 +0100 Subject: [PATCH] Shipping libnice on board --- CMakeLists.txt | 8 ++++++- git-teaspeak | 2 +- server/CMakeLists.txt | 5 ++--- server/repro/package_server.sh | 22 ++++++++++++++++--- server/src/client/ConnectedClient.cpp | 7 ++++-- .../client/ConnectedClientNotifyHandler.cpp | 6 ++--- server/src/client/SpeakingClient.cpp | 4 ++-- 7 files changed, 39 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6f3ddda..a5f4cdb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.6) -#project(TeamSpeak) +project(TeaSpeak-Parent) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") @@ -48,6 +48,12 @@ resolve_library(LIBRARY_PATH_JSON OFF "${LIBRARY_PATH}/jsoncpp/bui resolve_library(LIBRARY_PATH_ED255 OFF "${LIBRARY_PATH}/ed25519/build/libed25519.a") resolve_library(LIBRARY_PATH_DATA_PIPES OFF "${LIBRARY_PATH}/DataPipes/build/libDataPipes.so" "${LIBRARY_PATH}/DataPipes/cmake-build-release/libDataPipes.so" "${LIBRARY_PATH}/DataPipes/cmake-build-debug/libDataPipes.so") resolve_library(LIBRARY_PATH_OPUS OFF "${LIBRARY_PATH}/opus/build/.libs/libopus.a") +resolve_library(LIBRARY_PATH_NICE OFF "${LIBRARY_PATH}/libnice/linux_${BUILD_OS_ARCH}/lib/libnice.so.10") +include_directories(${LIBRARY_PATH}/libnice/linux_${BUILD_OS_ARCH}/include) +include_directories(${LIBRARY_PATH}/glibc/linux_${BUILD_OS_ARCH}/include) +include_directories(${LIBRARY_PATH}/glibc/linux_${BUILD_OS_ARCH}/include/glib-2.0) +include_directories(${LIBRARY_PATH}/glibc/linux_${BUILD_OS_ARCH}/lib/x86_64-linux-gnu/glib-2.0/include/) +include_directories(${LIBRARY_PATH}/glibc/linux_${BUILD_OS_ARCH}/lib/i386-linux-gnu/glib-2.0/include/) add_definitions(-DINET -DINET6) add_subdirectory(shared/) diff --git a/git-teaspeak b/git-teaspeak index b3b1875..f8d7f57 160000 --- a/git-teaspeak +++ b/git-teaspeak @@ -1 +1 @@ -Subproject commit b3b187527e4d0ed2ec5ed7ab964decb9fb6da762 +Subproject commit f8d7f5737d21b4bea2a11807d61a07b0943c7590 diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 2597417..7fbe898 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -229,7 +229,7 @@ target_link_libraries(PermMapHelper SET(CPACK_PACKAGE_VERSION_MAJOR "1") SET(CPACK_PACKAGE_VERSION_MINOR "4") -SET(CPACK_PACKAGE_VERSION_PATCH "2") +SET(CPACK_PACKAGE_VERSION_PATCH "3") if(BUILD_TYPE_NAME EQUAL OFF) SET(CPACK_PACKAGE_VERSION_DATA "beta") elseif(BUILD_TYPE_NAME STREQUAL "") @@ -268,6 +268,7 @@ target_link_libraries(TeaSpeakServer ${LIBRARY_PATH_BREAKPAD} ${LIBRARY_PATH_PROTOBUF} + ${LIBRARY_PATH_NICE} #${LIBWEBRTC_LIBRARIES} #ATTENTIAN! WebRTC does not work with crypto! (Already contains a crypto version) ${LIBRARY_TOM_CRYPT} @@ -280,10 +281,8 @@ target_link_libraries(TeaSpeakServer ) if(${COMPILE_WEB_CLIENT}) - find_package(LibNice REQUIRED) find_package(UsrSCTP REQUIRED) target_link_libraries(TeaSpeakServer - LibNice::LibNice ${LIBRARY_PATH_DATA_PIPES} ) endif() diff --git a/server/repro/package_server.sh b/server/repro/package_server.sh index 3be6a56..6ec36c9 100755 --- a/server/repro/package_server.sh +++ b/server/repro/package_server.sh @@ -8,8 +8,14 @@ BUILD_FILENAME=${BUILD_INFO[3]} echo "Creating TeaSpeak ${BUILD_NAME} Build index ${BUILD_VERSION}" +if [[ -d finalenv ]]; then + rm -r finalenv +fi cp -r env finalenv -cd finalenv +cd finalenv || { + echo "failed to enter dir" + exit 1 +} echo -e "# Version: ${BUILD_FULL_NAME} # TeaSpeak version: ${BUILD_NAME} # Build version: ${BUILD_VERSION} @@ -21,10 +27,20 @@ cp TeaSpeakServer TeaSpeakServerTmp rm TeaSpeakServer mv TeaSpeakServerTmp TeaSpeakServer +#Copy libnice into place +if [[ -z ${build_os_type} || -z ${build_os_arch} ]]; then + echo "Missing build_os_type or build_os_arch." + exit 1 +fi +cp "../../../../libraries/libnice/${build_os_type}_${build_os_arch}/lib/libnice.so.10" ./libs/ || { + echo "failed to copy libnice" + exit 1 +} + strip -s -p -v TeaSpeakServer tar --dereference -czvf "../${BUILD_FILENAME}" * cd .. -rm -r finalenv -./make_symbol.sh +#rm -r finalenv +#./make_symbol.sh echo "Package created (${BUILD_FILENAME})" diff --git a/server/src/client/ConnectedClient.cpp b/server/src/client/ConnectedClient.cpp index 7f79793..5eb20c6 100644 --- a/server/src/client/ConnectedClient.cpp +++ b/server/src/client/ConnectedClient.cpp @@ -701,10 +701,13 @@ void ConnectedClient::sendChannelDescription(const std::shared_ptr if(!this->channels->channel_visible(channel)) return; - Command cmd("notifychanneledited"); + auto limit = this->getType() == CLIENT_TEAMSPEAK ? 8192 : 131130; + + auto description = channel->properties()[property::CHANNEL_DESCRIPTION].as(); + Command cmd("notifychanneledited"); cmd["cid"] = channel->channelId(); cmd["reasonid"] = 9; - cmd["channel_description"] = channel->properties()[property::CHANNEL_DESCRIPTION].as(); + cmd["channel_description"] = description.size() > limit ? description.substr(0, limit) : description; this->sendCommand(cmd, true); } diff --git a/server/src/client/ConnectedClientNotifyHandler.cpp b/server/src/client/ConnectedClientNotifyHandler.cpp index 63a5969..0c92570 100644 --- a/server/src/client/ConnectedClientNotifyHandler.cpp +++ b/server/src/client/ConnectedClientNotifyHandler.cpp @@ -649,7 +649,7 @@ bool ConnectedClient::notifyChannelEdited( const std::shared_ptr &channel, const std::vector &properties, const std::shared_ptr &invoker, - bool send_description) { + bool) { auto v_channel = this->channels->find_channel(channel->channelId()); if(!v_channel) return false; //Not visible? Important do not remove! @@ -657,11 +657,11 @@ bool ConnectedClient::notifyChannelEdited( Command notify("notifychanneledited"); for(auto prop : properties) { - auto prop_info = property::impl::info(prop); + const auto& prop_info = property::impl::info(prop); if(prop == property::CHANNEL_ORDER) notify[prop_info->name] = v_channel->previous_channel; - else if(prop == property::CHANNEL_DESCRIPTION && !send_description) { + else if(prop == property::CHANNEL_DESCRIPTION) { send_description_change = true; } else { notify[prop_info->name] = channel->properties()[prop].as(); diff --git a/server/src/client/SpeakingClient.cpp b/server/src/client/SpeakingClient.cpp index 7c54e79..ddacc6c 100644 --- a/server/src/client/SpeakingClient.cpp +++ b/server/src/client/SpeakingClient.cpp @@ -483,7 +483,7 @@ CommandResult SpeakingClient::handleCommandClientInit(Command& cmd) { size_t clones_hwid = 0; auto _own_hwid = this->getHardwareId(); - this->server->forEachClient([&](shared_ptr client) { + this->server->forEachClient([&](const shared_ptr& client) { if(client->getExternalType() != CLIENT_TEAMSPEAK) return; if(client->getUid() == this->getUid()) clones_uid++; @@ -566,7 +566,7 @@ CommandResult SpeakingClient::handleCommandClientInit(Command& cmd) { size_t count = 0; { for(const auto &cl : this->server->getClients()) - if((cl->getType() == CLIENT_TEAMSPEAK || cl->getType() == CLIENT_WEB || cl->getType() == CLIENT_TEASPEAK)) + if((cl->getType() == CLIENT_TEAMSPEAK || cl->getType() == CLIENT_WEB || cl->getType() == CLIENT_TEASPEAK || cl->getType() == CLIENT_MUSIC)) if(cl->connectionState() <= ConnectionState::CONNECTED && cl->connectionState() >= ConnectionState::INIT_HIGH) count++; }