X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/1d9574827a360322e344883a477c8f52f35ede2e..e42487a5d0733c361fce6607ed7f01025f650aa1:/src/modcmd.c?ds=inline diff --git a/src/modcmd.c b/src/modcmd.c index f3c2df6..eb682ab 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -57,6 +57,7 @@ static const struct message_entry msgtab[] = { { "MCMSG_COMMAND_ALIASES", "%s is an alias for: %s" }, { "MCMSG_HELP_COMMAND_ALIAS", "$uAlias for:$u %s" }, { "MCMSG_HELP_COMMAND_HEADER", "Command help for: $b%s$b" }, + { "MCMSG_HELP_COMMAND_UNKNOWN", "No help available for that command." }, { "MCMSG_HELP_TOPIC_HEADER", "Help topic: $b%s$b" }, { "MCMSG_HELP_DIVIDER", "=---------------------------------------=" }, { "MCMSG_HELP_FOOTER", "=------------- End of Help -------------=" }, @@ -254,7 +255,7 @@ add_pending_template(struct svccmd *cmd, const char *target) { pending_templates = pending; } -static struct svccmd * +struct svccmd * svccmd_resolve_name(struct svccmd *origin, const char *name) { char *sep, svcname[MAXLEN]; @@ -755,7 +756,7 @@ svccmd_invoke_argv(struct userNode *user, struct service *service, struct chanNo slvl = LOG_COMMAND; /* Unsplit argv after running the function to get the benefit * of any mangling/hiding done by the commands. */ - log_audit(cmd->command->parent->clog, slvl, user, service->bot, channel_name, ((flags & MODCMD_LOG_HOSTMASK) ? AUDIT_HOSTMASK : 0), unsplit_string(argv, argc, NULL)); + log_audit(cmd->command->parent->clog, slvl, user, service->bot, channel_name, AUDIT_HOSTMASK, unsplit_string(argv, argc, NULL)); } return 1; } @@ -788,7 +789,7 @@ svccmd_send_help(struct userNode *user, struct service *service, const char *top struct module *module; struct svccmd *cmd; char cmdname[MAXLEN]; - unsigned int nn; + unsigned int nn, ii; int helpsent = 0; /* If there is no topic show the index */ @@ -825,24 +826,33 @@ svccmd_send_help(struct userNode *user, struct service *service, const char *top } /* If send_help still couldnt find it, tell them sorry */ if(!helpsent) - send_message(user, service->bot, "MSG_TOPIC_UNKNOWN"); + send_message(user, service->bot, "MCMSG_HELP_COMMAND_UNKNOWN"); send_message(user, service->bot, "MCMSG_HELP_FOOTER"); return true; } else /* look for topic in the help files loaded to this nick/service */ { - /* Check for non command help in first primary help file, then - * check for help for this on another service and provide a tip */ - module = service->modules.list[0]; - if (module->helpfile && dict_find(module->helpfile->db, topic, NULL)) + /* Check for non command help in first primary help file, then next and so on */ + /* Note - we need to think about default bindings. see opserv.helpfiles */ + for(ii = 0; ii < service->modules.used; ii++) { - - send_message(user, service->bot, "MCMSG_HELP_TOPIC_HEADER", cmdname); - send_message(user, service->bot, "MCMSG_HELP_DIVIDER"); - if(!send_help(user, service->bot, module->helpfile, topic)) - send_message(user, service->bot, "MSG_TOPIC_UNKNOWN"); - send_message(user, service->bot, "MCMSG_HELP_FOOTER"); - return true; + module = service->modules.list[ii]; + if(!module->helpfile) + continue; + if(dict_find(module->helpfile->db, topic, NULL)) + { + if (module->helpfile && dict_find(module->helpfile->db, topic, NULL)) + { + + send_message(user, service->bot, "MCMSG_HELP_TOPIC_HEADER", cmdname); + send_message(user, service->bot, "MCMSG_HELP_DIVIDER"); + /* This should never fail but maybe if something is odd? */ + if(!send_help(user, service->bot, module->helpfile, topic)) + send_message(user, service->bot, "MSG_TOPIC_UNKNOWN"); + send_message(user, service->bot, "MCMSG_HELP_FOOTER"); + return true; + } + } } } /* Otherwise say we cant find it */ @@ -931,6 +941,9 @@ modcmd_privmsg(struct userNode *user, struct userNode *bot, char *text, int serv */ snprintf(response, sizeof(response), "\x01VERSION %s\x01", PACKAGE_STRING); irc_notice_user(bot, user, response); + } else if (!irccasecmp(text, "GENDER")) { + snprintf(response, sizeof(response), "\x01GENDER ummm im still deciding\x01"); + irc_notice_user(bot, user, response); } return; }