| 1 |
/* |
| 2 |
* Copyright (c) 2003-2004 E. Will et al. |
| 3 |
* Copyright (c) 2005-2006 Atheme Development Group |
| 4 |
* Rights to this code are documented in doc/LICENSE. |
| 5 |
* |
| 6 |
* This file contains routines to handle the OService HELP command. |
| 7 |
* |
| 8 |
*/ |
| 9 |
|
| 10 |
#include "atheme.h" |
| 11 |
|
| 12 |
DECLARE_MODULE_V1 |
| 13 |
( |
| 14 |
"operserv/help", false, _modinit, _moddeinit, |
| 15 |
PACKAGE_STRING, |
| 16 |
VENDOR_STRING |
| 17 |
); |
| 18 |
|
| 19 |
static void os_cmd_help(sourceinfo_t *si, int parc, char *parv[]); |
| 20 |
|
| 21 |
command_t os_help = { "HELP", N_("Displays contextual help information."), AC_NONE, 1, os_cmd_help, { .path = "help" } }; |
| 22 |
|
| 23 |
void _modinit(module_t *m) |
| 24 |
{ |
| 25 |
service_named_bind_command("operserv", &os_help); |
| 26 |
} |
| 27 |
|
| 28 |
void _moddeinit(module_unload_intent_t intent) |
| 29 |
{ |
| 30 |
service_named_unbind_command("operserv", &os_help); |
| 31 |
} |
| 32 |
|
| 33 |
/* HELP <command> [params] */ |
| 34 |
static void os_cmd_help(sourceinfo_t *si, int parc, char *parv[]) |
| 35 |
{ |
| 36 |
char *command = parv[0]; |
| 37 |
|
| 38 |
if (!has_any_privs(si)) |
| 39 |
{ |
| 40 |
command_fail(si, fault_noprivs, _("You are not authorized to use %s."), si->service->nick); |
| 41 |
return; |
| 42 |
} |
| 43 |
|
| 44 |
if (!command) |
| 45 |
{ |
| 46 |
command_success_nodata(si, _("***** \2%s Help\2 *****"), si->service->nick); |
| 47 |
command_success_nodata(si, _("\2%s\2 provides essential network management services, such as\n" |
| 48 |
"routing manipulation and access restriction. Please do not abuse\n" |
| 49 |
"your access to \2%s\2!"), |
| 50 |
si->service->nick, si->service->nick); |
| 51 |
command_success_nodata(si, " "); |
| 52 |
command_success_nodata(si, _("For information on a command, type:")); |
| 53 |
command_success_nodata(si, "\2/%s%s help <command>\2", (ircd->uses_rcommand == false) ? "msg " : "", si->service->disp); |
| 54 |
command_success_nodata(si, " "); |
| 55 |
|
| 56 |
command_help(si, si->service->commands); |
| 57 |
|
| 58 |
command_success_nodata(si, _("***** \2End of Help\2 *****")); |
| 59 |
return; |
| 60 |
} |
| 61 |
|
| 62 |
/* take the command through the hash table */ |
| 63 |
help_display(si, si->service, command, si->service->commands); |
| 64 |
} |
| 65 |
|
| 66 |
/* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs |
| 67 |
* vim:ts=8 |
| 68 |
* vim:sw=8 |
| 69 |
* vim:noexpandtab |
| 70 |
*/ |