ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/src/pmodule.C
Revision: 1.6
Committed: Sun Sep 16 18:54:45 2007 UTC (16 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.5: +7 -2 lines
Log Message:
#defines to enum

File Contents

# Content
1 /*
2 * pmodule.C: Protocol command management.
3 *
4 * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
5 * Rights to this code are as documented in COPYING.
6 *
7 *
8 * Portions of this file were derived from sources bearing the following license:
9 * Rights to this code are documented in doc/pod/license.pod.
10 * Copyright © 2005-2007 Atheme Project (http://www.atheme.org)
11 */
12
13 static char const rcsid[] = "$Id: pmodule.C,v 1.5 2007-09-05 11:23:15 pippijn Exp $";
14
15 #include <map>
16
17 #include "atheme.h"
18 #include "pmodule.h"
19
20 typedef std::map<char const * const, pcommand_t const *, str_lt> pcommand_map;
21 pcommand_map pcommands;
22
23 cmode_t *mode_list;
24 extmode_t *ignore_mode_list;
25 cmode_t *status_mode_list;
26 cmode_t *prefix_mode_list;
27 protocol::ircd_t *ircd;
28 bool protocol::handler::loaded = false;
29
30 void
31 pcommand_add (pcommand_t const &pcmd)
32 {
33 if (pcommand_find (pcmd.token))
34 {
35 slog (LG_INFO, "pcommand_add(): token %s is already registered", pcmd.token);
36 return;
37 }
38
39 pcommands[pcmd.token] = &pcmd;
40 }
41
42 void
43 pcommand_delete (pcommand_t const &pcmd)
44 {
45 if (!pcommand_find (pcmd.token))
46 {
47 slog (LG_INFO, "pcommand_delete(): token %s is not registered", pcmd.token);
48 return;
49 }
50
51 pcommands.erase (pcmd.token);
52 }
53
54 pcommand_t const *
55 pcommand_find (char const * const token)
56 {
57 pcommand_map::iterator it;
58 if ((it = pcommands.find (token)) != pcommands.end ())
59 return it->second;
60 return NULL;
61 }