diff options
author | Adam <Adam@anope.org> | 2017-04-06 12:22:52 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-04-06 12:22:52 -0400 |
commit | 72bb1b14d372fa6065af77e8b98e8aab5295fe23 (patch) | |
tree | d0e426a88a64b67ba832fcd4648ec1d6f198fc42 /include | |
parent | 7f5cb607af73a4134a158a14006bdc3e202d0a34 (diff) |
Fix access comparison operators
Diffstat (limited to 'include')
-rw-r--r-- | include/modules/chanserv/chanaccess.h | 35 | ||||
-rw-r--r-- | include/modules/chanserv/main/chanaccess.h | 2 |
2 files changed, 8 insertions, 29 deletions
diff --git a/include/modules/chanserv/chanaccess.h b/include/modules/chanserv/chanaccess.h index dff39c0f8..ec05a7ae5 100644 --- a/include/modules/chanserv/chanaccess.h +++ b/include/modules/chanserv/chanaccess.h @@ -83,40 +83,17 @@ class CoreExport ChanAccess : public Serialize::Object */ virtual void AccessUnserialize(const Anope::string &data) anope_abstract; + virtual int Compare(ChanAccess *other) anope_abstract; + /* Comparison operators to other Access entries */ - virtual bool operator>(ChanAccess &other) + bool operator>(ChanAccess &other) { -// const std::vector<Privilege> &privs = service->GetPrivileges(); -// for (unsigned i = privs.size(); i > 0; --i) -// { -// bool this_p = this->HasPriv(privs[i - 1].name), -// other_p = other.HasPriv(privs[i - 1].name); -// -// if (!this_p && !other_p) -// continue; -// -// return this_p && !other_p; -// } - - return false; + return Compare(&other) > 0; } -#warning "move this out" - virtual bool operator<(ChanAccess &other) + bool operator<(ChanAccess &other) { -// const std::vector<Privilege> &privs = service->GetPrivileges(); -// for (unsigned i = privs.size(); i > 0; --i) -// { -// bool this_p = this->HasPriv(privs[i - 1].name), -// other_p = other.HasPriv(privs[i - 1].name); -// -// if (!this_p && !other_p) -// continue; -// -// return !this_p && other_p; -// } - - return false; + return Compare(&other) < 0; } bool operator>=(ChanAccess &other) diff --git a/include/modules/chanserv/main/chanaccess.h b/include/modules/chanserv/main/chanaccess.h index fb78056ea..ca6661a5b 100644 --- a/include/modules/chanserv/main/chanaccess.h +++ b/include/modules/chanserv/main/chanaccess.h @@ -45,4 +45,6 @@ class ChanAccessImpl : public ChanServ::ChanAccess Anope::string Mask() override; bool Matches(const User *u, NickServ::Account *acc) override; + + int Compare(ChanAccess *other) override; }; |