+++ /dev/null
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-/*
- * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
- * Author : Maxim Mamontov <faust@stargazer.dp.ua>
- */
-
-#ifndef __STG_STGLIBS_SRVCONF_PARSER_CHECK_USER_H__
-#define __STG_STGLIBS_SRVCONF_PARSER_CHECK_USER_H__
-
-#include "parser.h"
-
-#include <string>
-
-namespace STG
-{
-
-class PARSER_CHECK_USER: public PARSER
-{
-public:
- typedef int (* CALLBACK)(bool result, const std::string & reason, void * data);
-
- PARSER_CHECK_USER();
- int ParseStart(const char * el, const char ** attr);
- void ParseEnd(const char * el);
- void SetCallback(CALLBACK f, void * data);
-private:
- CALLBACK callback;
- void * data;
- int depth;
-
- void ParseAnswer(const char * el, const char ** attr);
-};
-
-} // namespace STG
-
-#endif
#ifndef __STG_STGLIBS_SERVCONF_H__
#define __STG_STGLIBS_SERVCONF_H__
-#include "stg/parser_check_user.h"
#include "stg/parser_get_user.h"
#include "stg/parser_get_users.h"
#include "stg/parser_chg_user.h"
int AuthBy(const std::string & login, AUTH_BY::CALLBACK f, void * data);
int SendMessage(const std::string & request, PARSER_SEND_MESSAGE::CALLBACK f, void * data);
int ServerInfo(SERVER_INFO::CALLBACK f, void * data);
- int CheckUser(const std::string & login, const std::string & password, PARSER_CHECK_USER::CALLBACK f, void * data);
+ int CheckUser(const std::string & login, const std::string & password, CHECK_USER::CALLBACK f, void * data);
const std::string & GetStrError() const;
typedef void (* CALLBACK)(bool result, const std::string & reason, const INFO & info, void * data);
} // namespace SERVER_INFO
+
+namespace CHECK_USER
+{
+
+typedef int (* CALLBACK)(bool result, const std::string & reason, void * data);
+
+}
} // namespace STG
#endif
}
}
//-----------------------------------------------------------------------------
-void AUTH_BY::PARSER::SetCallback(AUTH_BY::CALLBACK f, void * d)
+void AUTH_BY::PARSER::SetCallback(CALLBACK f, void * d)
{
callback = f;
data = d;
* Author : Maxim Mamontov <faust@stargazer.dp.ua>
*/
-#include "stg/parser_check_user.h"
+#include "parser_check_user.h"
#include <cstddef>
using namespace STG;
-PARSER_CHECK_USER::PARSER_CHECK_USER()
+CHECK_USER::PARSER::PARSER()
: callback(NULL),
data(NULL),
depth(0)
{
}
//-----------------------------------------------------------------------------
-int PARSER_CHECK_USER::ParseStart(const char * el, const char ** attr)
+int CHECK_USER::PARSER::ParseStart(const char * el, const char ** attr)
{
depth++;
if (depth == 1)
return 0;
}
//-----------------------------------------------------------------------------
-void PARSER_CHECK_USER::ParseEnd(const char *)
+void CHECK_USER::PARSER::ParseEnd(const char *)
{
depth--;
}
//-----------------------------------------------------------------------------
-void PARSER_CHECK_USER::ParseAnswer(const char *, const char **attr)
+void CHECK_USER::PARSER::ParseAnswer(const char *, const char **attr)
{
if (!callback)
return;
callback(false, "Invalid response.", data);
}
//-----------------------------------------------------------------------------
-void PARSER_CHECK_USER::SetCallback(CALLBACK f, void * d)
+void CHECK_USER::PARSER::SetCallback(CALLBACK f, void * d)
{
callback = f;
data = d;
--- /dev/null
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
+ * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ */
+
+#ifndef __STG_STGLIBS_SRVCONF_PARSER_CHECK_USER_H__
+#define __STG_STGLIBS_SRVCONF_PARSER_CHECK_USER_H__
+
+#include "stg/parser.h"
+#include "stg/servconf_types.h"
+
+#include <string>
+
+namespace STG
+{
+namespace CHECK_USER
+{
+
+class PARSER: public STG::PARSER
+{
+public:
+
+ PARSER();
+ int ParseStart(const char * el, const char ** attr);
+ void ParseEnd(const char * el);
+ void SetCallback(CALLBACK f, void * data);
+private:
+ CALLBACK callback;
+ void * data;
+ int depth;
+
+ void ParseAnswer(const char * el, const char ** attr);
+};
+
+} // namespace CHECK_USER
+} // namespace STG
+
+#endif
#include "netunit.h"
#include "parser_auth_by.h"
#include "parser_server_info.h"
+#include "parser_check_user.h"
#include "stg/common.h"
int AuthBy(const std::string & login, AUTH_BY::CALLBACK f, void * data);
int SendMessage(const std::string & request, PARSER_SEND_MESSAGE::CALLBACK f, void * data);
int ServerInfo(SERVER_INFO::CALLBACK f, void * data);
- int CheckUser(const std::string & login, const std::string & password, PARSER_CHECK_USER::CALLBACK f, void * data);
+ int CheckUser(const std::string & login, const std::string & password, CHECK_USER::CALLBACK f, void * data);
const std::string & GetStrError() const;
static void Start(void * data, const char * el, const char ** attr);
AUTH_BY::PARSER parserAuthBy;
SERVER_INFO::PARSER parserServerInfo;
PARSER_CHG_USER parserChgUser;
- PARSER_CHECK_USER parserCheckUser;
+ CHECK_USER::PARSER parserCheckUser;
PARSER_SEND_MESSAGE parserSendMessage;
NETTRANSACT nt;
return pImpl->ServerInfo(f, data);
}
-int SERVCONF::CheckUser(const std::string & login, const std::string & password, PARSER_CHECK_USER::CALLBACK f, void * data)
+int SERVCONF::CheckUser(const std::string & login, const std::string & password, CHECK_USER::CALLBACK f, void * data)
{
return pImpl->CheckUser(login, password, f, data);
}
return Exec(request, parserSendMessage);
}
//-----------------------------------------------------------------------------
-int SERVCONF::IMPL::CheckUser(const std::string & login, const std::string & password, PARSER_CHECK_USER::CALLBACK f, void * data)
+int SERVCONF::IMPL::CheckUser(const std::string & login, const std::string & password, CHECK_USER::CALLBACK f, void * data)
{
parserCheckUser.SetCallback(f, data);
return Exec("<CheckUser login=\"" + login + "\" password=\"" + password + "\"/>", parserCheckUser);