From 4e2ca31cf5fc874ab928dc4d3735f4345a910d0d Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 13 Feb 2016 14:16:29 -0500 Subject: Rewrite access path system to be simplier and use recursion Show where access is "from" in chanserv/status --- modules/commands/cs_status.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'modules/commands/cs_status.cpp') diff --git a/modules/commands/cs_status.cpp b/modules/commands/cs_status.cpp index 28fe60619..b984d5952 100644 --- a/modules/commands/cs_status.cpp +++ b/modules/commands/cs_status.cpp @@ -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()); + } } } -- cgit