2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
24 #include "stg/module_settings.h"
25 #include "stg/store.h"
26 #include "stg/subscriptions.h"
27 #include "stg/user_ips.h"
29 #include "stg/logger.h"
41 using UserPtr = User*;
42 using ConstUserPtr = const User*;
43 //-----------------------------------------------------------------------------
44 class AUTH_AO : public Auth
49 void SetUsers(Users * u) override { users = u; }
53 int Reload(const ModuleSettings & /*ms*/) override { return 0; }
54 bool IsRunning() override { return isRunning; }
55 void SetSettings(const ModuleSettings &) override {}
56 int ParseSettings() override { return 0; }
57 const std::string & GetStrError() const override { return errorStr; }
58 std::string GetVersion() const override;
59 uint16_t GetStartPosition() const override { return 30; }
60 uint16_t GetStopPosition() const override { return 30; }
62 int SendMessage(const Message & msg, uint32_t ip) const override;
65 AUTH_AO(const AUTH_AO & rvalue);
66 AUTH_AO & operator=(const AUTH_AO & rvalue);
68 void AddUser(UserPtr u);
69 void DelUser(UserPtr u);
72 void SetUserNotifiers(UserPtr u);
73 void UnSetUserNotifiers(UserPtr u);
74 void UpdateUserAuthorization(ConstUserPtr u) const;
75 void Unauthorize(UserPtr u);
77 mutable std::string errorStr;
79 std::vector<UserPtr> userList;
81 ModuleSettings settings;
83 using ConnHolder = std::tuple<int, ScopedConnection, ScopedConnection, ScopedConnection, ScopedConnection>;
84 std::vector<ConnHolder> m_conns;
86 ScopedConnection m_onAddUserConn;
87 ScopedConnection m_onDelUserConn;