| 1 |
pippijn |
1.1 |
/* |
| 2 |
|
|
* Copyright © 2003-2004 E. Will et al. |
| 3 |
|
|
* Copyright © 2005-2006 Atheme Development Group |
| 4 |
pippijn |
1.2 |
* Rights to this code are documented in doc/pod/license.pod. |
| 5 |
pippijn |
1.1 |
* |
| 6 |
|
|
* This file contains routines to handle the OService HELP command. |
| 7 |
|
|
* |
| 8 |
pippijn |
1.2 |
* $Id: help.C,v 1.1 2007-07-19 08:24:55 pippijn Exp $ |
| 9 |
pippijn |
1.1 |
*/ |
| 10 |
|
|
|
| 11 |
|
|
#include "atheme.h" |
| 12 |
|
|
|
| 13 |
|
|
static char const rcsid[] = "$Id"; |
| 14 |
|
|
|
| 15 |
|
|
struct os_help_listeners : callback::has_listeners |
| 16 |
|
|
{ |
| 17 |
|
|
}; |
| 18 |
|
|
|
| 19 |
|
|
os_help_listeners listeners; |
| 20 |
|
|
|
| 21 |
|
|
DECLARE_MODULE_V1 ("operserv/help", false, _modinit, _moddeinit, rcsid, "The Ermyth Team <http://ermyth.schmorp.de>"); |
| 22 |
|
|
|
| 23 |
|
|
static void os_cmd_help (sourceinfo_t *si, int parc, char *parv[]); |
| 24 |
|
|
|
| 25 |
|
|
command_t os_help = { "HELP", N_("Displays contextual help information."), AC_NONE, 1, |
| 26 |
|
|
os_cmd_help |
| 27 |
|
|
}; |
| 28 |
|
|
|
| 29 |
|
|
cmdvec *os_cmdtree; |
| 30 |
|
|
helpvec *os_helptree; |
| 31 |
|
|
|
| 32 |
|
|
void |
| 33 |
|
|
_modinit (module_t *m) |
| 34 |
|
|
{ |
| 35 |
|
|
MODULE_USE_SYMBOL_T (os_cmdtree, cmdvec, "operserv/main", "os_cmdtree"); |
| 36 |
|
|
MODULE_USE_SYMBOL_T (os_helptree, helpvec, "operserv/main", "os_helptree"); |
| 37 |
|
|
|
| 38 |
|
|
os_cmdtree << os_help; |
| 39 |
|
|
help_addentry (os_helptree, "HELP", "help/help", NULL); |
| 40 |
|
|
} |
| 41 |
|
|
|
| 42 |
|
|
void |
| 43 |
|
|
_moddeinit () |
| 44 |
|
|
{ |
| 45 |
|
|
os_cmdtree >> os_help; |
| 46 |
|
|
help_delentry (os_helptree, "HELP"); |
| 47 |
|
|
} |
| 48 |
|
|
|
| 49 |
|
|
/* HELP <command> [params] */ |
| 50 |
|
|
static void |
| 51 |
|
|
os_cmd_help (sourceinfo_t *si, int parc, char *parv[]) |
| 52 |
|
|
{ |
| 53 |
|
|
char *command = parv[0]; |
| 54 |
|
|
|
| 55 |
|
|
if (!has_any_privs (si)) |
| 56 |
|
|
{ |
| 57 |
|
|
command_fail (si, fault_noprivs, _("You are not authorized to use %s."), opersvs.nick); |
| 58 |
|
|
return; |
| 59 |
|
|
} |
| 60 |
|
|
|
| 61 |
|
|
if (!command) |
| 62 |
|
|
{ |
| 63 |
|
|
command_success_nodata (si, _("***** \2%s Help\2 *****"), opersvs.nick); |
| 64 |
|
|
command_success_nodata (si, _("\2%s\2 provides essential network management services, such as"), opersvs.nick); |
| 65 |
|
|
command_success_nodata (si, _("routing manipulation and access restriction. Please do not abuse")); |
| 66 |
|
|
command_success_nodata (si, _("your access to \2%s\2!"), opersvs.nick); |
| 67 |
|
|
command_success_nodata (si, " "); |
| 68 |
|
|
command_success_nodata (si, _("For information on a command, type:")); |
| 69 |
|
|
command_success_nodata (si, "\2/%s%s help <command>\2", (ircd->uses_rcommand == false) ? "msg " : "", opersvs.disp); |
| 70 |
|
|
command_success_nodata (si, " "); |
| 71 |
|
|
|
| 72 |
|
|
command_help (si, os_cmdtree); |
| 73 |
|
|
|
| 74 |
|
|
command_success_nodata (si, _("***** \2End of Help\2 *****"), opersvs.nick); |
| 75 |
|
|
return; |
| 76 |
|
|
} |
| 77 |
|
|
|
| 78 |
|
|
/* take the command through the hash table */ |
| 79 |
|
|
help_display (si, command, os_helptree); |
| 80 |
|
|
} |
| 81 |
|
|
|
| 82 |
|
|
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs |
| 83 |
|
|
* vim:ts=8 |
| 84 |
|
|
* vim:sw=8 |
| 85 |
|
|
* vim:noexpandtab |
| 86 |
|
|
*/ |