diff options
author | Adam <Adam@anope.org> | 2013-04-07 23:46:44 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-04-07 23:46:44 -0500 |
commit | fb7fef7a849342ab8463743497e781c5c3e6ae88 (patch) | |
tree | 5d230a68b6eed70c7b4f718410dd62fea779654c /src/regchannel.cpp | |
parent | 36602224b8b1a11326a224779d16bcb12f0ed532 (diff) |
Optimizations of much of the more commonly used code
Diffstat (limited to 'src/regchannel.cpp')
-rw-r--r-- | src/regchannel.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/src/regchannel.cpp b/src/regchannel.cpp index a35fa5d4d..9148d99fd 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -578,7 +578,10 @@ void ChannelInfo::AddAccess(ChanAccess *taccess) const NickAlias *na = NickAlias::Find(taccess->mask); if (na != NULL) + { na->nc->AddChannelReference(this); + taccess->nc = na->nc; + } } ChanAccess *ChannelInfo::GetAccess(unsigned index) const @@ -612,8 +615,19 @@ AccessGroup ChannelInfo::AccessFor(const User *u) group.nc = nc; for (unsigned i = 0, end = this->GetAccessCount(); i < end; ++i) - if (this->GetAccess(i)->Matches(u, nc)) - group.push_back(this->GetAccess(i)); + { + ChanAccess *a = this->GetAccess(i); + + if (a->nc) + { + if (a->nc == nc) + group.push_back(a); + } + else if (a->Matches(u, nc)) + { + group.push_back(a); + } + } if (group.founder || !group.empty()) { @@ -635,8 +649,19 @@ AccessGroup ChannelInfo::AccessFor(const NickCore *nc) group.nc = nc; for (unsigned i = 0, end = this->GetAccessCount(); i < end; ++i) - if (this->GetAccess(i)->Matches(NULL, nc)) + { + ChanAccess *a = this->GetAccess(i); + + if (a->nc) + { + if (a->nc == nc) + group.push_back(a); + } + else if (this->GetAccess(i)->Matches(NULL, nc)) + { group.push_back(this->GetAccess(i)); + } + } if (group.founder || !group.empty()) { |