From 5a9e79f06c84bdfd9a5849c97dbcefcb95d93806 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 20 Oct 2020 13:37:38 -0400 Subject: [PATCH] fix #1178 --- irc/channel.go | 16 ++++++++++++++-- irc/help.go | 2 ++ irc/modes/modes.go | 3 ++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/irc/channel.go b/irc/channel.go index d3f34d0b..67c6d332 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -1287,12 +1287,24 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod chname = fmt.Sprintf("%s%s", modes.ChannelModePrefixes[minPrefixMode], chname) } + if channel.flags.HasMode(modes.OpModerated) { + channel.stateMutex.RLock() + cuModes := channel.members[client] + channel.stateMutex.RUnlock() + if cuModes.HighestChannelUserMode() == modes.Mode(0) { + // max(statusmsg_minmode, halfop) + if minPrefixMode == modes.Mode(0) || minPrefixMode == modes.Voice { + minPrefixMode = modes.Halfop + } + } + } + // send echo-message rb.addEchoMessage(clientOnlyTags, details.nickMask, details.accountName, command, chname, message) for _, member := range channel.Members() { if minPrefixMode != modes.Mode(0) && !channel.ClientIsAtLeast(member, minPrefixMode) { - // STATUSMSG + // STATUSMSG or OpModerated continue } @@ -1320,7 +1332,7 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod } } - // #959: don't save STATUSMSG + // #959: don't save STATUSMSG (or OpModerated) if minPrefixMode == modes.Mode(0) { channel.AddHistoryItem(history.Item{ Type: histType, diff --git a/irc/help.go b/irc/help.go index 9aa63f67..c867c31d 100644 --- a/irc/help.go +++ b/irc/help.go @@ -56,6 +56,8 @@ Oragono supports the following channel modes: +C | Clients are blocked from sending CTCP messages in the channel. +u | Auditorium mode: JOIN, PART, QUIT, NAMES, and WHO are hidden hidden from unvoiced clients. + +U | Op-moderated mode: messages from unprivileged clients are sent + only to channel operators. = Prefixes = diff --git a/irc/modes/modes.go b/irc/modes/modes.go index e1f2079e..5fa51109 100644 --- a/irc/modes/modes.go +++ b/irc/modes/modes.go @@ -23,7 +23,7 @@ var ( SupportedChannelModes = Modes{ BanMask, ChanRoleplaying, ExceptMask, InviteMask, InviteOnly, Key, Moderated, NoOutside, OpOnlyTopic, RegisteredOnly, RegisteredOnlySpeak, - Secret, UserLimit, NoCTCP, Auditorium, + Secret, UserLimit, NoCTCP, Auditorium, OpModerated, } ) @@ -128,6 +128,7 @@ const ( Secret Mode = 's' // flag UserLimit Mode = 'l' // flag arg NoCTCP Mode = 'C' // flag + OpModerated Mode = 'U' // flag ) var (