-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.c
68 lines (52 loc) · 1.93 KB
/
help.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* syn: a utility bot to manage IRC network access
* Copyright (C) 2009-2016 Stephen Bennett
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "atheme.h"
#include "syn.h"
DECLARE_MODULE_V1
(
"syn/help", false, _modinit, _moddeinit,
"$Revision$",
"Stephen Bennett <stephen -at- freenode.net>"
);
static void syn_cmd_help(sourceinfo_t *si, int parc, char *parv[]);
command_t syn_help = { "HELP", N_("Displays contextual help information."), "syn:general", 1, syn_cmd_help };
void _modinit(module_t *m)
{
use_syn_main_symbols(m);
service_named_bind_command("syn", &syn_help);
}
void _moddeinit(module_unload_intent_t intent)
{
service_named_unbind_command("syn", &syn_help);
}
/* HELP <command> [params] */
void syn_cmd_help(sourceinfo_t *si, int parc, char *parv[])
{
char *command = parv[0];
if (!command)
{
command_success_nodata(si, "***** \2%s Help\2 *****", syn->nick);
command_success_nodata(si, "\2%s\2 is a utility service to control access to the network.", syn->nick);
command_success_nodata(si, " ");
command_help(si, syn->commands);
command_success_nodata(si, _("***** \2End of Help\2 *****"));
return;
}
/* take the command through the hash table */
help_display(si, syn, command, syn->commands);
}