From 4c6514e58eeda29b4f7c3b79130034a20ef7ef87 Mon Sep 17 00:00:00 2001
From: Mohamed Chibani <mohamed.chibani@savoirfairelinux.com>
Date: Mon, 17 May 2021 09:01:11 -0400
Subject: [PATCH] sip-regitration: fix expiration time max limit

The current registration expired max limit was set too low. The max
limit as per RFC-3261 is ((2**32)-1). Since this is a user setting,
it's best to give control to the user. However, a max limit set to
1 week should be reasonable.

Gitlab: #532

Change-Id: I61b05de2adbbb177ac2e83d85e7f72ab42347554
---
 src/constant/JamiStrings.qml                              | 4 ++--
 src/settingsadapter.cpp                                   | 2 +-
 src/settingsadapter.h                                     | 2 +-
 .../components/AdvancedConnectivitySettings.qml           | 8 ++++----
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/constant/JamiStrings.qml b/src/constant/JamiStrings.qml
index 38c4d2980..743f6355f 100644
--- a/src/constant/JamiStrings.qml
+++ b/src/constant/JamiStrings.qml
@@ -94,7 +94,7 @@ Item {
     // AdvancedConnectivitySettings
     property string connectivity: qsTr("Connectivity")
     property string autoRegistration: qsTr("Auto Registration After Expired")
-    property string registrationTimeOut: qsTr("Registration expire timeout (seconds)")
+    property string registrationExpirationTime: qsTr("Registration expiration time (seconds)")
     property string networkInterface: qsTr("Network interface")
     property string useUPnP: qsTr("Use UPnP")
     property string useTURN: qsTr("Use TURN")
@@ -252,7 +252,7 @@ Item {
     property string setAPassword: qsTr("Set password")
     property string changeCurrentPassword: qsTr("Change current password")
     property string tipBackupAccount: qsTr("Backup account to a .gz file")
-    property string tipAdvancedSettingsDisplay: qsTr("Display or hide advanced settings") 
+    property string tipAdvancedSettingsDisplay: qsTr("Display or hide advanced settings")
     property string enableAccount: qsTr("Enable account")
 
     // NameRegistrationDialog
diff --git a/src/settingsadapter.cpp b/src/settingsadapter.cpp
index 5e514bc9b..38efe1260 100644
--- a/src/settingsadapter.cpp
+++ b/src/settingsadapter.cpp
@@ -890,7 +890,7 @@ SettingsAdapter::negotiationTimeoutSpinBoxValueChanged(int value)
 }
 
 void
-SettingsAdapter::registrationTimeoutSpinBoxValueChanged(int value)
+SettingsAdapter::registrationExpirationTimeSpinBoxValueChanged(int value)
 {
     auto confProps = lrcInstance_->accountModel().getAccountConfig(
         lrcInstance_->getCurrentAccountId());
diff --git a/src/settingsadapter.h b/src/settingsadapter.h
index 01815c06d..3483ac234 100644
--- a/src/settingsadapter.h
+++ b/src/settingsadapter.h
@@ -192,7 +192,7 @@ public:
 
     Q_INVOKABLE void customPortSIPSpinBoxValueChanged(int value);
     Q_INVOKABLE void negotiationTimeoutSpinBoxValueChanged(int value);
-    Q_INVOKABLE void registrationTimeoutSpinBoxValueChanged(int value);
+    Q_INVOKABLE void registrationExpirationTimeSpinBoxValueChanged(int value);
     Q_INVOKABLE void networkInterfaceSpinBoxValueChanged(int value);
     Q_INVOKABLE void audioRTPMinPortSpinBoxEditFinished(int value);
     Q_INVOKABLE void audioRTPMaxPortSpinBoxEditFinished(int value);
diff --git a/src/settingsview/components/AdvancedConnectivitySettings.qml b/src/settingsview/components/AdvancedConnectivitySettings.qml
index 21a1adb78..239c3fef4 100644
--- a/src/settingsview/components/AdvancedConnectivitySettings.qml
+++ b/src/settingsview/components/AdvancedConnectivitySettings.qml
@@ -81,13 +81,13 @@ ColumnLayout {
             id: registrationExpireTimeoutSpinBox
             visible: isSIP
 
-            title: JamiStrings.registrationTimeOut
+            title: JamiStrings.registrationExpirationTime
             itemWidth: root.itemWidth
             bottomValue: 0
-            topValue: 3000
+            topValue: 7*24*3600
             step: 1
 
-            onNewValue: SettingsAdapter.registrationTimeoutSpinBoxValueChanged(valueField)
+            onNewValue: SettingsAdapter.registrationExpirationTimeSpinBoxValueChanged(valueField)
         }
 
         SettingSpinBox {
@@ -97,7 +97,7 @@ ColumnLayout {
             title: JamiStrings.networkInterface
             itemWidth: root.itemWidth
             bottomValue: 0
-            topValue: 65536
+            topValue: 65535
             step: 1
 
             onNewValue: SettingsAdapter.networkInterfaceSpinBoxValueChanged(valueField)
-- 
GitLab