diff options
author | Adam <Adam@anope.org> | 2013-08-11 17:14:39 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-08-11 17:14:39 -0400 |
commit | f1956b039d3c7be38ad03fbb79be6a4eed440cf0 (patch) | |
tree | 483b29cf3c67af4742945213eb88a173ae5b6d6a /src/regchannel.cpp | |
parent | 53d5b7c29ea2f0164b562549cef579fe2b276abf (diff) |
Remove channels from accesss lists when they expire/drop
Diffstat (limited to 'src/regchannel.cpp')
-rw-r--r-- | src/regchannel.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/regchannel.cpp b/src/regchannel.cpp index b79d07890..85b1f5b68 100644 --- a/src/regchannel.cpp +++ b/src/regchannel.cpp @@ -401,6 +401,12 @@ void ChannelInfo::AddAccess(ChanAccess *taccess) na->nc->AddChannelReference(this); taccess->nc = na->nc; } + else + { + ChannelInfo *ci = ChannelInfo::Find(taccess->mask); + if (ci != NULL) + ci->AddChannelReference(this->name); + } } ChanAccess *ChannelInfo::GetAccess(unsigned index) const @@ -656,3 +662,22 @@ bool IsFounder(const User *user, const ChannelInfo *ci) return false; } + +void ChannelInfo::AddChannelReference(const Anope::string &what) +{ + ++references[what]; +} + +void ChannelInfo::RemoveChannelReference(const Anope::string &what) +{ + int &i = references[what]; + if (--i <= 0) + references.erase(what); +} + +void ChannelInfo::GetChannelReferences(std::deque<Anope::string> &chans) +{ + chans.clear(); + for (Anope::map<int>::iterator it = references.begin(); it != references.end(); ++it) + chans.push_back(it->first); +} |