summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Jingle/Jingle.vcxproj2
-rw-r--r--plugins/Jingle/Jingle.vcxproj.filters6
-rw-r--r--plugins/Jingle/res/resource.rc57
-rw-r--r--plugins/Jingle/src/account.cpp5
-rw-r--r--plugins/Jingle/src/account.h1
-rw-r--r--plugins/Jingle/src/options.cpp61
-rw-r--r--plugins/Jingle/src/resource.h9
-rw-r--r--plugins/Jingle/src/stdafx.h3
-rw-r--r--plugins/Jingle/src/voip.cpp31
9 files changed, 144 insertions, 31 deletions
diff --git a/plugins/Jingle/Jingle.vcxproj b/plugins/Jingle/Jingle.vcxproj
index 4e625da708..6e232a8a48 100644
--- a/plugins/Jingle/Jingle.vcxproj
+++ b/plugins/Jingle/Jingle.vcxproj
@@ -34,12 +34,14 @@
<ClCompile Include="..\..\protocols\JabberG\src\jabber_xml.cpp" />
<ClCompile Include="src\account.cpp" />
<ClCompile Include="src\main.cpp" />
+ <ClCompile Include="src\options.cpp" />
<ClCompile Include="src\stdafx.cxx">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\voip.cpp" />
<ClInclude Include="..\ExternalAPI\m_jingle.h" />
<ClInclude Include="src\account.h" />
+ <ClInclude Include="src\resource.h" />
<ClInclude Include="src\stdafx.h" />
<ClInclude Include="src\version.h" />
</ItemGroup>
diff --git a/plugins/Jingle/Jingle.vcxproj.filters b/plugins/Jingle/Jingle.vcxproj.filters
index edcb62535d..303251fe77 100644
--- a/plugins/Jingle/Jingle.vcxproj.filters
+++ b/plugins/Jingle/Jingle.vcxproj.filters
@@ -17,6 +17,9 @@
<ClCompile Include="..\..\protocols\JabberG\src\jabber_xml.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\options.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\stdafx.h">
@@ -31,6 +34,9 @@
<ClInclude Include="..\ExternalAPI\m_jingle.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="src\resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\Version.rc">
diff --git a/plugins/Jingle/res/resource.rc b/plugins/Jingle/res/resource.rc
index 5843ada411..b86b0913ab 100644
--- a/plugins/Jingle/res/resource.rc
+++ b/plugins/Jingle/res/resource.rc
@@ -1,23 +1,30 @@
// Microsoft Visual C++ generated resource script.
//
+
#include "..\src\resource.h"
+#include "winres.h"
-#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "afxres.h"
+// English (United States) resources
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
-// English (Australia) resources
+//
+// Dialog
+//
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
-#pragma code_page(1252)
+IDD_OPTIONS DIALOGEX 0, 0, 304, 222
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ CONTROL "Enable VoIP",IDC_ENABLE_VOIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,6,289,10
+ LTEXT "STUN server address:",IDC_STATIC,12,26,153,8
+ EDITTEXT IDC_STUN_ADDRESS,175,24,122,12,ES_AUTOHSCROLL
+END
/////////////////////////////////////////////////////////////////////////////
//
@@ -28,15 +35,41 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
// remains consistent on all systems.
IDI_MAIN ICON "main.ico"
-#endif // English (Australia) resources
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "..\\src\\resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "winres.h\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
+
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
+
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
diff --git a/plugins/Jingle/src/account.cpp b/plugins/Jingle/src/account.cpp
index 9a334942e1..ecdfb01152 100644
--- a/plugins/Jingle/src/account.cpp
+++ b/plugins/Jingle/src/account.cpp
@@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static int OnModulesLoaded(WPARAM, LPARAM)
{
+ HookEvent(ME_OPT_INITIALISE, OnOptionsInit);
+
for (auto &it : Accounts())
if (auto *pApi = getJabberApi(it->szModuleName)) {
auto *pAccount = new CJabberAccount(pApi);
@@ -270,7 +272,8 @@ static INT_PTR __cdecl JabberVOIP_dropcall(void *pThis, WPARAM id, LPARAM)
CJabberAccount::CJabberAccount(IJabberInterface *_1) :
m_api(_1),
m_szModuleName(m_api->GetModuleName()),
- m_bEnableVOIP(m_api->GetModuleName(), "EnableVOIP", false)
+ m_bEnableVOIP(m_api->GetModuleName(), "EnableVOIP", false),
+ m_szStunServer(m_api->GetModuleName(), "StunServer", L"")
{
CMStringA tmp(m_szModuleName);
m_hVoiceEvent = CreateHookableEvent(tmp + PE_VOICE_CALL_STATE);
diff --git a/plugins/Jingle/src/account.h b/plugins/Jingle/src/account.h
index ae974b9363..4c47b22837 100644
--- a/plugins/Jingle/src/account.h
+++ b/plugins/Jingle/src/account.h
@@ -9,6 +9,7 @@ struct CJabberAccount : public MZeroedObject
IJabberInterface *m_api;
CMOption<bool> m_bEnableVOIP;
+ CMOption<wchar_t *> m_szStunServer;
void Init();
static void InitHooks();
diff --git a/plugins/Jingle/src/options.cpp b/plugins/Jingle/src/options.cpp
new file mode 100644
index 0000000000..36c68d1035
--- /dev/null
+++ b/plugins/Jingle/src/options.cpp
@@ -0,0 +1,61 @@
+/*
+Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org)
+
+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 version 2
+of the License.
+
+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"
+
+class CVoipOptionsDlg : public CDlgBase
+{
+ CCtrlEdit edtStun;
+ CCtrlCheck chkEnable;
+
+public:
+ CVoipOptionsDlg(CJabberAccount *pAcc) :
+ CDlgBase(g_plugin, IDD_OPTIONS),
+ edtStun(this, IDC_STUN_ADDRESS),
+ chkEnable(this, IDC_ENABLE_VOIP)
+ {
+ CreateLink(edtStun, pAcc->m_szStunServer);
+ CreateLink(chkEnable, pAcc->m_bEnableVOIP);
+ }
+
+ void onChange_Enable(CCtrlCheck *)
+ {
+ bool bEnable = chkEnable.IsChecked();
+ edtStun.Enable(bEnable);
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Module entry point
+
+int OnOptionsInit(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = {};
+ odp.szGroup.w = LPGENW("Network");
+ odp.szTab.w = LPGENW("VoIP");
+ odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
+
+ for (auto &it : g_arJabber) {
+ if (auto *pa = Proto_GetAccount(it->m_szModuleName)) {
+ odp.szTitle.w = pa->tszAccountName;
+ odp.pDialog = new CVoipOptionsDlg(it);
+ g_plugin.addOptions(wParam, &odp);
+ }
+ }
+
+ return 0;
+}
diff --git a/plugins/Jingle/src/resource.h b/plugins/Jingle/src/resource.h
index 38cffef069..108e0d3d5a 100644
--- a/plugins/Jingle/src/resource.h
+++ b/plugins/Jingle/src/resource.h
@@ -1,16 +1,19 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by X:\install\git\miranda\miranda-ng\plugins\Alarms\res\resource.rc
+// Used by resource.rc
//
#define IDI_MAIN 101
+#define IDD_OPTIONS 102
+#define IDC_ENABLE_VOIP 1080
+#define IDC_STUN_ADDRESS 1081
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
+#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40000
-#define _APS_NEXT_CONTROL_VALUE 1080
+#define _APS_NEXT_CONTROL_VALUE 1082
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/Jingle/src/stdafx.h b/plugins/Jingle/src/stdafx.h
index ba9edde323..472215a9b2 100644
--- a/plugins/Jingle/src/stdafx.h
+++ b/plugins/Jingle/src/stdafx.h
@@ -24,6 +24,7 @@
#include <m_jingle.h>
#include <m_langpack.h>
#include <m_netlib.h>
+#include <m_options.h>
#include <m_voice.h>
#include <m_voiceservice.h>
@@ -40,4 +41,6 @@ struct CMPlugin : public PLUGIN<CMPlugin>
int Load() override;
};
+int OnOptionsInit(WPARAM wParam, LPARAM);
+
#endif //_COMMONHEADERS_H \ No newline at end of file
diff --git a/plugins/Jingle/src/voip.cpp b/plugins/Jingle/src/voip.cpp
index 6749a07686..b8c33639e4 100644
--- a/plugins/Jingle/src/voip.cpp
+++ b/plugins/Jingle/src/voip.cpp
@@ -278,7 +278,7 @@ bool CJabberAccount::VOIPCreatePipeline(void)
MessageBoxA(0, "Cannot load Gstreamer library!", 0, MB_OK | MB_ICONERROR);
goto err;
}
- gst_init(NULL, NULL);
+ gst_init(nullptr, nullptr);
g_set_print_handler(dbgprint);
gst_print("preved medved");
if (!check_plugins()) {
@@ -288,21 +288,22 @@ bool CJabberAccount::VOIPCreatePipeline(void)
gstinited = 1;
}
- #define STUN_SERVER "stun-server=stun://stun.tng.de:3478 "
- #define RTP_CAPS_OPUS "application/x-rtp,media=audio,encoding-name=OPUS,payload="
#define RTP_TWCC_URI "http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"
-
- GError *error = NULL;
- m_pipe1 = gst_parse_launch(
- "webrtcbin bundle-policy=max-bundle name=sendrecv "
- STUN_SERVER
- "autoaudiosrc ! audioconvert ! audioresample ! queue ! opusenc ! rtpopuspay name=audiopay ! "
- "queue ! " RTP_CAPS_OPUS "111 ! sendrecv. ", &error);
-
- if (error) {
- MessageBoxA(0, "Failed to parse launch: ", error->message, MB_OK);
- g_error_free(error);
- goto err;
+ {
+ CMStringA szPipeDescr;
+ szPipeDescr += "webrtcbin bundle-policy=max-bundle name=sendrecv ";
+ if (mir_wstrlen(m_szStunServer))
+ szPipeDescr.AppendFormat("stun-server=%S ", (wchar_t *)m_szStunServer);
+ szPipeDescr += "autoaudiosrc ! audioconvert ! audioresample ! queue ! opusenc ! rtpopuspay name=audiopay ! ";
+ szPipeDescr += "queue ! application/x-rtp,media=audio,encoding-name=OPUS,payload=111 ! sendrecv. ";
+
+ GError *error = nullptr;
+ m_pipe1 = gst_parse_launch(szPipeDescr, &error);
+ if (error) {
+ MessageBoxA(0, "Failed to parse launch: ", error->message, MB_OK);
+ g_error_free(error);
+ goto err;
+ }
}
m_webrtc1 = gst_bin_get_by_name(GST_BIN(m_pipe1), "sendrecv");