Debian Codegraph @

modules/helpserv/main.c

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