X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/359e4b28458d352dc55ac39db7e4b5bb308eb361..5f1252496dfef1724c21421ea470a04d09af7ad0:/stglibs/srvconf.lib/servconf.cpp diff --git a/stglibs/srvconf.lib/servconf.cpp b/stglibs/srvconf.lib/servconf.cpp index 45d60f66..49d3ab73 100644 --- a/stglibs/srvconf.lib/servconf.cpp +++ b/stglibs/srvconf.lib/servconf.cpp @@ -20,8 +20,10 @@ #include "stg/servconf.h" -#include "stg/netunit.h" -#include "stg/servconf_types.h" +#include "netunit.h" +#include "parser_auth_by.h" +#include "parser_server_info.h" +#include "parser_check_user.h" #include "stg/common.h" @@ -30,6 +32,8 @@ #include +using namespace STG; + class SERVCONF::IMPL { public: @@ -39,10 +43,10 @@ public: int GetUsers(PARSER_GET_USERS::CALLBACK f, void * data); int GetUser(const std::string & login, PARSER_GET_USER::CALLBACK f, void * data); int ChgUser(const std::string & request, PARSER_CHG_USER::CALLBACK f, void * data); - int AuthBy(const std::string & login, PARSER_AUTH_BY::CALLBACK f, void * data); + 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(PARSER_SERVER_INFO::CALLBACK f, void * data); - int CheckUser(const std::string & login, const std::string & password, PARSER_CHECK_USER::CALLBACK f, void * data); + int ServerInfo(SERVER_INFO::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); @@ -51,10 +55,10 @@ public: private: PARSER_GET_USERS parserGetUsers; PARSER_GET_USER parserGetUser; - PARSER_AUTH_BY parserAuthBy; - PARSER_SERVER_INFO parserServerInfo; + 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; @@ -67,22 +71,6 @@ private: static bool AnsRecv(void * data, const std::string & chunk, bool final); }; -/*namespace -{ - -void ElementStart(void * data, const char * el, const char ** attr) -{ -static_cast(data)->Start(el, attr); -} - -void ElementEnd(void * data, const char * el) -{ -static_cast(data)->End(el); -} - -} // namespace anonymous -*/ - bool SERVCONF::IMPL::AnsRecv(void * data, const std::string & chunk, bool final) { SERVCONF::IMPL * sc = static_cast(data); @@ -125,7 +113,7 @@ int SERVCONF::ChgUser(const std::string & request, PARSER_CHG_USER::CALLBACK f, return pImpl->ChgUser(request, f, data); } -int SERVCONF::AuthBy(const std::string & login, PARSER_AUTH_BY::CALLBACK f, void * data) +int SERVCONF::AuthBy(const std::string & login, AUTH_BY::CALLBACK f, void * data) { return pImpl->AuthBy(login, f, data); } @@ -135,12 +123,12 @@ int SERVCONF::SendMessage(const std::string & request, PARSER_SEND_MESSAGE::CALL return pImpl->SendMessage(request, f, data); } -int SERVCONF::ServerInfo(PARSER_SERVER_INFO::CALLBACK f, void * data) +int SERVCONF::ServerInfo(SERVER_INFO::CALLBACK f, void * data) { 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); } @@ -165,7 +153,7 @@ parserGetUser.SetCallback(f, data); return Exec("", parserGetUser); } //----------------------------------------------------------------------------- -int SERVCONF::IMPL::AuthBy(const std::string & login, PARSER_AUTH_BY::CALLBACK f, void * data) +int SERVCONF::IMPL::AuthBy(const std::string & login, AUTH_BY::CALLBACK f, void * data) { parserAuthBy.SetCallback(f, data); return Exec("", parserAuthBy); @@ -177,7 +165,7 @@ parserGetUsers.SetCallback(f, data); return Exec("", parserGetUsers); } //----------------------------------------------------------------------------- -int SERVCONF::IMPL::ServerInfo(PARSER_SERVER_INFO::CALLBACK f, void * data) +int SERVCONF::IMPL::ServerInfo(SERVER_INFO::CALLBACK f, void * data) { parserServerInfo.SetCallback(f, data); return Exec("", parserServerInfo); @@ -195,7 +183,7 @@ parserSendMessage.SetCallback(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("", parserCheckUser);