| 1 |
/* |
| 2 |
* Copyright (c) 2005-2006 William Pitcock, et al. |
| 3 |
* Rights to this code are as documented in doc/LICENSE. |
| 4 |
* |
| 5 |
* Module listing. |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "atheme.h" |
| 10 |
|
| 11 |
DECLARE_MODULE_V1 |
| 12 |
( |
| 13 |
"operserv/modlist", false, _modinit, _moddeinit, |
| 14 |
PACKAGE_STRING, |
| 15 |
VENDOR_STRING |
| 16 |
); |
| 17 |
|
| 18 |
static void os_cmd_modlist(sourceinfo_t *si, int parc, char *parv[]); |
| 19 |
|
| 20 |
command_t os_modlist = { "MODLIST", N_("Lists loaded modules."), PRIV_SERVER_AUSPEX, 0, os_cmd_modlist, { .path = "oservice/modlist" } }; |
| 21 |
|
| 22 |
extern mowgli_list_t modules; |
| 23 |
|
| 24 |
void _modinit(module_t *m) |
| 25 |
{ |
| 26 |
service_named_bind_command("operserv", &os_modlist); |
| 27 |
} |
| 28 |
|
| 29 |
void _moddeinit(module_unload_intent_t intent) |
| 30 |
{ |
| 31 |
service_named_unbind_command("operserv", &os_modlist); |
| 32 |
} |
| 33 |
|
| 34 |
static void os_cmd_modlist(sourceinfo_t *si, int parc, char *parv[]) |
| 35 |
{ |
| 36 |
mowgli_node_t *n; |
| 37 |
unsigned int i = 0; |
| 38 |
command_success_nodata(si, _("Loaded modules:")); |
| 39 |
|
| 40 |
MOWGLI_ITER_FOREACH(n, modules.head) |
| 41 |
{ |
| 42 |
module_t *m = n->data; |
| 43 |
|
| 44 |
command_success_nodata(si, _("%2d: %-20s [loaded at 0x%lx]"), |
| 45 |
++i, m->name, (unsigned long)m->address); |
| 46 |
} |
| 47 |
|
| 48 |
command_success_nodata(si, _("\2%d\2 modules loaded."), i); |
| 49 |
logcommand(si, CMDLOG_GET, "MODLIST"); |
| 50 |
} |
| 51 |
|
| 52 |
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs |
| 53 |
* vim:ts=8 |
| 54 |
* vim:sw=8 |
| 55 |
* vim:noexpandtab |
| 56 |
*/ |