From: Maxim Mamontov Date: Tue, 27 May 2014 13:55:11 +0000 (+0300) Subject: Fixed getting user's login. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/5985f3c811497f87ac58b64695b6d28879f07c65 Fixed getting user's login. --- diff --git a/projects/sgconf/users.cpp b/projects/sgconf/users.cpp index 0fb68544..61d36736 100644 --- a/projects/sgconf/users.cpp +++ b/projects/sgconf/users.cpp @@ -25,7 +25,8 @@ std::cout << Indent(level, true) << "login: " << info.login << "\n" << Indent(level) << "cash: " << info.cash << "\n" << Indent(level) << "credit: " << info.credit << "\n" << Indent(level) << "credit expire: " << TimeToString(info.creditExpire) << "\n" - << Indent(level) << "last cash add: " << info.lastCash << "\n" + << Indent(level) << "last cash add: " << info.lastCashAdd << "\n" + << Indent(level) << "last cash add time: " << TimeToString(info.lastCashAddTime) << "\n" << Indent(level) << "prepaid traffic: " << info.prepaidTraff << "\n" << Indent(level) << "disabled: " << (info.disabled ? "t" : "f") << "\n" << Indent(level) << "passive: " << (info.passive ? "t" : "f") << "\n" @@ -42,6 +43,8 @@ std::cout << Indent(level, true) << "login: " << info.login << "\n" << Indent(level) << "address: " << info.address << "\n" << Indent(level) << "phone: " << info.phone << "\n" << Indent(level) << "free mb: " << info.stat.freeMb << "\n" + << Indent(level) << "last ping time: " << TimeToString(info.pingTime) << "\n" + << Indent(level) << "last activity time: " << TimeToString(info.lastActivityTime) << "\n" << Indent(level) << "traffic:\n"; for (size_t i = 0; i < DIR_NUM; ++i) { diff --git a/stglibs/srvconf.lib/include/stg/servconf_types.h b/stglibs/srvconf.lib/include/stg/servconf_types.h index 22172506..84ceae89 100644 --- a/stglibs/srvconf.lib/include/stg/servconf_types.h +++ b/stglibs/srvconf.lib/include/stg/servconf_types.h @@ -140,7 +140,8 @@ struct INFO double cash; double credit; time_t creditExpire; - double lastCash; + double lastCashAdd; + double lastCashAddTime; time_t lastTimeCash; double prepaidTraff; int disabled; diff --git a/stglibs/srvconf.lib/parsers/get_user.cpp b/stglibs/srvconf.lib/parsers/get_user.cpp index 39151973..3da8ee98 100644 --- a/stglibs/srvconf.lib/parsers/get_user.cpp +++ b/stglibs/srvconf.lib/parsers/get_user.cpp @@ -71,8 +71,8 @@ GET_USER::PARSER::PARSER(CALLBACK f, void * d) AddParser(propertyParsers, "cash", info.cash); AddParser(propertyParsers, "credit", info.credit); AddParser(propertyParsers, "creditExpire", info.creditExpire); - AddParser(propertyParsers, "lastCash", info.lastCash); - AddParser(propertyParsers, "lastTimeCash", info.lastCash); + AddParser(propertyParsers, "lastCash", info.lastCashAdd); + AddParser(propertyParsers, "lastTimeCash", info.lastCashAddTime); AddParser(propertyParsers, "freeMb", info.prepaidTraff); AddParser(propertyParsers, "down", info.disabled); AddParser(propertyParsers, "passive", info.passive); @@ -139,9 +139,11 @@ if (strcasecmp(el, "user") == 0) error = attr[3]; else error = "User not found."; + return; } - else - parsingAnswer = true; + else if (strcasecmp(attr[0], "login") == 0 && attr[1]) + info.login = attr[1]; + parsingAnswer = true; } else parsingAnswer = true;