"USERS" ("Managing helpers in $S",
" USER ACCESS Description of the user access levels",
" HELPERS List current helpers and their access levels",
+ " GIVEOWNERSHIP Transfer ownership to another user",
" ADDMANAGER Add a new manager to the service",
" ADDHELPER Add a helper to the service",
" ADDTRIAL Add a trial helper to the service",
" UNREGISTER Unregister a HelpServ bot",
" BOTS List registered HelpServ instances",
" EXPIRE Expire inactive channels",
- " VERSION Show version of HelpServ",
- " READHELP Re-read help file",
- " WRITE Write out database");
+ " READHELP Re-read help file");
"COMMANDS" "${index}";
"ADDTRIAL" ("$bADDTRIAL$b",
"/msg $S HELP [command|topic]",
"HELP will show you usage or other information for the command you give.",
"All help entries will use the same syntax for usage, with optional parameters listed in [] and meta-parameters listed in <> (a meta-parameter is one that you must provide a value for).",
- "For example, \"/msg $S VERSION [CVS]\" means that you may send either \"VERSION\" or \"VERSION CVS\" as a command; \"/msg $S HELP [<command>]\" means that you may send \"HELP\" alone, or fill in the name of a command, as in \"HELP VERSION\".",
"If you do not give a command or topic for HELP, an index is shown.");
"HELPERS" ("$bHELPERS$b",
"/msg $S HELPERS",
"UNREGISTER" ("$bUNREGISTER$b",
"/msg $S UNREGISTER CONFIRM",
"Unregisters the channel and removes the service from the channel.");
-"VERSION" ("$bVERSION$b",
- "/msg $S VERSION [CVS]",
- "This tells you the version of srvx this bot is part of.",
- "If you give the \"CVS\" argument, the source-code revision of $S is also shown.");
-"WRITE" ("$bWRITE$b",
- "/msg $O HELPSERV WRITE",
- "Saves all HelpServ bot data to the disk database.");
{ "MCMSG_SERVICE_REMOVED", "Service $b%s$b has been deleted." },
{ "MCMSG_FILE_NOT_OPENED", "Unable to open file $b%s$b for writing." },
{ "MCMSG_MESSAGES_DUMPED", "Messages written to $b%s$b." },
+ { "MCMSG_COMMAND_FLAGS", "Command flags are %s (inferred: %s)." },
+ { "MCMSG_COMMAND_ACCOUNT_FLAGS", "Requires account flags +%s, prohibits account flags +%s." },
+ { "MCMSG_COMMAND_ACCESS_LEVEL", "Requires channel access %d and $O access %d." },
+ { "MCMSG_COMMAND_USES", "%s has been used %d times." },
{ NULL, NULL }
};
struct userData *_GetChannelUser(struct chanData *channel, struct handle_info *handle, int override, int allow_suspended);
return 1;
}
+static void
+modcmd_describe_command(struct userNode *user, struct svccmd *cmd, struct svccmd *target) {
+ char buf1[MAXLEN], buf2[MAXLEN];
+ unsigned int ii, len, buf1_used, buf2_used;
+
+ if (target->alias.used) {
+ unsplit_string((char**)target->alias.list, target->alias.used, buf1);
+ reply("MCMSG_COMMAND_ALIASES", target->name, buf1);
+ } else {
+ snprintf(buf1, sizeof(buf1), "%s.%s", target->command->parent->name, target->command->name);
+ reply("MCMSG_COMMAND_BINDING", target->name, buf1);
+ }
+ for (ii = buf1_used = buf2_used = 0; flags[ii].name; ++ii) {
+ if (target->flags & flags[ii].flag) {
+ if (buf1_used)
+ buf1[buf1_used++] = ',';
+ len = strlen(flags[ii].name);
+ memcpy(buf1 + buf1_used, flags[ii].name, len);
+ buf1_used += len;
+ } else if (target->effective_flags & flags[ii].flag) {
+ if (buf2_used)
+ buf2[buf2_used++] = ',';
+ len = strlen(flags[ii].name);
+ memcpy(buf2 + buf2_used, flags[ii].name, len);
+ buf2_used += len;
+ }
+ }
+ if (buf1_used)
+ buf1[buf1_used] = '\0';
+ else
+ strcpy(buf1, user_find_message(user, "MSG_NONE"));
+ if (buf2_used)
+ buf2[buf2_used] = '\0';
+ else
+ strcpy(buf2, user_find_message(user, "MSG_NONE"));
+ reply("MCMSG_COMMAND_FLAGS", buf1, buf2);
+ for (ii = buf1_used = buf2_used = 0; handle_flags[ii]; ++ii) {
+ if (target->req_account_flags & (1 << ii))
+ buf1[buf1_used++] = handle_flags[ii];
+ else if (target->deny_account_flags & (1 << ii))
+ buf2[buf2_used++] = handle_flags[ii];
+ }
+ buf1[buf1_used] = buf2[buf2_used] = '\0';
+ reply("MCMSG_COMMAND_ACCOUNT_FLAGS", buf1, buf2);
+ reply("MCMSG_COMMAND_ACCESS_LEVEL", target->min_channel_access, target->min_opserv_level);
+ reply("MCMSG_COMMAND_USES", target->name, target->uses);
+}
+
static MODCMD_FUNC(cmd_modcmd) {
struct svccmd *svccmd;
unsigned int arg, changed;
assert(argc >= 2);
arg = collapse_cmdname(argv+1, argc-1, cmdname) + 1;
- if (!arg || (arg+2 < argc)) {
+ if (!arg) {
reply("MSG_MISSING_PARAMS", cmd->name);
return 0;
}
reply("MCMSG_UNKNOWN_COMMAND_2", cmdname, cmd->parent->bot->nick);
return 0;
}
- changed = 0;
- while (arg+1 < argc) {
+ for (changed = 0; arg+1 < argc; arg += 2) {
if (svccmd_configure(svccmd, user, cmd->parent->bot, argv[arg], argv[arg+1])) {
reply("MCMSG_COMMAND_MODIFIED", argv[arg], svccmd->name);
changed = 1;
}
- arg += 2;
}
if (changed)
modcmd_set_effective_flags(svccmd);
+ modcmd_describe_command(user, cmd, svccmd);
return changed;
}
bind_command = modcmd_register(modcmd_module, "bind", cmd_bind, 4, MODCMD_KEEP_BOUND, "oper_level", "800", NULL);
help_command = modcmd_register(modcmd_module, "help", cmd_help, 1, 0, "flags", "+nolog", NULL);
modcmd_register(modcmd_module, "command", cmd_command, 2, 0, "flags", "+nolog", NULL);
- modcmd_register(modcmd_module, "modcmd", cmd_modcmd, 4, MODCMD_KEEP_BOUND, "template", "bind", NULL);
+ modcmd_register(modcmd_module, "modcmd", cmd_modcmd, 2, MODCMD_KEEP_BOUND, "template", "bind", NULL);
modcmd_register(modcmd_module, "god", cmd_god, 0, MODCMD_REQUIRE_AUTHED, "flags", "+oper,+networkhelper", NULL);
modcmd_register(modcmd_module, "readhelp", cmd_readhelp, 2, 0, "oper_level", "650", NULL);
modcmd_register(modcmd_module, "timecmd", cmd_timecmd, 2, 0, "oper_level", "1", NULL);
"Reports how long it takes to run the specified command.");
"command" ("/msg $S COMMAND <command>",
"Shows the restrictions on who can use the named command (and how).");
-"modcmd" ("/msg $S MODCMD <command> <option> <newval> [additional option/value pairs..]",
- "Changes the named option(s) for the specified command. The command name may be prefixed with $bServiceNick.$b to specify another service's command (for example, $N.AUTH to refer to the auth command).",
+"modcmd" ("/msg $S MODCMD <command> [<option> <newval> ...]",
+ "Displays options for the specified command, or changes the options and values listed. The command name may be prefixed with $bServiceNick.$b to specify another service's command (for example, $N.AUTH to refer to the auth command).",
"Supported options are:",
" FLAGS Comma-separated, +/- prefixed list of flags to add or remove.",
" CHANNEL_ACCESS Minimum ChanServ access.",
" OPER_ACCESS Minimum OpServ access.",
- " ACCESS Alias for OPER_ACCESS (if the value starts with a digit) or CHANNEL_ACCESS (if the value does not start with a digit).",
" ACCOUNT_FLAGS Account flags to require or deny (for example, +R-S)",
- " TEMPLATE Command from which to inherit access restrictions",
- " WEIGHT How much the command counts against the anti-flood policer",
- "See the $bmodcmd flags$b entry for a list of supported flags.");
+ "See the $bmodcmd flags$b help entry for a list of supported flags.");
"modcmd flags" ("The following flags are supported for commands:",
" ACCEPTCHAN Treat a normal channel name (if specified) as the context for the command",
" ACCEPTPLUSCHAN Accept modeless channel names as well as normal channel names",