X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/ed05669cd2cc6678791f07d84d6111ab5d851139..0f3e9cfc4b5d0f13085c975e10c0e6c4c8e5fbc3:/src/modcmd.c diff --git a/src/modcmd.c b/src/modcmd.c index 75fb319..3226327 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -255,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]; @@ -756,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; } @@ -784,6 +784,29 @@ svccmd_send_help_brief(struct userNode *user, struct userNode *bot, struct svccm return r; } +int is_joiner(struct svccmd *cmd) +{ + if(cmd->command->name) + { + if(strcasecmp("joiner", cmd->command->name)) + return(0); + else + return(1); + } + return(0); +/* + if(cmd->alias.used) + { + char alias_text[MAXLEN]; + unsplit_string((char**)cmd->alias.list, cmd->alias.used, alias_text); + if(strcasecmp("joiner", alias_text)) + return(0); + else + return(1); + } +*/ +} + int svccmd_send_help(struct userNode *user, struct service *service, const char *topic) { struct module *module; @@ -800,8 +823,8 @@ svccmd_send_help(struct userNode *user, struct service *service, const char *top cmdname[nn] = toupper(topic[nn]); cmdname[nn] = 0; - /* If there is a command 'topic', send command help for the command */ - if ((cmd = dict_find(service->commands, topic, NULL))) + /* If there is a command 'topic', send command help for the command (unless its bound to JOINER) */ + if ((cmd = dict_find(service->commands, topic, NULL)) && !is_joiner(cmd)) { send_message(user, service->bot, "MCMSG_HELP_COMMAND_HEADER", cmdname); send_message(user, service->bot, "MCMSG_HELP_DIVIDER"); @@ -941,6 +964,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; } @@ -1275,8 +1301,8 @@ static MODCMD_FUNC(cmd_readhelp) { stop.tv_sec -= start.tv_sec; stop.tv_usec -= start.tv_usec; if (stop.tv_usec < 0) { - stop.tv_sec -= 1; - stop.tv_usec += 1000000; + stop.tv_sec -= 1; + stop.tv_usec += 1000000; } reply("MCMSG_HELPFILE_READ", module->name, stop.tv_sec, stop.tv_usec/1000); return 1; @@ -1300,8 +1326,8 @@ static MODCMD_FUNC(cmd_timecmd) { stop.tv_sec -= start.tv_sec; stop.tv_usec -= start.tv_usec; if (stop.tv_usec < 0) { - stop.tv_sec -= 1; - stop.tv_usec += 1000000; + stop.tv_sec -= 1; + stop.tv_usec += 1000000; } reply("MCMSG_COMMAND_TIME", cmd_text, stop.tv_sec, stop.tv_usec); return 1; @@ -1504,17 +1530,17 @@ static MODCMD_FUNC(cmd_god) { reply("MCMSG_ALREADY_HELPING"); return 0; } - helping = 1; + helping = 1; } else if (disabled_string(argv[1])) { if (!HANDLE_FLAGGED(user->handle_info, HELPING)) { reply("MCMSG_ALREADY_NOT_HELPING"); return 0; } - helping = 0; + helping = 0; } else { reply("MSG_INVALID_BINARY", argv[1]); return 0; - } + } } else { helping = !IsHelping(user); } @@ -1917,13 +1943,32 @@ static MODCMD_FUNC(cmd_version) { * command or its accessibility to normal IRC users, except to add * copyright information pertaining to changes you make to X3. */ - send_message_type(4, user, cmd->parent->bot, "$b"PACKAGE_STRING"$b (Based on srvx 1.3), Built: "__DATE__", "__TIME__"."); - send_message_type(4, user, cmd->parent->bot, "("CVS_VERSION")"); - send_message_type(4, user, cmd->parent->bot, "Copyright 2000-2005 srvx Development Team."); - send_message_type(4, user, cmd->parent->bot, "Copyright 2004-2005 X3 Development Team."); + + char *svn = NULL, *svnver = NULL, *svndate = NULL, *v = 0, ver[MAXLEN]; + int vc = 0; + + strcpy(ver, CVS_VERSION); + for (svn = x3_strtok(&v, ver, " "); svn; + svn = x3_strtok(&v, 0, " ")) { + if (vc == 2) + svnver = svn; + else if (vc == 3) + svndate = svn; + vc++; + } + + send_message_type(4, user, cmd->parent->bot, "$b"PACKAGE_STRING"+[%s %s]$b (Based on srvx 1.3), Built: "__DATE__", "__TIME__".", svnver, svndate); + send_message_type(4, user, cmd->parent->bot, "$b$b"); + send_message_type(4, user, cmd->parent->bot, "Copyright 2000-2006 srvx Development Team."); + send_message_type(4, user, cmd->parent->bot, "Copyright 2004-2006 X3 Development Team."); + send_message_type(4, user, cmd->parent->bot, "$b$b"); send_message_type(4, user, cmd->parent->bot, "The srvx 1.3 Development Team includes Paul Chang, Adrian Dewhurst, Miles Peterson, Michael Poole and others."); send_message_type(4, user, cmd->parent->bot, "The X3 Development Team includes Alex Schumann, Reed Loden, Neil Spierling."); - send_message_type(4, user, cmd->parent->bot, "The X3 Development Team can be reached at http://sf.net/projects/x2serv/ or in #evilnet on irc.afternet.org."); + send_message_type(4, user, cmd->parent->bot, "The X3 Development Team can be reached at http://sourceforge.net/projects/evilnet or in #evilnet on irc.afternet.org."); + send_message_type(4, user, cmd->parent->bot, "$b$b"); + send_message_type(4, user, cmd->parent->bot, "Thanks goes to Adrian M (thiefmaster), Joe Hansche (joeatrr) and to any other people who have contributed to X3."); + send_message_type(4, user, cmd->parent->bot, "This program is free software; see COPYING in the distribution."); + return 1; }