ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/commandtree.h
Revision: 1.1
Committed: Thu Jul 19 08:24:50 2007 UTC (16 years, 10 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Log Message:
initial import. the most important changes since Atheme are:
- fixed many memory leaks
- fixed many bugs
- converted to C++ and use more STL containers
- added a (not very enhanced yet) perl module
- greatly improved XML-RPC speed
- added a JSON-RPC module with code from json-cpp
- added a valgrind memcheck module to operserv
- added a more object oriented base64 implementation
- added a specialised unit test framework
- improved stability
- use gettimeofday() if available
- reworked adding/removing commands
- MemoServ IGNORE DEL can now remove indices

File Contents

# Content
1 /*
2 * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
3 * Copyright © 2005 William Pitcock, et al.
4 * Rights to this code are as documented in doc/LICENSE.
5 *
6 * Commandlist manipulation routines.
7 *
8 * $Id: commandtree.h,v 1.1 2007-07-11 11:04:40 pippijn Exp $
9 */
10
11 #ifndef COMMANDLIST_H
12 #define COMMANDLIST_H
13
14 #include <vector>
15
16 #include <common/util.h>
17
18 struct command_t
19 {
20 char const * const name;
21 char const * const desc;
22 char const *access;
23 const int maxparc;
24 void (*cmd) (sourceinfo_t *, const int parc, char *parv[]);
25
26 void exec (service_t *svs, sourceinfo_t *si, int parc, char *parv[]) const;
27 };
28
29 E command_t null_cmd;
30
31 struct cmdvec : std::vector<command_t const *>
32 {
33 typedef cmdvec::iterator iterator;
34
35 command_t const *find (char const *command);
36 };
37
38 E cmdvec null_cmdvec;
39
40 /* struct for help command hash table */
41 struct helpentry_t : zero_initialised
42 {
43 char *name;
44 char const * const access;
45 char *file;
46 void (*func) (sourceinfo_t *si);
47 };
48
49 typedef std::vector<helpentry_t *> helpvec;
50
51 /* commandtree.c */
52 void operator << (cmdvec *commandlist, command_t const &cmd);
53 void operator << (cmdvec &commandlist, command_t const *cmd[]);
54 void operator >> (cmdvec *commandlist, command_t const &cmd);
55 void operator >> (cmdvec &commandlist, command_t const *cmd[]);
56 E void command_exec_split (service_t *svs, sourceinfo_t *si, char *cmd, char *text, cmdvec *commandlist);
57 E void command_help (sourceinfo_t *si, cmdvec *commandlist);
58 E void command_help_short (sourceinfo_t *si, cmdvec *commandlist, char *maincmds);
59
60 /* help.c */
61 E void help_display (sourceinfo_t *si, char *command, helpvec *list);
62 E void help_addentry (helpvec *list, char *topic, char *fname, void (*func) (sourceinfo_t *si));
63 E void help_delentry (helpvec *list, char *name);
64
65 #endif