From ac3929126ffd550079c30c2ae120d640aaa0f25c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 7 Jun 2024 16:28:48 +0300 Subject: Discord to be packed with libsodium --- protocols/Discord/src/main.cpp | 5 +++++ protocols/Discord/src/proto.h | 2 +- protocols/Discord/src/stdafx.h | 1 + protocols/Discord/src/voice.cpp | 6 ------ protocols/Discord/src/voice_client.cpp | 27 +++++++++++++++++++++++++++ 5 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 protocols/Discord/src/voice_client.cpp (limited to 'protocols/Discord/src') diff --git a/protocols/Discord/src/main.cpp b/protocols/Discord/src/main.cpp index 17a10bf78e..023a7b7925 100644 --- a/protocols/Discord/src/main.cpp +++ b/protocols/Discord/src/main.cpp @@ -72,6 +72,11 @@ static int OnModulesLoaded(WPARAM, LPARAM) int CMPlugin::Load() { + if (sodium_init() < 0) { + Netlib_Log(0, "libsodium cannot be initialized"); + bVoiceEnabled = false; + } + HookEvent(ME_SYSTEM_MODULESLOADED, &OnModulesLoaded); g_plugin.registerIcon("Protocols/Discord", g_iconList); diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index 98a3b1343b..32dce00906 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -608,7 +608,7 @@ struct CMPlugin : public ACCPROTOPLUGIN { CMPlugin(); - bool bVoiceService = false; + bool bVoiceService = false, bVoiceEnabled = true; int Load() override; }; diff --git a/protocols/Discord/src/stdafx.h b/protocols/Discord/src/stdafx.h index 9987d6a256..95990b7dd2 100644 --- a/protocols/Discord/src/stdafx.h +++ b/protocols/Discord/src/stdafx.h @@ -51,6 +51,7 @@ #include #include "../../libs/zlib/src/zlib.h" +#include "../../libs/libsodium/src/include/sodium.h" extern IconItem g_iconList[]; diff --git a/protocols/Discord/src/voice.cpp b/protocols/Discord/src/voice.cpp index b30d7b166a..fad1728896 100644 --- a/protocols/Discord/src/voice.cpp +++ b/protocols/Discord/src/voice.cpp @@ -89,12 +89,6 @@ void CDiscordProto::TryVoiceStart(CDiscordGuild *pGuild) } } -void CDiscordProto::VoiceClientThread(void *param) -{ - auto *pCall = (CDiscordVoiceCall *)param; - pCall->startTime = time(0); -} - ///////////////////////////////////////////////////////////////////////////////////////// // call operations (voice & video) diff --git a/protocols/Discord/src/voice_client.cpp b/protocols/Discord/src/voice_client.cpp new file mode 100644 index 0000000000..e20f6c95a9 --- /dev/null +++ b/protocols/Discord/src/voice_client.cpp @@ -0,0 +1,27 @@ +/* +Copyright © 2016-22 Miranda NG team + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include "stdafx.h" + +void CDiscordProto::VoiceClientThread(void *param) +{ + auto *pCall = (CDiscordVoiceCall *)param; + pCall->startTime = time(0); + + int nLoops = 0; + time_t lastLoopTime = time(0); +} -- cgit v1.2.3