]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/ctables.h
Split inspircd_io.* insp inspsocket.* and configreader.* with a few odd bits going...
[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 #include "inspircd_config.h"
21 #include "hash_map.h"
22
23 class userrec;
24
25 /*typedef void (handlerfunc) (char**, int, userrec*);*/
26
27 /** A structure that defines a command
28  */
29 class command_t
30 {
31  public:
32         /** Command name
33         */
34          std::string command;
35         /** User flags needed to execute the command or 0
36          */
37         char flags_needed;
38         /** Minimum number of parameters command takes
39         */
40         int min_params;
41         /** used by /stats m
42          */
43         long use_count;
44         /** used by /stats m
45          */
46         long total_bytes;
47         /** used for resource tracking between modules
48          */
49         std::string source;
50
51         command_t(const std::string &cmd, char flags, int minpara) : command(cmd), flags_needed(flags), min_params(minpara)
52         {
53                 use_count = total_bytes = 0;
54                 source = "<core>";
55         }
56
57         virtual void Handle(char** parameters, int pcnt, userrec* user) = 0;
58
59         virtual ~command_t() {}
60 };
61
62 typedef nspace::hash_map<std::string,command_t*> command_table;
63
64 #endif