From 709122c3e844e2d19a29414643142cfe9fa078b9 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 5 May 2013 10:11:46 +0000 Subject: - can_send(): fixed bug where bans were not checked against non-channel members git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@1943 82007160-df01-0410-b94d-b575c5fd34c7 --- src/channel.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/channel.c b/src/channel.c index 6eeac2d..2943351 100644 --- a/src/channel.c +++ b/src/channel.c @@ -744,19 +744,20 @@ can_send(struct Channel *chptr, struct Client *source_p, if ((conf = match_find_resv(chptr->chname)) && !resv_find_exempt(source_p, conf)) return ERR_CANNOTSENDTOCHAN; - if (ms != NULL || (ms = find_channel_link(source_p, chptr))) - { - if ((chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(message)) - return ERR_NOCTRLSONCHAN; + if ((chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(message)) + return ERR_NOCTRLSONCHAN; + if (ms || (ms = find_channel_link(source_p, chptr))) if (ms->flags & (CHFL_CHANOP|CHFL_HALFOP|CHFL_VOICE)) return CAN_SEND_OPV; - if (chptr->mode.mode & MODE_MODERATED) - return ERR_CANNOTSENDTOCHAN; - if ((chptr->mode.mode & MODE_REGONLY) && !HasUMode(source_p, UMODE_REGISTERED)) - return ERR_NEEDREGGEDNICK; + if (chptr->mode.mode & MODE_MODERATED) + return ERR_CANNOTSENDTOCHAN; + if ((chptr->mode.mode & MODE_REGONLY) && !HasUMode(source_p, UMODE_REGISTERED)) + return ERR_NEEDREGGEDNICK; - /* cache can send if quiet_on_ban and banned */ - if (ConfigChannel.quiet_on_ban && MyClient(source_p)) + /* cache can send if quiet_on_ban and banned */ + if (MyClient(source_p)) + { + if (ms) { if (ms->flags & CHFL_BAN_SILENCED) return ERR_CANNOTSENDTOCHAN; @@ -772,17 +773,8 @@ can_send(struct Channel *chptr, struct Client *source_p, ms->flags |= CHFL_BAN_CHECKED; } } - } - else - { - if (chptr->mode.mode & MODE_NOPRIVMSGS) - return ERR_CANNOTSENDTOCHAN; - if (chptr->mode.mode & MODE_MODERATED) + else if (is_banned(chptr, source_p)) return ERR_CANNOTSENDTOCHAN; - if ((chptr->mode.mode & MODE_REGONLY) && !HasUMode(source_p, UMODE_REGISTERED)) - return ERR_NEEDREGGEDNICK; - if ((chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(message)) - return ERR_NOCTRLSONCHAN; } return CAN_SEND_NONOP; -- cgit