1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
21 #include "inspircd_config.h"
28 /** Used to indicate command success codes
32 CMD_FAILURE = 0, /* Command exists, but failed */
33 CMD_SUCCESS = 1, /* Command exists, and succeeded */
34 CMD_INVALID = 2, /* Command doesnt exist at all! */
35 CMD_USER_DELETED = 3, /* User was deleted! */
38 /** A structure that defines a command
40 class command_t : public Extensible
43 InspIRCd* ServerInstance;
48 /** User flags needed to execute the command or 0
51 /** Minimum number of parameters command takes
60 /** used for resource tracking between modules
63 /** True if the command is disabled to non-opers
66 /** True if the command can be issued before registering
68 bool works_before_reg;
69 /** Syntax string for the command, displayed if non-empty string.
70 * This takes place of the text in the 'not enough parameters' numeric.
74 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)
76 use_count = total_bytes = 0;
81 virtual CmdResult Handle(const char** parameters, int pcnt, userrec* user) = 0;
83 virtual CmdResult HandleServer(const char** parameters, int pcnt, const std::string &servername)
88 void Disable(bool setting)
100 return works_before_reg;
103 virtual ~command_t() {}
106 typedef nspace::hash_map<std::string,command_t*> command_table;