diff options
author | Adam <Adam@drink-coca-cola.info> | 2010-05-07 15:29:41 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-06-18 20:58:55 -0400 |
commit | ebfff71599fbedb72009d71cd40c264713b43b5a (patch) | |
tree | dd687cc4fd7e77866c91fc7f48646762dee3983d /src/opertype.cpp | |
parent | 9439cac6b126254bc488c2375b9e7ff5fd4fce74 (diff) |
Made opertypes inheritable
Diffstat (limited to 'src/opertype.cpp')
-rw-r--r-- | src/opertype.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/opertype.cpp b/src/opertype.cpp index fb0689add..0ee6d000f 100644 --- a/src/opertype.cpp +++ b/src/opertype.cpp @@ -16,26 +16,44 @@ OperType::OperType(const ci::string &nname) : name(nname) bool OperType::HasCommand(const std::string &cmdstr) const { - for (std::list<std::string>::const_iterator it = this->commands.begin(); it != this->commands.end(); it++) + for (std::list<std::string>::const_iterator it = this->commands.begin(); it != this->commands.end(); ++it) { if (Anope::Match(cmdstr, *it)) { return true; } } + for (std::set<OperType *>::const_iterator iit = this->inheritances.begin(); iit != this->inheritances.end(); ++iit) + { + OperType *ot = *iit; + + if (ot->HasCommand(cmdstr)) + { + return true; + } + } return false; } bool OperType::HasPriv(const std::string &privstr) const { - for (std::list<std::string>::const_iterator it = this->privs.begin(); it != this->privs.end(); it++) + for (std::list<std::string>::const_iterator it = this->privs.begin(); it != this->privs.end(); ++it) { if (Anope::Match(privstr, *it)) { return true; } } + for (std::set<OperType *>::const_iterator iit = this->inheritances.begin(); iit != this->inheritances.end(); ++iit) + { + OperType *ot = *iit; + + if (ot->HasPriv(privstr)) + { + return true; + } + } return false; } @@ -55,3 +73,8 @@ const ci::string &OperType::GetName() const return this->name; } +void OperType::Inherits(OperType *ot) +{ + this->inheritances.insert(ot); +} + |