1 |
/** |
2 |
* help.C: This file contains routines to handle the MemoServ HELP command. |
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 |
* Copyright © 2005 Atheme Development Group |
10 |
* Rights to this code are documented in doc/pod/license.pod. |
11 |
* |
12 |
* $Id: help.C,v 1.5 2007-09-16 18:54:43 pippijn Exp $ |
13 |
*/ |
14 |
|
15 |
#include "atheme.h" |
16 |
#include <ermyth/module.h> |
17 |
|
18 |
static char const rcsid[] = "$Id: help.C,v 1.5 2007-09-16 18:54:43 pippijn Exp $"; |
19 |
|
20 |
REGISTER_MODULE ("memoserv/help", false, "The Ermyth Team <http://ermyth.xinutec.org>"); |
21 |
|
22 |
E cmdvec ms_cmdtree; |
23 |
E helpvec ms_helptree; |
24 |
|
25 |
static void ms_cmd_help (sourceinfo_t *si, int parc, char *parv[]); |
26 |
|
27 |
command_t const ms_help = { "HELP", N_(N_("Displays contextual help information.")), AC_NONE, 2, ms_cmd_help }; |
28 |
|
29 |
bool |
30 |
_modinit (module *m) |
31 |
{ |
32 |
ms_cmdtree << ms_help; |
33 |
help_addentry (ms_helptree, "HELP", "help/help", NULL); |
34 |
|
35 |
return true; |
36 |
} |
37 |
|
38 |
void |
39 |
_moddeinit () |
40 |
{ |
41 |
ms_cmdtree >> ms_help; |
42 |
help_delentry (ms_helptree, "HELP"); |
43 |
} |
44 |
|
45 |
/* HELP <command> [params] */ |
46 |
void |
47 |
ms_cmd_help (sourceinfo_t *si, int parc, char *parv[]) |
48 |
{ |
49 |
char *command = parv[0]; |
50 |
|
51 |
if (!command) |
52 |
{ |
53 |
command_success_nodata (si, _("***** \2%s Help\2 *****"), memosvs.nick); |
54 |
command_success_nodata (si, _("\2%s\2 allows users to send memos to registered users."), memosvs.nick); |
55 |
command_success_nodata (si, " "); |
56 |
command_success_nodata (si, _("For more information on a command, type:")); |
57 |
command_success_nodata (si, "\2/%s%s help <command>\2", (ircd->uses_rcommand == false) ? "msg " : "", memosvs.disp); |
58 |
command_success_nodata (si, " "); |
59 |
|
60 |
command_help (si, ms_cmdtree); |
61 |
|
62 |
command_success_nodata (si, _("***** \2End of Help\2 *****")); |
63 |
return; |
64 |
} |
65 |
|
66 |
if (!strcasecmp ("COMMANDS", command)) |
67 |
{ |
68 |
command_success_nodata (si, _("***** \2%s Help\2 *****"), nicksvs.nick); |
69 |
command_help (si, ms_cmdtree); |
70 |
command_success_nodata (si, _("***** \2End of Help\2 *****")); |
71 |
return; |
72 |
} |
73 |
|
74 |
/* take the command through the hash table */ |
75 |
help_display (si, command, ms_helptree); |
76 |
} |