1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 11:56:38 +02:00

Rewrite access path system to be simplier and use recursion

Show where access is "from" in chanserv/status
This commit is contained in:
Adam
2016-02-13 14:16:29 -05:00
parent addd2a1987
commit 4e2ca31cf5
9 changed files with 165 additions and 113 deletions
+18 -3
View File
@@ -57,11 +57,26 @@ public:
{
source.Reply(_("Access for \002%s\002 on \002%s\002:"), nick.c_str(), ci->name.c_str());
for (unsigned i = 0; i < ag.size(); ++i)
for (unsigned i = 0; i < ag.paths.size(); ++i)
{
ChanAccess *acc = ag[i];
ChanAccess::Path &p = ag.paths[i];
source.Reply(_("\002%s\002 matches access entry %s, which has privilege %s."), nick.c_str(), acc->Mask().c_str(), acc->AccessSerialize().c_str());
if (p.empty())
continue;
if (p.size() == 1)
{
ChanAccess *acc = p[0];
source.Reply(_("\002%s\002 matches access entry %s, which has privilege %s."), nick.c_str(), acc->Mask().c_str(), acc->AccessSerialize().c_str());
}
else
{
ChanAccess *first = p[0];
ChanAccess *acc = p[p.size() - 1];
source.Reply(_("\002%s\002 matches access entry %s (from entry %s), which has privilege %s."), nick.c_str(), acc->Mask().c_str(), first->Mask().c_str(), acc->AccessSerialize().c_str());
}
}
}