X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/e767204dbf56ac466489c142f0acdaebd5d0b935..015efefb3fcbf0613cefc6826eb92c0f4aec25f0:/projects/stargazer/user_impl.cpp?ds=sidebyside diff --git a/projects/stargazer/user_impl.cpp b/projects/stargazer/user_impl.cpp index 6ef806f2..e1bb4bae 100644 --- a/projects/stargazer/user_impl.cpp +++ b/projects/stargazer/user_impl.cpp @@ -36,23 +36,24 @@ #include // access #include +#include #include "user_impl.h" #include "users.h" #include "common.h" -#include "settings.h" +#include "settings_impl.h" #include "script_executer.h" #include "tariff.h" #include "tariffs.h" #include "admin.h" -USER_IMPL::USER_IMPL(const SETTINGS * s, +USER_IMPL::USER_IMPL(const SETTINGS_IMPL * s, const STORE * st, const TARIFFS * t, const ADMIN * a, const USERS * u) : users(u), - property(s), + property(s->GetScriptsDir()), WriteServLog(GetStgLogger()), login(), id(0), @@ -115,7 +116,7 @@ tariff = tariffs->GetNoTariff(); ips = StrToIPS("*"); deleted = false; lastWriteStat = stgTime + random() % settings->GetStatWritePeriod(); -lastWriteDeatiledStat = stgTime; +lastWriteDetailedStat = stgTime; property.tariffName.AddBeforeNotifier(&tariffNotifier); property.passive.AddBeforeNotifier(&passiveNotifier); @@ -132,7 +133,7 @@ pthread_mutex_init(&mutex, &attr); //----------------------------------------------------------------------------- USER_IMPL::USER_IMPL(const USER_IMPL & u) : users(u.users), - property(u.settings), + property(u.settings->GetScriptsDir()), WriteServLog(GetStgLogger()), login(u.login), id(u.id), @@ -193,7 +194,7 @@ connected = 0; deleted = u.deleted; lastWriteStat = u.lastWriteStat; -lastWriteDeatiledStat = u.lastWriteDeatiledStat; +lastWriteDetailedStat = u.lastWriteDetailedStat; settings = u.settings; @@ -458,7 +459,7 @@ STG_LOCKER lock(&mutex, __FILE__, __LINE__); if (!fakeConnect) { - string scriptOnConnect = settings->GetScriptDir() + "/OnConnect"; + string scriptOnConnect = settings->GetScriptsDir() + "/OnConnect"; if (access(scriptOnConnect.c_str(), X_OK) == 0) { @@ -515,7 +516,7 @@ if (!lastIPForDisconnect) if (!fakeDisconnect) { - string scriptOnDisonnect = settings->GetScriptDir() + "/OnDisconnect"; + string scriptOnDisonnect = settings->GetScriptsDir() + "/OnDisconnect"; if (access(scriptOnDisonnect.c_str(), X_OK) == 0) { @@ -911,7 +912,7 @@ void USER_IMPL::OnAdd() { STG_LOCKER lock(&mutex, __FILE__, __LINE__); -string scriptOnAdd = settings->GetScriptDir() + "/OnUserAdd"; +string scriptOnAdd = settings->GetScriptsDir() + "/OnUserAdd"; if (access(scriptOnAdd.c_str(), X_OK) == 0) { @@ -933,7 +934,7 @@ void USER_IMPL::OnDelete() { STG_LOCKER lock(&mutex, __FILE__, __LINE__); -string scriptOnDel = settings->GetScriptDir() + "/OnUserDel"; +string scriptOnDel = settings->GetScriptsDir() + "/OnUserDel"; if (access(scriptOnDel.c_str(), X_OK) == 0) { @@ -980,7 +981,7 @@ printfd(__FILE__, "USER::WriteDetailedStat() - size = %d\n", ts.size()); if (ts.size() && !disabledDetailStat) { - if (store->WriteDetailedStat(ts, lastWriteDeatiledStat, login)) + if (store->WriteDetailedStat(ts, lastWriteDetailedStat, login)) { printfd(__FILE__, "USER::WriteDetailStat() - failed to write current detail stat\n"); WriteServLog("Cannot write detail stat for user %s.", login.c_str()); @@ -990,12 +991,12 @@ if (ts.size() && !disabledDetailStat) printfd(__FILE__, "USER::WriteDetailStat() - pushing detail stat to queue\n"); STG_LOCKER lock(&mutex, __FILE__, __LINE__); traffStatSaved.second.swap(ts); - traffStatSaved.first = lastWriteDeatiledStat; + traffStatSaved.first = lastWriteDetailedStat; } return -1; } } -lastWriteDeatiledStat = stgTime; +lastWriteDetailedStat = stgTime; return 0; } //-----------------------------------------------------------------------------