| 1 |
/** |
| 2 |
* help.C: This file contains routines to handle the ChanServ 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 © 2003-2004 E. Will 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:42 pippijn Exp $ |
| 13 |
*/ |
| 14 |
|
| 15 |
#include "atheme.h" |
| 16 |
#include <ermyth/module.h> |
| 17 |
#include <account/chanacs.h> |
| 18 |
|
| 19 |
static char const rcsid[] = "$Id: help.C,v 1.6 2007-09-16 18:54:42 pippijn Exp $"; |
| 20 |
|
| 21 |
REGISTER_MODULE ("chanserv/help", false, "The Ermyth Team <http://ermyth.xinutec.org>"); |
| 22 |
|
| 23 |
static void cs_cmd_help (sourceinfo_t *si, int parc, char *parv[]); |
| 24 |
|
| 25 |
command_t const cs_help = { "HELP", N_("Displays contextual help information."), AC_NONE, 1, cs_cmd_help }; |
| 26 |
|
| 27 |
E cmdvec cs_cmdtree; |
| 28 |
E helpvec cs_helptree; |
| 29 |
|
| 30 |
bool |
| 31 |
_modinit (module *m) |
| 32 |
{ |
| 33 |
cs_cmdtree << cs_help; |
| 34 |
help_addentry (cs_helptree, "HELP", "help/chanserv/help", NULL); |
| 35 |
|
| 36 |
return true; |
| 37 |
} |
| 38 |
|
| 39 |
void |
| 40 |
_moddeinit () |
| 41 |
{ |
| 42 |
cs_cmdtree >> cs_help; |
| 43 |
help_delentry (cs_helptree, "HELP"); |
| 44 |
} |
| 45 |
|
| 46 |
/* HELP <command> [params] */ |
| 47 |
static void |
| 48 |
cs_cmd_help (sourceinfo_t *si, int parc, char *parv[]) |
| 49 |
{ |
| 50 |
char *command = parv[0]; |
| 51 |
|
| 52 |
/* strip off channel name for fantasy commands */ |
| 53 |
if (si->c) |
| 54 |
{ |
| 55 |
command = strchr (command, ' '); |
| 56 |
if (command != NULL) |
| 57 |
command++; |
| 58 |
} |
| 59 |
|
| 60 |
if (!command) |
| 61 |
{ |
| 62 |
command_success_nodata (si, _("***** \2%s Help\2 *****"), chansvs.nick); |
| 63 |
command_success_nodata (si, _("\2%s\2 gives normal users the ability to maintain control"), chansvs.nick); |
| 64 |
command_success_nodata (si, _("of a channel, without the need of a bot. Channel takeovers are")); |
| 65 |
command_success_nodata (si, _("virtually impossible when a channel is registered with \2%s\2."), chansvs.nick); |
| 66 |
command_success_nodata (si, _("Registration is a quick and painless process. Once registered,")); |
| 67 |
command_success_nodata (si, _("the founder can maintain complete and total control over the channel.")); |
| 68 |
if (chansvs.expiry > 0) |
| 69 |
{ |
| 70 |
command_success_nodata (si, _("Please note that channels will expire after %d days of inactivity,"), (chansvs.expiry / 86400)); |
| 71 |
command_success_nodata (si, _("or if there are no eligible channel successors.")); |
| 72 |
command_success_nodata (si, _("Activity is defined as a user with one of %s being on the channel."), bitmask_to_flags2 (CA_USEDUPDATE & ca_all, 0, chanacs_flags)); |
| 73 |
} |
| 74 |
else |
| 75 |
{ |
| 76 |
command_success_nodata (si, _("Please note that channels will expire if there are no eligible channel successors.")); |
| 77 |
} |
| 78 |
command_success_nodata (si, _("Successors are primarily those who have the +R flag")); |
| 79 |
command_success_nodata (si, _("set on their account in the channel, although other")); |
| 80 |
command_success_nodata (si, _("people may be chosen depending on their access")); |
| 81 |
command_success_nodata (si, _("level and activity.")); |
| 82 |
command_success_nodata (si, " "); |
| 83 |
if (chansvs.fantasy && config_options.join_chans && chansvs.trigger != '\0') |
| 84 |
{ |
| 85 |
command_success_nodata (si, _("Commands can also be given on channel by prefixing one of '%s'"), chansvs.trigger); |
| 86 |
command_success_nodata (si, _("and omitting the channel name. These are called \"fantasy\"")); |
| 87 |
command_success_nodata (si, _("commands and can also be disabled on a per-channel basis.")); |
| 88 |
command_success_nodata (si, " "); |
| 89 |
} |
| 90 |
command_success_nodata (si, _("For more information on a command, type:")); |
| 91 |
command_success_nodata (si, "\2/%s%s help <command>\2", (ircd->uses_rcommand == false) ? "msg " : "", chansvs.disp); |
| 92 |
command_success_nodata (si, " "); |
| 93 |
command_success_nodata (si, _("For a verbose listing of all commands, type:")); |
| 94 |
command_success_nodata (si, "\2/%s%s help commands\2", (ircd->uses_rcommand == false) ? "msg " : "", chansvs.disp); |
| 95 |
command_success_nodata (si, " "); |
| 96 |
|
| 97 |
command_help_short (si, cs_cmdtree, "REGISTER OP INVITE UNBAN FLAGS RECOVER SET"); |
| 98 |
|
| 99 |
command_success_nodata (si, _("***** \2End of Help\2 *****")); |
| 100 |
return; |
| 101 |
} |
| 102 |
|
| 103 |
if (!strcasecmp ("COMMANDS", command)) |
| 104 |
{ |
| 105 |
command_success_nodata (si, _("***** \2%s Help\2 *****"), chansvs.nick); |
| 106 |
command_help (si, cs_cmdtree); |
| 107 |
command_success_nodata (si, _("***** \2End of Help\2 *****")); |
| 108 |
return; |
| 109 |
} |
| 110 |
|
| 111 |
help_display (si, command, cs_helptree); |
| 112 |
} |