From 5a98249bfadbe1d22d316dc3e9e770e0c305e5d6 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Tue, 27 May 2014 16:30:41 +0300 Subject: [PATCH] Code cleanup. --- projects/sgconf/Makefile | 1 - projects/sgconf/common_sg.cpp | 536 ------------------ projects/sgconf/common_sg.h | 77 --- projects/sgconf/main.cpp | 5 +- projects/sgconf/request.h | 113 ---- projects/sgconf/users.cpp | 2 +- .../srvconf.lib/include/stg/servconf_types.h | 5 +- stglibs/srvconf.lib/parsers/get_user.cpp | 9 +- 8 files changed, 12 insertions(+), 736 deletions(-) delete mode 100644 projects/sgconf/common_sg.cpp delete mode 100644 projects/sgconf/common_sg.h delete mode 100644 projects/sgconf/request.h diff --git a/projects/sgconf/Makefile b/projects/sgconf/Makefile index c5f3e4bf..e2fb8c1b 100644 --- a/projects/sgconf/Makefile +++ b/projects/sgconf/Makefile @@ -7,7 +7,6 @@ include ../../Makefile.conf PROG = sgconf SRCS = ./main.cpp \ - ./common_sg.cpp \ ./options.cpp \ ./actions.cpp \ ./admins.cpp \ diff --git a/projects/sgconf/common_sg.cpp b/projects/sgconf/common_sg.cpp deleted file mode 100644 index e407a716..00000000 --- a/projects/sgconf/common_sg.cpp +++ /dev/null @@ -1,536 +0,0 @@ -/* - * 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 - */ - - /* - $Author: faust $ - $Revision: 1.12 $ - $Date: 2009/06/08 10:02:28 $ - */ - - -#include "sg_error_codes.h" -#include "common_sg.h" -#include "version_sg.h" - -#include "stg/common.h" - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -using namespace STG; - -const int usageConf = 0; -const int usageInfo = 1; - -const int TO_KOI8 = 0; -const int FROM_KOI8 = 1; -//----------------------------------------------------------------------------- -struct ResultData -{ - bool result; - std::string reason; -}; -//----------------------------------------------------------------------------- -struct GetUserData -{ - GetUserData(REQUEST & req, bool res) : request(req), result(res) {} - REQUEST & request; - bool result; - std::string reason; -}; -//--------------------------------------------------------------------------- -struct HelpParams -{ - std::string setActionName; - std::string getActionName; - std::string valueName; - std::string valueParam; -}; -//--------------------------------------------------------------------------- -void Usage(int usageType) -{ -printf("Sgconf version: %s\n\n", VERSION_SG); - -char action[4]; -if (usageType == usageConf) - strcpy(action, "set"); -else - strcpy(action, "get"); - -printf("To add or to set cash use:\n"); -printf("sgconf set -s -p -a -w -u -c \n"); -printf("sgconf set -s -p -a -w -u -v \n"); -printf("To get cash use:\n"); -printf("sgconf get -s -p -a -w -u -c\n\n"); - -HelpParams hp[] = -{ - {"set tariff", "get tariff", "-t", ""}, - {"set credit", "get credit", "-r", ""}, - {"set credit expire", "get credit expire", "-E", ""}, - {"set password", "get password", "-o", ""}, - {"set prepaid traffic", "get prepaid traffic", "-e", ""}, - {"set IP-addresses", "get IP-addresses", "-I", "<*|ip_addr[,ip_addr...]>"}, - {"set name", "get name", "-A", ""}, - {"set note", "get note", "-N", ""}, - {"set street address", "get street address", "-D", "
"}, - {"set email", "get email", "-L", ""}, - {"set phone", "get phone", "-P", ""}, - {"set group", "get group", "-G", ""}, - {"set/unset down", "get down", "-d", "<0/1>"}, - {"set/unset \'passive\'", "get \'passive\'", "-i", "<0/1>"}, - {"set/unset \'disableDetailStat\'", "get \'disableDetailStat\'", "--disable-stat", "<0/1>"}, - {"set/unset \'alwaysOnline\'", "get \'alwaysOnline\'", "--always-online", "<0/1>"}, -}; - -for (unsigned i = 0; i < sizeof(hp) / sizeof(HelpParams); i++) - { - printf("To %s use:\n", hp[i].setActionName.c_str()); - printf("sgconf set -s -p -a -w -u %s %s\n", - hp[i].valueName.c_str(), hp[i].valueParam.c_str()); - printf("To %s use:\n", hp[i].getActionName.c_str()); - printf("sgconf get -s -p -a -w -u %s\n\n", - hp[i].valueName.c_str()); - } - -printf("To set user\'s upload traffic value use:\n"); -printf("sgconf set -s -p -a -w -u --u0 [--u1 ...]\n"); -printf("To get user\'s upload traffic value use:\n"); -printf("sgconf get -s -p -a -w -u --u0 [--u1 ...]\n\n"); - -printf("To set user\'s download traffic value use:\n"); -printf("sgconf set -s -p -a -w -u --d0 [--d1 ...]\n"); -printf("To get user\'s download traffic value use:\n"); -printf("sgconf get -s -p -a -w -u --d0 [--d1 ...]\n\n"); - -printf("To set userdata<0...9> use:\n"); -printf("sgconf set -s -p -a -w -u --ud0 [--ud1 ...]\n"); -printf("To get userdata<0...9> use:\n"); -printf("sgconf get -s -p -a -w -u --ud0 [--ud1 ...]\n\n"); - -printf("To get user's authorizers list use:\n"); -printf("sgconf get -s -p -a -w -u --authorized-by\n\n"); - -printf("To send message use:\n"); -printf("sgconf set -s -p -a -w -u -m \n\n"); - -printf("To create user use:\n"); -printf("sgconf set -s -p -a -w -u -n\n\n"); - -printf("To delete user use:\n"); -printf("sgconf set -s -p -a -w -u -l\n\n"); -} -//--------------------------------------------------------------------------- -void UsageConf() -{ -Usage(usageConf); -} -//--------------------------------------------------------------------------- -void UsageInfo() -{ -Usage(usageInfo); -} -//--------------------------------------------------------------------------- -int CheckLogin(const char * login) -{ -for (int i = 0; i < (int)strlen(login); i++) - { - if (!(( login[i] >= 'a' && login[i] <= 'z') - || (login[i] >= 'A' && login[i] <= 'Z') - || (login[i] >= '0' && login[i] <= '9') - || login[i] == '.' - || login[i] == '_' - || login[i] == '-')) - { - return 1; - } - } -return 0; -} -//----------------------------------------------------------------------------- -short int ParseServerPort(const char * p) -{ -int port; -if (str2x(p, port) != 0) - { - printf("Incorrect server port %s\n", p); - exit(NETWORK_ERR_CODE); - } -return (short)port; -} -//----------------------------------------------------------------------------- -char * ParseAdminLogin(char * adm) -{ -if (CheckLogin(adm)) - { - printf("Incorrect admin login %s\n", adm); - exit(PARAMETER_PARSING_ERR_CODE); - } -return adm; -} -//----------------------------------------------------------------------------- -char * ParsePassword(char * pass) -{ -if (strlen(pass) >= ADM_PASSWD_LEN) - { - printf("Password too big %s\n", pass); - exit(PARAMETER_PARSING_ERR_CODE); - } - -return pass; -} -//----------------------------------------------------------------------------- -char * ParseUser(char * usr) -{ -if (CheckLogin(usr)) - { - printf("Incorrect user login %s\n", usr); - exit(PARAMETER_PARSING_ERR_CODE); - } -return usr; -} -//----------------------------------------------------------------------------- -void ConvertKOI8(const std::string & src, std::string * dst, int encType) -{ -iconv_t cd; -char * ob = new char[src.size() * 2 + 1]; -char * ib = new char[src.size() + 1]; - -strcpy(ib, src.c_str()); - -char * outbuf = ob; -char * inbuf = ib; - -setlocale(LC_ALL, ""); - -char charsetF[100]; -char charsetT[100]; - -if (encType == TO_KOI8) - { - strcpy(charsetF, nl_langinfo(CODESET)); - strcpy(charsetT, "koi8-ru"); - } -else - { - strcpy(charsetT, nl_langinfo(CODESET)); - strcpy(charsetF, "koi8-ru"); - } - -size_t nconv = 1; - -size_t insize = strlen(ib); -size_t outsize = insize * 2 + 1; - -insize = src.size(); - -cd = iconv_open(charsetT, charsetF); -if (cd == (iconv_t) -1) - { - if (errno != EINVAL) - printf("error iconv_open\n"); - else - { - printf("Warning: iconv from %s to %s failed\n", charsetF, charsetT); - *dst = src; - return; - } - - exit(ICONV_ERR_CODE); - } - -#if defined(FREE_BSD) || defined(FREE_BSD5) -nconv = iconv(cd, (const char **)&inbuf, &insize, &outbuf, &outsize); -#else -nconv = iconv(cd, &inbuf, &insize, &outbuf, &outsize); -#endif -//printf("charsetT=%s charsetF=%s\n", charsetT, charsetF); -//printf("ib=%s ob=%s\n", ib, ob); -//printf("nconv=%d outsize=%d\n", nconv, outsize); -if (nconv == (size_t) -1) - { - if (errno != EINVAL) - { - printf("iconv error\n"); - exit(ICONV_ERR_CODE); - } - } - -*outbuf = L'\0'; - -iconv_close(cd); -*dst = ob; - -delete[] ob; -delete[] ib; -} -//----------------------------------------------------------------------------- -void ConvertFromKOI8(const std::string & src, std::string * dst) -{ -ConvertKOI8(src, dst, FROM_KOI8); -} -//----------------------------------------------------------------------------- -void ResultCallback(bool result, const std::string & reason, void * d) -{ -ResultData * data = static_cast(d); -data->result = result; -data->reason = reason; -} -//----------------------------------------------------------------------------- -void RecvAuthByData(bool result, const std::string & reason, - const AUTH_BY::INFO & list, void * d) -{ -ResultData * data = static_cast(d); -data->result = result; -data->reason = reason; - -if (!result) - return; - -for (std::vector::const_iterator it = list.begin(); it != list.end(); ++it) - std::cout << *it << "\n"; - -std::cout << std::endl; -} -//----------------------------------------------------------------------------- -struct StringReqParams -{ - std::string name; - RESETABLE reqParam; - const std::string * value; -}; -//----------------------------------------------------------------------------- -void GetUserCallback(bool result, const std::string& reason, const GET_USER::INFO & info, void * d) -{ -GetUserData * data = static_cast(d); -data->result = false; -data->reason = reason; - -if (!result) - return; - -if (info.login == "") - { - data->result = false; - data->reason = "Invalid login."; - return; - } - -if (!data->request.cash.empty()) - cout << "cash = " << info.cash << endl; - -if (!data->request.credit.empty()) - cout << "credit = " << info.credit << endl; - -if (!data->request.creditExpire.empty()) - { - char buf[32]; - struct tm brokenTime; - time_t tt = info.creditExpire; - - brokenTime.tm_wday = 0; - brokenTime.tm_yday = 0; - brokenTime.tm_isdst = 0; - brokenTime.tm_hour = 0; - brokenTime.tm_min = 0; - brokenTime.tm_sec = 0; - - gmtime_r(&tt, &brokenTime); - - strftime(buf, 32, "%Y-%m-%d", &brokenTime); - - cout << "creditExpire = " << buf << endl; - } - -if (!data->request.down.empty()) - cout << "down = " << info.down << endl; - -if (!data->request.passive.empty()) - cout << "passive = " << info.passive << endl; - -if (!data->request.disableDetailStat.empty()) - cout << "disableDetailStat = " << info.disableDetailStat << endl; - -if (!data->request.alwaysOnline.empty()) - cout << "alwaysOnline = " << info.alwaysOnline << endl; - -if (!data->request.prepaidTraff.empty()) - cout << "prepaidTraff = " << info.prepaidTraff << endl; - -for (int i = 0; i < DIR_NUM; i++) - { - if (!data->request.sessionUpload[i].empty()) - cout << "session upload for dir " << i << " = " << info.stat.su[i] << endl; - if (!data->request.sessionDownload[i].empty()) - cout << "session download for dir " << i << "=" << info.stat.sd[i] << endl; - } - -for (int i = 0; i < DIR_NUM; i++) - { - if (!data->request.monthUpload[i].empty()) - cout << "month upload for dir " << i << " = " << info.stat.mu[i] << endl; - if (!data->request.monthDownload[i].empty()) - cout << "month download for dir " << i << " = " << info.stat.md[i] << endl; - } - -for (int i = 0; i < USERDATA_NUM; i++) - { - if (!data->request.userData[i].empty()) - { - std::string str; - ConvertFromKOI8(info.userData[i], &str); - cout << "user data " << i << " = " << str << endl; - } - } - -StringReqParams strReqParams[] = -{ - {"note", data->request.note, &info.note}, - {"name", data->request.name, &info.name}, - {"address", data->request.address, &info.address}, - {"email", data->request.email, &info.email}, - {"phone", data->request.phone, &info.phone}, - {"group", data->request.group, &info.group}, - {"tariff", data->request.tariff, &info.tariff}, - {"password", data->request.usrPasswd, &info.password}, - {"ip", data->request.ips, &info.ips} // IP-address of user -}; -for (unsigned i = 0; i < sizeof(strReqParams) / sizeof(StringReqParams); i++) - { - if (!strReqParams[i].reqParam.empty()) - { - string str; - ConvertFromKOI8(*strReqParams[i].value, &str); - cout << strReqParams[i].name << " = " << str << endl; - } - } -data->result = true; -} -//----------------------------------------------------------------------------- -bool ProcessSetUser(const std::string & server, - int port, - const std::string & login, - const std::string & password, - const std::string & user, - const USER_CONF_RES & conf, - const USER_STAT_RES & stat) -{ -SERVCONF sc(server, port, login, password); - -ResultData data; -int res = sc.ChgUser(user, conf, stat, ResultCallback, &data); - -if (res == st_ok && data.result) - { - printf("Ok\n"); - return false; - } - -printf("Error\n"); -if (res != st_ok) - printf("%s\n", sc.GetStrError().c_str()); -else - printf("%s\n", data.reason.c_str()); -return true; -} -//----------------------------------------------------------------------------- -bool ProcessSendMessage(const std::string & server, uint16_t port, - const std::string & login, const std::string & password, - const std::string & user, const std::string & text) -{ -SERVCONF sc(server, port, login, password); - -ResultData data; -int res = sc.SendMessage(user, text, ResultCallback, &data); - -if (res == st_ok && data.result) - { - printf("Ok\n"); - return true; - } - -printf("Error\n"); -if (res != st_ok) - printf("%s\n", sc.GetStrError().c_str()); -else - printf("%s\n", data.reason.c_str()); -return false; -} -//----------------------------------------------------------------------------- -bool ProcessGetUser(const std::string &server, - int port, - const std::string &admLogin, - const std::string &admPasswd, - const std::string &login, - REQUEST & request) -{ -SERVCONF sc(server, port, admLogin, admPasswd); - -GetUserData data(request, false); -bool res = (sc.GetUser(login.c_str(), GetUserCallback, &data) == st_ok); - -if (res && data.result) - { - printf("Ok\n"); - return true; - } - -printf("Error\n"); -if (!res) - printf("%s\n", sc.GetStrError().c_str()); -else - printf("%s\n", data.reason.c_str()); -return false; -} -//----------------------------------------------------------------------------- -bool ProcessAuthBy(const std::string &server, - int port, - const std::string &admLogin, - const std::string &admPasswd, - const std::string &login) -{ -SERVCONF sc(server, port, admLogin, admPasswd); - -ResultData data; -bool res = (sc.AuthBy(login.c_str(), RecvAuthByData, &data) == st_ok); - -if (res && data.result) - { - printf("Ok\n"); - return true; - } - -printf("Error\n"); -if (!res) - printf("%s\n", sc.GetStrError().c_str()); -else - printf("%s\n", data.reason.c_str()); -return false; -} -//----------------------------------------------------------------------------- diff --git a/projects/sgconf/common_sg.h b/projects/sgconf/common_sg.h deleted file mode 100644 index 323a8cf8..00000000 --- a/projects/sgconf/common_sg.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 - */ - - /* - $Author: faust $ - $Revision: 1.5 $ - $Date: 2009/06/08 10:02:28 $ - */ - - -#ifndef COMMON_SG_H -#define COMMON_SG_H - -#include "stg/servconf.h" -#include "stg/servconf_types.h" -#include "request.h" - -#include - -struct USER_CONF_RES; -struct USER_STAT_RES; - -void UsageConf(); -void UsageInfo(); - -char * ParseUser(char * usr); -char * ParsePassword(char * pass); -char * ParseAdminLogin(char * adm); -short int ParseServerPort(const char * p); -void ParseAnyString(const char * c, string * msg, const char * enc = "cp1251"); -int CheckLogin(const char * login); -void ConvertFromKOI8(const std::string & src, std::string * dst); -void ConvertToKOI8(const std::string & src, std::string * dst); - -bool ProcessGetUser(const std::string & server, - int port, - const std::string & admLogin, - const std::string & admPasswd, - const std::string & login, - REQUEST & request); - -bool ProcessAuthBy(const std::string & server, - int port, - const std::string & admLogin, - const std::string & admPasswd, - const std::string & login); - -bool ProcessSetUser(const std::string & server, - int port, - const std::string & admLogin, - const std::string & admPasswd, - const std::string & user, - const USER_CONF_RES & conf, - const USER_STAT_RES & stat); - -bool ProcessSendMessage(const std::string & server, uint16_t port, - const std::string & login, const std::string & password, - const std::string & user, const std::string & text); - -#endif diff --git a/projects/sgconf/main.cpp b/projects/sgconf/main.cpp index e10d21f0..135cd3c0 100644 --- a/projects/sgconf/main.cpp +++ b/projects/sgconf/main.cpp @@ -19,10 +19,6 @@ * Author : Maxim Mamontov */ -#include "request.h" -#include "common_sg.h" -#include "sg_error_codes.h" - #include "xml.h" #include "admins.h" #include "tariffs.h" @@ -31,6 +27,7 @@ #include "actions.h" #include "config.h" +#include "stg/servconf.h" #include "stg/user_conf.h" #include "stg/user_stat.h" #include "stg/common.h" diff --git a/projects/sgconf/request.h b/projects/sgconf/request.h deleted file mode 100644 index bca3c148..00000000 --- a/projects/sgconf/request.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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 - */ - -/* - * Date: 27.10.2002 - */ - -/* - * Author : Boris Mikhailenko - */ - - /* - $Author: faust $ - $Revision: 1.14 $ - $Date: 2009/06/08 10:02:28 $ - */ - -#ifndef request_h -#define request_h - -#include - -#include "stg/resetable.h" -#include "stg/const.h" -#include "stg/os_int.h" - -#define TARIFF_NOW (0) -#define TARIFF_DEL (1) -#define TARIFF_REC (2) - -using namespace std; -//----------------------------------------------------------------------------- -struct REQUEST -{ - -REQUEST() - : chgTariff(false), - createUser(false), - deleteUser(false), - authBy(false) -{ - for (int i = 0; i < DIR_NUM; i++) - { - sessionUpload[i].reset(); - sessionDownload[i].reset(); - monthUpload[i].reset(); - monthDownload[i].reset(); - } - - for (int i = 0; i < USERDATA_NUM; i++) - userData[i].reset(); -} - -RESETABLE server; -RESETABLE port; -RESETABLE admLogin; -RESETABLE admPasswd; -RESETABLE login; - -RESETABLE tariff; -int chgTariff; - -RESETABLE cash; -RESETABLE setCash; -string message; -bool createUser; -bool deleteUser; -bool authBy; - -RESETABLE usrMsg; -RESETABLE credit; -RESETABLE creditExpire; -RESETABLE usrPasswd; -RESETABLE down; -RESETABLE passive; -RESETABLE disableDetailStat; -RESETABLE alwaysOnline; -RESETABLE prepaidTraff; - -RESETABLE sessionUpload[DIR_NUM]; -RESETABLE sessionDownload[DIR_NUM]; - -RESETABLE monthUpload[DIR_NUM]; -RESETABLE monthDownload[DIR_NUM]; - -RESETABLE userData[USERDATA_NUM]; - -RESETABLE note; -RESETABLE name; -RESETABLE address; -RESETABLE email; -RESETABLE phone; -RESETABLE group; -RESETABLE ips; // IP-address of user -}; -//----------------------------------------------------------------------------- - -#endif - - diff --git a/projects/sgconf/users.cpp b/projects/sgconf/users.cpp index cdbfbbb5..0fb68544 100644 --- a/projects/sgconf/users.cpp +++ b/projects/sgconf/users.cpp @@ -27,7 +27,7 @@ std::cout << Indent(level, true) << "login: " << info.login << "\n" << Indent(level) << "credit expire: " << TimeToString(info.creditExpire) << "\n" << Indent(level) << "last cash add: " << info.lastCash << "\n" << Indent(level) << "prepaid traffic: " << info.prepaidTraff << "\n" - << Indent(level) << "disabled: " << (info.down ? "t" : "f") << "\n" + << Indent(level) << "disabled: " << (info.disabled ? "t" : "f") << "\n" << Indent(level) << "passive: " << (info.passive ? "t" : "f") << "\n" << Indent(level) << "disabled detail stat: " << (info.disableDetailStat ? "t" : "f") << "\n" << Indent(level) << "connected: " << (info.connected ? "t" : "f") << "\n" diff --git a/stglibs/srvconf.lib/include/stg/servconf_types.h b/stglibs/srvconf.lib/include/stg/servconf_types.h index 3fd1c7c5..22172506 100644 --- a/stglibs/srvconf.lib/include/stg/servconf_types.h +++ b/stglibs/srvconf.lib/include/stg/servconf_types.h @@ -141,8 +141,9 @@ struct INFO double credit; time_t creditExpire; double lastCash; + time_t lastTimeCash; double prepaidTraff; - int down; + int disabled; int passive; int disableDetailStat; int connected; @@ -157,6 +158,8 @@ struct INFO std::string address; std::string phone; STAT stat; + time_t pingTime; + time_t lastActivityTime; ARRAY userData; }; diff --git a/stglibs/srvconf.lib/parsers/get_user.cpp b/stglibs/srvconf.lib/parsers/get_user.cpp index cd19d1f6..39151973 100644 --- a/stglibs/srvconf.lib/parsers/get_user.cpp +++ b/stglibs/srvconf.lib/parsers/get_user.cpp @@ -72,11 +72,12 @@ GET_USER::PARSER::PARSER(CALLBACK f, void * d) AddParser(propertyParsers, "credit", info.credit); AddParser(propertyParsers, "creditExpire", info.creditExpire); AddParser(propertyParsers, "lastCash", info.lastCash); - AddParser(propertyParsers, "prepaidTraff", info.prepaidTraff); - AddParser(propertyParsers, "down", info.down); + AddParser(propertyParsers, "lastTimeCash", info.lastCash); + AddParser(propertyParsers, "freeMb", info.prepaidTraff); + AddParser(propertyParsers, "down", info.disabled); AddParser(propertyParsers, "passive", info.passive); AddParser(propertyParsers, "disableDetailStat", info.disableDetailStat); - AddParser(propertyParsers, "connected", info.connected); + AddParser(propertyParsers, "status", info.connected); AddParser(propertyParsers, "aonline", info.alwaysOnline); AddParser(propertyParsers, "currIP", info.ip, GetIPValue); AddParser(propertyParsers, "ip", info.ips); @@ -88,6 +89,8 @@ GET_USER::PARSER::PARSER(CALLBACK f, void * d) AddParser(propertyParsers, "address", info.address, GetEncodedValue); AddParser(propertyParsers, "phone", info.phone, GetEncodedValue); AddParser(propertyParsers, "traff", info.stat); + AddParser(propertyParsers, "pingTime", info.pingTime); + AddParser(propertyParsers, "lastActivityTime", info.lastActivityTime); for (size_t i = 0; i < USERDATA_NUM; ++i) AddParser(propertyParsers, "userData" + unsigned2str(i), info.userData[i], GetEncodedValue); -- 2.43.2