1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
18 #include "inspircd_config.h"
25 /** Used to indicate command success codes
29 CMD_FAILURE = 0, /* Command exists, but failed */
30 CMD_SUCCESS = 1, /* Command exists, and succeeded */
31 CMD_INVALID = 2, /* Command doesnt exist at all! */
32 CMD_USER_DELETED = 3, /* User was deleted! */
35 /** A structure that defines a command
37 class command_t : public Extensible
40 InspIRCd* ServerInstance;
45 /** User flags needed to execute the command or 0
48 /** Minimum number of parameters command takes
57 /** used for resource tracking between modules
60 /** True if the command is disabled to non-opers
63 /** True if the command can be issued before registering
65 bool works_before_reg;
66 /** Syntax string for the command, displayed if non-empty string.
67 * This takes place of the text in the 'not enough parameters' numeric.
71 command_t(InspIRCd* Instance, const std::string &cmd, char flags, int minpara, int before_reg = false) : ServerInstance(Instance), command(cmd), flags_needed(flags), min_params(minpara), disabled(false), works_before_reg(before_reg)
73 use_count = total_bytes = 0;
78 virtual CmdResult Handle(const char** parameters, int pcnt, userrec* user) = 0;
80 virtual CmdResult HandleServer(const char** parameters, int pcnt, const std::string &servername)
85 void Disable(bool setting)
97 return works_before_reg;
100 virtual ~command_t() {}
103 typedef nspace::hash_map<std::string,command_t*> command_table;