]> git.stg.codes - stg.git/blobdiff - stglibs/srvconf.lib/parsers/server_info.cpp
Merge branch 'stg-2.409-radius'
[stg.git] / stglibs / srvconf.lib / parsers / server_info.cpp
index fbefb2d45ae0049de569c2d437060325c0b9f32c..f00336115323c24b2f43a9831e15fccecdaed955 100644 (file)
 
 using namespace STG;
 
-namespace
-{
-
-const size_t UNAME_LEN    = 256;
-const size_t SERV_VER_LEN = 64;
-const size_t DIRNAME_LEN  = 16;
-
-}
-
-SERVER_INFO::PARSER::PARSER(CALLBACK f, void * d)
+SERVER_INFO::PARSER::PARSER(CALLBACK f, void * d, const std::string & e)
     : callback(f),
       data(d),
+      encoding(e),
       depth(0),
       parsingAnswer(false)
 {
@@ -48,7 +40,7 @@ SERVER_INFO::PARSER::PARSER(CALLBACK f, void * d)
     AddParser(propertyParsers, "version", info.version);
     AddParser(propertyParsers, "tariff", info.tariffType);
     AddParser(propertyParsers, "dir_num", info.dirNum);
-    AddParser(propertyParsers, "users_num", info.usersNum);
+    AddParser(propertyParsers, "user_num", info.usersNum);
     AddParser(propertyParsers, "tariff_num", info.tariffNum);
 
     for (size_t i = 0; i < DIR_NUM; i++)
@@ -60,13 +52,13 @@ int SERVER_INFO::PARSER::ParseStart(const char *el, const char **attr)
 depth++;
 if (depth == 1)
     {
-    if (strcasecmp(el, "ServerInfo") == 0)
+    if (strcasecmp(el, "GetServerInfo") == 0)
         parsingAnswer = true;
     }
 else
     {
     if (depth == 2 && parsingAnswer)
-        if (!TryParse(propertyParsers, ToLower(el), attr))
+        if (!TryParse(propertyParsers, ToLower(el), attr, encoding))
             error = "Invalid parameter.";
     }
 return 0;