X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/baaffcbb18847d38ac7413c91abc361eaad8007b..ccb2e3ee51729c893c6eb8042cb0aff560c193b8:/stglibs/srvconf.lib/parsers/chg_user.cpp diff --git a/stglibs/srvconf.lib/parsers/chg_user.cpp b/stglibs/srvconf.lib/parsers/chg_user.cpp index ed2002bc..01361d08 100644 --- a/stglibs/srvconf.lib/parsers/chg_user.cpp +++ b/stglibs/srvconf.lib/parsers/chg_user.cpp @@ -25,13 +25,28 @@ #include "stg/user_conf.h" #include "stg/user_stat.h" +#include "stg/common.h" #include +#include #include using namespace STG; +namespace +{ + +RESETABLE MaybeEncode(const RESETABLE & value) +{ +RESETABLE res; +if (!value.empty()) + res = Encode12str(value.data()); +return res; +} + +} + CHG_USER::PARSER::PARSER(SIMPLE::CALLBACK f, void * d) : callback(f), data(d), @@ -87,24 +102,33 @@ appendResetable(stream, "ip", conf.ips); // TODO: ip -> ips if (!conf.nextTariff.empty()) stream << ""; else if (!conf.tariffName.empty()) - stream << ""; + stream << ""; -appendResetable(stream, "note", conf.note); -appendResetable(stream, "name", conf.realName); // TODO: name -> realName -appendResetable(stream, "address", conf.address); -appendResetable(stream, "email", conf.email); -appendResetable(stream, "phone", conf.phone); -appendResetable(stream, "group", conf.group); +appendResetable(stream, "note", MaybeEncode(conf.note)); +appendResetable(stream, "name", MaybeEncode(conf.realName)); // TODO: name -> realName +appendResetable(stream, "address", MaybeEncode(conf.address)); +appendResetable(stream, "email", MaybeEncode(conf.email)); +appendResetable(stream, "phone", MaybeEncode(conf.phone)); +appendResetable(stream, "group", MaybeEncode(conf.group)); +appendResetable(stream, "corp", conf.group); for (size_t i = 0; i < conf.userdata.size(); ++i) - appendResetable(stream, "userdata", i, conf.userdata[i]); + appendResetable(stream, "userdata", i, MaybeEncode(conf.userdata[i])); + +if (!conf.services.empty()) + { + stream << ""; + for (size_t i = 0; i < conf.services.data().size(); ++i) + stream << ""; + stream << ""; + } // Stat if (!stat.cashAdd.empty()) - stream << ""; + stream << ""; else if (!stat.cashSet.empty()) - stream << ""; + stream << ""; appendResetable(stream, "freeMb", stat.freeMb); @@ -126,5 +150,6 @@ std::string traffData = traff.str(); if (!traffData.empty()) stream << ""; +std::cerr << stream.str() << "\n"; return stream.str(); }