ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/modules/operserv/modload.C
Revision: 1.5
Committed: Tue Aug 28 17:08:11 2007 UTC (19 years, 1 month ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.4: +33 -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 pippijn 1.5 * Copyright © 2005-2006 William Pitcock, et al.
3 pippijn 1.2 * Rights to this code are as documented in doc/pod/license.pod.
4 pippijn 1.1 *
5     * Loads a new module in.
6     *
7 pippijn 1.5 * $Id: modload.C,v 1.4 2007-07-22 18:38:43 pippijn Exp $
8 pippijn 1.1 */
9    
10     #include "atheme.h"
11 pippijn 1.5 #include <ermyth/module.h>
12 pippijn 1.1
13 pippijn 1.5 static char const rcsid[] = "$Id: modload.C,v 1.4 2007-07-22 18:38:43 pippijn Exp $";
14 pippijn 1.1
15 pippijn 1.5 REGISTER_MODULE ("operserv/modload", false, "The Ermyth Team <http://ermyth.schmorp.de>");
16 pippijn 1.1
17     static void os_cmd_modload (sourceinfo_t *si, int parc, char *parv[]);
18    
19 pippijn 1.5 command_t const os_modload = { "MODLOAD", N_("Loads a module."), PRIV_ADMIN, 20, os_cmd_modload };
20 pippijn 1.1
21 pippijn 1.5 E cmdvec os_cmdtree;
22     E helpvec os_helptree;
23 pippijn 1.1
24 pippijn 1.5 bool
25     _modinit (module *m)
26 pippijn 1.1 {
27     os_cmdtree << os_modload;
28 pippijn 1.4 help_addentry (os_helptree, "MODLOAD", "help/operserv/modload", NULL);
29 pippijn 1.5
30     return true;
31 pippijn 1.1 }
32    
33     void
34     _moddeinit ()
35     {
36     os_cmdtree >> os_modload;
37     help_delentry (os_helptree, "MODLOAD");
38     }
39    
40     static void
41     os_cmd_modload (sourceinfo_t *si, int parc, char *parv[])
42     {
43 pippijn 1.5 char *modname;
44 pippijn 1.1 int i;
45    
46     if (parc < 1)
47     {
48     command_fail (si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "MODLOAD");
49     command_fail (si, fault_needmoreparams, _("Syntax: MODLOAD <module...>"));
50     return;
51     }
52     i = 0;
53     while (i < parc)
54     {
55 pippijn 1.5 modname = parv[i++];
56    
57     logcommand (si, CMDLOG_ADMIN, "MODLOAD %s", modname);
58     faultcode_t success = modules::enable (modname);
59    
60     switch (success)
61     {
62     case fault_nosuch_target:
63     command_fail (si, fault_nosuch_target, _("\2%s\2 does not exist."), modname);
64     continue;
65     case fault_nochange:
66     command_fail (si, fault_nochange, _("\2%s\2 is already loaded."), modname);
67     continue;
68     case fault_ok:
69     command_success_nodata (si, _("Module \2%s\2 loaded."), modname);
70     continue;
71     default:
72     command_fail (si, fault_nosuch_target, _("Module \2%s\2 failed to load."), modname);
73     continue;
74     }
75 pippijn 1.1 }
76     }