00001 /* 00002 * Copyright (C) 2008-2011 Robin Burchell <w00t@inspircd.org> 00003 * Copyright (C) 2008-2013 Anope Team <team@anope.org> 00004 * 00005 * Please read COPYING and README for further details. 00006 * 00007 */ 00008 00009 #ifndef OPERTYPE_H 00010 #define OPERTYPE_H 00011 00012 #include "services.h" 00013 #include "account.h" 00014 00015 /* A services operator. Usually made by the configuration file, but not always. 00016 * NickAlias::Find(name)->nc->o == this 00017 */ 00018 struct CoreExport Oper 00019 { 00020 /* The oper's nick */ 00021 Anope::string name; 00022 /* The type of operator this operator is */ 00023 OperType *ot; 00024 /* Whether the user must be an IRC operator (umode +o) to be considered a services operator */ 00025 bool require_oper; 00026 Anope::string password; 00027 Anope::string certfp; 00028 /* True if this operator is set in the config */ 00029 bool config; 00030 /* Hosts allowed to use this operator block */ 00031 std::vector<Anope::string> hosts; 00032 Anope::string vhost; 00033 00034 Oper(const Anope::string &n, OperType *o) : name(n), ot(o), require_oper(false), config(false) { } 00035 00036 virtual ~Oper() { } 00037 00042 static Oper *Find(const Anope::string &name); 00043 }; 00044 00045 class CoreExport OperType 00046 { 00047 private: 00050 Anope::string name; 00051 00055 std::list<Anope::string> privs; 00056 00065 std::list<Anope::string> commands; 00066 00069 std::set<OperType *> inheritances; 00070 public: 00073 Anope::string modes; 00074 00079 static OperType *Find(const Anope::string &name); 00080 00084 OperType(const Anope::string &nname); 00085 00090 bool HasCommand(const Anope::string &cmdstr) const; 00091 00096 bool HasPriv(const Anope::string &privstr) const; 00097 00101 void AddCommand(const Anope::string &cmdstr); 00102 00106 void AddPriv(const Anope::string &privstr); 00107 00110 const Anope::string &GetName() const; 00111 00115 void Inherits(OperType *ot); 00116 00120 const std::list<Anope::string> GetCommands() const; 00121 00125 const std::list<Anope::string> GetPrivs() const; 00126 }; 00127 00128 #endif // OPERTYPE_H
1.7.1