mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-15 00:19:29 +01:00
commit
bf33fba33a
@ -1228,20 +1228,26 @@ func (channel *Channel) CanSpeak(client *Client) (bool, modes.Mode) {
|
||||
channel.stateMutex.RLock()
|
||||
memberData, hasClient := channel.members[client]
|
||||
channel.stateMutex.RUnlock()
|
||||
clientModes := memberData.modes
|
||||
|
||||
highestMode := func() modes.Mode {
|
||||
if !hasClient {
|
||||
return modes.Mode(0)
|
||||
}
|
||||
return memberData.modes.HighestChannelUserMode()
|
||||
}
|
||||
|
||||
if !hasClient && channel.flags.HasMode(modes.NoOutside) {
|
||||
// TODO: enforce regular +b bans on -n channels?
|
||||
return false, modes.NoOutside
|
||||
}
|
||||
if channel.isMuted(client) && clientModes.HighestChannelUserMode() == modes.Mode(0) {
|
||||
if channel.isMuted(client) && highestMode() == modes.Mode(0) {
|
||||
return false, modes.BanMask
|
||||
}
|
||||
if channel.flags.HasMode(modes.Moderated) && clientModes.HighestChannelUserMode() == modes.Mode(0) {
|
||||
if channel.flags.HasMode(modes.Moderated) && highestMode() == modes.Mode(0) {
|
||||
return false, modes.Moderated
|
||||
}
|
||||
if channel.flags.HasMode(modes.RegisteredOnlySpeak) && client.Account() == "" &&
|
||||
clientModes.HighestChannelUserMode() == modes.Mode(0) {
|
||||
highestMode() == modes.Mode(0) {
|
||||
return false, modes.RegisteredOnlySpeak
|
||||
}
|
||||
return true, modes.Mode('?')
|
||||
|
2
irctest
2
irctest
@ -1 +1 @@
|
||||
Subproject commit 3b7f81e22c317eae885f5a942767ba4f6a30414e
|
||||
Subproject commit bb8a6b6c3d3e55c1146c3c9f8224983d88a42b17
|
Loading…
Reference in New Issue
Block a user