X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/f4333737c7e347efe9258ccf85c1237e03be619c..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 260f4aef..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(); @@ -291,14 +289,14 @@ while (users_iter != usersList.end()) } } //----------------------------------------------------------------------------- -void CHG_CURRIP_NOTIFIER_PING::Notify(const uint32_t & oldIP, const uint32_t & newIP) +void CHG_CURRIP_NOTIFIER_PING::notify(const uint32_t & oldIP, const uint32_t & newIP) { ping.pinger.DelIP(oldIP); if (newIP != 0) ping.pinger.AddIP(newIP); } //----------------------------------------------------------------------------- -void CHG_IPS_NOTIFIER_PING::Notify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS) +void CHG_IPS_NOTIFIER_PING::notify(const STG::UserIPs & oldIPS, const STG::UserIPs & newIPS) { if (oldIPS.onlyOneIP()) ping.pinger.DelIP(oldIPS[0].ip); @@ -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); -} -//-----------------------------------------------------------------------------