]> git.stg.codes - stg.git/commitdiff
Fixed getting user's login.
authorMaxim Mamontov <faust.madf@gmail.com>
Tue, 27 May 2014 13:55:11 +0000 (16:55 +0300)
committerMaxim Mamontov <faust.madf@gmail.com>
Tue, 27 May 2014 13:55:11 +0000 (16:55 +0300)
projects/sgconf/users.cpp
stglibs/srvconf.lib/include/stg/servconf_types.h
stglibs/srvconf.lib/parsers/get_user.cpp

index 0fb68544e1584961a5aad457729481e91eaf51fe..61d367366ca1680aa0d8f0ab838026d0feb4b6ec 100644 (file)
@@ -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)       << "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"
           << 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)       << "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)
     {
           << Indent(level)       << "traffic:\n";
 for (size_t i = 0; i < DIR_NUM; ++i)
     {
index 2217250666ad07cbb109e47610110ff4f5a8112e..84ceae89ac81a5efa057788b7626dbff9459db7a 100644 (file)
@@ -140,7 +140,8 @@ struct INFO
     double      cash;
     double      credit;
     time_t      creditExpire;
     double      cash;
     double      credit;
     time_t      creditExpire;
-    double      lastCash;
+    double      lastCashAdd;
+    double      lastCashAddTime;
     time_t      lastTimeCash;
     double      prepaidTraff;
     int         disabled;
     time_t      lastTimeCash;
     double      prepaidTraff;
     int         disabled;
index 391519733cc55d3f2a73def9469a3aa5dfdf9a15..3da8ee98f99a192ee111f5fcc41b7b32a1354eb4 100644 (file)
@@ -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, "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);
     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.";
                 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;
         }
     else
         parsingAnswer = true;