From: Maxim Mamontov Date: Tue, 5 Apr 2011 11:16:21 +0000 (+0300) Subject: Code cleanup for mod_auth_ao X-Git-Tag: 2.407-rc3~81 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/30723e4545227800cd3b43f2423f6760b1e4e22d Code cleanup for mod_auth_ao --- diff --git a/projects/stargazer/plugins/authorization/ao/ao.cpp b/projects/stargazer/plugins/authorization/ao/ao.cpp index 84e97a0d..f1b05dbc 100644 --- a/projects/stargazer/plugins/authorization/ao/ao.cpp +++ b/projects/stargazer/plugins/authorization/ao/ao.cpp @@ -34,6 +34,7 @@ $Author: faust $ #include "user.h" #include "users.h" #include "user_property.h" +#include "common.h" #include "../../../eventloop.h" class AO_CREATOR @@ -135,33 +136,13 @@ isRunning = false; return 0; } //----------------------------------------------------------------------------- -bool AUTH_AO::IsRunning() -{ -return isRunning; -} -//----------------------------------------------------------------------------- -uint16_t AUTH_AO::GetStartPosition() const -{ -return 70; -} -//----------------------------------------------------------------------------- -uint16_t AUTH_AO::GetStopPosition() const -{ -return 70; -} -//----------------------------------------------------------------------------- void AUTH_AO::SetUserNotifiers(USER_PTR u) { // ---------- AlwaysOnline ------------------- CHG_BEFORE_NOTIFIER BeforeChgAONotifier(*this, u); CHG_AFTER_NOTIFIER AfterChgAONotifier(*this, u); -/*BeforeChgAONotifier.SetAuthorizator(this); -BeforeChgAONotifier.SetUser(u);*/ BeforeChgAONotifierList.push_front(BeforeChgAONotifier); - -/*AfterChgAONotifier.SetAuthorizator(this); -AfterChgAONotifier.SetUser(u);*/ AfterChgAONotifierList.push_front(AfterChgAONotifier); u->GetProperty().alwaysOnline.AddBeforeNotifier(&(*BeforeChgAONotifierList.begin())); @@ -172,12 +153,7 @@ u->GetProperty().alwaysOnline.AddAfterNotifier(&(*AfterChgAONotifierList.begin() CHG_BEFORE_NOTIFIER BeforeChgIPNotifier(*this, u); CHG_AFTER_NOTIFIER AfterChgIPNotifier(*this, u); -/*BeforeChgIPNotifier.SetAuthorizator(this); -BeforeChgIPNotifier.SetUser(u);*/ BeforeChgIPNotifierList.push_front(BeforeChgIPNotifier); - -/*AfterChgIPNotifier.SetAuthorizator(this); -AfterChgIPNotifier.SetUser(u);*/ AfterChgIPNotifierList.push_front(AfterChgIPNotifier); u->GetProperty().ips.AddBeforeNotifier(&(*BeforeChgIPNotifierList.begin())); @@ -254,12 +230,8 @@ if (!h) return; } -while (1) +while (users->SearchNext(h, &u)) { - if (users->SearchNext(h, &u)) - { - break; - } usersList.push_back(u); SetUserNotifiers(u); } @@ -297,8 +269,9 @@ void AUTH_AO::DelUser(USER_PTR u) { Unauthorize(u); UnSetUserNotifiers(u); +usersList.remove(u); -list::iterator users_iter; +/*list::iterator users_iter; users_iter = usersList.begin(); while (users_iter != usersList.end()) @@ -309,7 +282,7 @@ while (users_iter != usersList.end()) break; } ++users_iter; - } + }*/ } //----------------------------------------------------------------------------- int AUTH_AO::SendMessage(const STG_MSG &, uint32_t) const diff --git a/projects/stargazer/plugins/authorization/ao/ao.h b/projects/stargazer/plugins/authorization/ao/ao.h index f6c9f8a1..05aa27a2 100644 --- a/projects/stargazer/plugins/authorization/ao/ao.h +++ b/projects/stargazer/plugins/authorization/ao/ao.h @@ -88,13 +88,13 @@ public: int Start(); int Stop(); int Reload() { return 0; } - bool IsRunning(); + bool IsRunning() { return isRunning; } void SetSettings(const MODULE_SETTINGS &) {} int ParseSettings() { return 0; } const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const; - uint16_t GetStartPosition() const; - uint16_t GetStopPosition() const; + uint16_t GetStartPosition() const { return 70; } + uint16_t GetStopPosition() const { return 70; } void AddUser(USER_PTR u); void DelUser(USER_PTR u);