]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/rscript/rscript.cpp
Start replacing notifiers with subscriptions.
[stg.git] / projects / stargazer / plugins / other / rscript / rscript.cpp
index 7f0f4bc4d74f4618738b7af9173b81f24f7df6a8..d54c800e5e4ebdd7591e035d3c8ea9a74de4957d 100644 (file)
@@ -160,8 +160,6 @@ REMOTE_SCRIPT::REMOTE_SCRIPT()
       isRunning(false),
       users(nullptr),
       sock(0),
-      onAddUserNotifier(*this),
-      onDelUserNotifier(*this),
       logger(STG::PluginLogger::get("rscript"))
 {
 }
@@ -201,8 +199,8 @@ netRouters = rsSettings.GetSubnetsMap();
 
 InitEncrypt(rsSettings.GetPassword());
 
-users->AddNotifierUserAdd(&onAddUserNotifier);
-users->AddNotifierUserDel(&onDelUserNotifier);
+m_onAddUserConn = users->onUserAdd([this](auto user){ AddUser(user); });
+m_onDelUserConn = users->onUserDel([this](auto user){ DelUser(user); });
 
 if (GetUsers())
     return -1;
@@ -242,9 +240,6 @@ if (isRunning)
         }
     }
 
-users->DelNotifierUserDel(&onDelUserNotifier);
-users->DelNotifierUserAdd(&onAddUserNotifier);
-
 if (isRunning)
     {
     logger("Cannot stop thread.");