summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2025-04-16 01:46:52 +0100
committerSadie Powell <sadie@witchery.services>2025-04-16 01:50:59 +0100
commit74e9a9d2feb3690dc06a310e0477cd6f17e25fab (patch)
treebfde58ac0c6babff941b29459b92e89c22cb9d76 /modules
parentd2aee394ea5bc91b132001fb5bf2457eec295432 (diff)
Automatically wrap the help output.
Diffstat (limited to 'modules')
-rw-r--r--modules/botserv/bs_kick.cpp4
-rw-r--r--modules/botserv/bs_set.cpp6
-rw-r--r--modules/chanserv/cs_set.cpp6
-rw-r--r--modules/chanserv/cs_set_misc.cpp4
-rw-r--r--modules/help.cpp4
-rw-r--r--modules/memoserv/ms_set.cpp56
-rw-r--r--modules/nickserv/ns_register.cpp4
-rw-r--r--modules/nickserv/ns_set.cpp9
-rw-r--r--modules/nickserv/ns_set_misc.cpp4
-rw-r--r--modules/operserv/os_set.cpp16
-rw-r--r--modules/rewrite.cpp4
11 files changed, 66 insertions, 51 deletions
diff --git a/modules/botserv/bs_kick.cpp b/modules/botserv/bs_kick.cpp
index 80d8fc45d..97ca62d54 100644
--- a/modules/botserv/bs_kick.cpp
+++ b/modules/botserv/bs_kick.cpp
@@ -139,6 +139,7 @@ public:
source.Reply(" ");
source.Reply(_("Configures bot kickers. \037option\037 can be one of:"));
+ HelpWrapper help;
Anope::string this_name = source.command;
for (const auto &[c_name, info] : source.service->commands)
{
@@ -148,10 +149,11 @@ public:
if (command)
{
source.command = c_name;
- command->OnServHelp(source);
+ command->OnServHelp(source, help);
}
}
}
+ help.SendTo(source);
source.Reply(_(
"Type \002%s\032\037option\037\002 for more information "
diff --git a/modules/botserv/bs_set.cpp b/modules/botserv/bs_set.cpp
index 4cce07b98..a7c6ba414 100644
--- a/modules/botserv/bs_set.cpp
+++ b/modules/botserv/bs_set.cpp
@@ -37,6 +37,8 @@ public:
));
bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
+
+ HelpWrapper help;
Anope::string this_name = source.command;
for (const auto &[c_name, info] : source.service->commands)
{
@@ -56,10 +58,12 @@ public:
continue;
source.command = c_name;
- command->OnServHelp(source);
+ command->OnServHelp(source, help);
}
}
}
+ help.SendTo(source);
+
source.Reply(_("Type \002%s\032\037option\037\002 for more information on a particular option."),
source.service->GetQueryCommand("generic/help", this_name).c_str());
diff --git a/modules/chanserv/cs_set.cpp b/modules/chanserv/cs_set.cpp
index d4325bd8a..d5b7994de 100644
--- a/modules/chanserv/cs_set.cpp
+++ b/modules/chanserv/cs_set.cpp
@@ -39,6 +39,8 @@ public:
Anope::string this_name = source.command;
bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
+
+ HelpWrapper help;
for (const auto &[c_name, info] : source.service->commands)
{
if (c_name.find_ci(this_name + " ") == 0)
@@ -57,9 +59,11 @@ public:
continue;
source.command = c_name;
- c->OnServHelp(source);
+ c->OnServHelp(source, help);
}
}
+ help.SendTo(source);
+
source.Reply(_("Type \002%s\032\037option\037\002 for more information on a particular option."),
source.service->GetQueryCommand("generic/help", this_name).c_str());
return true;
diff --git a/modules/chanserv/cs_set_misc.cpp b/modules/chanserv/cs_set_misc.cpp
index 71afbe942..58650f557 100644
--- a/modules/chanserv/cs_set_misc.cpp
+++ b/modules/chanserv/cs_set_misc.cpp
@@ -157,12 +157,12 @@ public:
}
}
- void OnServHelp(CommandSource &source) override
+ void OnServHelp(CommandSource &source, HelpWrapper &help) override
{
if (descriptions.count(source.command))
{
this->SetDesc(descriptions[source.command]);
- Command::OnServHelp(source);
+ Command::OnServHelp(source, help);
}
}
diff --git a/modules/help.cpp b/modules/help.cpp
index abf97f7e1..bd29c01e5 100644
--- a/modules/help.cpp
+++ b/modules/help.cpp
@@ -47,6 +47,7 @@ public:
bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
+ HelpWrapper help;
if (params.empty() || params[0].equals_ci("ALL"))
{
bool all = !params.empty() && params[0].equals_ci("ALL");
@@ -88,9 +89,10 @@ public:
}
source.command = c_name;
- c->OnServHelp(source);
+ c->OnServHelp(source, help);
}
+ help.SendTo(source);
for (auto &[gr, cmds] : groups)
{
diff --git a/modules/memoserv/ms_set.cpp b/modules/memoserv/ms_set.cpp
index f4158c855..f1bd798af 100644
--- a/modules/memoserv/ms_set.cpp
+++ b/modules/memoserv/ms_set.cpp
@@ -225,18 +225,17 @@ public:
{
this->SendSyntax(source);
source.Reply(" ");
- source.Reply(_(
- "Sets various memo options. \037option\037 can be one of:"
- "\n\n"
- " NOTIFY Changes when you will be notified about\n"
- " new memos (only for nicknames)"
- "\n\n"
- " LIMIT Sets the maximum number of memos you can\n"
- " receive"
- "\n\n"
- "Type \002%s\032\037option\037\002 for more information "
- "on a specific option."
- ),
+ source.Reply(_("Sets various memo options. \037option\037 can be one of:"));
+
+ HelpWrapper help;
+ help.AddEntry("NOTIFY", _("Changes when you will be notified about new memos (only for nicknames)"));
+ help.AddEntry("LIMIT", _("Sets the maximum number of memos you can receive"));
+
+ source.Reply(" ");
+ help.SendTo(source);
+
+ source.Reply(" ");
+ source.Reply(_("Type \002%s\032\037option\037\002 for more information on a specific option."),
source.service->GetQueryCommand("generic/help", source.command).c_str());
}
else if (subcommand.equals_ci("NOTIFY"))
@@ -245,26 +244,21 @@ public:
"Syntax: \002NOTIFY {ON | LOGON | NEW | MAIL | NOMAIL | OFF}\002"
"\n\n"
"Changes when you will be notified about new memos:"
- "\n\n"
- " ON You will be notified of memos when you log on,\n"
- " when you unset /AWAY, and when they are sent\n"
- " to you."
- "\n\n"
- " LOGON You will only be notified of memos when you log\n"
- " on or when you unset /AWAY."
- "\n\n"
- " NEW You will only be notified of memos when they\n"
- " are sent to you."
- "\n\n"
- " MAIL You will be notified of memos by email as well as\n"
- " any other settings you have."
- "\n\n"
- " NOMAIL You will not be notified of memos by email."
- "\n\n"
- " OFF You will not receive any notification of memos."
- "\n\n"
- "\002ON\002 is essentially \002LOGON\002 and \002NEW\002 combined."
));
+
+ HelpWrapper help;
+ help.AddEntry("ON", _("You will be notified of memos when you log on, when you unset /AWAY, and when they are sent to you."));
+ help.AddEntry("LOGON", _("You will only be notified of memos when you log on or when you unset /AWAY."));
+ help.AddEntry("NEW", _("You will only be notified of memos when they are sent to you."));
+ help.AddEntry("MAIL", _("You will be notified of memos by email as well as any other settings you have."));
+ help.AddEntry("NOMAIL", _("You will not be notified of memos by email."));
+ help.AddEntry("OFF", _("You will not receive any notification of memos."));
+
+ source.Reply(" ");
+ help.SendTo(source);
+
+ source.Reply(" ");
+ source.Reply(_("\002ON\002 is essentially \002LOGON\002 and \002NEW\002 combined."));
}
else if (subcommand.equals_ci("LIMIT"))
{
diff --git a/modules/nickserv/ns_register.cpp b/modules/nickserv/ns_register.cpp
index bfa528bd5..55f79772d 100644
--- a/modules/nickserv/ns_register.cpp
+++ b/modules/nickserv/ns_register.cpp
@@ -376,10 +376,10 @@ public:
return true;
}
- void OnServHelp(CommandSource &source) override
+ void OnServHelp(CommandSource &source, HelpWrapper &help) override
{
if (Config->GetModule(this->owner).Get<const Anope::string>("registration").equals_ci("mail"))
- Command::OnServHelp(source);
+ Command::OnServHelp(source, help);
}
};
diff --git a/modules/nickserv/ns_set.cpp b/modules/nickserv/ns_set.cpp
index d1fefecab..200430988 100644
--- a/modules/nickserv/ns_set.cpp
+++ b/modules/nickserv/ns_set.cpp
@@ -36,6 +36,8 @@ public:
Anope::string this_name = source.command;
bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"),
hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands");
+
+ HelpWrapper help;
for (const auto &[c_name, info] : source.service->commands)
{
if (c_name.find_ci(this_name + " ") == 0)
@@ -53,9 +55,10 @@ public:
continue;
source.command = c_name;
- c->OnServHelp(source);
+ c->OnServHelp(source, help);
}
}
+ help.SendTo(source);
source.Reply(_("Type \002%s\032\037option\037\002 for more information on a specific option."),
source.service->GetQueryCommand("generic/help", this_name).c_str());
@@ -86,6 +89,7 @@ public:
source.Reply(" ");
source.Reply(_("Sets various nickname options. \037option\037 can be one of:"));
+ HelpWrapper help;
Anope::string this_name = source.command;
for (const auto &[c_name, info] : source.service->commands)
{
@@ -95,10 +99,11 @@ public:
if (command)
{
source.command = c_name;
- command->OnServHelp(source);
+ command->OnServHelp(source, help);
}
}
}
+ help.SendTo(source);
source.Reply(_(
"Type \002%s\032\037option\037\002 for more information "
diff --git a/modules/nickserv/ns_set_misc.cpp b/modules/nickserv/ns_set_misc.cpp
index c7606cf85..ca048487c 100644
--- a/modules/nickserv/ns_set_misc.cpp
+++ b/modules/nickserv/ns_set_misc.cpp
@@ -153,12 +153,12 @@ public:
this->Run(source, source.nc->display, !params.empty() ? params[0] : "");
}
- void OnServHelp(CommandSource &source) override
+ void OnServHelp(CommandSource &source, HelpWrapper &help) override
{
if (descriptions.count(source.command))
{
this->SetDesc(descriptions[source.command]);
- Command::OnServHelp(source);
+ Command::OnServHelp(source, help);
}
}
diff --git a/modules/operserv/os_set.cpp b/modules/operserv/os_set.cpp
index ced5a9d97..a667bb7bb 100644
--- a/modules/operserv/os_set.cpp
+++ b/modules/operserv/os_set.cpp
@@ -200,13 +200,17 @@ public:
source.Reply(_(
"Sets various global services options. Option names "
"currently defined are:"
- "\n\n"
- " READONLY Set read-only or read-write mode\n"
- " DEBUG Activate or deactivate debug mode\n"
- " NOEXPIRE Activate or deactivate no expire mode\n"
- " SUPERADMIN Activate or deactivate super admin mode\n"
- " LIST List the options"
));
+
+ HelpWrapper help;
+ help.AddEntry("READONLY", "Set read-only or read-write mode");
+ help.AddEntry("DEBUG", "Activate or deactivate debug mode");
+ help.AddEntry("NOEXPIRE", "Activate or deactivate no expire mode");
+ help.AddEntry("SUPERADMIN", "Activate or deactivate super admin mode");
+ help.AddEntry("LIST", "List the options");
+
+ source.Reply(" ");
+ help.SendTo(source);
}
else if (subcommand.equals_ci("LIST"))
{
diff --git a/modules/rewrite.cpp b/modules/rewrite.cpp
index 28007dadd..94cacb8cc 100644
--- a/modules/rewrite.cpp
+++ b/modules/rewrite.cpp
@@ -129,13 +129,13 @@ public:
Log() << "rewrite: Unable to rewrite '" << source.command << (!params.empty() ? " " + params[0] : "") << "'";
}
- void OnServHelp(CommandSource &source) override
+ void OnServHelp(CommandSource &source, HelpWrapper &help) override
{
Rewrite *r = Rewrite::Find(!source.c ? source.service->nick : "", source.command);
if (r != NULL && !r->desc.empty())
{
this->SetDesc(r->desc);
- Command::OnServHelp(source);
+ Command::OnServHelp(source, help);
}
}