diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/access.cpp | 10 | ||||
-rw-r--r-- | src/chanserv.cpp | 2 | ||||
-rw-r--r-- | src/regchannel.cpp | 7 | ||||
-rw-r--r-- | src/users.cpp | 4 |
4 files changed, 18 insertions, 5 deletions
diff --git a/src/access.cpp b/src/access.cpp index 5fba02c98..07e82159c 100644 --- a/src/access.cpp +++ b/src/access.cpp @@ -75,13 +75,21 @@ bool ChanAccess::operator<=(ChanAccess &other) AccessGroup::AccessGroup() : std::vector<ChanAccess *>() { + this->SuperAdmin = false; } bool AccessGroup::HasPriv(ChannelAccess priv) const { + if (this->SuperAdmin) + return true; for (unsigned i = this->size(); i > 0; --i) - if (this->at(i - 1)->HasPriv(priv)) + { + ChanAccess *access = this->at(i - 1); + EventReturn MOD_RESULT; + FOREACH_RESULT(I_OnCheckPriv, OnCheckPriv(access, priv)); + if (MOD_RESULT == EVENT_ALLOW || access->HasPriv(priv)) return true; + } return false; } diff --git a/src/chanserv.cpp b/src/chanserv.cpp index c7bbe11f8..f515e3680 100644 --- a/src/chanserv.cpp +++ b/src/chanserv.cpp @@ -124,7 +124,7 @@ bool IsFounder(User *user, ChannelInfo *ci) if (!user || !ci) return false; - if (user->isSuperAdmin) + if (user->SuperAdmin) return true; if (user->Account() && user->Account() == ci->GetFounder()) diff --git a/src/regchannel.cpp b/src/regchannel.cpp index 1528a6ce5..a13e47009 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -215,6 +215,9 @@ bool ChannelInfo::HasPriv(User *u, ChannelAccess priv) { AccessGroup group = this->AccessFor(u); + if (u->SuperAdmin) + return true; + if (this->founder && u->Account() == this->founder) { switch (priv) @@ -257,6 +260,8 @@ AccessGroup ChannelInfo::AccessFor(User *u) if (this->access[i]->Matches(u, nc)) group.push_back(this->access[i]); + group.SuperAdmin = u->SuperAdmin; + return group; } @@ -707,7 +712,7 @@ bool ChannelInfo::CheckKick(User *user) if (!user || !this->c) return false; - if (user->isSuperAdmin) + if (user->SuperAdmin) return false; /* We don't enforce services restrictions on clients on ulined services diff --git a/src/users.cpp b/src/users.cpp index 214f3c91b..50e84dce3 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -40,7 +40,7 @@ User::User(const Anope::string &snick, const Anope::string &sident, const Anope: this->ident = sident; this->host = shost; this->uid = suid; - this->isSuperAdmin = 0; + this->SuperAdmin = false; UserListByNick[snick] = this; if (!suid.empty()) @@ -815,7 +815,7 @@ User *do_nick(const Anope::string &source, const Anope::string &nick, const Anop Log() << "user: NICK from nonexistent nick " << source; return NULL; } - user->isSuperAdmin = 0; /* Dont let people nick change and stay SuperAdmins */ + user->SuperAdmin = false; Log(user, "nick") << "(" << user->realname << ") changed nick to " << nick; |