blob: b993ee0d85ff4aaf6d22771b413a45379a780ed7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#ifndef ACCESS_H
#define ACCESS_H
enum
{
ACCESS_INVALID = -10000,
ACCESS_FOUNDER = 10001
};
struct CoreExport Privilege
{
Anope::string name;
Anope::string desc;
Privilege(const Anope::string &n, const Anope::string &d);
bool operator==(const Privilege &other);
};
class CoreExport PrivilegeManager
{
static std::vector<Privilege> privs;
public:
static void AddPrivilege(Privilege p, int pos = -1, int def = 0);
static void RemovePrivilege(Privilege &p);
static Privilege *FindPrivilege(const Anope::string &name);
static std::vector<Privilege> &GetPrivileges();
static void ClearPrivileges();
};
class ChanAccess;
class CoreExport AccessProvider : public Service<AccessProvider>
{
public:
AccessProvider(Module *o, const Anope::string &n);
virtual ~AccessProvider();
virtual ChanAccess *Create() = 0;
};
class CoreExport ChanAccess : public Serializable
{
public:
AccessProvider *provider;
ChannelInfo *ci;
Anope::string mask;
Anope::string creator;
time_t last_seen;
time_t created;
ChanAccess(AccessProvider *p);
virtual ~ChanAccess();
Anope::string serialize_name() const;
serialized_data serialize();
static void unserialize(serialized_data &);
virtual bool Matches(User *u, NickCore *nc) = 0;
virtual bool HasPriv(const Anope::string &name) = 0;
virtual Anope::string Serialize() = 0;
virtual void Unserialize(const Anope::string &data) = 0;
bool operator>(ChanAccess &other);
bool operator<(ChanAccess &other);
bool operator>=(ChanAccess &other);
bool operator<=(ChanAccess &other);
};
class CoreExport AccessGroup : public std::vector<ChanAccess *>
{
public:
ChannelInfo *ci;
NickCore *nc;
bool SuperAdmin, Founder;
AccessGroup();
bool HasPriv(const Anope::string &priv) const;
ChanAccess *Highest() const;
bool operator>(const AccessGroup &other) const;
bool operator<(const AccessGroup &other) const;
bool operator>=(const AccessGroup &other) const;
bool operator<=(const AccessGroup &other) const;
};
#endif
|