ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/modules/nickserv/help.C
Revision: 1.7
Committed: Sat Sep 22 14:27:27 2007 UTC (19 years ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +3 -3 lines
Log Message:
split up ermyth into ermyth-modules, libermyth (currently just ermyth-util) and ermyth-core

File Contents

# User Rev Content
1 pippijn 1.6 /**
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 pippijn 1.5 * Copyright © 2005 William Pitcock, et al.
10 pippijn 1.2 * Rights to this code are documented in doc/pod/license.pod.
11 pippijn 1.1 *
12 pippijn 1.7 * $Id: help.C,v 1.6 2007-09-16 18:54:43 pippijn Exp $
13 pippijn 1.1 */
14    
15     #include "atheme.h"
16 pippijn 1.5 #include <ermyth/module.h>
17 pippijn 1.1
18 pippijn 1.7 static char const rcsid[] = "$Id: help.C,v 1.6 2007-09-16 18:54:43 pippijn Exp $";
19 pippijn 1.1
20 pippijn 1.7 REGISTER_MODULE ("nickserv/help", false, "The Ermyth Team <http://ermyth.xinutec.org>");
21 pippijn 1.1
22 pippijn 1.5 E cmdvec ns_cmdtree;
23     E helpvec ns_helptree;
24 pippijn 1.1
25     static void ns_cmd_help (sourceinfo_t *si, int parc, char *parv[]);
26    
27 pippijn 1.5 command_t const ns_help = { "HELP", N_("Displays contextual help information."), AC_NONE, 1, ns_cmd_help };
28 pippijn 1.1
29 pippijn 1.5 bool
30     _modinit (module *m)
31 pippijn 1.1 {
32     ns_cmdtree << ns_help;
33 pippijn 1.4 help_addentry (ns_helptree, "HELP", "help/nickserv/help", NULL);
34 pippijn 1.5
35     return true;
36 pippijn 1.1 }
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     }