summaryrefslogtreecommitdiff
path: root/include/modules.h
diff options
context:
space:
mode:
authorAdam <Adam@drink-coca-cola.info>2010-04-24 17:18:25 -0400
committerAdam <Adam@anope.org>2010-06-18 20:55:38 -0400
commitfa82890696c498f38643df7df6891434c91c9269 (patch)
tree4b28359e75c29825586e6b2394e5334e43ea074b /include/modules.h
parent2ba89de64d3b755f731f202dd97c48d256db8031 (diff)
Moved Commands stuff to its own file and changed Command::name to be ci::string - Will be used after hashing system is rewritten
Diffstat (limited to 'include/modules.h')
-rw-r--r--include/modules.h92
1 files changed, 1 insertions, 91 deletions
diff --git a/include/modules.h b/include/modules.h
index bd553c2cc..dcaac342c 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -19,6 +19,7 @@
#include "timers.h"
#include "hashcomp.h"
#include "version.h"
+#include "commands.h"
/* Cross OS compatibility macros */
#ifdef _WIN32
@@ -113,23 +114,7 @@ enum Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFOR
/*************************************************************************/
-#define CMD_HASH(x) (((x)[0]&31)<<5 | ((x)[1]&31)) /* Will gen a hash from a string :) */
-#define MAX_CMD_HASH 1024
-/** The return value from commands.
- */
-enum CommandReturn
-{
- MOD_CONT,
- MOD_STOP
-};
-
-#define HOSTSERV HS_cmdTable /* using HOSTSERV etc. looks nicer than HS_cmdTable for modules */
-#define BOTSERV BS_cmdTable
-#define MEMOSERV MS_cmdTable
-#define NICKSERV NS_cmdTable
-#define CHANSERV CS_cmdTable
-#define OPERSERV OS_cmdTable
#define IRCD IRCD_cmdTable
#define MODULE_HASH Module_table
#define EVENT EVENT_cmdTable
@@ -191,7 +176,6 @@ typedef enum { MOD_OP_LOAD, MOD_OP_UNLOAD } ModuleOperation;
/*************************************************************************/
/* Structure for information about a *Serv command. */
-struct CommandHash;
typedef struct ModuleLang_ ModuleLang;
typedef struct ModuleHash_ ModuleHash;
typedef struct Message_ Message;
@@ -199,15 +183,6 @@ typedef struct MessageHash_ MessageHash;
/*************************************************************************/
-
-
-
-extern MDE CommandHash *HOSTSERV[MAX_CMD_HASH];
-extern MDE CommandHash *BOTSERV[MAX_CMD_HASH];
-extern MDE CommandHash *MEMOSERV[MAX_CMD_HASH];
-extern MDE CommandHash *NICKSERV[MAX_CMD_HASH];
-extern MDE CommandHash *CHANSERV[MAX_CMD_HASH];
-extern MDE CommandHash *OPERSERV[MAX_CMD_HASH];
extern MDE MessageHash *IRCD[MAX_CMD_HASH];
extern MDE ModuleHash *MODULE_HASH[MAX_CMD_HASH];
@@ -216,65 +191,6 @@ struct ModuleLang_ {
char **argv;
};
-enum CommandFlag
-{
- CFLAG_ALLOW_UNREGISTERED,
- CFLAG_ALLOW_FORBIDDEN,
- CFLAG_ALLOW_SUSPENDED,
- CFLAG_ALLOW_UNREGISTEREDCHANNEL,
- CFLAG_STRIP_CHANNEL,
- CFLAG_DISABLE_FANTASY
-};
-
-/** Every services command is a class, inheriting from Command.
- */
-class CoreExport Command : public Flags<CommandFlag>
-{
- public:
- size_t MaxParams;
- size_t MinParams;
- std::string name;
- std::string permission;
-
- /** Create a new command.
- * @param min_params The minimum number of parameters the parser will require to execute this command
- * @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(const std::string &sname, size_t min_params, size_t max_params = 0, const std::string &spermission = "");
-
- virtual ~Command();
-
- /** Execute this command.
- * @param u The user executing the command.
- */
- virtual CommandReturn Execute(User *u, const std::vector<ci::string> &);
-
- /** Requested when the user is requesting help on this command. Help on this command should be sent to the user.
- * @param u The user requesting help
- * @param subcommand The subcommand the user is requesting help on, or an empty string. (e.g. /ns help set foo bar lol gives a subcommand of "FOO BAR LOL")
- * @return true if help was provided to the user, false otherwise.
- */
- virtual bool OnHelp(User *u, const ci::string &subcommand);
-
- /** Requested when the user provides bad syntax to this command (not enough params, etc).
- * @param u The user executing the command.
- * @param subcommand The subcommand the user tried to use
- */
- virtual void OnSyntaxError(User *u, const ci::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 std::string &reststr);
-
- /* Module related stuff */
- int core; /* Can this command be deleted? */
- char *mod_name; /* Name of the module who owns us, NULL for core's */
- char *service; /* Service we provide this command for */
- Command *next;
-};
-
class Version
{
private:
@@ -1324,12 +1240,6 @@ struct ModuleHash_ {
ModuleHash *next;
};
-struct CommandHash {
- char *name; /* Name of the command */
- Command *c; /* Actual command */
- CommandHash *next; /* Next command */
-};
-
struct Message_ {
char *name;
int (*func)(const char *source, int ac, const char **av);