$Author: faust $
*/
-#include <stdio.h>
#include <unistd.h>
-#include <signal.h>
+
+#include <csignal>
+#include <algorithm> // for_each
+#include <functional> // mem_fun_ref
#include "ao.h"
#include "user.h"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-// ëÌÁÓÓ ÄÌÑ ÐÏÉÓËÁ ÀÚÅÒÁ × ÓÐÉÓËÅ ÎÏÔÉÆÉËÁÔÏÒÏ×
template <typename varType>
class IS_CONTAINS_USER: public binary_function<varType, USER_PTR, bool>
{
{
}
//-----------------------------------------------------------------------------
-void AUTH_AO::SetUsers(USERS * u)
-{
-users = u;
-}
-//-----------------------------------------------------------------------------
-void AUTH_AO::SetSettings(const MODULE_SETTINGS & s)
-{
-settings = s;
-}
-//-----------------------------------------------------------------------------
-int AUTH_AO::ParseSettings()
-{
-return 0;
-}
-//-----------------------------------------------------------------------------
-const string & AUTH_AO::GetStrError() const
-{
-return errorStr;
-}
-//-----------------------------------------------------------------------------
int AUTH_AO::Start()
{
GetUsers();
-list<USER_PTR>::iterator users_iter;
-
-/*onAddUserNotifier.SetAuthorizator(this);
-onDelUserNotifier.SetAuthorizator(this);*/
users->AddNotifierUserAdd(&onAddUserNotifier);
users->AddNotifierUserDel(&onDelUserNotifier);
-users_iter = usersList.begin();
-while (users_iter != usersList.end())
+/*list<USER_PTR>::iterator it = usersList.begin();
+while (it != usersList.end())
{
- UpdateUserAuthorization(*users_iter);
- ++users_iter;
- }
+ UpdateUserAuthorization(*it);
+ ++it;
+ }*/
+std::for_each(usersList.begin(), usersList.end(), std::bind1st(std::mem_fun(&AUTH_AO::UpdateUserAuthorization), this));
+
isRunning = true;
+
return 0;
}
//-----------------------------------------------------------------------------
AUTH_AO();
virtual ~AUTH_AO(){};
- void SetUsers(USERS * u);
+ void SetUsers(USERS * u) { users = u; }
void SetTariffs(TARIFFS *) {}
void SetAdmins(ADMINS *) {}
void SetTraffcounter(TRAFFCOUNTER *) {}
int Stop();
int Reload() { return 0; }
bool IsRunning();
- void SetSettings(const MODULE_SETTINGS & s);
- int ParseSettings();
- const std::string & GetStrError() const;
+ void SetSettings(const MODULE_SETTINGS &) {}
+ int ParseSettings() { return 0; }
+ const std::string & GetStrError() const { return errorStr; }
const std::string GetVersion() const;
uint16_t GetStartPosition() const;
uint16_t GetStopPosition() const;
bool isRunning;
MODULE_SETTINGS settings;
- /*
- ÍÙ ÄÏÌÖÎÙ ÐÅÒÅÐÒÏ×ÅÒÉÔØ ×ÏÚÍÏÖÎÏÓÔØ Á×ÔÏÒÉÚÁÃÉÉ ÀÚÅÒÁ ÐÒÉ ÉÚÍÅÎÅÎÉÉ
- ÓÌÅÄÕÀÝÉÈ ÅÇÏ ÐÁÒÁÍÅÔÒÏ×:
- - alwaysOnline
- - ips
- */
+ list<CHG_BEFORE_NOTIFIER<int> > BeforeChgAONotifierList;
+ list<CHG_AFTER_NOTIFIER<int> > AfterChgAONotifierList;
- list<CHG_BEFORE_NOTIFIER<int> > BeforeChgAONotifierList;
- list<CHG_AFTER_NOTIFIER<int> > AfterChgAONotifierList;
-
- list<CHG_BEFORE_NOTIFIER<USER_IPS> > BeforeChgIPNotifierList;
- list<CHG_AFTER_NOTIFIER<USER_IPS> > AfterChgIPNotifierList;
+ list<CHG_BEFORE_NOTIFIER<USER_IPS> > BeforeChgIPNotifierList;
+ list<CHG_AFTER_NOTIFIER<USER_IPS> > AfterChgIPNotifierList;
class ADD_USER_NONIFIER: public NOTIFIER_BASE<USER_PTR> {
public: