3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 10:42:52 +01:00
Also ensure that people can remove their own persistent modes via CS AMODE
This commit is contained in:
Shivaram Lingamneni 2019-05-23 18:33:41 -04:00
parent 678c8606b6
commit 0835ad6af5
2 changed files with 4 additions and 1 deletions

View File

@ -395,7 +395,7 @@ func channelUserModeHasPrivsOver(clientMode modes.Mode, targetMode modes.Mode) b
return targetMode != modes.ChannelFounder && targetMode != modes.ChannelAdmin
case modes.Halfop:
// halfops cannot kick other halfops
return targetMode != modes.ChannelFounder && targetMode != modes.ChannelAdmin && targetMode != modes.Halfop
return targetMode == modes.Voice || targetMode == modes.Mode(0)
default:
// voice and unprivileged cannot kick anyone
return false

View File

@ -277,6 +277,9 @@ func (channel *Channel) ProcessAccountToUmodeChange(client *Client, change modes
hasPrivs = true
} else if channelUserModeHasPrivsOver(clientMode, targetModeNow) && channelUserModeHasPrivsOver(clientMode, targetModeAfter) {
hasPrivs = true
} else if change.Op == modes.Remove && account == change.Arg {
// you can always de-op yourself
hasPrivs = true
}
if !hasPrivs {
return nil, errInsufficientPrivs