diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-02 12:38:41 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-02 12:38:41 +0000 |
commit | a753fb1bc711e10794e939e424f3cdd703116d82 (patch) | |
tree | bf17b41965232848b840c4340f74bec3741afae2 /include/modules.h | |
parent | 0ae832406f989194761528a1b8d49aa115c7fb3b (diff) |
Added support for modules to create commands - this needs a proof-of-concept module yet, do not use unless you like to live dangerously.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@351 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/modules.h')
-rw-r--r-- | include/modules.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/modules.h b/include/modules.h index d9d04e762..b26554d56 100644 --- a/include/modules.h +++ b/include/modules.h @@ -20,6 +20,7 @@ #include "dynamic.h" #include "base.h" +#include "ctables.h" #include <string> #include <deque> @@ -34,6 +35,8 @@ typedef file_cache string_list; #define FOREACH_MOD for (int i = 0; i <= MODCOUNT; i++) modules[i]-> +extern void createcommand(char* cmd, handlerfunc f, char flags, int minparams); + // class Version holds the version information of a Module, returned // by Module::GetVersion (thanks RD) @@ -271,6 +274,22 @@ class Server : public classbase * effects. */ virtual bool AddExtendedMode(char modechar, int type, bool default_on, int params_when_on, int params_when_off); + + /** Adds a command to the command table. + * This allows modules to add extra commands into the command table. You must place a function within your + * module which is is of type handlerfunc: + * + * typedef void (handlerfunc) (char**, int, userrec*); + * ... + * void handle_kill(char **parameters, int pcnt, userrec *user) + * + * When the command is typed, the parameters will be placed into the parameters array (similar to argv) and + * the parameter count will be placed into pcnt (similar to argv). There will never be any less parameters + * than the 'minparams' value you specified when creating the command. The *user parameter is the class of + * the user which caused the command to trigger, who will always have the flag you specified in 'flags' when + * creating the initial command. For example to create an oper only command create the commands with flags='o'. + */ + virtual void AddCommand(char* cmd, handlerfunc f, char flags, int minparams); }; |