ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/src/pmodule.C
Revision: 1.4
Committed: Tue Aug 28 17:08:12 2007 UTC (19 years, 1 month ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.3: +23 -47 lines
Log Message:
- changed name
- updated the example config to the new system
- added more documentation
- enhanced documentation generators
- added a link to the pdf to the website
- added an RSS feed generator
- transitioned hooks to c++ callbacks
- did various merges with upstream along the way
- added const where appropriate
- removed the old block allocator
- fixed most memory leaks
- transitioned some dictionaries to std::map
- transitioned some lists to std::vector
- made some free functions members where appropriate
- renamed string to dynstr and added a static string ststr
- use NOW instead of time (NULL) if possible
- completely reworked database backends, crypto handlers and protocol handlers
  to use an object factory
- removed the old module system. ermyth does not do any dynamic loading anymore
- fixed most of the build system
- reworked how protocol commands work

File Contents

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