mirror of
https://github.com/anope/anope.git
synced 2026-06-12 17:24:49 +02:00
Allow Command::FindCommandFromService to skip hidden commands.
This commit is contained in:
+1
-1
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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(_(
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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(_(
|
||||
|
||||
@@ -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."));
|
||||
|
||||
@@ -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 "
|
||||
|
||||
@@ -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
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user