]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/ctables.h
Remove dnsqueue
[user/henk/code/inspircd.git] / include / ctables.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16  
17 #ifndef __CTABLES_H__
18 #define __CTABLES_H__
19
20
21 #include "inspircd_config.h"
22 #include "hash_map.h"
23 #include "base.h"
24
25 class userrec;
26
27 /*typedef void (handlerfunc) (char**, int, userrec*);*/
28
29 /** A structure that defines a command
30  */
31 class command_t : public Extensible
32 {
33  public:
34         /** Command name
35         */
36          std::string command;
37         /** User flags needed to execute the command or 0
38          */
39         char flags_needed;
40         /** Minimum number of parameters command takes
41         */
42         int min_params;
43         /** used by /stats m
44          */
45         long use_count;
46         /** used by /stats m
47          */
48         long total_bytes;
49         /** used for resource tracking between modules
50          */
51         std::string source;
52         /** True if the command is disabled to non-opers
53          */
54         bool disabled;
55         /** Syntax string for the command, displayed if non-empty string.
56          * This takes place of the text in the 'not enough parameters' numeric.
57          */
58         std::string syntax;
59
60         command_t(const std::string &cmd, char flags, int minpara) : command(cmd), flags_needed(flags), min_params(minpara), disabled(false)
61         {
62                 use_count = total_bytes = 0;
63                 source = "<core>";
64                 syntax = "";
65         }
66
67         virtual void Handle(const char** parameters, int pcnt, userrec* user) = 0;
68
69         void Disable(bool setting)
70         {
71                 disabled = setting;
72         }
73
74         bool IsDisabled()
75         {
76                 return disabled;
77         }
78
79         virtual ~command_t() {}
80 };
81
82 typedef nspace::hash_map<std::string,command_t*> command_table;
83
84 #endif