mirror of
https://github.com/anope/anope.git
synced 2026-06-29 20:46:39 +02:00
Allow configuring fantasy commands to not require the FANTASY priv.
This commit is contained in:
+3
-1
@@ -34,8 +34,10 @@ struct CommandInfo final
|
||||
Anope::string group;
|
||||
/* whether or not to hide this command in help output */
|
||||
bool hide = false;
|
||||
/* Only used with fantasy */
|
||||
/* Whether to prepend the channel name (only used with fantasy) */
|
||||
bool prepend_channel = false;
|
||||
/* Whether to require the FANTASY privilege (only used with fantasy) */
|
||||
bool require_privilege = true;
|
||||
};
|
||||
|
||||
/* Where the replies from commands go to. User inherits from this and is the normal
|
||||
|
||||
+1
-1
@@ -188,7 +188,7 @@ public:
|
||||
source.permission = info.permission;
|
||||
|
||||
AccessGroup ag = c->ci->AccessFor(u);
|
||||
bool has_fantasy = ag.HasPriv("FANTASY") || source.HasPriv("botserv/fantasy");
|
||||
bool has_fantasy = !info.require_privilege || ag.HasPriv("FANTASY") || source.HasPriv("botserv/fantasy");
|
||||
|
||||
EventReturn MOD_RESULT;
|
||||
if (has_fantasy)
|
||||
|
||||
+3
-4
@@ -491,8 +491,6 @@ Conf::Conf() : Block("")
|
||||
&service = fantasy.Get<const Anope::string>("command"),
|
||||
&permission = fantasy.Get<const Anope::string>("permission"),
|
||||
&group = fantasy.Get<const Anope::string>("group");
|
||||
bool hide = fantasy.Get<bool>("hide"),
|
||||
prepend_channel = fantasy.Get<bool>("prepend_channel", "yes");
|
||||
|
||||
ValidateNotEmpty("fantasy", "name", nname);
|
||||
ValidateNotEmptyOrSpaces("fantasy", "command", service);
|
||||
@@ -501,8 +499,9 @@ Conf::Conf() : Block("")
|
||||
c.name = service;
|
||||
c.permission = permission;
|
||||
c.group = group;
|
||||
c.hide = hide;
|
||||
c.prepend_channel = prepend_channel;
|
||||
c.hide = fantasy.Get<bool>("hide");
|
||||
c.prepend_channel = fantasy.Get<bool>("prepend_channel", "yes");
|
||||
c.require_privilege = fantasy.Get<bool>("require_privilege", "no");
|
||||
}
|
||||
|
||||
for (int i = 0; i < this->CountBlock("command_group"); ++i)
|
||||
|
||||
Reference in New Issue
Block a user