X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/fdfb7497dea6cc94a44133ef19e953ced167e855..c4456f2cae7261f7263e3708ff995bade7da722f:/stglibs/srvconf.lib/parser.cpp diff --git a/stglibs/srvconf.lib/parser.cpp b/stglibs/srvconf.lib/parser.cpp index 89b2457c..62537359 100644 --- a/stglibs/srvconf.lib/parser.cpp +++ b/stglibs/srvconf.lib/parser.cpp @@ -33,10 +33,9 @@ #include #include -#include "common.h" -//#include "srvconf_common.h" -#include "stg_const.h" -#include "servconf.h" +#include "stg/common.h" +#include "stg/const.h" +#include "stg/servconf.h" using namespace std; @@ -46,6 +45,7 @@ using namespace std; PARSER_GET_USERS::PARSER_GET_USERS() : RecvUserDataCb(NULL), userDataCb(NULL), + user(), depth(0), error(false) { @@ -387,6 +387,7 @@ userDataCb = data; PARSER_GET_USER::PARSER_GET_USER() : RecvUserDataCb(NULL), userDataCb(NULL), + user(), depth(0), error(false) { @@ -665,7 +666,8 @@ PARSER_GET_SERVER_INFO::PARSER_GET_SERVER_INFO() : RecvServerInfoDataCb(NULL), serverInfoDataCb(NULL), depth(0), - error(false) + error(false), + serverInfo() { } //----------------------------------------------------------------------------- @@ -820,6 +822,58 @@ if (strcmp(attr[0], "value") == 0) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +PARSER_AUTH_BY::PARSER_AUTH_BY() + : RecvAuthByDataCb(NULL), + authByDataCb(NULL), + depth(0), + error(false), + list() +{ +} +//----------------------------------------------------------------------------- +int PARSER_AUTH_BY::ParseStart(const char *el, const char **attr) +{ +depth++; +if (depth == 1) + { + if (strcasecmp(el, "AuthorizedBy") != 0) + { + list.erase(list.begin(), list.end()); + //printf("%s\n", el); + } + } +else + { + if (depth == 2) + { + if (strcasecmp(el, "Auth") == 0) + { + if (attr && attr[0]) + list.push_back(attr[0]); + return 0; + } + } + } +return 0; +} +//----------------------------------------------------------------------------- +void PARSER_AUTH_BY::ParseEnd(const char *) +{ +depth--; +if (depth == 0) + { + RecvAuthByDataCb(list, authByDataCb); + } +} +//----------------------------------------------------------------------------- +void PARSER_AUTH_BY::SetRecvCb(RecvAuthByDataCb_t f, void * data) +{ +RecvAuthByDataCb = f; +authByDataCb = data; +} +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- PARSER_CHG_USER::PARSER_CHG_USER() : RecvChgUserCb(NULL), chgUserCbData(NULL),