X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/261442af210d652fc2c8a3d9197097982701bd16..040deac4b8ae0728e3ff7635bb16595ec08d5817:/stglibs/srvconf.lib/include/stg/servconf.h diff --git a/stglibs/srvconf.lib/include/stg/servconf.h b/stglibs/srvconf.lib/include/stg/servconf.h index 67c2f248..6bf33ddb 100644 --- a/stglibs/srvconf.lib/include/stg/servconf.h +++ b/stglibs/srvconf.lib/include/stg/servconf.h @@ -30,6 +30,7 @@ #include #include +#include #include #include "stg/os_int.h" @@ -101,6 +102,7 @@ typedef void(*RecvServerInfoDataCb_t)(SERVERINFO * si, void * data); typedef int(*RecvChgUserCb_t)(const char * asnwer, void * data); typedef int(*RecvCheckUserCb_t)(const char * answer, void * data); typedef int(*RecvSendMessageCb_t)(const char * answer, void * data); +typedef void(*RecvAuthByDataCb_t)(const std::vector & list, void * data); //----------------------------------------------------------------------------- struct ADMINDATA { @@ -128,7 +130,6 @@ private: RecvChgUserCb_t RecvChgUserCb; void * chgUserCbData; int depth; - bool error; }; //----------------------------------------------------------------------------- class PARSER_CHECK_USER: public PARSER @@ -143,7 +144,6 @@ private: RecvCheckUserCb_t RecvCheckUserCb; void * checkUserCbData; int depth; - bool error; }; //----------------------------------------------------------------------------- class PARSER_GET_USERS: public PARSER @@ -162,7 +162,6 @@ private: void * userDataCb; USERDATA user; int depth; - bool error; }; //----------------------------------------------------------------------------- class PARSER_GET_USER: public PARSER @@ -221,13 +220,30 @@ private: RecvSendMessageCb_t RecvSendMessageCb; void * sendMessageCbData; int depth; +}; +//----------------------------------------------------------------------------- +class PARSER_AUTH_BY: public PARSER +{ +public: + PARSER_AUTH_BY(); + int ParseStart(const char *el, const char **attr); + void ParseEnd(const char *el); + void ParseServerInfo(const char *el, const char **attr); + bool GetError(); + void SetRecvCb(RecvAuthByDataCb_t, void * data); +private: + RecvAuthByDataCb_t RecvAuthByDataCb; + void * authByDataCb; + int depth; bool error; + std::vector list; }; //----------------------------------------------------------------------------- class SERVCONF { public: SERVCONF(); + ~SERVCONF(); void SetServer(const char * server); void SetPort(uint16_t port); @@ -235,6 +251,7 @@ public: void SetAdmPassword(const char * password); void SetUserDataRecvCb(RecvUserDataCb_t, void * data); + void SetGetUserAuthByRecvCb(RecvAuthByDataCb_t, void * data); void SetServerInfoRecvCb(RecvServerInfoDataCb_t, void * data); void SetChgUserCb(RecvChgUserCb_t, void * data); void SetCheckUserCb(RecvCheckUserCb_t, void * data); @@ -244,6 +261,7 @@ public: int GetUsers(); int GetUser(const char * login); int ChgUser(const char * request); + int GetUserAuthBy(const char * login); // TODO: Remove this shit! int MsgUser(const char * request); int SendMessage(const char * login, const char * message, int prio); @@ -260,13 +278,13 @@ private: PARSER_GET_USERS parserGetUsers; PARSER_GET_USER parserGetUser; + PARSER_AUTH_BY parserAuthBy; PARSER_GET_SERVER_INFO parserServerInfo; PARSER_CHG_USER parserChgUser; PARSER_CHECK_USER parserCheckUser; PARSER_SEND_MESSAGE parserSendMessage; NETTRANSACT nt; - int parseDepth; std::string errorMsg; int error; @@ -274,12 +292,14 @@ private: RecvUserDataCb_t RecvUserDataCb; RecvUserDataCb_t RecvGetUserDataCb; + RecvAuthByDataCb_t RecvAuthByCb; RecvServerInfoDataCb_t RecvServerInfoDataCb; RecvChgUserCb_t RecvChgUserCb; RecvCheckUserCb_t RecvCheckUserCb; RecvSendMessageCb_t RecvSendMessageCb; void * getUserDataDataCb; + void * getUserAuthByDataCb; void * getUsersDataDataCb; void * getServerInfoDataCb; void * chgUserDataCb;