X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/d76ed9a966ee3d955c8ef00ecc02e643c2005e2e..9b2d838a3f6c15287a36caed1c8e10ff8d74613d:/src/modcmd.c diff --git a/src/modcmd.c b/src/modcmd.c index b4a736e..dcc9edb 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -18,7 +18,6 @@ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -//#include "arch-version.h" #include "chanserv.h" #include "conf.h" #include "modcmd.h" @@ -55,6 +54,7 @@ static const struct message_entry msgtab[] = { { "MCMSG_NO_CHANNEL_BEFORE", "You may not give a channel name before this command." }, { "MCMSG_NO_PLUS_CHANNEL", "You may not use a +channel with this command." }, { "MCMSG_COMMAND_ALIASES", "%s is an alias for: %s" }, + { "MCMSG_HELP_COMMAND_ALIAS", "$uAlias for:$u %s" }, { "MCMSG_COMMAND_BINDING", "%s is a binding of: %s" }, { "MCMSG_ALIAS_ERROR", "Error in alias expansion for %s; check the error log for details." }, { "MCMSG_INTERNAL_COMMAND", "$b%s$b is an internal command and cannot be called directly; please check command bindings." }, @@ -757,19 +757,28 @@ int svccmd_send_help(struct userNode *user, struct userNode *bot, struct svccmd *cmd) { char cmdname[MAXLEN]; unsigned int nn; + int r; /* Show command name (in bold). */ for (nn=0; cmd->name[nn]; nn++) cmdname[nn] = toupper(cmd->name[nn]); cmdname[nn] = 0; - send_message_type(4, user, bot, "$b%s$b", cmdname); + send_message_type(4, user, bot, "=--- $b%s$b ---=", cmdname); + + /* Show the help entry for the underlying command. */ + /* Lets not show help for a parent command, thats not what + * they asked for! + * return send_help(user, bot, cmd->command->parent->helpfile, cmd->command->name); + * TODO: We actually DO want to show the parent IF there is no other help. + */ + r = send_help(user, bot, cmd->command->parent->helpfile, cmd->name); + /* If it's an alias, show what it's an alias for. */ if (cmd->alias.used) { char alias_text[MAXLEN]; unsplit_string((char**)cmd->alias.list, cmd->alias.used, alias_text); - send_message(user, bot, "MCMSG_COMMAND_ALIASES", cmd->name, alias_text); + send_message(user, bot, "MCMSG_HELP_COMMAND_ALIAS", alias_text); } - /* Show the help entry for the underlying command. */ - return send_help(user, bot, cmd->command->parent->helpfile, cmd->command->name); + return r; } int @@ -778,10 +787,14 @@ svccmd_send_help_2(struct userNode *user, struct service *service, const char *t struct svccmd *cmd; unsigned int ii; + /* If there is a command, send help for the command */ if ((cmd = dict_find(service->commands, topic, NULL))) return svccmd_send_help(user, service->bot, cmd); + + /* If there is no topic show the index */ if (!topic) topic = ""; + /* look for the thing in the included help files */ for (ii = 0; ii < service->modules.used; ++ii) { module = service->modules.list[ii]; if (!module->helpfile) @@ -789,6 +802,7 @@ svccmd_send_help_2(struct userNode *user, struct service *service, const char *t if (dict_find(module->helpfile->db, topic, NULL)) return send_help(user, service->bot, module->helpfile, topic); } + /* Otherwise say we cant find it */ send_message(user, service->bot, "MSG_TOPIC_UNKNOWN"); return 0; } @@ -1464,7 +1478,7 @@ static MODCMD_FUNC(cmd_god) { } static MODCMD_FUNC(cmd_joiner) { - char cmdname[80]; + char cmdname[MAXLEN]; if (argc < 2) { int len = sprintf(cmdname, "%s ", cmd->name); @@ -1730,7 +1744,7 @@ static MODCMD_FUNC(cmd_service_add) { reply("MCMSG_ALREADY_SERVICE", bot->nick); return 0; } - bot = AddService(nick, desc, hostname); + bot = AddService(nick, NULL, desc, hostname); service_register(bot); reply("MCMSG_NEW_SERVICE", bot->nick); return 1; @@ -1851,8 +1865,6 @@ static MODCMD_FUNC(cmd_version) { * copyright information pertaining to changes you make to srvx. */ send_message_type(4, user, cmd->parent->bot, "$b"PACKAGE_STRING"$b ("CODENAME"), Built: "__DATE__", "__TIME__".\nCopyright 2000-2004 srvx Development Team.\nThe srvx Development Team includes Paul Chang, Adrian Dewhurst, Miles Peterson, Michael Poole and others.\nThe srvx Development Team can be reached at http://sf.net/projects/srvx/ or in #srvx on irc.gamesurge.net."); - if ((argc > 1) && !irccasecmp(argv[1], "arch")) - send_message_type(4, user, cmd->parent->bot, "%s", ""); return 1; } @@ -2049,7 +2061,7 @@ modcmd_load_bots(struct dict *db, int default_nick) { hostname = database_get_data(rd->d.object, "hostname", RECDB_QSTRING); if (desc) { if (!svc) - svc = service_register(AddService(nick, desc, hostname)); + svc = service_register(AddService(nick, NULL, desc, hostname)); else if (hostname) strcpy(svc->bot->hostname, hostname); desc = database_get_data(rd->d.object, "trigger", RECDB_QSTRING); @@ -2308,12 +2320,13 @@ create_default_binds(void) { if (!irccasecmp(def_binds[ii].svcname, "ChanServ")) { service_make_alias(service, "addowner", "*chanserv.adduser", "$1", "owner", NULL); service_make_alias(service, "addcoowner", "*chanserv.adduser", "$1", "coowner", NULL); - service_make_alias(service, "addmaster", "*chanserv.adduser", "$1", "master", NULL); + service_make_alias(service, "addmanager", "*chanserv.adduser", "$1", "manager", NULL); service_make_alias(service, "addop", "*chanserv.adduser", "$1", "op", NULL); + service_make_alias(service, "addhop", "*chanserv.adduser", "$1", "halfop", NULL); service_make_alias(service, "addpeon", "*chanserv.adduser", "$1", "peon", NULL); service_make_alias(service, "delowner", "*chanserv.deluser", "owner", "$1", NULL); service_make_alias(service, "delcoowner", "*chanserv.deluser", "coowner", "$1", NULL); - service_make_alias(service, "delmaster", "*chanserv.deluser", "master", "$1", NULL); + service_make_alias(service, "delmanager", "*chanserv.deluser", "manager", "$1", NULL); service_make_alias(service, "delop", "*chanserv.deluser", "op", "$1", NULL); service_make_alias(service, "delpeon", "*chanserv.deluser", "peon", "$1", NULL); service_make_alias(service, "command", "*modcmd.command", NULL);