ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/src/pmodule.C
Revision: 1.5
Committed: Wed Sep 5 11:23:15 2007 UTC (16 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.4: +2 -2 lines
Log Message:
removed GPLed code and put license back to BSD

File Contents

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