#include <arpa/inet.h>
#include <string>
-#include "common.h"
-//#include "srvconf_common.h"
-#include "stg_const.h"
-#include "servconf.h"
+#include "stg/common.h"
+#include "stg/const.h"
+#include "stg/servconf.h"
using namespace std;
-//-----------------------------------------------------------------------------
-PARSER::PARSER()
-{
-}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
PARSER_GET_USERS::PARSER_GET_USERS()
+ : RecvUserDataCb(NULL),
+ userDataCb(NULL),
+ user(),
+ depth(0),
+ error(false)
{
-depth = 0;
-error = false;
-RecvUserDataCb = NULL;
-}
-//-----------------------------------------------------------------------------
-void PARSER_GET_USERS::Reset()
-{
-
}
//-----------------------------------------------------------------------------
int PARSER_GET_USERS::ParseStart(const char *el, const char **attr)
}
}
+if (strcasecmp(el, "creditExpire") == 0)
+ {
+ if (str2x(attr[1], user.creditExpire) < 0)
+ {
+ return;
+ }
+ }
+
/*if (strcasecmp(el, "freemb") == 0)
{
if (strtodouble2(attr[1], user.freeMb) < 0)
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
PARSER_GET_USER::PARSER_GET_USER()
+ : RecvUserDataCb(NULL),
+ userDataCb(NULL),
+ user(),
+ depth(0),
+ error(false)
{
-depth = 0;
-error = false;
-RecvUserDataCb = NULL;
-}
-//-----------------------------------------------------------------------------
-void PARSER_GET_USER::Reset()
-{
-
}
//-----------------------------------------------------------------------------
int PARSER_GET_USER::ParseStart(const char *el, const char **attr)
user.ip = inet_addr(attr[1]);
}
+if (strcasecmp(el, "creditExpire") == 0)
+ {
+ if (str2x(attr[1], user.creditExpire) < 0)
+ {
+ return;
+ }
+ }
+
for (int i = 0; i < USERDATA_NUM; i++)
{
string num;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
PARSER_GET_SERVER_INFO::PARSER_GET_SERVER_INFO()
+ : RecvServerInfoDataCb(NULL),
+ serverInfoDataCb(NULL),
+ depth(0),
+ error(false),
+ serverInfo()
{
-depth = 0;
-error = false;
-RecvServerInfoDataCb = NULL;
-}
-//-----------------------------------------------------------------------------
-void PARSER_GET_SERVER_INFO::Reset()
-{
-
}
//-----------------------------------------------------------------------------
int PARSER_GET_SERVER_INFO::ParseStart(const char *el, const char **attr)
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
PARSER_CHG_USER::PARSER_CHG_USER()
+ : RecvChgUserCb(NULL),
+ chgUserCbData(NULL),
+ depth(0),
+ error(false)
{
-depth = 0;
-error = false;
-RecvChgUserCb = NULL;
}
//-----------------------------------------------------------------------------
int PARSER_CHG_USER::ParseStart(const char *el, const char **attr)
void PARSER_CHG_USER::ParseEnd(const char *)
{
depth--;
-}
-//-----------------------------------------------------------------------------
-void PARSER_CHG_USER::Reset()
-{
-
}
//-----------------------------------------------------------------------------
void PARSER_CHG_USER::ParseAnswer(const char *, const char **attr)
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
PARSER_CHECK_USER::PARSER_CHECK_USER()
+ : RecvCheckUserCb(NULL),
+ checkUserCbData(NULL),
+ depth(0),
+ error(false)
{
-depth = 0;
-error = false;
-RecvCheckUserCb = NULL;
}
//-----------------------------------------------------------------------------
int PARSER_CHECK_USER::ParseStart(const char *el, const char **attr)
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
PARSER_SEND_MESSAGE::PARSER_SEND_MESSAGE()
+ : RecvSendMessageCb(NULL),
+ sendMessageCbData(NULL),
+ depth(0),
+ error(false)
{
-depth = 0;
-error = false;
-RecvSendMessageCb = NULL;
}
//-----------------------------------------------------------------------------
int PARSER_SEND_MESSAGE::ParseStart(const char *el, const char **attr)
void PARSER_SEND_MESSAGE::ParseEnd(const char *)
{
depth--;
-}
-//-----------------------------------------------------------------------------
-void PARSER_SEND_MESSAGE::Reset()
-{
-
}
//-----------------------------------------------------------------------------
void PARSER_SEND_MESSAGE::ParseAnswer(const char *, const char **attr)
sendMessageCbData = data;
}
//-----------------------------------------------------------------------------
-