summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Tox/res/resource.rc21
-rw-r--r--protocols/Tox/src/resource.h3
-rw-r--r--protocols/Tox/src/tox_core.cpp3
-rw-r--r--protocols/Tox/src/tox_options.cpp13
-rw-r--r--protocols/Tox/src/tox_options.h4
5 files changed, 34 insertions, 10 deletions
diff --git a/protocols/Tox/res/resource.rc b/protocols/Tox/res/resource.rc
index 25bdea7c5c..478f13fe9f 100644
--- a/protocols/Tox/res/resource.rc
+++ b/protocols/Tox/res/resource.rc
@@ -107,16 +107,20 @@ BEGIN
PUSHBUTTON "Import Tox profile",IDC_PROFILE_IMPORT,191,30,107,13
PUSHBUTTON "Copy Tox ID",IDC_CLIPBOARD,81,30,107,13,NOT WS_VISIBLE
PUSHBUTTON "Export Tox profile",IDC_PROFILE_EXPORT,191,30,107,13,NOT WS_VISIBLE
- GROUPBOX "Connection settings",IDC_STATIC,7,99,296,75
+ GROUPBOX "Connection settings",IDC_STATIC,7,99,296,106
CONTROL "Enable UDP (otherwise force Tox to use TCP)",IDC_ENABLE_UDP,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,111,286,10
- CONTROL "Enable IPv6",IDC_ENABLE_IPV6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,125,286,10
- LTEXT "Max connect retries:",IDC_STATIC,12,142,121,8
- EDITTEXT IDC_MAXCONNECTRETRIES,133,139,43,14,ES_NUMBER
- CONTROL "",IDC_MAXCONNECTRETRIESSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,166,139,10,14
- EDITTEXT IDC_MAXRECONNECTRETRIES,133,155,43,14,ES_NUMBER
- CONTROL "",IDC_MAXRECONNECTRETRIESSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,166,155,10,14
- LTEXT "Max reconnect retries:",IDC_STATIC,12,158,121,8
+ CONTROL "Enable IPv6",IDC_ENABLE_IPV6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,139,286,10
+ LTEXT "Max connect retries:",IDC_STATIC,12,171,121,8
+ EDITTEXT IDC_MAXCONNECTRETRIES,133,168,43,14,ES_NUMBER
+ CONTROL "",IDC_MAXCONNECTRETRIESSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,166,168,10,14
+ EDITTEXT IDC_MAXRECONNECTRETRIES,133,184,43,14,ES_NUMBER
+ CONTROL "",IDC_MAXRECONNECTRETRIESSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,166,184,10,14
+ LTEXT "Max reconnect retries:",IDC_STATIC,12,186,121,8
+ CONTROL "Enable UDP hole-punching",IDC_ENABLE_HOLEPUNCHING,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,24,125,274,10
+ CONTROL "Enable local network peer discovery",IDC_ENABLE_LOCALDISCOVERY,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,153,286,10
END
IDD_SEARCH DIALOGEX 0, 0, 109, 113
@@ -212,6 +216,7 @@ BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 303
VERTGUIDE, 12
+ VERTGUIDE, 24
VERTGUIDE, 81
VERTGUIDE, 133
VERTGUIDE, 298
diff --git a/protocols/Tox/src/resource.h b/protocols/Tox/src/resource.h
index a036587e91..b5f13e9d32 100644
--- a/protocols/Tox/src/resource.h
+++ b/protocols/Tox/src/resource.h
@@ -27,8 +27,9 @@
#define IDC_ENABLE_IPV6 1008
#define IDC_PROFILE_EXPORT 1009
#define IDC_DNS_ID 1010
+#define IDC_ENABLE_HOLEPUNCHING 1010
#define IDC_PROFILE_NEW 1011
-#define IDC_SAVEPERMANENT 1012
+#define IDC_ENABLE_LOCALDISCOVERY 1012
#define IDC_PROFILE_IMPORT 1013
#define IDC_SAVEPERMANENTLY 1014
#define IDC_NODESLIST 1015
diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp
index 735bcd0f3f..de977b090f 100644
--- a/protocols/Tox/src/tox_core.cpp
+++ b/protocols/Tox/src/tox_core.cpp
@@ -10,7 +10,10 @@ Tox_Options* CToxProto::GetToxOptions()
}
options->udp_enabled = getBool("EnableUDP", 1);
+ if (options->udp_enabled && getBool("EnableUDPHolePunching", 1))
+ options->hole_punching_enabled = true;
options->ipv6_enabled = getBool("EnableIPv6", 0);
+ options->local_discovery_enabled = getBool("EnableLocalDiscovery", 0);
if (m_hNetlibUser != nullptr) {
NETLIBUSERSETTINGS nlus = { sizeof(nlus) };
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp
index bf4aeea940..cdd12f7089 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -6,7 +6,8 @@ CToxOptionsMain::CToxOptionsMain(CToxProto *proto, int idDialog)
m_profileCreate(this, IDC_PROFILE_NEW), m_profileImport(this, IDC_PROFILE_IMPORT),
m_profileExport(this, IDC_PROFILE_EXPORT), m_nickname(this, IDC_NAME),
m_password(this, IDC_PASSWORD), m_group(this, IDC_GROUP),
- m_enableUdp(this, IDC_ENABLE_UDP), m_enableIPv6(this, IDC_ENABLE_IPV6),
+ m_enableUdp(this, IDC_ENABLE_UDP), m_enableUdpHolePunching(this, IDC_ENABLE_HOLEPUNCHING),
+ m_enableIPv6(this, IDC_ENABLE_IPV6), m_enableLocalDiscovery(this, IDC_ENABLE_LOCALDISCOVERY),
m_maxConnectRetries(this, IDC_MAXCONNECTRETRIES), m_maxConnectRetriesSpin(this, IDC_MAXCONNECTRETRIESSPIN),
m_maxReconnectRetries(this, IDC_MAXRECONNECTRETRIES), m_maxReconnectRetriesSpin(this, IDC_MAXRECONNECTRETRIESSPIN)
{
@@ -15,13 +16,18 @@ CToxOptionsMain::CToxOptionsMain(CToxProto *proto, int idDialog)
CreateLink(m_password, "Password", L"");
CreateLink(m_group, TOX_SETTINGS_GROUP, L"Tox");
CreateLink(m_enableUdp, "EnableUDP", DBVT_BYTE, TRUE);
+ CreateLink(m_enableUdpHolePunching, "EnableUDPHolePunching", DBVT_BYTE, TRUE);
CreateLink(m_enableIPv6, "EnableIPv6", DBVT_BYTE, FALSE);
+ CreateLink(m_enableLocalDiscovery, "EnableLocalDiscovery", DBVT_BYTE, FALSE);
if (idDialog == IDD_OPTIONS_MAIN) {
CreateLink(m_maxConnectRetries, "MaxConnectRetries", DBVT_BYTE, TOX_MAX_CONNECT_RETRIES);
CreateLink(m_maxReconnectRetries, "MaxReconnectRetries", DBVT_BYTE, TOX_MAX_RECONNECT_RETRIES);
}
+ m_enableUdp.OnChange = Callback(this, &CToxOptionsMain::EnableUdp_OnClick);
+ m_enableUdpHolePunching.Enable(m_enableUdp.GetState());
+
m_toxAddressCopy.OnClick = Callback(this, &CToxOptionsMain::ToxAddressCopy_OnClick);
m_profileCreate.OnClick = Callback(this, &CToxOptionsMain::ProfileCreate_OnClick);
m_profileImport.OnClick = Callback(this, &CToxOptionsMain::ProfileImport_OnClick);
@@ -54,6 +60,11 @@ void CToxOptionsMain::OnInitDialog()
m_maxReconnectRetriesSpin.SetPosition(m_proto->getByte("MaxReconnectRetries", TOX_MAX_RECONNECT_RETRIES));
}
+void CToxOptionsMain::EnableUdp_OnClick(CCtrlBase*)
+{
+ m_enableUdpHolePunching.Enable(m_enableUdp.GetState());
+}
+
void CToxOptionsMain::ToxAddressCopy_OnClick(CCtrlButton*)
{
char *toxAddress = m_toxAddress.GetTextA();
diff --git a/protocols/Tox/src/tox_options.h b/protocols/Tox/src/tox_options.h
index f134e3d554..011aaf6b76 100644
--- a/protocols/Tox/src/tox_options.h
+++ b/protocols/Tox/src/tox_options.h
@@ -17,7 +17,9 @@ private:
CCtrlEdit m_group;
CCtrlCheck m_enableUdp;
+ CCtrlCheck m_enableUdpHolePunching;
CCtrlCheck m_enableIPv6;
+ CCtrlCheck m_enableLocalDiscovery;
CCtrlEdit m_maxConnectRetries;
CCtrlSpin m_maxConnectRetriesSpin;
@@ -27,6 +29,8 @@ private:
protected:
void OnInitDialog();
+ void EnableUdp_OnClick(CCtrlBase*);
+
void ToxAddressCopy_OnClick(CCtrlButton*);
void ProfileCreate_OnClick(CCtrlButton*);
void ProfileImport_OnClick(CCtrlButton*);