#include "stg/plugin.h"
#include "stg/module_settings.h"
+#include "stg/subscriptions.h"
#include "stg/notifer.h"
#include "stg/user.h"
#include "stg/blowfish.h"
using UserPtr = STG::User*;
-//-----------------------------------------------------------------------------
-class ADD_USER_NONIFIER: public STG::NotifierBase<UserPtr> {
-public:
- explicit ADD_USER_NONIFIER(REMOTE_SCRIPT & r)
- : rs(r) {}
- void Notify(const UserPtr & user);
-
-private:
- ADD_USER_NONIFIER(const ADD_USER_NONIFIER & rhs);
- ADD_USER_NONIFIER & operator=(const ADD_USER_NONIFIER);
-
- REMOTE_SCRIPT & rs;
-};
-//-----------------------------------------------------------------------------
-class DEL_USER_NONIFIER: public STG::NotifierBase<UserPtr> {
-public:
- explicit DEL_USER_NONIFIER(REMOTE_SCRIPT & r)
- : rs(r) {}
- void Notify(const UserPtr & user);
-
-private:
- DEL_USER_NONIFIER(const DEL_USER_NONIFIER & rhs);
- DEL_USER_NONIFIER & operator=(const DEL_USER_NONIFIER);
-
- REMOTE_SCRIPT & rs;
-};
//-----------------------------------------------------------------------------
class IP_NOTIFIER: public STG::PropertyNotifierBase<uint32_t> {
public:
return *this;
}
- void Notify(const uint32_t & oldValue, const uint32_t & newValue);
+ void notify(const uint32_t & oldValue, const uint32_t & newValue) override;
UserPtr GetUser() const { return user; }
private:
return *this;
}
- void Notify(const bool & oldValue, const bool & newValue);
+ void notify(const bool & oldValue, const bool & newValue) override;
UserPtr GetUser() const { return user; }
private:
int sock;
- ADD_USER_NONIFIER onAddUserNotifier;
- DEL_USER_NONIFIER onDelUserNotifier;
+ STG::ScopedConnection m_onAddUserConn;
+ STG::ScopedConnection m_onDelUserConn;
STG::PluginLogger logger;
REMOTE_SCRIPT & rscript;
};
//-----------------------------------------------------------------------------
-inline void ADD_USER_NONIFIER::Notify(const UserPtr & user)
-{
-rs.AddUser(user);
-}
-//-----------------------------------------------------------------------------
-inline void DEL_USER_NONIFIER::Notify(const UserPtr & user)
-{
-rs.DelUser(user);
-}
-//-----------------------------------------------------------------------------
} // namespace RS