X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/f4333737c7e347efe9258ccf85c1237e03be619c..ee1709cd231588fe672d0bd2546ef69ee87ff88c:/projects/stargazer/users_impl.cpp?ds=sidebyside diff --git a/projects/stargazer/users_impl.cpp b/projects/stargazer/users_impl.cpp index 8cb9bee5..5bf082ec 100644 --- a/projects/stargazer/users_impl.cpp +++ b/projects/stargazer/users_impl.cpp @@ -148,26 +148,8 @@ u.OnAdd(); users.push_front(u); AddUserIntoIndexes(users.begin()); - - { - // Fire all "on add" notifiers - auto ni = onAddNotifiers.begin(); - while (ni != onAddNotifiers.end()) - { - (*ni)->Notify(&users.front()); - ++ni; - } - } - - { - // Fire all "on add" implementation notifiers - auto ni = onAddNotifiersImpl.begin(); - while (ni != onAddNotifiersImpl.end()) - { - (*ni)->Notify(&users.front()); - ++ni; - } - } +m_onAddCallbacks.notify(&users.front()); +m_onAddImplCallbacks.notify(&users.front()); return 0; } @@ -199,23 +181,8 @@ if (priv.userAddDel == 0) u->SetDeleted(); } - { - auto ni = onDelNotifiers.begin(); - while (ni != onDelNotifiers.end()) - { - (*ni)->Notify(&(*u)); - ++ni; - } - } - - { - auto ni = onDelNotifiersImpl.begin(); - while (ni != onDelNotifiersImpl.end()) - { - (*ni)->Notify(&(*u)); - ++ni; - } - } + m_onDelCallbacks.notify(&(*u)); + m_onDelImplCallbacks.notify(&(*u)); { std::lock_guard lock(m_mutex); @@ -664,54 +631,6 @@ while (iter != users.end()) return false; } //----------------------------------------------------------------------------- -void UsersImpl::AddNotifierUserAdd(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onAddNotifiers.insert(n); -} -//----------------------------------------------------------------------------- -void UsersImpl::DelNotifierUserAdd(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onAddNotifiers.erase(n); -} -//----------------------------------------------------------------------------- -void UsersImpl::AddNotifierUserDel(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onDelNotifiers.insert(n); -} -//----------------------------------------------------------------------------- -void UsersImpl::DelNotifierUserDel(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onDelNotifiers.erase(n); -} -//----------------------------------------------------------------------------- -void UsersImpl::AddNotifierUserAdd(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onAddNotifiersImpl.insert(n); -} -//----------------------------------------------------------------------------- -void UsersImpl::DelNotifierUserAdd(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onAddNotifiersImpl.erase(n); -} -//----------------------------------------------------------------------------- -void UsersImpl::AddNotifierUserDel(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onDelNotifiersImpl.insert(n); -} -//----------------------------------------------------------------------------- -void UsersImpl::DelNotifierUserDel(NotifierBase * n) -{ -std::lock_guard lock(m_mutex); -onDelNotifiersImpl.erase(n); -} -//----------------------------------------------------------------------------- unsigned int UsersImpl::OpenSearch() { std::lock_guard lock(m_mutex);