X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/e9ae1f101b5418c0ba2e6c9d86b23c12f0140982..67f951ee2b013af01994803b7adb37d2d4e84072:/libs/srvconf/parsers/chg_user.cpp?ds=inline
diff --git a/libs/srvconf/parsers/chg_user.cpp b/libs/srvconf/parsers/chg_user.cpp
index c0a08382..42682f58 100644
--- a/libs/srvconf/parsers/chg_user.cpp
+++ b/libs/srvconf/parsers/chg_user.cpp
@@ -86,10 +86,10 @@ std::string ChgUser::serialize(const UserConfOpt& conf, const UserStatOpt& stat,
appendResetableTag(stream, "aonline", conf.alwaysOnline); // TODO: aonline -> alwaysOnline
appendResetableTag(stream, "ip", conf.ips); // TODO: ip -> ips
- if (!conf.nextTariff.empty())
- stream << "";
- else if (!conf.tariffName.empty())
- stream << "";
+ if (conf.nextTariff)
+ stream << "";
+ else if (conf.tariffName)
+ stream << "";
appendResetableTag(stream, "note", maybeEncode(maybeIconv(conf.note, encoding, "koi8-ru")));
appendResetableTag(stream, "name", maybeEncode(maybeIconv(conf.realName, encoding, "koi8-ru"))); // TODO: name -> realName
@@ -102,36 +102,36 @@ std::string ChgUser::serialize(const UserConfOpt& conf, const UserStatOpt& stat,
for (size_t i = 0; i < conf.userdata.size(); ++i)
appendResetableTag(stream, "userdata", i, maybeEncode(maybeIconv(conf.userdata[i], encoding, "koi8-ru")));
- if (!conf.services.empty())
+ if (conf.services)
{
stream << "";
- for (size_t i = 0; i < conf.services.data().size(); ++i)
- stream << "";
+ for (const auto& service : conf.services.value())
+ stream << "";
stream << "";
}
// Stat
- if (!stat.cashAdd.empty())
- stream << "";
- else if (!stat.cashSet.empty())
- stream << "";
+ if (stat.cashAdd)
+ stream << "";
+ else if (stat.cashSet)
+ stream << "";
appendResetableTag(stream, "freeMb", stat.freeMb);
std::ostringstream traff;
for (size_t i = 0; i < stat.sessionUp.size(); ++i)
- if (!stat.sessionUp[i].empty())
- traff << " SU" << i << "=\"" << stat.sessionUp[i].data() << "\"";
+ if (stat.sessionUp[i])
+ traff << " SU" << i << "=\"" << stat.sessionUp[i].value() << "\"";
for (size_t i = 0; i < stat.sessionDown.size(); ++i)
- if (!stat.sessionDown[i].empty())
- traff << " SD" << i << "=\"" << stat.sessionDown[i].data() << "\"";
+ if (stat.sessionDown[i])
+ traff << " SD" << i << "=\"" << stat.sessionDown[i].value() << "\"";
for (size_t i = 0; i < stat.monthUp.size(); ++i)
- if (!stat.monthUp[i].empty())
- traff << " MU" << i << "=\"" << stat.monthUp[i].data() << "\"";
+ if (stat.monthUp[i])
+ traff << " MU" << i << "=\"" << stat.monthUp[i].value() << "\"";
for (size_t i = 0; i < stat.monthDown.size(); ++i)
- if (!stat.monthDown[i].empty())
- traff << " MD" << i << "=\"" << stat.monthDown[i].data() << "\"";
+ if (stat.monthDown[i])
+ traff << " MD" << i << "=\"" << stat.monthDown[i].value() << "\"";
std::string traffData = traff.str();
if (!traffData.empty())