Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,19 +193,28 @@ jobs:
cd deps
git clone https://github.com/nlohmann/json
cd json
git checkout bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d
git checkout 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03
mkdir build
cd build
cmake ..
cmake -DJSON_BuildTests=OFF ..
make
sudo make install
sudo apt-get install libgtkmm-3.0-dev
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libopus-dev
sudo apt-get install libsodium-dev
sudo apt-get install libspdlog-dev
sudo apt-get install libhandy-1-dev

- name: Build curl from source
run: |
sudo apt-get install libbrotli-dev libidn2-dev libnghttp2-dev libpsl-dev libzstd-dev zlib1g-dev libidn-dev
wget https://github.com/curl/curl/releases/download/curl-8_12_1/curl-8.12.1.tar.xz
tar -xf curl-8.12.1.tar.xz
cd curl-8.12.1
cmake .
make
sudo make install

- name: Build
uses: lukka/run-cmake@v3
env:
Expand Down
29 changes: 2 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@ find_package(CURL)
find_package(ZLIB REQUIRED)
find_package(SQLite3 REQUIRED)
find_package(gtkmm REQUIRED)

set(USE_TLS TRUE)
set(USE_OPEN_SSL TRUE)
find_package(IXWebSocket QUIET)
if (NOT IXWebSocket_FOUND)
message("ixwebsocket was not found and will be included as a submodule")
add_subdirectory(subprojects/ixwebsocket)
include_directories(IXWEBSOCKET_INCLUDE_DIRS)
endif ()
find_package(OpenSSL REQUIRED)

if (MINGW OR WIN32)
link_libraries(ws2_32)
Expand Down Expand Up @@ -82,24 +74,6 @@ else ()
target_sources(abaddon PRIVATE src/notifications/notifier_fallback.cpp)
endif ()

if (IXWebSocket_LIBRARIES)
target_link_libraries(abaddon ${IXWebSocket_LIBRARIES})
find_library(MBEDTLS_X509_LIBRARY mbedx509)
find_library(MBEDTLS_TLS_LIBRARY mbedtls)
find_library(MBEDTLS_CRYPTO_LIBRARY mbedcrypto)
if (MBEDTLS_TLS_LIBRARY)
target_link_libraries(abaddon ${MBEDTLS_TLS_LIBRARY})
endif ()
if (MBEDTLS_X509_LIBRARY)
target_link_libraries(abaddon ${MBEDTLS_X509_LIBRARY})
endif ()
if (MBEDTLS_CRYPTO_LIBRARY)
target_link_libraries(abaddon ${MBEDTLS_CRYPTO_LIBRARY})
endif ()
else ()
target_link_libraries(abaddon $<BUILD_INTERFACE:ixwebsocket>)
endif ()

find_package(Threads)
if (Threads_FOUND)
target_link_libraries(abaddon Threads::Threads)
Expand All @@ -120,6 +94,7 @@ target_link_libraries(abaddon ${NLOHMANN_JSON_LIBRARIES})
target_link_libraries(abaddon ${CMAKE_DL_LIBS})

target_link_libraries(abaddon CURL::libcurl)
target_link_libraries(abaddon OpenSSL::SSL OpenSSL::Crypto)

include(CheckAtomic)
if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB OR NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
Expand Down
6 changes: 3 additions & 3 deletions src/discord/discord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2768,7 +2768,7 @@ EPremiumType DiscordClient::GetSelfPremiumType() const {
void DiscordClient::HeartbeatThread() {
while (m_client_connected) {
if (!m_heartbeat_acked) {
printf("wow! a heartbeat wasn't acked! how could this happen?");
spdlog::get("discord")->warn("Heartbeat not acked");
}

m_heartbeat_acked = false;
Expand Down Expand Up @@ -2855,8 +2855,8 @@ void DiscordClient::SetSuperPropertiesFromIdentity(const IdentifyMessage &identi
void DiscordClient::HandleSocketOpen() {
}

void DiscordClient::HandleSocketClose(const ix::WebSocketCloseInfo &info) {
auto close_code = static_cast<GatewayCloseCode>(info.code);
void DiscordClient::HandleSocketClose(const Websocket::CloseInfo &info) {
auto close_code = static_cast<GatewayCloseCode>(info.Code);
auto cb = [this, close_code]() {
m_heartbeat_waiter.kill();
if (m_heartbeat_thread.joinable()) m_heartbeat_thread.join();
Expand Down
2 changes: 1 addition & 1 deletion src/discord/discord.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class DiscordClient {
void SetSuperPropertiesFromIdentity(const IdentifyMessage &identity);

void HandleSocketOpen();
void HandleSocketClose(const ix::WebSocketCloseInfo &info);
void HandleSocketClose(const Websocket::CloseInfo &info);

static bool CheckCode(const http::response_type &r);
static bool CheckCode(const http::response_type &r, int expected);
Expand Down
8 changes: 4 additions & 4 deletions src/discord/voiceclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ void DiscordVoiceClient::OnWebsocketOpen() {
SetState(State::EstablishingConnection);
}

void DiscordVoiceClient::OnWebsocketClose(const ix::WebSocketCloseInfo &info) {
if (info.remote) {
m_log->debug("Websocket closed (remote): {} ({})", info.code, info.reason);
void DiscordVoiceClient::OnWebsocketClose(const Websocket::CloseInfo &info) {
if (info.Remote) {
m_log->debug("Websocket closed (remote): {} ({})", info.Code, info.Reason);
} else {
m_log->debug("Websocket closed (local): {} ({})", info.code, info.reason);
m_log->debug("Websocket closed (local): {} ({})", info.Code, info.Reason);
}
}

Expand Down
8 changes: 7 additions & 1 deletion src/discord/voiceclient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
#include <sigc++/sigc++.h>
#include <spdlog/logger.h>
#include <unordered_map>

#ifndef _WIN32
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#endif
// clang-format on

enum class VoiceGatewayCloseCode : uint16_t {
Expand Down Expand Up @@ -242,7 +248,7 @@ class DiscordVoiceClient {
void SelectProtocol(const char *ip, uint16_t port);

void OnWebsocketOpen();
void OnWebsocketClose(const ix::WebSocketCloseInfo &info);
void OnWebsocketClose(const Websocket::CloseInfo &info);
void OnWebsocketMessage(const std::string &str);

void HeartbeatThread();
Expand Down
Loading
Loading