3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-22 11:59:40 +01:00

Merge pull request #1341 from slingamn/opmoderated

fix #1178
This commit is contained in:
Shivaram Lingamneni 2020-10-20 15:30:12 -07:00 committed by GitHub
commit 033022599b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 4 deletions

View File

@ -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,

View File

@ -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 =

View File

@ -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 (

@ -1 +1 @@
Subproject commit f0eb6e4e80669b7587ffd8802f20e0e5fef923b5
Subproject commit 62197e4c4d54a5a7bbeefc21b545cfd17c7933b2