summaryrefslogtreecommitdiff
path: root/src/regchannel.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-08-11 17:14:39 -0400
committerAdam <Adam@anope.org>2013-08-11 17:14:39 -0400
commitf1956b039d3c7be38ad03fbb79be6a4eed440cf0 (patch)
tree483b29cf3c67af4742945213eb88a173ae5b6d6a /src/regchannel.cpp
parent53d5b7c29ea2f0164b562549cef579fe2b276abf (diff)
Remove channels from accesss lists when they expire/drop
Diffstat (limited to 'src/regchannel.cpp')
-rw-r--r--src/regchannel.cpp25
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);
+}