diff options
author | Adam <Adam@anope.org> | 2011-08-01 22:37:27 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-08-01 22:37:27 -0400 |
commit | f7adc0b35b50f06706872a161f1c7476e6e6981e (patch) | |
tree | 91fbe281f2772136a327fd4fc4c64740d1ab65ab /include/access.h | |
parent | 710c02f3bd3581b7c5b3d48e7604756975219fc8 (diff) |
Rewrote the access systems and added a flags access system
Diffstat (limited to 'include/access.h')
-rw-r--r-- | include/access.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/include/access.h b/include/access.h new file mode 100644 index 000000000..69f8f4bc7 --- /dev/null +++ b/include/access.h @@ -0,0 +1,91 @@ +#ifndef ACCESS_H +#define ACCESS_H + +enum ChannelAccess +{ + CA_ACCESS_LIST, + CA_NOKICK, + CA_FANTASIA, + CA_GREET, + CA_AUTOVOICE, + CA_VOICEME, + CA_VOICE, + CA_INFO, + CA_SAY, + CA_AUTOHALFOP, + CA_HALFOPME, + CA_HALFOP, + CA_KICK, + CA_SIGNKICK, + CA_BAN, + CA_TOPIC, + CA_MODE, + CA_GETKEY, + CA_INVITE, + CA_UNBAN, + CA_AUTOOP, + CA_OPDEOPME, + CA_OPDEOP, + CA_AUTOPROTECT, + CA_AKICK, + CA_BADWORDS, + CA_ASSIGN, + CA_MEMO, + CA_ACCESS_CHANGE, + CA_PROTECTME, + CA_PROTECT, + CA_SET, + CA_AUTOOWNER, + CA_OWNERME, + CA_OWNER, + CA_FOUNDER, + CA_SIZE +}; + +class ChanAccess; + +class AccessProvider : public Service +{ + public: + AccessProvider(Module *o, const Anope::string &n); + virtual ~AccessProvider(); + virtual ChanAccess *Create() = 0; +}; + +class CoreExport ChanAccess +{ + public: + AccessProvider *provider; + ChannelInfo *ci; + Anope::string mask; + Anope::string creator; + time_t last_seen; + time_t created; + + ChanAccess(AccessProvider *p); + virtual ~ChanAccess(); + virtual bool Matches(User *u, NickCore *nc) = 0; + virtual bool HasPriv(ChannelAccess priv) = 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 AccessGroup : public std::vector<ChanAccess *> +{ + public: + AccessGroup(); + bool HasPriv(ChannelAccess 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 + |