diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-04-03 02:42:06 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-04-03 02:42:06 +0000 |
commit | 6d97b7f8f9599f1825e3b0e4b07d421bc3db2c06 (patch) | |
tree | 57735af404345dd9a4fbb1742be4d775e175f34d /src/commands.c | |
parent | c6ef1e0390abe38404742d2355145d6f671ca2dc (diff) |
Fix bug #1045, patch from Adam, suspended channels can no longer be administered, and control over checking forbidden and suspended channels has been moved out of the modules and into the core.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2243 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/commands.c')
-rw-r--r-- | src/commands.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/commands.c b/src/commands.c index 399d8e332..17deffb04 100644 --- a/src/commands.c +++ b/src/commands.c @@ -53,7 +53,7 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * { Command *c = findCommand(cmdTable, cmd); int retVal = 0; - + ChannelInfo *ci; if (!c) { @@ -125,6 +125,27 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * if (MOD_RESULT == EVENT_STOP) return; + if (params.size() > 0 && ircdproto->IsChannelValid(params[0].c_str())) + { + if ((ci = cs_findchan(params[0].c_str()))) + { + if ((ci->flags & CI_FORBIDDEN) && (!c->HasFlag(CFLAG_ALLOW_FORBIDDEN))) + { + notice_lang(service, u, CHAN_X_FORBIDDEN, ci->name); + alog("Access denied for user %s with service %s and command %s because of FORBIDDEN channel %s", + u->nick, service, cmd, ci->name); + return; + } + else if ((ci->flags & CI_SUSPENDED) && (!c->HasFlag(CFLAG_ALLOW_SUSPENDED))) + { + notice_lang(service, u, CHAN_X_FORBIDDEN, ci->name); + alog("Access denied for user %s with service %s and command %s because of SUSPENDED channel %s", + u->nick, service, cmd, ci->name); + return; + } + } + } + retVal = c->Execute(u, params); FOREACH_MOD(I_OnPostCommand, OnPostCommand(u, c->service, c->name, params)); @@ -140,8 +161,7 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[], const char * * @param cmd Command * @return void */ -void mod_help_cmd(char *service, User * u, CommandHash * cmdTable[], - const char *cmd) +void mod_help_cmd(char *service, User * u, CommandHash * cmdTable[], const char *cmd) { spacesepstream tokens(cmd); std::string token; |