mirror of
https://github.com/anope/anope.git
synced 2026-06-27 11:56:37 +02:00
Fix access lists showing the wrong mask if the display nick for a group
expires but the group still exists. This can cause access entries for nicks to not be deleted whenever the nicks are deleted.
This commit is contained in:
+49
-4
@@ -151,9 +151,8 @@ ChanAccess::~ChanAccess()
|
||||
if (it != this->ci->access->end())
|
||||
this->ci->access->erase(it);
|
||||
|
||||
const NickAlias *na = NickAlias::Find(this->mask);
|
||||
if (na != NULL)
|
||||
na->nc->RemoveChannelReference(this->ci);
|
||||
if (nc != NULL)
|
||||
nc->RemoveChannelReference(this->ci);
|
||||
else
|
||||
{
|
||||
ChannelInfo *c = ChannelInfo::Find(this->mask);
|
||||
@@ -163,6 +162,50 @@ ChanAccess::~ChanAccess()
|
||||
}
|
||||
}
|
||||
|
||||
void ChanAccess::SetMask(const Anope::string &m, ChannelInfo *c)
|
||||
{
|
||||
if (nc != NULL)
|
||||
nc->RemoveChannelReference(this->ci);
|
||||
else if (!this->mask.empty())
|
||||
{
|
||||
ChannelInfo *targc = ChannelInfo::Find(this->mask);
|
||||
if (targc)
|
||||
targc->RemoveChannelReference(this->ci->name);
|
||||
}
|
||||
|
||||
ci = c;
|
||||
mask.clear();
|
||||
nc = NULL;
|
||||
|
||||
const NickAlias *na = NickAlias::Find(m);
|
||||
if (na != NULL)
|
||||
{
|
||||
nc = na->nc;
|
||||
nc->AddChannelReference(ci);
|
||||
}
|
||||
else
|
||||
{
|
||||
mask = m;
|
||||
|
||||
ChannelInfo *targci = ChannelInfo::Find(mask);
|
||||
if (targci != NULL)
|
||||
targci->AddChannelReference(ci->name);
|
||||
}
|
||||
}
|
||||
|
||||
const Anope::string &ChanAccess::Mask() const
|
||||
{
|
||||
if (nc)
|
||||
return nc->display;
|
||||
else
|
||||
return mask;
|
||||
}
|
||||
|
||||
NickCore *ChanAccess::GetAccount() const
|
||||
{
|
||||
return nc;
|
||||
}
|
||||
|
||||
void ChanAccess::Serialize(Serialize::Data &data) const
|
||||
{
|
||||
data["provider"] << this->provider->name;
|
||||
@@ -192,7 +235,9 @@ Serializable* ChanAccess::Unserialize(Serializable *obj, Serialize::Data &data)
|
||||
else
|
||||
access = aprovider->Create();
|
||||
access->ci = ci;
|
||||
data["mask"] >> access->mask;
|
||||
Anope::string m;
|
||||
data["mask"] >> m;
|
||||
access->SetMask(m, ci);
|
||||
data["creator"] >> access->creator;
|
||||
data["last_seen"] >> access->last_seen;
|
||||
data["created"] >> access->created;
|
||||
|
||||
Reference in New Issue
Block a user