summaryrefslogtreecommitdiff
path: root/protocols/Tox/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Tox/src')
-rw-r--r--protocols/Tox/src/resource.h12
-rw-r--r--protocols/Tox/src/stdafx.h2
-rw-r--r--protocols/Tox/src/tox_connection.cpp12
-rw-r--r--protocols/Tox/src/tox_options.cpp12
-rw-r--r--protocols/Tox/src/tox_options.h5
5 files changed, 31 insertions, 12 deletions
diff --git a/protocols/Tox/src/resource.h b/protocols/Tox/src/resource.h
index ae4158d754..78d9fad660 100644
--- a/protocols/Tox/src/resource.h
+++ b/protocols/Tox/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by D:\Projects\MirandaNG\protocols\Tox\res\resource.rc
+// Used by C:\Users\unsane\Projects\c++\miranda-ng\protocols\Tox\res\resource.rc
//
#define IDI_TOX 100
#define IDD_USER_INFO 101
@@ -42,7 +42,6 @@
#define IDC_NODESLIST 1015
#define IDC_ADDNODE 1016
#define IDC_IPV4 1017
-#define IDC_UPDATENODES 1081
#define IDC_IPV6 1018
#define IDC_PORT 1019
#define IDC_PKEY 1020
@@ -52,18 +51,23 @@
#define IDC_AUDIOOUTPUT 1022
#define IDC_AUDIOFILTER 1023
#define IDC_COMBO_VIDEOINPUT 1024
+#define IDC_MAXCONNECTRETRIES 1025
+#define IDC_MAXRECONNECTRETRIES 1026
+#define IDC_MAXCONNECTRETRIESSPIN 1027
+#define IDC_MAXRECONNECTRETRIESSPIN 1028
#define IDC_DETAILS 1069
#define IDC_USERMENU 1071
#define IDC_HISTORY 1080
+#define IDC_UPDATENODES 1081
#define IDC_PROTOCOL 1580
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 116
+#define _APS_NEXT_RESOURCE_VALUE 117
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1025
+#define _APS_NEXT_CONTROL_VALUE 1029
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h
index ccef2fd2cf..c403b787ce 100644
--- a/protocols/Tox/src/stdafx.h
+++ b/protocols/Tox/src/stdafx.h
@@ -77,7 +77,7 @@ extern HINSTANCE g_hInstance;
#define TOX_ERROR -1
#define TOX_MAX_CONNECT_RETRIES 10
-#define TOX_MAX_DISCONNECT_RETRIES 10
+#define TOX_MAX_RECONNECT_RETRIES 10
#define TOX_MAX_CALLS 1
diff --git a/protocols/Tox/src/tox_connection.cpp b/protocols/Tox/src/tox_connection.cpp
index 89ce9a2e70..39b9474225 100644
--- a/protocols/Tox/src/tox_connection.cpp
+++ b/protocols/Tox/src/tox_connection.cpp
@@ -22,7 +22,8 @@ void CToxProto::TryConnect(Tox *tox)
return;
}
- if (m_iStatus++ > TOX_MAX_CONNECT_RETRIES)
+ int maxConnectRetries = getByte("MaxConnectRetries", TOX_MAX_CONNECT_RETRIES);
+ if (m_iStatus++ > maxConnectRetries)
{
SetStatus(ID_STATUS_OFFLINE);
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
@@ -33,18 +34,19 @@ void CToxProto::TryConnect(Tox *tox)
void CToxProto::CheckConnection(Tox *tox, int &retriesCount)
{
+ int maxReconnectRetries = getByte("MaxReconnectRetries", TOX_MAX_RECONNECT_RETRIES);
TOX_CONNECTION connectionStatus = tox_self_get_connection_status(tox);
if (connectionStatus != TOX_CONNECTION_NONE)
{
- if (retriesCount < TOX_MAX_DISCONNECT_RETRIES)
+ if (retriesCount < maxReconnectRetries)
{
debugLogA(__FUNCTION__": restored connection with DHT");
- retriesCount = TOX_MAX_DISCONNECT_RETRIES;
+ retriesCount = maxReconnectRetries;
}
}
else
{
- if (retriesCount == TOX_MAX_DISCONNECT_RETRIES)
+ if (retriesCount == maxReconnectRetries)
{
retriesCount--;
debugLogA(__FUNCTION__": lost connection with DHT");
@@ -65,7 +67,7 @@ void CToxProto::CheckingThread(void *arg)
debugLogA(__FUNCTION__": entering");
Tox *tox = (Tox*)arg;
- int retriesCount = TOX_MAX_DISCONNECT_RETRIES;
+ int retriesCount = getByte("MaxReconnectRetries", TOX_MAX_RECONNECT_RETRIES);
while (!isTerminated)
{
if (m_iStatus < ID_STATUS_ONLINE)
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp
index 22249057e8..87cb0b77e5 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -6,15 +6,18 @@ 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_enableIPv6(this, IDC_ENABLE_IPV6),
+ m_maxConnectRetries(this, IDC_MAXCONNECTRETRIES), m_maxConnectRetriesSpin(this, IDC_MAXCONNECTRETRIESSPIN),
+ m_maxReconnectRetries(this, IDC_MAXRECONNECTRETRIES), m_maxReconnectRetriesSpin(this, IDC_MAXRECONNECTRETRIESSPIN)
{
-
CreateLink(m_toxAddress, TOX_SETTINGS_ID, L"");
CreateLink(m_nickname, "Nick", L"");
CreateLink(m_password, "Password", L"");
CreateLink(m_group, TOX_SETTINGS_GROUP, L"Tox");
CreateLink(m_enableUdp, "EnableUDP", DBVT_BYTE, TRUE);
CreateLink(m_enableIPv6, "EnableIPv6", DBVT_BYTE, FALSE);
+ CreateLink(m_maxConnectRetries, "MaxConnectRetries", DBVT_BYTE, TOX_MAX_CONNECT_RETRIES);
+ CreateLink(m_maxReconnectRetries, "MaxReconnectRetries", DBVT_BYTE, TOX_MAX_RECONNECT_RETRIES);
m_toxAddressCopy.OnClick = Callback(this, &CToxOptionsMain::ToxAddressCopy_OnClick);
m_profileCreate.OnClick = Callback(this, &CToxOptionsMain::ProfileCreate_OnClick);
@@ -42,6 +45,11 @@ void CToxOptionsMain::OnInitDialog()
SendMessage(m_nickname.GetHwnd(), EM_LIMITTEXT, TOX_MAX_NAME_LENGTH, 0);
SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 32, 0);
SendMessage(m_group.GetHwnd(), EM_LIMITTEXT, 64, 0);
+
+ m_maxConnectRetriesSpin.SetRange(255, 1);
+ m_maxConnectRetriesSpin.SetPosition(m_proto->getByte("MaxConnectRetries", TOX_MAX_CONNECT_RETRIES));
+ m_maxReconnectRetriesSpin.SetRange(255, 1);
+ m_maxReconnectRetriesSpin.SetPosition(m_proto->getByte("MaxReconnectRetries", TOX_MAX_RECONNECT_RETRIES));
}
void CToxOptionsMain::ToxAddressCopy_OnClick(CCtrlButton*)
diff --git a/protocols/Tox/src/tox_options.h b/protocols/Tox/src/tox_options.h
index 675d9a2294..f134e3d554 100644
--- a/protocols/Tox/src/tox_options.h
+++ b/protocols/Tox/src/tox_options.h
@@ -19,6 +19,11 @@ private:
CCtrlCheck m_enableUdp;
CCtrlCheck m_enableIPv6;
+ CCtrlEdit m_maxConnectRetries;
+ CCtrlSpin m_maxConnectRetriesSpin;
+ CCtrlEdit m_maxReconnectRetries;
+ CCtrlSpin m_maxReconnectRetriesSpin;
+
protected:
void OnInitDialog();