diff options
author | Adam <Adam@anope.org> | 2013-12-27 17:20:47 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-12-27 17:20:47 -0500 |
commit | 187973c16a06466173990d38c92a42587fe860e6 (patch) | |
tree | 2d7ae274f996e85d4a66afcdc8b638bdbe9d54b0 | |
parent | 072631aa3897300879f659fee5ccb924edfb3bf1 (diff) |
Allow inverting opertype privs and commands, to make them behave like the log settings
-rw-r--r-- | src/opertype.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/opertype.cpp b/src/opertype.cpp index 38a1f2f50..c6e016043 100644 --- a/src/opertype.cpp +++ b/src/opertype.cpp @@ -60,7 +60,11 @@ bool OperType::HasCommand(const Anope::string &cmdstr) const { for (std::list<Anope::string>::const_iterator it = this->commands.begin(), it_end = this->commands.end(); it != it_end; ++it) { - if (Anope::Match(cmdstr, *it)) + const Anope::string &s = *it; + + if (!s.find('~') && Anope::Match(cmdstr, s.substr(1))) + return false; + else if (Anope::Match(cmdstr, s)) return true; } for (std::set<OperType *>::const_iterator iit = this->inheritances.begin(), iit_end = this->inheritances.end(); iit != iit_end; ++iit) @@ -78,7 +82,11 @@ bool OperType::HasPriv(const Anope::string &privstr) const { for (std::list<Anope::string>::const_iterator it = this->privs.begin(), it_end = this->privs.end(); it != it_end; ++it) { - if (Anope::Match(privstr, *it)) + const Anope::string &s = *it; + + if (!s.find('~') && Anope::Match(privstr, s.substr(1))) + return false; + else if (Anope::Match(privstr, s)) return true; } for (std::set<OperType *>::const_iterator iit = this->inheritances.begin(), iit_end = this->inheritances.end(); iit != iit_end; ++iit) |