diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/account.h | 14 | ||||
| -rw-r--r-- | include/config.h | 2 | ||||
| -rw-r--r-- | include/opertype.h | 25 | ||||
| -rw-r--r-- | include/users.h | 17 |
4 files changed, 44 insertions, 14 deletions
diff --git a/include/account.h b/include/account.h index 635606f62..01ec082dd 100644 --- a/include/account.h +++ b/include/account.h @@ -156,29 +156,17 @@ class CoreExport NickCore : public Extensible, public Flags<NickCoreFlag, NI_END MemoInfo memos; uint16 channelcount; /* Number of channels currently registered */ - OperType *ot; + Oper *o; /* Unsaved data */ time_t lastmail; /* Last time this nick record got a mail */ std::list<NickAlias *> aliases; /* List of aliases */ - /** Check whether this opertype has access to run the given command string. - * @param cmdstr The string to check, e.g. botserv/set/private. - * @return True if this opertype may run the specified command, false otherwise. - */ - virtual bool HasCommand(const Anope::string &cmdstr) const; - /** Checks whether this account is a services oper or not. * @return True if this account is a services oper, false otherwise. */ virtual bool IsServicesOper() const; - /** Check whether this opertype has access to the given special permission. - * @param privstr The priv to check for, e.g. users/auspex. - * @return True if this opertype has the specified priv, false otherwise. - */ - virtual bool HasPriv(const Anope::string &privstr) const; - /** Add an entry to the nick's access list * * @param entry The nick!ident@host entry to add to the access list diff --git a/include/config.h b/include/config.h index 4a8d8411f..aee6f44e5 100644 --- a/include/config.h +++ b/include/config.h @@ -757,7 +757,7 @@ class CoreExport ServerConfig /* List of available opertypes */ std::list<OperType *> MyOperTypes; /* List of pairs of opers and their opertype from the config */ - std::list<std::pair<Anope::string, Anope::string> > Opers; + std::vector<Oper *> Opers; }; /** This class can be used on its own to represent an exception, or derived to represent a module-specific exception. diff --git a/include/opertype.h b/include/opertype.h index 6f48b7831..bf76d71eb 100644 --- a/include/opertype.h +++ b/include/opertype.h @@ -10,6 +10,25 @@ #include "hashcomp.h" +class OperType; + +struct Oper +{ + Anope::string name; + Anope::string password; + Anope::string certfp; + OperType *ot; + + Oper(const Anope::string &n, const Anope::string &p, const Anope::string &c, OperType *o) : + name(n), password(p), certfp(c), ot(o) { } + + /** Find an oper block by name + * @param name The name + * @return the oper block + */ + static Oper *Find(const Anope::string &name); +}; + class CoreExport OperType { private: @@ -36,6 +55,12 @@ class CoreExport OperType */ std::set<OperType *> inheritances; public: + /** Find an oper type by name + * @param name The name + * @return The oper type + */ + static OperType *Find(const Anope::string &name); + /** Create a new opertype of the given name. * @param nname The opertype name, e.g. "sra". */ diff --git a/include/users.h b/include/users.h index 30f5c8275..9f6e250e5 100644 --- a/include/users.h +++ b/include/users.h @@ -197,6 +197,23 @@ class CoreExport User : public Extensible */ virtual bool IsRecognized(bool CheckSecure = false); + /** Check if the user is a services oper + * @return true if they are an oper + */ + bool IsServicesOper(); + + /** Check whether this user has access to run the given command string. + * @param cmdstr The string to check, e.g. botserv/set/private. + * @return True if this user may run the specified command, false otherwise. + */ + bool HasCommand(const Anope::string &cmdstr); + + /** Check whether this user has access to the given special permission. + * @param privstr The priv to check for, e.g. users/auspex. + * @return True if this user has the specified priv, false otherwise. + */ + bool HasPriv(const Anope::string &privstr); + /** Update the last usermask stored for a user, and check to see if they are recognized */ void UpdateHost(); |
