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

Move access entries for other access systems under an ALL option.

This should hopefully make it clearer that the access systems are
separate.
This commit is contained in:
Sadie Powell
2026-03-16 19:05:14 +00:00
parent 63032dc8d9
commit a657cb5edf
4 changed files with 69 additions and 13 deletions
+34 -5
View File
@@ -427,6 +427,8 @@ private:
void ProcessList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params, ListFormatter &list)
{
const Anope::string &nick = params.size() > 2 ? params[2] : "";
const auto show_all = params.size() > 3 && params[3].equals_ci("ALL");
unsigned foreign = 0;
if (!ci->GetAccessCount())
source.Reply(_("%s access list is empty."), ci->name.c_str());
@@ -437,9 +439,16 @@ private:
{
ListFormatter &list;
ChannelInfo *ci;
bool show_all;
unsigned& foreign;
public:
AccessListCallback(ListFormatter &_list, ChannelInfo *_ci, const Anope::string &numlist) : NumberList(numlist, false), list(_list), ci(_ci)
AccessListCallback(ListFormatter &_list, ChannelInfo *_ci, const Anope::string &numlist, bool _show_all, unsigned &_foreign)
: NumberList(numlist, false)
, list(_list)
, ci(_ci)
, show_all(_show_all)
, foreign(_foreign)
{
}
@@ -449,11 +458,16 @@ private:
return;
const ChanAccess *access = ci->GetAccess(number - 1);
if (!show_all && access->provider->name != "access/access")
{
foreign++;
return;
}
AddEntry(this->list, ci, access, number);
}
}
nl_list(list, ci, nick);
nl_list(list, ci, nick, show_all, foreign);
nl_list.Process();
}
else
@@ -465,6 +479,12 @@ private:
if (!nick.empty() && !Anope::Match(access->Mask(), nick))
continue;
if (!show_all && access->provider->name != "access/access")
{
foreign++;
continue;
}
AddEntry(list, ci, access, i + 1);
}
}
@@ -477,6 +497,14 @@ private:
list.SendTo(source);
source.Reply(_("End of access list"));
}
if (foreign)
{
const auto full_command = Anope::Format("%s %s %s %s", source.command.c_str(),
ci->name.c_str(), params[1].upper().c_str(), nick.empty() ? "*" : nick.c_str()).nobreak();
source.Reply(foreign, CHAN_ACCESS_FOREIGN, foreign, full_command.c_str());
}
}
void DoList(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
@@ -542,8 +570,8 @@ public:
this->SetDesc(_("Modify the list of privileged users"));
this->SetSyntax(_("\037channel\037 ADD \037mask\037 \037level\037 [\037description\037]"));
this->SetSyntax(_("\037channel\037 DEL {\037mask\037 | \037entry-num\037 | \037list\037}"));
this->SetSyntax(_("\037channel\037 LIST [\037mask\037 | \037list\037]"));
this->SetSyntax(_("\037channel\037 VIEW [\037mask\037 | \037list\037]"));
this->SetSyntax(_("\037channel\037 LIST [\037mask\037 | \037list\037] [ALL]"));
this->SetSyntax(_("\037channel\037 VIEW [\037mask\037 | \037list\037] [ALL]"));
this->SetSyntax(_("\037channel\037 CLEAR"));
}
@@ -646,7 +674,8 @@ public:
"The \002%s\033LIST\002 command displays the access list. If "
"a wildcard mask is given, only those entries matching the "
"mask are displayed. If a list of entry numbers is given, "
"only those entries are shown."
"only those entries are shown. The \002ALL\002 option allows "
"listing entries from other access systems as well as levels."
"\n\n"
"The \002%s\033VIEW\002 command displays the access list similar "
"to \002%s\033LIST\002 but shows the creator and last used time."