| 1 |
/* |
| 2 |
* Copyright (c) 2005 William Pitcock, et al. |
| 3 |
* Rights to this code are documented in doc/LICENSE. |
| 4 |
* |
| 5 |
* This file contains routines to handle the NickServ HELP command. |
| 6 |
* |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "atheme.h" |
| 10 |
|
| 11 |
DECLARE_MODULE_V1 |
| 12 |
( |
| 13 |
"nickserv/help", false, _modinit, _moddeinit, |
| 14 |
PACKAGE_STRING, |
| 15 |
VENDOR_STRING |
| 16 |
); |
| 17 |
|
| 18 |
static void ns_cmd_help(sourceinfo_t *si, int parc, char *parv[]); |
| 19 |
|
| 20 |
command_t ns_help = { "HELP", N_("Displays contextual help information."), AC_NONE, 1, ns_cmd_help, { .path = "help" } }; |
| 21 |
|
| 22 |
void _modinit(module_t *m) |
| 23 |
{ |
| 24 |
service_named_bind_command("nickserv", &ns_help); |
| 25 |
} |
| 26 |
|
| 27 |
void _moddeinit(module_unload_intent_t intent) |
| 28 |
{ |
| 29 |
service_named_unbind_command("nickserv", &ns_help); |
| 30 |
} |
| 31 |
|
| 32 |
/* HELP <command> [params] */ |
| 33 |
void ns_cmd_help(sourceinfo_t *si, int parc, char *parv[]) |
| 34 |
{ |
| 35 |
char *command = parv[0]; |
| 36 |
|
| 37 |
if (!command) |
| 38 |
{ |
| 39 |
command_success_nodata(si, _("***** \2%s Help\2 *****"), nicksvs.nick); |
| 40 |
if (nicksvs.no_nick_ownership) |
| 41 |
{ |
| 42 |
command_success_nodata(si, _("\2%s\2 allows users to \2'register'\2 an account for use with \2%s\2."), nicksvs.nick, chansvs.nick); |
| 43 |
if (nicksvs.expiry > 0) |
| 44 |
{ |
| 45 |
command_success_nodata(si, _("If a registered account is not used by the owner for %d days,\n" |
| 46 |
"\2%s\2 will drop the account, allowing it to be reregistered."), |
| 47 |
(nicksvs.expiry / 86400), nicksvs.nick); |
| 48 |
} |
| 49 |
} |
| 50 |
else |
| 51 |
{ |
| 52 |
command_success_nodata(si, _("\2%s\2 allows users to \2'register'\2 a nickname, and stop\n" |
| 53 |
"others from using that nick. \2%s\2 allows the owner of a\n" |
| 54 |
"nickname to disconnect a user from the network that is using\n" |
| 55 |
"their nickname."), nicksvs.nick, nicksvs.nick); |
| 56 |
if (nicksvs.expiry > 0) |
| 57 |
{ |
| 58 |
command_success_nodata(si, _("If a registered nick is not used by the owner for %d days,\n" |
| 59 |
"\2%s\2 will drop the nickname, allowing it to be reregistered."), |
| 60 |
(nicksvs.expiry / 86400), nicksvs.nick); |
| 61 |
} |
| 62 |
} |
| 63 |
command_success_nodata(si, " "); |
| 64 |
command_success_nodata(si, _("For more information on a command, type:")); |
| 65 |
command_success_nodata(si, "\2/%s%s help <command>\2", (ircd->uses_rcommand == false) ? "msg " : "", nicksvs.me->disp); |
| 66 |
command_success_nodata(si, _("For a verbose listing of all commands, type:")); |
| 67 |
command_success_nodata(si, "\2/%s%s help commands\2", (ircd->uses_rcommand == false) ? "msg " : "", nicksvs.me->disp); |
| 68 |
command_success_nodata(si, " "); |
| 69 |
|
| 70 |
command_help_short(si, si->service->commands, "REGISTER IDENTIFY GHOST RELEASE INFO LISTCHANS SET GROUP UNGROUP FDROP FUNGROUP MARK FREEZE SENDPASS VHOST"); |
| 71 |
|
| 72 |
command_success_nodata(si, _("***** \2End of Help\2 *****")); |
| 73 |
|
| 74 |
/* Fun for helpchan/helpurl. */ |
| 75 |
if (config_options.helpchan && config_options.helpurl) |
| 76 |
command_success_nodata(si, _("If you're having trouble or you need some additional help, you may want to join the help channel %s or visit the help webpage %s"), |
| 77 |
config_options.helpchan, config_options.helpurl); |
| 78 |
else if (config_options.helpchan && !config_options.helpurl) |
| 79 |
command_success_nodata(si, _("If you're having trouble or you need some additional help, you may want to join the help channel %s"), config_options.helpchan); |
| 80 |
else if (!config_options.helpchan && config_options.helpurl) |
| 81 |
command_success_nodata(si, _("If you're having trouble or you need some additional help, you may want to visit the help webpage %s"), config_options.helpurl); |
| 82 |
|
| 83 |
return; |
| 84 |
} |
| 85 |
|
| 86 |
if (!strcasecmp("COMMANDS", command)) |
| 87 |
{ |
| 88 |
command_success_nodata(si, _("***** \2%s Help\2 *****"), nicksvs.nick); |
| 89 |
command_help(si, si->service->commands); |
| 90 |
command_success_nodata(si, _("***** \2End of Help\2 *****")); |
| 91 |
return; |
| 92 |
} |
| 93 |
|
| 94 |
/* take the command through the hash table */ |
| 95 |
help_display(si, si->service, command, si->service->commands); |
| 96 |
} |
| 97 |
|
| 98 |
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs |
| 99 |
* vim:ts=8 |
| 100 |
* vim:sw=8 |
| 101 |
* vim:noexpandtab |
| 102 |
*/ |