ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/modules/operserv/modlist.C
Revision: 1.7
Committed: Sat Sep 22 14:27:28 2007 UTC (19 years ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +3 -3 lines
Log Message:
split up ermyth into ermyth-modules, libermyth (currently just ermyth-util) and ermyth-core

File Contents

# User Rev Content
1 pippijn 1.6 /**
2     * modlist.C: Module listing.
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 pippijn 1.5 * Copyright © 2005-2006 William Pitcock, et al.
10 pippijn 1.2 * Rights to this code are as documented in doc/pod/license.pod.
11 pippijn 1.1 *
12 pippijn 1.7 * $Id: modlist.C,v 1.6 2007-09-16 18:54:44 pippijn Exp $
13 pippijn 1.1 */
14    
15 pippijn 1.5 #include <boost/foreach.hpp>
16    
17 pippijn 1.1 #include "atheme.h"
18 pippijn 1.5 #include <ermyth/module.h>
19 pippijn 1.1
20 pippijn 1.7 static char const rcsid[] = "$Id: modlist.C,v 1.6 2007-09-16 18:54:44 pippijn Exp $";
21 pippijn 1.1
22 pippijn 1.7 REGISTER_MODULE ("operserv/modlist", false, "The Ermyth Team <http://ermyth.xinutec.org>");
23 pippijn 1.1
24 pippijn 1.5 static void os_cmd_modlist (sourceinfo_t *si, int parc, char *parv[]);
25 pippijn 1.1
26 pippijn 1.5 command_t const os_modlist = { "MODLIST", N_("Lists loaded modules."), PRIV_SERVER_AUSPEX, 0, os_cmd_modlist };
27 pippijn 1.1
28 pippijn 1.5 E cmdvec os_cmdtree;
29     E helpvec os_helptree;
30 pippijn 1.1
31 pippijn 1.5 bool
32     _modinit (module *m)
33 pippijn 1.1 {
34     os_cmdtree << os_modlist;
35 pippijn 1.4 help_addentry (os_helptree, "MODLIST", "help/operserv/modlist", NULL);
36 pippijn 1.5
37     return true;
38 pippijn 1.1 }
39    
40     void
41     _moddeinit ()
42     {
43     os_cmdtree >> os_modlist;
44     help_delentry (os_helptree, "MODLIST");
45     }
46    
47     static void
48     os_cmd_modlist (sourceinfo_t *si, int parc, char *parv[])
49     {
50 pippijn 1.5 unsigned i = 0;
51 pippijn 1.1 command_success_nodata (si, _("Loaded modules:"));
52    
53 pippijn 1.5 foreach (module const * const m, modules::list ())
54     if (m->enabled)
55     command_success_nodata (si, _("%2d: %-20s"), ++i, m->name);
56 pippijn 1.1
57     command_success_nodata (si, _("\2%d\2 modules loaded."), i);
58     logcommand (si, CMDLOG_GET, "MODLIST");
59     }