X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/de7760b87ad8ca38954140a738d66a133f7021f0..3261ecc2503f45394eb3b9df97c36b08fb14fb1d:/stglibs/srvconf.lib/parsers/get_service.cpp?ds=sidebyside diff --git a/stglibs/srvconf.lib/parsers/get_service.cpp b/stglibs/srvconf.lib/parsers/get_service.cpp index d6b16b9b..e9949cbc 100644 --- a/stglibs/srvconf.lib/parsers/get_service.cpp +++ b/stglibs/srvconf.lib/parsers/get_service.cpp @@ -36,7 +36,7 @@ GET_SERVICE::PARSER::PARSER(CALLBACK f, void * d, const std::string & e) parsingAnswer(false) { AddParser(propertyParsers, "name", info.name); - AddParser(propertyParsers, "comment", info.comment, "koi8-ru", GetEncodedValue); + AddParser(propertyParsers, "comment", info.comment, GetEncodedValue); AddParser(propertyParsers, "cost", info.cost); AddParser(propertyParsers, "payDay", info.payDay); } @@ -54,8 +54,8 @@ depth++; if (depth == 1) ParseService(el, attr); -if (depth == 2 && parsingAnswer) - ParseServiceParams(el, attr); +/*if (depth == 2 && parsingAnswer) + ParseServiceParams(el, attr);*/ return 0; } @@ -86,15 +86,23 @@ if (strcasecmp(el, "service") == 0) error = "Service not found."; } else + { parsingAnswer = true; + for (const char ** pos = attr; *pos != NULL; pos = pos + 2) + if (!TryParse(propertyParsers, ToLower(*pos), pos, encoding, *pos)) + { + error = std::string("Invalid parameter '") + *pos + "' or value '" + *(pos + 1) + "'."; + break; + } + } } else parsingAnswer = true; } } //----------------------------------------------------------------------------- -void GET_SERVICE::PARSER::ParseServiceParams(const char * el, const char ** attr) +/*void GET_SERVICE::PARSER::ParseServiceParams(const char * el, const char ** attr) { if (!TryParse(propertyParsers, ToLower(el), attr, encoding)) error = "Invalid parameter."; -} +}*/