X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/908dee0db9288bb455e9f1b68dd81ab50897a677..fe67eb715426dbd5bb72d133b8d708f3042f1199:/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 3f7effd9..f0027968 100644 --- a/stglibs/srvconf.lib/parsers/chg_user.cpp +++ b/stglibs/srvconf.lib/parsers/chg_user.cpp @@ -34,30 +34,10 @@ using namespace STG; -namespace -{ - -RESETABLE MaybeEncode(const RESETABLE & value) -{ -RESETABLE res; -if (!value.empty()) - res = Encode12str(value.data()); -return res; -} - -RESETABLE MaybeIconv(const RESETABLE & value, const std::string & fromEncoding, const std::string & toEncoding) -{ -RESETABLE res; -if (!value.empty()) - res = IconvString(value.data(), fromEncoding, toEncoding); -return res; -} - -} - -CHG_USER::PARSER::PARSER(SIMPLE::CALLBACK f, void * d) +CHG_USER::PARSER::PARSER(SIMPLE::CALLBACK f, void * d, const std::string & e) : callback(f), data(d), + encoding(e), depth(0) { } @@ -112,16 +92,16 @@ if (!conf.nextTariff.empty()) else if (!conf.tariffName.empty()) stream << ""; -appendResetable(stream, "note", MaybeIconv(MaybeEncode(conf.note), "koi8-ru", encoding)); -appendResetable(stream, "name", MaybeIconv(MaybeEncode(conf.realName), "koi8-ru", encoding)); // TODO: name -> realName -appendResetable(stream, "address", MaybeIconv(MaybeEncode(conf.address), "koi8-ru", encoding)); -appendResetable(stream, "email", MaybeIconv(MaybeEncode(conf.email), "koi8-ru", encoding)); -appendResetable(stream, "phone", MaybeIconv(MaybeEncode(conf.phone), "koi8-ru", encoding)); -appendResetable(stream, "group", MaybeIconv(MaybeEncode(conf.group), "koi8-ru", encoding)); +appendResetable(stream, "note", MaybeEncode(MaybeIconv(conf.note, encoding, "koi8-ru"))); +appendResetable(stream, "name", MaybeEncode(MaybeIconv(conf.realName, encoding, "koi8-ru"))); // TODO: name -> realName +appendResetable(stream, "address", MaybeEncode(MaybeIconv(conf.address, encoding, "koi8-ru"))); +appendResetable(stream, "email", MaybeEncode(MaybeIconv(conf.email, encoding, "koi8-ru"))); +appendResetable(stream, "phone", MaybeEncode(MaybeIconv(conf.phone, encoding, "cp1251"))); +appendResetable(stream, "group", MaybeEncode(MaybeIconv(conf.group, encoding, "koi8-ru"))); appendResetable(stream, "corp", conf.corp); for (size_t i = 0; i < conf.userdata.size(); ++i) - appendResetable(stream, "userdata", i, MaybeIconv(MaybeEncode(conf.userdata[i]), "koi8-ru", encoding)); + appendResetable(stream, "userdata", i, MaybeEncode(MaybeIconv(conf.userdata[i], encoding, "koi8-ru"))); if (!conf.services.empty()) { @@ -134,9 +114,9 @@ if (!conf.services.empty()) // Stat if (!stat.cashAdd.empty()) - stream << ""; + stream << ""; else if (!stat.cashSet.empty()) - stream << ""; + stream << ""; appendResetable(stream, "freeMb", stat.freeMb);