1 /*
2 * Copyright (c) 2005 Atheme Development Group
3 * Rights to this code are documented in doc/LICENSE.
4 *
5 * This file contains routines to handle the GameServ HELP command.
6 *
7 */
8
9 #include "atheme.h"
10
11 DECLARE_MODULE_V1
12 (
13 "gameserv/help", false, _modinit, _moddeinit,
14 PACKAGE_STRING,
15 VENDOR_STRING
16 );
17
18 static void gs_cmd_help(sourceinfo_t *si, int parc, char *parv[]);
19
20 command_t gs_help = { "HELP", N_("Displays contextual help information."), AC_NONE, 2, gs_cmd_help, { .path = "help" } };
21
_modinit(module_t * m)22 void _modinit(module_t *m)
23 {
24 service_named_bind_command("gameserv", &gs_help);
25 }
26
_moddeinit(module_unload_intent_t intent)27 void _moddeinit(module_unload_intent_t intent)
28 {
29 service_named_unbind_command("gameserv", &gs_help);
30 }
31
32 /* HELP <command> [params] */
gs_cmd_help(sourceinfo_t * si,int parc,char * parv[])33 void gs_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 *****"), si->service->nick);
40 command_success_nodata(si, _("\2%s\2 provides games and tools for playing games to the network."), si->service->nick);
41 command_success_nodata(si, " ");
42 command_success_nodata(si, _("For more information on a command, type:"));
43 command_success_nodata(si, "\2/%s%s help <command>\2", (ircd->uses_rcommand == false) ? "msg " : "", si->service->disp);
44 command_success_nodata(si, " ");
45
46 command_help(si, si->service->commands);
47
48 command_success_nodata(si, _("***** \2End of Help\2 *****"));
49 return;
50 }
51
52 /* take the command through the hash table */
53 help_display(si, si->service, command, si->service->commands);
54 }
55
56 /* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
57 * vim:ts=8
58 * vim:sw=8
59 * vim:noexpandtab
60 */
61