mirror of
https://github.com/anope/anope.git
synced 2026-06-27 13:16:38 +02:00
Add a command flag to require that a user is executing the command
This commit is contained in:
+4
-1
@@ -18,7 +18,7 @@
|
||||
#include "regchannel.h"
|
||||
#include "channels.h"
|
||||
|
||||
static const Anope::string CommandFlagString[] = { "CFLAG_ALLOW_UNREGISTERED", "CFLAG_STRIP_CHANNEL", "" };
|
||||
static const Anope::string CommandFlagString[] = { "CFLAG_ALLOW_UNREGISTERED", "CFLAG_STRIP_CHANNEL", "CFLAG_REQUIRE_USER", "" };
|
||||
template<> const Anope::string* Flags<CommandFlag>::flags_strings = CommandFlagString;
|
||||
|
||||
CommandSource::CommandSource(const Anope::string &n, User *user, NickCore *core, CommandReply *r, BotInfo *bi) : nick(n), u(user), nc(core), reply(r),
|
||||
@@ -218,6 +218,9 @@ void RunCommand(CommandSource &source, const Anope::string &message)
|
||||
return;
|
||||
}
|
||||
|
||||
if (c->HasFlag(CFLAG_REQUIRE_USER) && !source.GetUser())
|
||||
return;
|
||||
|
||||
// Command requires registered users only
|
||||
if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !source.nc)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user