X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/bc6cac0e474dfe2feb4983aef98f99e23a98ffc4..1cd2b12bd4e4d86f6cd099240795f3ebeb3852b3:/projects/stargazer/plugins/other/ping/ping.cpp diff --git a/projects/stargazer/plugins/other/ping/ping.cpp b/projects/stargazer/plugins/other/ping/ping.cpp index 35237120..71752de6 100644 --- a/projects/stargazer/plugins/other/ping/ping.cpp +++ b/projects/stargazer/plugins/other/ping/ping.cpp @@ -63,8 +63,6 @@ return 0; PING::PING() : users(nullptr), isRunning(false), - onAddUserNotifier(*this), - onDelUserNotifier(*this), logger(STG::PluginLogger::get("ping")) { } @@ -81,8 +79,8 @@ int PING::Start() { GetUsers(); -users->AddNotifierUserAdd(&onAddUserNotifier); -users->AddNotifierUserDel(&onDelUserNotifier); +m_onAddUserConn = users->onAdd([this](auto user){ AddUser(user); }); +m_onDelUserConn = users->onDel([this](auto user){ DelUser(user); }); pinger.SetDelayTime(pingSettings.GetPingDelay()); pinger.Start(); @@ -111,8 +109,8 @@ for (int i = 0; i < 25; i++) nanosleep(&ts, nullptr); } -users->DelNotifierUserAdd(&onAddUserNotifier); -users->DelNotifierUserDel(&onDelUserNotifier); +m_onAddUserConn.disconnect(); +m_onDelUserConn.disconnect(); std::list::iterator users_iter; users_iter = usersList.begin(); @@ -306,14 +304,3 @@ if (oldIPS.onlyOneIP()) if (newIPS.onlyOneIP()) ping.pinger.AddIP(newIPS[0].ip); } -//----------------------------------------------------------------------------- -void ADD_USER_NONIFIER_PING::notify(const UserPtr & user) -{ -ping.AddUser(user); -} -//----------------------------------------------------------------------------- -void DEL_USER_NONIFIER_PING::notify(const UserPtr & user) -{ -ping.DelUser(user); -} -//-----------------------------------------------------------------------------