Debian Codegraph @

modules/statserv/main.c

raw
1 /*
2 * Copyright (c) 2011 Alexandria Wolcott
3 * Rights to this code are documented in doc/LICENSE.
4 *
5 * This file contains the body of StatServ.
6 *
7 */
8
9 #include "atheme.h"
10
11 DECLARE_MODULE_V1
12 ("statserv/main", false, _modinit, _moddeinit,
13 PACKAGE_STRING, "Alexandria Wolcott <[email protected]>");
14
15 service_t *statsvs;
16
17 static void ss_cmd_help(sourceinfo_t * si, int parc, char *parv[]);
18
19 command_t ss_help =
20 { "HELP", N_("Displays contextual help information."), AC_NONE, 2, ss_cmd_help, {.path = "help"}
21 };
22
23 void _modinit(module_t * m)
24 {
25 statsvs = service_add("statserv", NULL);
26 service_named_bind_command("statserv", &ss_help);
27 }
28
29 void _moddeinit(module_unload_intent_t intent)
30 {
31 service_named_unbind_command("statserv", &ss_help);
32 if (statsvs != NULL)
33 service_delete(statsvs);
34 }
35
36 void ss_cmd_help(sourceinfo_t * si, int parc, char *parv[])
37 {
38 char *command = parv[0];
39
40 if (!command)
41 {
42 command_success_nodata(si, _("***** \2%s Help\2 *****"), si->service->nick);
43 command_success_nodata(si, _("\2%s\2 records various network statistics."),
44 si->service->nick);
45 command_success_nodata(si, " ");
46 command_success_nodata(si, _("For more information on a command, type:"));
47 command_success_nodata(si, "\2/%s%s help <command>\2",
48 (ircd->uses_rcommand == false) ? "msg " : "",
49 si->service->disp);
50 command_success_nodata(si, " ");
51
52 command_help(si, si->service->commands);
53
54 command_success_nodata(si, _("***** \2End of Help\2 *****"));
55 return;
56 }
57
58 help_display(si, si->service, command, si->service->commands);
59 }
60
61 /* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
62 * vim:ts=8
63 * vim:sw=8
64 * vim:noexpandtab
65 */