X-Git-Url: https://jfr.im/git/irc/evilnet/x3.git/blobdiff_plain/d0f04f713ca0b689f745842fcc9e61d24610f11a..47956fc5f8ace10e7b32db88bfb9100ad1829833:/src/modcmd.c diff --git a/src/modcmd.c b/src/modcmd.c index 5a58c87..ce25e38 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -22,7 +22,9 @@ #include "chanserv.h" #include "conf.h" #include "modcmd.h" +#include "opserv.h" #include "saxdb.h" +#include "timeq.h" struct pending_template { struct svccmd *cmd; @@ -30,6 +32,7 @@ struct pending_template { struct pending_template *next; }; +extern unsigned long god_timeout; static struct dict *modules; static struct dict *services; static struct pending_template *pending_templates; @@ -130,6 +133,7 @@ static const struct message_entry msgtab[] = { { "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." }, + { "MCMSG_GOD_EXPIRED", "Security override expired." }, { NULL, NULL } }; struct userData *_GetChannelUser(struct chanData *channel, struct handle_info *handle, int override, int allow_suspended); @@ -635,13 +639,6 @@ svccmd_invoke_argv(struct userNode *user, struct service *service, struct chanNo unsigned int cmd_arg, perms, flags, options; char channel_name[CHANNELLEN+1]; - /* First check pubcmd for the channel. */ - if (channel && (channel->channel_info) && (service->bot == chanserv) - && !check_user_level(channel, user, lvlPubCmd, 1, 0)) { - send_message(user, service->bot, "MCMSG_PUBLIC_DENY", channel->name); - return 0; - } - options = (server_qualified ? SVCCMD_QUALIFIED : 0) | SVCCMD_DEBIT | SVCCMD_NOISY; /* Find the command argument. */ cmd_arg = IsChannelName(argv[0]) ? 1 : 0; @@ -659,6 +656,14 @@ svccmd_invoke_argv(struct userNode *user, struct service *service, struct chanNo send_message(user, service->bot, "MSG_COMMAND_UNKNOWN", argv[cmd_arg]); return 0; } + + /* Check pubcmd for the channel. */ + if (channel && (channel->channel_info) && (service->bot == chanserv) + && !check_user_level(channel, user, lvlPubCmd, 1, 0)) { + send_message(user, service->bot, "MCMSG_PUBLIC_DENY", channel->name); + return 0; + } + flags = cmd->effective_flags; /* If they put a channel name first, check if the command allows * it. If so, swap it with the command name. @@ -1521,6 +1526,18 @@ static MODCMD_FUNC(cmd_modcmd) { return changed; } +static void +timeout_god(void *data) +{ + extern struct userNode *chanserv; + struct userNode *user = data; + + if(!user || !IsHelping(user)) return; + + HANDLE_CLEAR_FLAG(user->handle_info, HELPING); + send_message(user, chanserv, "MCMSG_GOD_EXPIRED"); +} + static MODCMD_FUNC(cmd_god) { int helping; @@ -1547,9 +1564,11 @@ static MODCMD_FUNC(cmd_god) { if (helping) { HANDLE_SET_FLAG(user->handle_info, HELPING); + timeq_add(now + god_timeout, timeout_god, user); reply("MCMSG_NOW_HELPING"); } else { HANDLE_CLEAR_FLAG(user->handle_info, HELPING); + timeq_del(0, timeout_god, user, TIMEQ_IGNORE_WHEN); reply("MCMSG_NOW_NOT_HELPING"); } @@ -1966,7 +1985,7 @@ static MODCMD_FUNC(cmd_version) { 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://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, "Thanks goes to Adrian M (thiefmaster), Joe Hansche (joeatrr), Martijn Smit (wasted), 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; @@ -2122,10 +2141,10 @@ modcmd_expand(const char *variable) { exp.type = HF_TABLE; exp.value.table.length = 1; exp.value.table.width = 1; - exp.value.table.flags = TABLE_REPEAT_ROWS; + exp.value.table.flags = TABLE_REPEAT_ROWS | TABLE_NO_HEADERS; exp.value.table.contents = calloc(dict_size(service->commands)+1, sizeof(char**)); exp.value.table.contents[0] = calloc(1, sizeof(char*)); - exp.value.table.contents[0][0] = "Commands:"; + exp.value.table.contents[0][0] = "Commands"; dict_foreach(service->commands, append_entry, &exp); return exp; } else if (!irccasecmp(variable, "languages")) { @@ -2402,6 +2421,7 @@ create_default_binds(int rebind) { { "Global", { "Global", NULL } }, { "NickServ", { "NickServ", NULL } }, { "OpServ", { "OpServ", "modcmd", "sendmail", "saxdb", "proxycheck", NULL } }, + { "SpamServ", { "SpamServ", NULL } }, { NULL, { NULL } } }; unsigned int ii, jj; @@ -2452,6 +2472,8 @@ create_default_binds(int rebind) { svccmd->min_opserv_level = 101; svccmd = service_make_alias(service, "service", "*modcmd.joiner", NULL); svccmd->min_opserv_level = 900; + svccmd = service_make_alias(service, "routing", "*modcmd.joiner", NULL); + svccmd->min_opserv_level = 100; } } }