]> git.stg.codes - stg.git/blobdiff - stglibs/srvconf.lib/parser_get_users.cpp
Added result on success for GetAuthBy.
[stg.git] / stglibs / srvconf.lib / parser_get_users.cpp
index 6996dbaf3859056988d579eb6ea4e126bda01fea..26ffc15705b8a6df0362d07606746cf7270a99fe 100644 (file)
@@ -26,7 +26,7 @@
 #include <strings.h>
 
 PARSER_GET_USERS::PARSER_GET_USERS()
-    : callabck(NULL),
+    : callback(NULL),
       data(NULL),
       depth(0)
 {
@@ -52,8 +52,11 @@ if (depth > 0)
     userParser.ParseEnd(el);
 
 if (depth == 0)
+    {
     if (callback)
-        callback(&info, data);
+        callback(error.empty(), error, info, data);
+    error.clear();
+    }
 }
 //-----------------------------------------------------------------------------
 void PARSER_GET_USERS::ParseUsers(const char * el, const char ** /*attr*/)
@@ -70,11 +73,14 @@ info.push_back(userInfo);
 void PARSER_GET_USERS::SetCallback(CALLBACK f, void * d)
 {
 callback = f;
-data = data;
+data = d;
 }
 //-----------------------------------------------------------------------------
-void PARSER_GET_USERS::UserCallback(const PARSER_GET_USER::INFO & info, void * data)
+void PARSER_GET_USERS::UserCallback(bool result, const std::string & error, const PARSER_GET_USER::INFO & info, void * data)
 {
     PARSER_GET_USERS * parser = static_cast<PARSER_GET_USERS *>(data);
-    parser->AddUser(info);
+    if (!result)
+        parser->SetError(error);
+    else
+        parser->AddUser(info);
 }