X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/a500fb72810060e52d87ad2c2e4691531f0bcc5a..ee1709cd231588fe672d0bd2546ef69ee87ff88c:/projects/stargazer/plugins/other/rscript/rscript.h diff --git a/projects/stargazer/plugins/other/rscript/rscript.h b/projects/stargazer/plugins/other/rscript/rscript.h index 80fc8651..d0bf1e7e 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.h +++ b/projects/stargazer/plugins/other/rscript/rscript.h @@ -23,6 +23,7 @@ #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" @@ -58,32 +59,6 @@ class DisconnectUser; using UserPtr = STG::User*; -//----------------------------------------------------------------------------- -class ADD_USER_NONIFIER: public STG::NotifierBase { -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 { -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 { public: @@ -101,7 +76,7 @@ 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: @@ -126,7 +101,7 @@ public: 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: @@ -177,7 +152,6 @@ private: class REMOTE_SCRIPT : public STG::Plugin { public: REMOTE_SCRIPT(); - ~REMOTE_SCRIPT() override; void SetUsers(STG::Users * u) override { users = u; } void SetSettings(const STG::ModuleSettings & s) override { settings = s; } @@ -244,8 +218,8 @@ private: int sock; - ADD_USER_NONIFIER onAddUserNotifier; - DEL_USER_NONIFIER onDelUserNotifier; + STG::ScopedConnection m_onAddUserConn; + STG::ScopedConnection m_onDelUserConn; STG::PluginLogger logger; @@ -265,15 +239,5 @@ class DisconnectUser : public std::unary_function