diff options
Diffstat (limited to 'src/commands.c')
-rw-r--r-- | src/commands.c | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/commands.c b/src/commands.c index 7fe9f829b..034725b31 100644 --- a/src/commands.c +++ b/src/commands.c @@ -125,28 +125,37 @@ 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 (params.size() > 0) { - if ((ci = cs_findchan(params[0].c_str()))) + if (ircdproto->IsChannelValid(params[0].c_str())) { - if ((ci->flags & CI_FORBIDDEN) && (!c->HasFlag(CFLAG_ALLOW_FORBIDDEN))) + if ((ci = cs_findchan(params[0].c_str()))) { - 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; + 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; + } } - else if ((ci->flags & CI_SUSPENDED) && (!c->HasFlag(CFLAG_ALLOW_SUSPENDED))) + else if (!c->HasFlag(CFLAG_ALLOW_UNREGISTEREDCHANNEL)) { - 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); + notice_lang(service, u, CHAN_X_NOT_REGISTERED, params[0].c_str()); return; } } - else if (!c->HasFlag(CFLAG_ALLOW_UNREGISTEREDCHANNEL)) + /* A user not giving a channel name for a param that should be a channel */ + else if ((cmdTable == CHANSERV || cmdTable == BOTSERV) && !c->HasFlag(CFLAG_STRIP_CHANNEL)) { - notice_lang(service, u, CHAN_X_NOT_REGISTERED, params[0].c_str()); + notice_lang(service, u, CHAN_X_INVALID, params[0].c_str()); return; } } |