X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..e7b7bc2d8c852e52c08f833c1862c9edd5ace0ea:/projects/stargazer/users.cpp diff --git a/projects/stargazer/users.cpp b/projects/stargazer/users.cpp index 1b710baa..e2f326e0 100644 --- a/projects/stargazer/users.cpp +++ b/projects/stargazer/users.cpp @@ -144,7 +144,7 @@ if (store->AddUser(login)) USER u(settings, store, tariffs, sysAdmin, &ipIndex); -struct tm * tms; +/*struct tm * tms; time_t t = stgTime; tms = localtime(&t); @@ -156,7 +156,7 @@ tms->tm_sec = 0; if (settings->GetDayResetTraff() > tms->tm_mday) tms->tm_mon -= 1; -tms->tm_mday = settings->GetDayResetTraff(); +tms->tm_mday = settings->GetDayResetTraff();*/ u.SetLogin(login); @@ -352,9 +352,6 @@ return NULL; //----------------------------------------------------------------------------- void USERS::NewMinute(const struct tm * t) { -int usersCnt = 0; -list::iterator usr; - //Write traff, reset session traff. Fake disconnect-connect if (t->tm_hour == 23 && t->tm_min == 59) { @@ -365,11 +362,10 @@ if (t->tm_hour == 23 && t->tm_min == 59) if (TimeToWriteDetailStat(t)) { //printfd(__FILE__, "USER::WriteInetStat\n"); - for_each(users.begin(), users.end(), mem_fun_ref(&USER::SwapDetailStat)); - usersCnt = 0; + int usersCnt = 0; // ðÉÛÅÍ ÀÚÅÒÏ× ÞÁÓÔÑÍÉ. ÷ ÐÅÒÅÒÙ×ÁÈ ×ÙÚÙ×ÁÅÍ USER::Run - usr = users.begin(); + list::iterator usr = users.begin(); while (usr != users.end()) { usersCnt++; @@ -378,8 +374,6 @@ if (TimeToWriteDetailStat(t)) if (usersCnt % 10 == 0) for_each(users.begin(), users.end(), mem_fun_ref(&USER::Run)); } - - for_each(users.begin(), users.end(), mem_fun_ref(&USER::ResetDetailStat)); } RealDelUser(); @@ -495,8 +489,13 @@ if (isRunning) printfd(__FILE__, "Before USERS::Run()\n"); for_each(users.begin(), users.end(), mem_fun_ref(&USER::Run)); -for_each(users.begin(), users.end(), mem_fun_ref(&USER::SwapDetailStat)); -for_each(users.begin(), users.end(), mem_fun_ref(&USER::WriteDetailStat)); + +// 'cause bind2st accepts only constant first param +for (list::iterator it = users.begin(); + it != users.end(); + ++it) + it->WriteDetailStat(true); + for_each(users.begin(), users.end(), mem_fun_ref(&USER::WriteStat)); for_each(users.begin(), users.end(), mem_fun_ref(&USER::WriteConf)); @@ -753,16 +752,3 @@ switch (statTime) } return false; } -//----------------------------------------------------------------------------- -/*int USERS::SendMessage(const string & login, - time_t sndTtime, - time_t showTime, - char type, - const string & text) const -{ -return 0; -}*/ -//----------------------------------------------------------------------------- - - -