1 |
/** |
2 |
* help.C: This file contains routines to handle the NickServ 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 William Pitcock, et al. |
10 |
* Rights to this code are documented in doc/pod/license.pod. |
11 |
* |
12 |
* $Id: help.C,v 1.6 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.6 2007-09-16 18:54:43 pippijn Exp $"; |
19 |
|
20 |
REGISTER_MODULE ("nickserv/help", false, "The Ermyth Team <http://ermyth.xinutec.org>"); |
21 |
|
22 |
E cmdvec ns_cmdtree; |
23 |
E helpvec ns_helptree; |
24 |
|
25 |
static void ns_cmd_help (sourceinfo_t *si, int parc, char *parv[]); |
26 |
|
27 |
command_t const ns_help = { "HELP", N_("Displays contextual help information."), AC_NONE, 1, ns_cmd_help }; |
28 |
|
29 |
bool |
30 |
_modinit (module *m) |
31 |
{ |
32 |
ns_cmdtree << ns_help; |
33 |
help_addentry (ns_helptree, "HELP", "help/nickserv/help", NULL); |
34 |
|
35 |
return true; |
36 |
} |
37 |
|
38 |
void |
39 |
_moddeinit () |
40 |
{ |
41 |
ns_cmdtree >> ns_help; |
42 |
help_delentry (ns_helptree, "HELP"); |
43 |
} |
44 |
|
45 |
/* HELP <command> [params] */ |
46 |
void |
47 |
ns_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 *****"), nicksvs.nick); |
54 |
if (nicksvs.no_nick_ownership) |
55 |
{ |
56 |
command_success_nodata (si, _("\2%s\2 allows users to \2'register'\2 an account for use with"), nicksvs.nick); |
57 |
command_success_nodata (si, _("\2%s\2. If a registered account is not used by the owner for %d days,"), chansvs.nick, (nicksvs.expiry / 86400)); |
58 |
command_success_nodata (si, _("\2%s\2 will drop the account, allowing it to be reregistered."), nicksvs.nick); |
59 |
} |
60 |
else |
61 |
{ |
62 |
command_success_nodata (si, _("\2%s\2 allows users to \2'register'\2 a nickname, and stop"), nicksvs.nick); |
63 |
command_success_nodata (si, _("others from using that nick. \2%s\2 allows the owner of a"), nicksvs.nick); |
64 |
command_success_nodata (si, _("nickname to disconnect a user from the network that is using"), nicksvs.nick); |
65 |
command_success_nodata (si, _("their nickname. If a registered nick is not used by the owner for %d days,"), (nicksvs.expiry / 86400)); |
66 |
command_success_nodata (si, _("\2%s\2 will drop the nickname, allowing it to be reregistered."), nicksvs.nick); |
67 |
} |
68 |
command_success_nodata (si, " "); |
69 |
command_success_nodata (si, _("For more information on a command, type:")); |
70 |
command_success_nodata (si, "\2/%s%s help <command>\2", (ircd->uses_rcommand == false) ? "msg " : "", nicksvs.disp); |
71 |
command_success_nodata (si, " "); |
72 |
|
73 |
command_help_short (si, ns_cmdtree, "REGISTER IDENTIFY GHOST RELEASE INFO LISTCHANS SET GROUP UNGROUP MARK FREEZE SENDPASS"); |
74 |
|
75 |
command_success_nodata (si, _("***** \2End of Help\2 *****")); |
76 |
return; |
77 |
} |
78 |
|
79 |
if (!strcasecmp ("COMMANDS", command)) |
80 |
{ |
81 |
command_success_nodata (si, _("***** \2%s Help\2 *****"), nicksvs.nick); |
82 |
command_help (si, ns_cmdtree); |
83 |
command_success_nodata (si, _("***** \2End of Help\2 *****")); |
84 |
return; |
85 |
} |
86 |
|
87 |
/* take the command through the hash table */ |
88 |
help_display (si, command, ns_helptree); |
89 |
} |