Debian Codegraph @

modules/chanserv/help.c

raw
1 /*
2 * Copyright (c) 2003-2004 E. Will et al.
3 * Rights to this code are documented in doc/LICENSE.
4 *
5 * This file contains routines to handle the CService HELP command.
6 *
7 */
8
9 #include "atheme.h"
10
11 DECLARE_MODULE_V1
12 (
13 "chanserv/help", false, _modinit, _moddeinit,
14 PACKAGE_STRING,
15 VENDOR_STRING
16 );
17
18 static void cs_cmd_help(sourceinfo_t *si, int parc, char *parv[]);
19
20 command_t cs_help = { "HELP", N_("Displays contextual help information."),
21 AC_NONE, 1, cs_cmd_help, { .path = "help" } };
22
23 void _modinit(module_t *m)
24 {
25 service_named_bind_command("chanserv", &cs_help);
26 }
27
28 void _moddeinit(module_unload_intent_t intent)
29 {
30 service_named_unbind_command("chanserv", &cs_help);
31 }
32
33 /* HELP <command> [params] */
34 static void cs_cmd_help(sourceinfo_t *si, int parc, char *parv[])
35 {
36 char *command = parv[0];
37
38 /* strip off channel name for fantasy commands */
39 if (si->c)
40 {
41 command = strchr(command, ' ');
42 if (command != NULL)
43 command++;
44 }
45
46 if (!command)
47 {
48 command_success_nodata(si, _("***** \2%s Help\2 *****"), chansvs.nick);
49 command_success_nodata(si, _("\2%s\2 gives normal users the ability to maintain control\n"
50 "of a channel, without the need of a bot. Channel takeovers are\n"
51 "virtually impossible when a channel is registered with \2%s\2.\n"
52 "Registration is a quick and painless process. Once registered,\n"
53 "the founder can maintain complete and total control over the channel."),
54 chansvs.nick, chansvs.nick);
55 if (chansvs.expiry > 0)
56 {
57 command_success_nodata(si, _("Please note that channels will expire after %d days of inactivity,\n"
58 "or if there are no eligible channel successors.\n"
59 "Activity is defined as a user with one of %s being on the channel."), (chansvs.expiry / 86400), bitmask_to_flags2(CA_USEDUPDATE & ca_all, 0));
60 }
61 else
62 {
63 command_success_nodata(si, _("Please note that channels will expire if there are no eligible channel successors."));
64 }
65 command_success_nodata(si, _("Successors are primarily those who have the +S (if available) or +R flag\n"
66 "set on their account in the channel, although other people may be chosen\n"
67 "depending on their access level and activity."));
68 command_success_nodata(si, " ");
69 if (chansvs.fantasy && config_options.join_chans && chansvs.trigger != '\0')
70 {
71 command_success_nodata(si, _("Commands can also be given on channel by prefixing one of '%s'\n"
72 "and omitting the channel name. These are called \"fantasy\"\n"
73 "commands and can also be disabled on a per-channel basis."), chansvs.trigger);
74 command_success_nodata(si, " ");
75 }
76 command_success_nodata(si, _("For more information on a command, type:"));
77 command_success_nodata(si, "\2/%s%s help <command>\2", (ircd->uses_rcommand == false) ? "msg " : "", chansvs.me->disp);
78 command_success_nodata(si, _("For a verbose listing of all commands, type:"));
79 command_success_nodata(si, "\2/%s%s help commands\2", (ircd->uses_rcommand == false) ? "msg " : "", chansvs.me->disp);
80 command_success_nodata(si, " ");
81
82 command_help_short(si, chansvs.me->commands, "REGISTER OP INVITE UNBAN FLAGS INFO SET CLOSE FDROP FFLAGS FTRANSFER");
83
84 command_success_nodata(si, _("***** \2End of Help\2 *****"));
85
86 /* Fun for helpchan/helpurl. */
87 if (config_options.helpchan && config_options.helpurl)
88 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"),
89 config_options.helpchan, config_options.helpurl);
90 else if (config_options.helpchan && !config_options.helpurl)
91 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);
92 else if (!config_options.helpchan && config_options.helpurl)
93 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);
94
95 return;
96 }
97
98 if (!strcasecmp("COMMANDS", command))
99 {
100 command_success_nodata(si, _("***** \2%s Help\2 *****"), chansvs.nick);
101 command_help(si, chansvs.me->commands);
102 command_success_nodata(si, _("***** \2End of Help\2 *****"));
103 return;
104 }
105
106 help_display(si, chansvs.me, command, chansvs.me->commands);
107 }
108
109 /* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
110 * vim:ts=8
111 * vim:sw=8
112 * vim:noexpandtab
113 */