summaryrefslogtreecommitdiff
path: root/protocols/Discord/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-06-07 16:28:48 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-06-07 16:28:48 +0300
commitac3929126ffd550079c30c2ae120d640aaa0f25c (patch)
tree911f49df9b5d102eacce2d4d9a3de193c8c27587 /protocols/Discord/src
parent6ac39390bcfe21275c29721fff0c78158c14abb2 (diff)
Discord to be packed with libsodium
Diffstat (limited to 'protocols/Discord/src')
-rw-r--r--protocols/Discord/src/main.cpp5
-rw-r--r--protocols/Discord/src/proto.h2
-rw-r--r--protocols/Discord/src/stdafx.h1
-rw-r--r--protocols/Discord/src/voice.cpp6
-rw-r--r--protocols/Discord/src/voice_client.cpp27
5 files changed, 34 insertions, 7 deletions
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<CDiscordProto>
{
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 <m_voiceservice.h>
#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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "stdafx.h"
+
+void CDiscordProto::VoiceClientThread(void *param)
+{
+ auto *pCall = (CDiscordVoiceCall *)param;
+ pCall->startTime = time(0);
+
+ int nLoops = 0;
+ time_t lastLoopTime = time(0);
+}