summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/bots.h15
-rw-r--r--include/commands.h17
-rw-r--r--include/config.h4
-rw-r--r--include/services.h1
4 files changed, 24 insertions, 13 deletions
diff --git a/include/bots.h b/include/bots.h
index 7508e4091..446287abf 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -13,7 +13,6 @@ class BotInfo;
extern CoreExport Anope::insensitive_map<BotInfo *> BotListByNick;
extern CoreExport Anope::map<BotInfo *> BotListByUID;
typedef Anope::insensitive_map<BotInfo *> botinfo_map;
-typedef Anope::insensitive_map<Anope::string> command_map;
/** Flags settable on a bot
*/
@@ -39,6 +38,7 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
uint32 chancount;
time_t created; /* Birth date ;) */
time_t lastmsg; /* Last time we said something */
+ typedef Anope::insensitive_map<CommandInfo> command_map;
command_map commands; /* Commands, actual name to service name */
/** Create a new bot.
@@ -100,6 +100,19 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
* @param message The users' message
*/
virtual void OnMessage(User *u, const Anope::string &message);
+
+ /** Link a command name to a command in services
+ * @param cname The command name
+ * @param sname The service name
+ * @param permission Permission required to execute the command, if any
+ */
+ void SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission = "");
+
+ /** Get command info for a command
+ * @param cname The command name
+ * @return A struct containing service name and permission
+ */
+ CommandInfo *GetCommand(const Anope::string &cname);
};
#endif // BOTS_H
diff --git a/include/commands.h b/include/commands.h
index 0ee9af226..227483f63 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -30,6 +30,12 @@ const Anope::string CommandFlagStrings[] = {
""
};
+struct CommandInfo
+{
+ Anope::string name;
+ Anope::string permission;
+};
+
/* The source for a command */
struct CoreExport CommandSource
{
@@ -43,6 +49,8 @@ struct CoreExport CommandSource
BotInfo *service;
/* The actual name of the command being executed */
Anope::string command;
+ /* The permission of the command being executed */
+ Anope::string permission;
std::list<Anope::string> reply;
@@ -64,8 +72,6 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
size_t MaxParams;
/* Minimum parameters required to use this command */
size_t MinParams;
- /* Permission needed to use this comand */
- Anope::string permission;
/* Module which owns us */
Module *module;
@@ -77,7 +83,7 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
* @param max_params The maximum number of parameters the parser will create, after max_params, all will be combined into the last argument.
* NOTE: If max_params is not set (default), there is no limit to the max number of params.
*/
- Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0, const Anope::string &spermission = "");
+ Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0);
virtual ~Command();
@@ -117,11 +123,6 @@ class CoreExport Command : public Service, public Flags<CommandFlag>
* @param subcommand The subcommand the user tried to use
*/
virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand);
-
- /** Set which command permission (e.g. chanserv/forbid) is required for this command.
- * @param reststr The permission required to successfully execute this command
- */
- void SetPermission(const Anope::string &reststr);
};
#endif // COMMANDS_H
diff --git a/include/config.h b/include/config.h
index 84ed2f8d3..6e686b13f 100644
--- a/include/config.h
+++ b/include/config.h
@@ -482,8 +482,6 @@ class CoreExport ServerConfig
Anope::string NSEnforcerHost;
/* How long before recovered nicks are released */
time_t NSReleaseTimeout;
- /* /nickserv list is oper only */
- bool NSListOpersOnly;
/* Max number of entries that can be returned from the list command */
unsigned NSListMax;
/* Only allow usermode +a etc on real services admins */
@@ -523,8 +521,6 @@ class CoreExport ServerConfig
Anope::string CSAutokickReason;
/* Time ChanServ should stay in the channel to hold it to keep users from getting in */
time_t CSInhabit;
- /* ChanServ's LIST command is oper only */
- bool CSListOpersOnly;
/* Max number of entries allowed to be returned from the LIST command */
unsigned CSListMax;
/* true to make ChanServ oper only */
diff --git a/include/services.h b/include/services.h
index 0eeafc0e9..addaf6ae8 100644
--- a/include/services.h
+++ b/include/services.h
@@ -674,6 +674,7 @@ enum
#include "users.h"
#include "account.h"
+#include "commands.h"
#include "bots.h"
struct LevelInfo