diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ctables.h | 10 | ||||
-rw-r--r-- | include/inspircd.h | 2 | ||||
-rw-r--r-- | include/modules.h | 13 |
3 files changed, 20 insertions, 5 deletions
diff --git a/include/ctables.h b/include/ctables.h index 5ca5e13b3..ab39bf5f3 100644 --- a/include/ctables.h +++ b/include/ctables.h @@ -27,17 +27,17 @@ typedef void (handlerfunc) (char**, int, userrec*); class command_t : public classbase { public: - /** Command name - */ + /** Command name + */ char command[MAXBUF]; /** Handler function as in typedef - */ + */ handlerfunc *handler_function; /** User flags needed to execute the command or 0 */ char flags_needed; - /** Minimum number of parameters command takes - */ + /** Minimum number of parameters command takes + */ int min_params; /** used by /stats m */ diff --git a/include/inspircd.h b/include/inspircd.h index 8409c391d..6da27ce3f 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -112,4 +112,6 @@ chanrec* del_channel(userrec *user, const char* cname, const char* reason, bool void force_nickchange(userrec* user,const char* newnick); void kill_link(userrec *user,const char* r); int usercount(chanrec *c); +void call_handler(const char* commandname,char **parameters, int pcnt, userrec *user); +void send_network_quit(const char* nick, const char* reason); diff --git a/include/modules.h b/include/modules.h index 691e6eda1..91688b622 100644 --- a/include/modules.h +++ b/include/modules.h @@ -458,6 +458,19 @@ class Server : public classbase * Returns true if the literal successfully matches the pattern, false if otherwise. */ virtual bool MatchText(std::string sliteral, std::string spattern); + + /** Calls the handler for a command, either implemented by the core or by another module. + * You can use this function to trigger other commands in the ircd, such as PRIVMSG, JOIN, + * KICK etc, or even as a method of callback. By defining command names that are untypeable + * for users on irc (e.g. those which contain a \r or \n) you may use them as callback identifiers. + * The first parameter to this method is the name of the command handler you wish to call, e.g. + * PRIVMSG. This will be a command handler previously registered by the core or wih AddCommand(). + * The second parameter is an array of parameters, and the third parameter is a count of parameters + * in the array. If you do not pass enough parameters to meet the minimum needed by the handler, the + * functiom will silently ignore it. The final parameter is the user executing the command handler, + * used for privilage checks, etc. + */ + virtual void CallCommandHandler(std::string commandname, char** parameters, int pcnt, userrec* user); }; /** Allows reading of values from configuration files |