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"
43 using UserPtr = User*;
44 using ConstUserPtr = const User*;
45 //-----------------------------------------------------------------------------
46 class AUTH_AO : public Auth
51 void SetUsers(Users * u) override { users = u; }
55 int Reload(const ModuleSettings & /*ms*/) override { return 0; }
56 bool IsRunning() override { return isRunning; }
57 void SetSettings(const ModuleSettings &) override {}
58 int ParseSettings() override { return 0; }
59 const std::string & GetStrError() const override { return errorStr; }
60 std::string GetVersion() const override;
61 uint16_t GetStartPosition() const override { return 30; }
62 uint16_t GetStopPosition() const override { return 30; }
64 int SendMessage(const Message & msg, uint32_t ip) const override;
67 AUTH_AO(const AUTH_AO & rvalue);
68 AUTH_AO & operator=(const AUTH_AO & rvalue);
70 void AddUser(UserPtr u);
71 void DelUser(UserPtr u);
74 void SetUserNotifiers(UserPtr u);
75 void UnSetUserNotifiers(UserPtr u);
76 void UpdateUserAuthorization(ConstUserPtr u) const;
77 void Unauthorize(UserPtr u);
79 mutable std::string errorStr;
81 std::vector<UserPtr> userList;
83 ModuleSettings settings;
85 using ConnHolder = std::tuple<int, ScopedConnection, ScopedConnection, ScopedConnection, ScopedConnection>;
86 std::vector<ConnHolder> m_conns;
88 ScopedConnection m_onAddUserConn;
89 ScopedConnection m_onDelUserConn;