From fa5bb3f1bf6ae8517b05edd45c51711dc5afed89 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 10 Mar 2026 23:28:54 +0000 Subject: [PATCH] Show the default levels in LEVELS DESC. Closes #564. --- language/anope.en_US.po | 9 ++++++--- modules/chanserv/cs_access.cpp | 25 +++++++++++++++---------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/language/anope.en_US.po b/language/anope.en_US.po index e0bb5e648..a26041f9d 100644 --- a/language/anope.en_US.po +++ b/language/anope.en_US.po @@ -16,8 +16,8 @@ msgid "" msgstr "" "Project-Id-Version: Anope\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-02-24 18:55+0000\n" -"PO-Revision-Date: 2026-02-24 18:55+0000\n" +"POT-Creation-Date: 2026-03-10 23:30+0000\n" +"PO-Revision-Date: 2026-03-10 23:30+0000\n" "Last-Translator: Sadie Powell \n" "Language-Team: English\n" "Language: en_US\n" @@ -414,7 +414,7 @@ msgstr "" msgid "{name} = {value}" msgstr "" -msgid "{name}: {description}" +msgid "{name}: defaults to {default} ({description})" msgstr "" msgid "{nick} (account: {account})" @@ -2529,6 +2529,9 @@ msgstr "" msgid "Deactivates your assigned vhost" msgstr "" +msgid "Default" +msgstr "" + #, c-format msgid "Default AKILL expiry time: %d days" msgstr "" diff --git a/modules/chanserv/cs_access.cpp b/modules/chanserv/cs_access.cpp index 0e4a2da39..abd8c834b 100644 --- a/modules/chanserv/cs_access.cpp +++ b/modules/chanserv/cs_access.cpp @@ -23,6 +23,17 @@ static inline void reset_levels(ChannelInfo *ci) ci->SetLevel(priv, level); } +static Anope::string LevelToString(CommandSource &source, int16_t level) +{ + if (level == ACCESS_INVALID) + return Language::Translate(source.GetAccount(), _("(disabled)")); + + if (level == ACCESS_FOUNDER) + return Language::Translate(source.GetAccount(), _("(founder only)")); + + return Anope::ToString(level); +} + class AccessChanAccess final : public ChanAccess { @@ -768,14 +779,7 @@ class CommandCSLevels final ListFormatter::ListEntry entry; entry["Name"] = p.name; - - if (j == ACCESS_INVALID) - entry["Level"] = Language::Translate(source.GetAccount(), _("(disabled)")); - else if (j == ACCESS_FOUNDER) - entry["Level"] = Language::Translate(source.GetAccount(), _("(founder only)")); - else - entry["Level"] = Anope::ToString(j); - + entry["Level"] = LevelToString(source, j); list.AddEntry(entry); } @@ -852,13 +856,14 @@ public: source.Reply(_("The following feature/function names are available:")); ListFormatter list(source.GetAccount()); - list.AddColumn(_("Name")).AddColumn(_("Description")); - list.SetFlexible(_("\002{name}\002: {description}")); + list.AddColumn(_("Name")).AddColumn(_("Default")).AddColumn(_("Description")); + list.SetFlexible(_("\002{name}\002: defaults to {default} ({description})")); for (const auto &p : PrivilegeManager::GetPrivileges()) { ListFormatter::ListEntry entry; entry["Name"] = p.name; + entry["Default"] = LevelToString(source, defaultLevels[p.name]); entry["Description"] = Language::Translate(source.nc, p.desc.c_str()); list.AddEntry(entry); }