]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/rscript/rscript.h
Start replacing notifiers with subscriptions.
[stg.git] / projects / stargazer / plugins / other / rscript / rscript.h
index fc95710894507e737e82ef42b6bde923f7dc1aa1..d0bf1e7e262f3d82fd23f7dab3b41e441861b4d6 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "stg/plugin.h"
 #include "stg/module_settings.h"
 
 #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"
 #include "stg/notifer.h"
 #include "stg/user.h"
 #include "stg/blowfish.h"
@@ -58,32 +59,6 @@ class DisconnectUser;
 
 using UserPtr = STG::User*;
 
 
 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) override;
-
-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) override;
-
-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:
 //-----------------------------------------------------------------------------
 class IP_NOTIFIER: public STG::PropertyNotifierBase<uint32_t> {
 public:
@@ -243,8 +218,8 @@ private:
 
     int                 sock;
 
 
     int                 sock;
 
-    ADD_USER_NONIFIER onAddUserNotifier;
-    DEL_USER_NONIFIER onDelUserNotifier;
+    STG::ScopedConnection m_onAddUserConn;
+    STG::ScopedConnection m_onDelUserConn;
 
     STG::PluginLogger       logger;
 
 
     STG::PluginLogger       logger;
 
@@ -264,15 +239,5 @@ class DisconnectUser : public std::unary_function<std::pair<const uint32_t, USER
         REMOTE_SCRIPT & rscript;
 };
 //-----------------------------------------------------------------------------
         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
 
 } // namespace RS