From: Maxim Mamontov <faust@gts.dp.ua>
Date: Thu, 26 May 2011 15:25:29 +0000 (+0300)
Subject: ReconnectOnTariffChange added to the settings
X-Git-Tag: 2.408-alpha~135
X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/02bcc3a0cfbd20bdbb474fc6c02057468d980276?ds=inline

ReconnectOnTariffChange added to the settings
---

diff --git a/include/stg/settings.h b/include/stg/settings.h
index 16714be3..e62f403b 100644
--- a/include/stg/settings.h
+++ b/include/stg/settings.h
@@ -39,6 +39,7 @@ public:
     virtual bool                GetShowFeeInCash() const = 0;
     virtual unsigned            GetMessageTimeout() const = 0;
     virtual unsigned            GetFeeChargeType() const = 0;
+    virtual bool                GetReconnectOnTariffChange() const = 0;
     virtual const std::string & GetMonitorDir() const = 0;
     virtual bool                GetMonitoring() const = 0;
 };
diff --git a/projects/stargazer/inst/freebsd/etc/stargazer/stargazer.conf b/projects/stargazer/inst/freebsd/etc/stargazer/stargazer.conf
index 55efa6ac..49214fe8 100644
--- a/projects/stargazer/inst/freebsd/etc/stargazer/stargazer.conf
+++ b/projects/stargazer/inst/freebsd/etc/stargazer/stargazer.conf
@@ -87,7 +87,7 @@ WriteFreeMbTraffCost = yes
 # Parameter: optional
 # Values: yes, no
 # Default: no
-FullFee = yes
+FullFee = no
 
 # Allow user to see and use a full cash (yes) or hide a part of it (no) 
 # for the next fee charge
@@ -165,6 +165,12 @@ ModulesPath = /usr/lib/stg
 # Default: 0 (classic)
 # FeeChargeType = 0
 
+# Enable or disable reconnect on tariff change
+# Parameter: optional
+# Values: yes, no
+# Default: no
+# ReconnectOnTariffChange = no
+
 ################################################################################
 # Store module
 # Configure the module that works with the database server
diff --git a/projects/stargazer/inst/linux/etc/stargazer/stargazer.conf b/projects/stargazer/inst/linux/etc/stargazer/stargazer.conf
index 55efa6ac..49214fe8 100644
--- a/projects/stargazer/inst/linux/etc/stargazer/stargazer.conf
+++ b/projects/stargazer/inst/linux/etc/stargazer/stargazer.conf
@@ -87,7 +87,7 @@ WriteFreeMbTraffCost = yes
 # Parameter: optional
 # Values: yes, no
 # Default: no
-FullFee = yes
+FullFee = no
 
 # Allow user to see and use a full cash (yes) or hide a part of it (no) 
 # for the next fee charge
@@ -165,6 +165,12 @@ ModulesPath = /usr/lib/stg
 # Default: 0 (classic)
 # FeeChargeType = 0
 
+# Enable or disable reconnect on tariff change
+# Parameter: optional
+# Values: yes, no
+# Default: no
+# ReconnectOnTariffChange = no
+
 ################################################################################
 # Store module
 # Configure the module that works with the database server
diff --git a/projects/stargazer/settings_impl.cpp b/projects/stargazer/settings_impl.cpp
index 33b3e840..f9135a1a 100644
--- a/projects/stargazer/settings_impl.cpp
+++ b/projects/stargazer/settings_impl.cpp
@@ -64,6 +64,7 @@ SETTINGS_IMPL::SETTINGS_IMPL()
       showFeeInCash(true),
       messageTimeout(0),
       feeChargeType(0),
+      reconnectOnTariffChange(false),
       modulesSettings(),
       storeModuleSettings(),
       logger(GetStgLogger())
@@ -95,6 +96,7 @@ SETTINGS_IMPL::SETTINGS_IMPL(const std::string & cd)
       showFeeInCash(true),
       messageTimeout(0),
       feeChargeType(0),
+      reconnectOnTariffChange(false),
       modulesSettings(),
       storeModuleSettings(),
       logger(GetStgLogger())
@@ -126,6 +128,7 @@ SETTINGS_IMPL::SETTINGS_IMPL(const SETTINGS_IMPL & rval)
       showFeeInCash(rval.showFeeInCash),
       messageTimeout(rval.messageTimeout),
       feeChargeType(rval.feeChargeType),
+      reconnectOnTariffChange(rval.reconnectOnTariffChange),
       modulesSettings(rval.modulesSettings),
       storeModuleSettings(rval.storeModuleSettings),
       logger(GetStgLogger())
@@ -441,6 +444,15 @@ while (node)
             }
         }
 
+    if (strcasecmp(node->getName(), "ReconnectOnTariffChange") == 0)
+        {
+        if (ParseYesNo(node->getValue(0), &reconnectOnTariffChange) != 0)
+            {
+            strError = "Incorrect ReconnectOnTariffChange value: \'" + string(node->getValue(0)) + "\'";
+            return -1;
+            }
+        }
+
     if (strcasecmp(node->getName(), "DirNames") == 0)
         {
         const DOTCONFDocumentNode * child = node->getChildNode();
diff --git a/projects/stargazer/settings_impl.h b/projects/stargazer/settings_impl.h
index 97990d32..43dcab0c 100644
--- a/projects/stargazer/settings_impl.h
+++ b/projects/stargazer/settings_impl.h
@@ -91,6 +91,7 @@ public:
     bool                GetMonitoring() const { return monitoring; }
     unsigned            GetMessageTimeout() const { return messageTimeout * 3600 * 24; }
     unsigned            GetFeeChargeType() const { return feeChargeType; }
+    bool                GetReconnectOnTariffChange() const { return reconnectOnTariffChange; }
 
     const std::string & GetModulesPath() const { return modulesPath; }
     const MODULE_SETTINGS & GetStoreModuleSettings() const
@@ -137,6 +138,7 @@ private:
     bool        showFeeInCash;
     unsigned    messageTimeout;
     unsigned    feeChargeType;
+    bool        reconnectOnTariffChange;
 
     std::vector<MODULE_SETTINGS> modulesSettings;
     MODULE_SETTINGS storeModuleSettings;