1
0
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:
Adam
2012-12-19 16:03:53 -05:00
parent 67bd2c6b2d
commit 276247b463
9 changed files with 25 additions and 34 deletions
+4 -1
View File
@@ -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)
{