#include <cassert>
#include <cstdlib>
+#include "stg/users.h"
+#include "stg/common.h"
+#include "stg/scriptexecuter.h"
+#include "stg/tariff.h"
+#include "stg/tariffs.h"
+#include "stg/admin.h"
#include "user_impl.h"
-#include "users.h"
-#include "common.h"
#include "settings_impl.h"
-#include "script_executer.h"
-#include "tariff.h"
-#include "tariffs.h"
-#include "admin.h"
USER_IMPL::USER_IMPL(const SETTINGS_IMPL * s,
const STORE * st,
ips = StrToIPS("*");
deleted = false;
lastWriteStat = stgTime + random() % settings->GetStatWritePeriod();
-lastWriteDeatiledStat = stgTime;
+lastWriteDetailedStat = stgTime;
property.tariffName.AddBeforeNotifier(&tariffNotifier);
property.passive.AddBeforeNotifier(&passiveNotifier);
deleted = u.deleted;
lastWriteStat = u.lastWriteStat;
-lastWriteDeatiledStat = u.lastWriteDeatiledStat;
+lastWriteDetailedStat = u.lastWriteDetailedStat;
settings = u.settings;
currIP.DelAfterNotifier(n);
}
//-----------------------------------------------------------------------------
+void USER_IMPL::AddConnectedBeforeNotifier(PROPERTY_NOTIFIER_BASE<bool> * n)
+{
+STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+connected.AddBeforeNotifier(n);
+}
+//-----------------------------------------------------------------------------
+void USER_IMPL::DelConnectedBeforeNotifier(PROPERTY_NOTIFIER_BASE<bool> * n)
+{
+STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+connected.DelBeforeNotifier(n);
+}
+//-----------------------------------------------------------------------------
+void USER_IMPL::AddConnectedAfterNotifier(PROPERTY_NOTIFIER_BASE<bool> * n)
+{
+STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+connected.AddAfterNotifier(n);
+}
+//-----------------------------------------------------------------------------
+void USER_IMPL::DelConnectedAfterNotifier(PROPERTY_NOTIFIER_BASE<bool> * n)
+{
+STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+connected.DelAfterNotifier(n);
+}
+//-----------------------------------------------------------------------------
void USER_IMPL::OnAdd()
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
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());
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;
}
//-----------------------------------------------------------------------------