X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..4035038a041a93a0d6e34d0a4af88479f84dc08d:/stglibs/srvconf.lib/servconf.h?ds=sidebyside diff --git a/stglibs/srvconf.lib/servconf.h b/stglibs/srvconf.lib/servconf.h index f3beaec3..67c2f248 100644 --- a/stglibs/srvconf.lib/servconf.h +++ b/stglibs/srvconf.lib/servconf.h @@ -27,13 +27,14 @@ #ifndef SERVCONF_H #define SERVCONF_H -#include "os_int.h" - #include + #include #include + +#include "stg/os_int.h" +#include "stg/const.h" #include "netunit.h" -#include "stg_const.h" void Start(void *data, const char *el, const char **attr); void End(void *data, const char *el); @@ -71,6 +72,7 @@ struct USERDATA std::string password; double cash; double credit; + time_t creditExpire; double lastCash; double prepaidTraff; int down; @@ -108,16 +110,10 @@ struct ADMINDATA class PARSER { public: - PARSER(); - virtual ~PARSER(){}; + PARSER() {} + virtual ~PARSER() {} virtual int ParseStart(const char *el, const char **attr) = 0; virtual void ParseEnd(const char *el) = 0; - void Reset(); - //virtual bool GetError() = 0; - //virtual void SetUserDataRecvCb(RecvUserDataCb_t) = 0; -protected: - //RecvUserDataCb_t RecvUserDataCb; -private: }; //----------------------------------------------------------------------------- class PARSER_CHG_USER: public PARSER @@ -126,7 +122,6 @@ public: PARSER_CHG_USER(); int ParseStart(const char *el, const char **attr); void ParseEnd(const char *el); - void Reset(); void ParseAnswer(const char *el, const char **attr); void SetChgUserRecvCb(RecvChgUserCb_t, void * data); private: @@ -142,7 +137,6 @@ public: PARSER_CHECK_USER(); int ParseStart(const char *el, const char **attr); void ParseEnd(const char *el); - void Reset(); void ParseAnswer(const char *el, const char **attr); void SetCheckUserRecvCb(RecvCheckUserCb_t, void * data); private: @@ -158,12 +152,10 @@ public: PARSER_GET_USERS(); int ParseStart(const char *el, const char **attr); void ParseEnd(const char *el); - void Reset(); void ParseUsers(const char *el, const char **attr); void ParseUser(const char *el, const char **attr); void ParseUserParams(const char *el, const char **attr); void ParseUserLoadStat(const char * el, const char ** attr); - //bool GetError(); void SetUserDataRecvCb(RecvUserDataCb_t, void * data); private: RecvUserDataCb_t RecvUserDataCb; @@ -179,7 +171,6 @@ public: PARSER_GET_USER(); int ParseStart(const char *el, const char **attr); void ParseEnd(const char *el); - void Reset(); void ParseUsers(const char *el, const char **attr); void ParseUser(const char *el, const char **attr); void ParseUserParams(const char *el, const char **attr); @@ -199,7 +190,6 @@ public: PARSER_GET_SERVER_INFO(); int ParseStart(const char *el, const char **attr); void ParseEnd(const char *el); - void Reset(); void ParseServerInfo(const char *el, const char **attr); bool GetError(); void SetServerInfoRecvCb(RecvServerInfoDataCb_t, void * data); @@ -214,7 +204,6 @@ private: RecvServerInfoDataCb_t RecvServerInfoDataCb; void * serverInfoDataCb; - USERDATA user; int depth; bool error; SERVERINFO serverInfo; @@ -226,7 +215,6 @@ public: PARSER_SEND_MESSAGE(); int ParseStart(const char *el, const char **attr); void ParseEnd(const char *el); - void Reset(); void ParseAnswer(const char *el, const char **attr); void SetSendMessageRecvCb(RecvSendMessageCb_t, void * data); private: @@ -262,8 +250,8 @@ public: int GetServerInfo(); int CheckUser(const char * login, const char * password); - char * GetStrError(); - int GetError(); + const std::string & GetStrError() const; + int GetError(); int Start(const char *el, const char **attr); void End(const char *el); @@ -279,11 +267,10 @@ private: NETTRANSACT nt; int parseDepth; - USERDATA ud; - char errorMsg[MAX_ERR_STR_LEN]; - int error; - XML_Parser parser; + std::string errorMsg; + int error; + XML_Parser parser; RecvUserDataCb_t RecvUserDataCb; RecvUserDataCb_t RecvGetUserDataCb; @@ -304,6 +291,3 @@ private: //----------------------------------------------------------------------------- #endif /* _SERVCONF_H_ */ - -/* EOF */ -