]> git.stg.codes - stg.git/blobdiff - include/stg/user_conf.h
Allow to have multi-leveled module settings.
[stg.git] / include / stg / user_conf.h
index 599336583a4ebc159e400e76279b15e12292b9bb..5987c4d8c6b9d51c93c980877b8b59da0558e7ed 100644 (file)
 struct USER_CONF
 {
     USER_CONF()
-        : password(),
-          passive(0),
+        : passive(0),
           disabled(0),
           disabledDetailStat(0),
           alwaysOnline(0),
-          tariffName(),
-          address(),
-          phone(),
-          email(),
-          note(),
-          realName(),
-          corp(),
-          service(),
-          group(),
           credit(0),
-          nextTariff(),
           userdata(USERDATA_NUM),
-          creditExpire(0),
-          ips()
+          creditExpire(0)
     {}
 
     std::string              password;
@@ -63,26 +51,8 @@ struct USER_CONF
 struct USER_CONF_RES
 {
     USER_CONF_RES()
-        : password(),
-          passive(),
-          disabled(),
-          disabledDetailStat(),
-          alwaysOnline(),
-          tariffName(),
-          address(),
-          phone(),
-          email(),
-          note(),
-          realName(),
-          group(),
-          credit(),
-          nextTariff(),
-          userdata(USERDATA_NUM, RESETABLE<std::string>()),
-          creditExpire(),
-          ips()
-    {
-    }
-
+        : userdata(USERDATA_NUM)
+    {}
     USER_CONF_RES & operator=(const USER_CONF & uc)
     {
         userdata.resize(USERDATA_NUM);
@@ -108,29 +78,29 @@ struct USER_CONF_RES
         ips          = uc.ips;
         return *this;
     }
-    operator USER_CONF() const
+    USER_CONF GetData() const
     {
         USER_CONF uc;
-        uc.password     = password;
-        uc.passive      = passive;
-        uc.disabled     = disabled;
-        uc.disabledDetailStat = disabledDetailStat;
-        uc.alwaysOnline = alwaysOnline;
-        uc.tariffName   = tariffName;
-        uc.address      = address;
-        uc.phone        = phone;
-        uc.email        = email;
-        uc.note         = note;
-        uc.realName     = realName;
-        uc.group        = group;
-        uc.credit       = credit;
-        uc.nextTariff   = nextTariff;
+        uc.password     = password.data();
+        uc.passive      = passive.data();
+        uc.disabled     = disabled.data();
+        uc.disabledDetailStat = disabledDetailStat.data();
+        uc.alwaysOnline = alwaysOnline.data();
+        uc.tariffName   = tariffName.data();
+        uc.address      = address.data();
+        uc.phone        = phone.data();
+        uc.email        = email.data();
+        uc.note         = note.data();
+        uc.realName     = realName.data();
+        uc.group        = group.data();
+        uc.credit       = credit.data();
+        uc.nextTariff   = nextTariff.data();
         for (int i = 0; i < USERDATA_NUM; i++)
             {
-            uc.userdata[i]  = userdata[i];
+            uc.userdata[i]  = userdata[i].data();
             }
-        uc.creditExpire = creditExpire;
-        uc.ips          = ips;
+        uc.creditExpire = creditExpire.data();
+        uc.ips          = ips.data();
         return uc;
     }
     //-------------------------------------------------------------------------
@@ -155,4 +125,3 @@ struct USER_CONF_RES
 };
 //-----------------------------------------------------------------------------
 #endif
-