]> git.stg.codes - stg.git/blobdiff - stglibs/srvconf.lib/parser_send_message.cpp
Better handling of errors from server. Refactoring.
[stg.git] / stglibs / srvconf.lib / parser_send_message.cpp
index 77aba248dd14c2ffd6d2dd9a99fc1e4c1a2c859f..2e2f785a77d690d00edab0ae96e5928dd194e466 100644 (file)
@@ -48,9 +48,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)