1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 07:33:13 +02:00

Remove channels from accesss lists when they expire/drop

This commit is contained in:
Adam
2013-08-11 17:14:39 -04:00
parent 53d5b7c29e
commit f1956b039d
4 changed files with 63 additions and 0 deletions
+25
View File
@@ -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);
}