summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2017-03-27 00:50:53 +0300
committeraunsane <aunsane@gmail.com>2017-03-27 00:51:31 +0300
commit80646f0b4671c647aa76cb5619f74edccb9e3108 (patch)
tree49bbda1f51bfcd669336161853dff928ef8f18b6
parent2d161955dabcb5a8a8b6069f94945ec7657805bf (diff)
Tox: added new options
- max connect retries - max reconnect retries
-rw-r--r--protocols/Tox/res/resource.rc31
-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
6 files changed, 55 insertions, 19 deletions
diff --git a/protocols/Tox/res/resource.rc b/protocols/Tox/res/resource.rc
index 77d0bd1bef..9d5c6810b0 100644
--- a/protocols/Tox/res/resource.rc
+++ b/protocols/Tox/res/resource.rc
@@ -63,11 +63,16 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_TOX ICON "icons\\tox.ico"
+
IDI_AUDIO_CALL ICON "icons\\audio_call.ico"
+
IDI_AUDIO_END ICON "icons\\audio_end.ico"
+
IDI_AUDIO_RING ICON "icons\\audio_ring.ico"
+
IDI_AUDIO_START ICON "icons\\audio_start.ico"
+
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
@@ -97,12 +102,12 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Tox",IDC_STATIC,7,7,296,116
+ GROUPBOX "Tox",IDC_STATIC,7,7,296,90
LTEXT "Tox ID:",IDC_STATIC,12,17,69,11
EDITTEXT IDC_TOXID,81,15,217,12,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED
LTEXT "Name:",IDC_STATIC,12,48,69,11
EDITTEXT IDC_NAME,81,46,217,12,ES_AUTOHSCROLL
- LTEXT "Password:",IDC_STATIC,12,63,69,8,NOT WS_VISIBLE
+ LTEXT "Password:",IDC_STATIC,12,64,69,8,NOT WS_VISIBLE
EDITTEXT IDC_PASSWORD,81,62,217,12,ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_VISIBLE
LTEXT "Default group:",IDC_STATIC,12,80,69,12
EDITTEXT IDC_GROUP,81,78,217,12,ES_AUTOHSCROLL
@@ -110,10 +115,16 @@ 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,123,296,40
+ GROUPBOX "Connection settings",IDC_STATIC,7,99,296,75
CONTROL "Enable UDP (otherwise force Tox to use TCP)",IDC_ENABLE_UDP,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,135,286,10
- CONTROL "Enable IPv6",IDC_ENABLE_IPV6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,149,286,10
+ "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_READONLY | 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_READONLY | 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
END
IDD_SEARCH DIALOGEX 0, 0, 109, 113
@@ -266,6 +277,7 @@ BEGIN
RIGHTMARGIN, 303
VERTGUIDE, 12
VERTGUIDE, 81
+ VERTGUIDE, 133
VERTGUIDE, 298
TOPMARGIN, 7
BOTTOMMARGIN, 228
@@ -360,9 +372,14 @@ END
// AFX_DIALOG_LAYOUT
//
-IDD_OPTIONS_MULTIMEDIA AFX_DIALOG_LAYOUT
+IDD_OPTIONS_MULTIMEDIA AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
+IDD_OPTIONS_MAIN AFX_DIALOG_LAYOUT
BEGIN
- 0x0000
+ 0
END
#endif // English resources
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();