diff options
author | Adam <Adam@anope.org> | 2010-06-19 11:54:08 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-06-19 11:54:08 -0400 |
commit | 52058fe87b4b0475b1775198c725af14e540d355 (patch) | |
tree | c3597d6411a006ffbb670d2ce761101b9640e9b6 /src/opertype.cpp | |
parent | 43e951aed54f838ba55a4c1552214773aee2fb2f (diff) | |
parent | df9d291bcba9788e51d11424ebaf6f05c26cc80f (diff) |
Merge remote branch 'origin/1.9.3' into 1.9
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); +} + |