1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 07:16:39 +02:00

Hopefully sort this AccessGroup::HasPriv once and for all

This commit is contained in:
Adam
2011-08-09 00:06:44 -04:00
parent b7542fd6f2
commit 91c3363c15
4 changed files with 30 additions and 24 deletions
+12 -1
View File
@@ -13,6 +13,12 @@
#include "modules.h"
#include "access.h"
enum
{
ACCESS_INVALID = -10000,
ACCESS_FOUNDER = 10001
};
AccessProvider::AccessProvider(Module *o, const Anope::string &n) : Service(o, n)
{
}
@@ -75,13 +81,18 @@ bool ChanAccess::operator<=(ChanAccess &other)
AccessGroup::AccessGroup() : std::vector<ChanAccess *>()
{
this->SuperAdmin = false;
this->ci = NULL;
this->SuperAdmin = this->Founder = false;
}
bool AccessGroup::HasPriv(ChannelAccess priv) const
{
if (this->SuperAdmin)
return true;
else if (ci->levels[priv] == ACCESS_INVALID)
return false;
else if (this->Founder)
return true;
for (unsigned i = this->size(); i > 0; --i)
{
ChanAccess *access = this->at(i - 1);