diff --git a/irc/channel.go b/irc/channel.go index 09a8a956..99dde88e 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -1324,6 +1324,12 @@ func (channel *Channel) isMuted(client *Client) bool { return muteRe.MatchString(nuh) && !channel.lists[modes.ExceptMask].MatchMute(nuh) } +func (channel *Channel) relayNickMuted(relayNick string) bool { + relayNUH := fmt.Sprintf("%s!*@*", relayNick) + return channel.lists[modes.BanMask].MatchMute(relayNUH) && + !channel.lists[modes.ExceptMask].MatchMute(relayNUH) +} + func msgCommandToHistType(command string) (history.ItemType, error) { switch command { case "PRIVMSG": diff --git a/irc/handlers.go b/irc/handlers.go index 5ad2771c..ac417a6d 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -2647,6 +2647,10 @@ func relaymsgHandler(server *Server, client *Client, msg ircmsg.Message, rb *Res rb.Add(nil, server.name, "FAIL", "RELAYMSG", "INVALID_NICK", fmt.Sprintf(client.t("Relayed nicknames MUST contain a relaymsg separator from this set: %s"), config.Server.Relaymsg.Separators)) return false } + if channel.relayNickMuted(nick) { + rb.Add(nil, server.name, "FAIL", "RELAYMSG", "BANNED", fmt.Sprintf(client.t("%s is banned from relaying to the channel"), nick)) + return false + } channel.AddHistoryItem(history.Item{ Type: history.Privmsg,