1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 15:44:46 +02:00

Allow Command::FindCommandFromService to skip hidden commands.

This commit is contained in:
Sadie Powell
2026-03-11 05:44:48 +00:00
parent fa5bb3f1bf
commit 22a1924bfd
8 changed files with 15 additions and 12 deletions
+1 -1
View File
@@ -189,5 +189,5 @@ public:
* @param name If found, is set to the command name, eg REGISTER
* @return true if the given command service exists
*/
static bool FindCommandFromService(const Anope::string &command_service, BotInfo *&bi, Anope::string &name);
static bool FindFromService(const Anope::string &command_service, BotInfo *&bi, Anope::string &name);
};
+1 -1
View File
@@ -671,7 +671,7 @@ public:
BotInfo *bi;
Anope::string cmd;
if (Command::FindCommandFromService("chanserv/levels", bi, cmd))
if (Command::FindFromService("chanserv/levels", bi, cmd))
{
source.Reply(" ");
source.Reply(_(
+1 -1
View File
@@ -245,7 +245,7 @@ public:
BotInfo *bi;
Anope::string cmd;
if (Command::FindCommandFromService("chanserv/list", bi, cmd))
if (Command::FindFromService("chanserv/list", bi, cmd))
{
source.Reply(_("When \002private\002 is set, the channel will not appear in %s's %s command."),
bi->nick.c_str(), cmd.c_str());
+1 -1
View File
@@ -105,7 +105,7 @@ public:
BotInfo *bi;
Anope::string cmd;
if (Command::FindCommandFromService("chanserv/access", bi, cmd))
if (Command::FindFromService("chanserv/access", bi, cmd))
{
source.Reply(" ");
source.Reply(_(
+2 -2
View File
@@ -636,8 +636,8 @@ public:
BotInfo *access_bi, *flags_bi;
Anope::string access_cmd, flags_cmd;
Command::FindCommandFromService("chanserv/access", access_bi, access_cmd);
Command::FindCommandFromService("chanserv/flags", flags_bi, flags_cmd);
Command::FindFromService("chanserv/access", access_bi, access_cmd);
Command::FindFromService("chanserv/flags", flags_bi, flags_cmd);
if (!access_cmd.empty() || !flags_cmd.empty())
{
source.Reply(_("Alternative methods of modifying channel access lists are available."));
+1 -1
View File
@@ -285,7 +285,7 @@ public:
BotInfo *bi;
Anope::string cmd;
if (dnsmanager && Command::FindCommandFromService("hostserv/validate", bi, cmd))
if (dnsmanager && Command::FindFromService("hostserv/validate", bi, cmd))
{
source.Reply(_(
"Your vhost \002%s\002 has been requested. If the requested vhost is for a valid "
+1 -1
View File
@@ -90,7 +90,7 @@ public:
BotInfo *bi;
Anope::string cmd;
if (Command::FindCommandFromService("memoserv/del", bi, cmd))
if (Command::FindFromService("memoserv/del", bi, cmd))
{
if (ci)
source.Reply(_("To delete, type: \002%s %s %d\002"), bi->GetQueryCommand({}, cmd).c_str(), ci->name.c_str(), index + 1);
+7 -4
View File
@@ -364,9 +364,10 @@ bool Command::Run(CommandSource &source, const Anope::string &cmdname, const Com
return true;
}
bool Command::FindCommandFromService(const Anope::string &command_service, BotInfo *&bot, Anope::string &name)
bool Command::FindFromService(const Anope::string &command_service, BotInfo *&bot, Anope::string &name)
{
bot = NULL;
bot = nullptr;
name.clear();
for (const auto &[_, bi] : *BotListByNick)
{
@@ -377,9 +378,11 @@ bool Command::FindCommandFromService(const Anope::string &command_service, BotIn
bot = bi;
name = c_name;
return true;
if (!info.hide)
return true;
}
}
return false;
return name.empty();
}