X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/0ebb52df5d005faab367ad69616958974c5ae107..186fb2b18b89a0280b8cc4b5ea8f7a59d3bd0853:/projects/sgconf/xml.cpp diff --git a/projects/sgconf/xml.cpp b/projects/sgconf/xml.cpp index bf5589fe..ec8b9178 100644 --- a/projects/sgconf/xml.cpp +++ b/projects/sgconf/xml.cpp @@ -1,5 +1,9 @@ #include "xml.h" +#include "config.h" + +#include "stg/servconf.h" + #include #include @@ -48,6 +52,16 @@ if (el != NULL) std::cout << Indent(state->level) << "\n"; } +void RawXMLCallback(bool result, const std::string & reason, const std::string & response, void * /*data*/) +{ +if (!result) + { + std::cerr << "Failed to get raw XML response. Reason: '" << reason << "'." << std::endl; + return; + } +SGCONF::PrintXML(response); +} + } void SGCONF::PrintXML(const std::string& xml) @@ -66,3 +80,14 @@ if (XML_Parse(parser, xml.c_str(), xml.length(), true) == XML_STATUS_ERROR) XML_ParserFree(parser); } + +bool SGCONF::RawXMLFunction(const SGCONF::CONFIG & config, + const std::string & arg, + const std::map & /*options*/) +{ + STG::SERVCONF proto(config.server.data(), + config.port.data(), + config.userName.data(), + config.userPass.data()); + return proto.RawXML(arg, RawXMLCallback, NULL) == STG::st_ok; +}