]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/sgconfig/parser_tariffs.cpp
Fix email.
[stg.git] / projects / stargazer / plugins / configuration / sgconfig / parser_tariffs.cpp
index b1564406f7bc7f9f51eec8ffdae7550f99d66f36..34f09fe5d39cf302c5c91f886c6c638c4452fe71 100644 (file)
@@ -16,7 +16,7 @@
 
 /*
  *    Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
- *    Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ *    Author : Maksym Mamontov <stg@madf.info>
  */
 
 #include "parser_tariffs.h"
@@ -115,6 +115,7 @@ void GET_TARIFFS::CreateAnswer()
                   "<TraffType value=\"" + TARIFF::TraffTypeToString(it->tariffConf.traffType) + "\"/>" +
                   "<Period value=\"" + TARIFF::PeriodToString(it->tariffConf.period) + "\"/>" +
                   "<ChangePolicy value=\"" + TARIFF::ChangePolicyToString(it->tariffConf.changePolicy) + "\"/>" +
+                  "<ChangePolicyTimeout value=\"" + x2str(it->tariffConf.changePolicyTimeout) + "\"/>" +
                   "</tariff>";
         }
 
@@ -174,6 +175,8 @@ int CHG_TARIFF::Start(void *, const char * el, const char ** attr)
             const TARIFF * tariff = m_tariffs.FindByName(attr[1]);
             if (tariff != NULL)
                 td = tariff->GetTariffData();
+            else
+                return -1;
             return 0;
         }
     }
@@ -297,6 +300,14 @@ int CHG_TARIFF::Start(void *, const char * el, const char ** attr)
             td.tariffConf.changePolicy = TARIFF::StringToChangePolicy(attr[1]);
             return 0;
         }
+
+        if (strcasecmp(el, "ChangePolicyTimeout") == 0)
+        {
+            int64_t policyTime = 0;
+            if (str2x(attr[1], policyTime) == 0)
+                td.tariffConf.changePolicyTimeout = (time_t)policyTime;
+            return 0;
+        }
     }
     return -1;
 }