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 (19 years ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.5: +7 -2 lines
Log Message:
#defines to enum

File Contents

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