]> git.stg.codes - stg.git/blobdiff - stglibs/srvconf.lib/parser_send_message.cpp
Moved AUTH_BY parser from global scope.
[stg.git] / stglibs / srvconf.lib / parser_send_message.cpp
index 77aba248dd14c2ffd6d2dd9a99fc1e4c1a2c859f..08b6046208cf0366af1dbf749775238f9f272037 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <strings.h>
 
+using namespace STG;
+
 PARSER_SEND_MESSAGE::PARSER_SEND_MESSAGE()
     : callback(NULL),
       data(NULL),
@@ -32,7 +34,7 @@ PARSER_SEND_MESSAGE::PARSER_SEND_MESSAGE()
 {
 }
 //-----------------------------------------------------------------------------
-int  PARSER_SEND_MESSAGE::ParseStart(const char * el, const char ** attr)
+int PARSER_SEND_MESSAGE::ParseStart(const char * el, const char ** attr)
 {
 depth++;
 if (depth == 1)
@@ -48,9 +50,12 @@ depth--;
 //-----------------------------------------------------------------------------
 void PARSER_SEND_MESSAGE::ParseAnswer(const char * /*el*/, const char **attr)
 {
+if (!callback)
+    return;
 if (attr && attr[0] && attr[1])
-    if (callback)
-        callback(attr[1], data);
+    callback(strcasecmp(attr[1], "ok") == 0, attr[1], data);
+else
+    callback(false, "Invalid response.", data);
 }
 //-----------------------------------------------------------------------------
 void PARSER_SEND_MESSAGE::SetCallback(CALLBACK f, void * d)