X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/8738549c84637f1250749a212cc05d55c746fc03..3bbc755fc0e1ab3a1e47cb39c4eeaa986d4b0d8b:/projects/stargazer/users_impl.cpp?ds=sidebyside diff --git a/projects/stargazer/users_impl.cpp b/projects/stargazer/users_impl.cpp index 3dd7638b..14c44604 100644 --- a/projects/stargazer/users_impl.cpp +++ b/projects/stargazer/users_impl.cpp @@ -51,29 +51,18 @@ extern volatile time_t stgTime; //#define USERS_DEBUG 1 //----------------------------------------------------------------------------- -USERS_IMPL::USERS_IMPL(SETTINGS_IMPL * s, STORE * st, TARIFFS * t, const ADMIN * sa) - : USERS(), - users(), - usersToDelete(), - /*userIPNotifiersBefore(), - userIPNotifiersAfter(),*/ - ipIndex(), - loginIndex(), - settings(s), +USERS_IMPL::USERS_IMPL(SETTINGS_IMPL * s, STORE * st, + TARIFFS * t, SERVICES & svcs, + const ADMIN * sa) + : settings(s), tariffs(t), + m_services(svcs), store(st), sysAdmin(sa), WriteServLog(GetStgLogger()), nonstop(false), isRunning(false), - mutex(), - thread(), - handle(0), - searchDescriptors(), - onAddNotifiers(), - onDelNotifiers(), - onAddNotifiersImpl(), - onDelNotifiersImpl() + handle(0) { pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); @@ -171,7 +160,7 @@ if (store->AddUser(login)) } ////// -USER_IMPL u(settings, store, tariffs, sysAdmin, this); +USER_IMPL u(settings, store, tariffs, sysAdmin, this, m_services); /*struct tm * tms; time_t t = stgTime; @@ -355,9 +344,10 @@ if (store->GetUsersList(&usersList) < 0) user_iter ui; +unsigned errors = 0; for (unsigned int i = 0; i < usersList.size(); i++) { - USER_IMPL u(settings, store, tariffs, sysAdmin, this); + USER_IMPL u(settings, store, tariffs, sysAdmin, this, m_services); u.SetLogin(usersList[i]); users.push_front(u); @@ -366,12 +356,14 @@ for (unsigned int i = 0; i < usersList.size(); i++) AddUserIntoIndexes(ui); if (ui->ReadConf() < 0) - return -1; + errors++; if (ui->ReadStat() < 0) - return -1; + errors++; } +if (errors > 0) + return -1; return 0; } //----------------------------------------------------------------------------- @@ -521,6 +513,7 @@ else } std::for_each(users.begin(), users.end(), std::mem_fun_ref(&USER_IMPL::ProcessDailyFee)); +std::for_each(users.begin(), users.end(), std::mem_fun_ref(&USER_IMPL::ProcessServices)); if (settings->GetDayFeeIsLastDay()) {