partial implementation of #729

This propagates CS AMODE changes to the actual modes, but not the other
way around.

Also fixes #909.
This commit is contained in:
Shivaram Lingamneni 2020-03-25 12:08:08 -04:00
parent f4e9c79e36
commit f5fe580d22
6 changed files with 94 additions and 77 deletions

View file

@ -256,13 +256,28 @@ func (channel *Channel) ApplyChannelModeChanges(client *Client, isSamode bool, c
continue
}
change := channel.applyModeToMember(client, change.Mode, change.Op, nick, rb)
if change != nil {
applied = append(applied, *change)
success, change := channel.applyModeToMember(client, change, rb)
if success {
applied = append(applied, change)
}
}
}
var includeFlags uint
for _, change := range applied {
switch change.Mode {
case modes.BanMask, modes.ExceptMask, modes.InviteMask:
includeFlags |= IncludeLists
case modes.ChannelFounder, modes.ChannelAdmin, modes.ChannelOperator, modes.Halfop, modes.Voice:
// these are never persisted currently, but might be in the future (see discussion on #729)
default:
includeFlags |= IncludeModes
}
}
if includeFlags != 0 {
channel.MarkDirty(includeFlags)
}
// #649: don't send 324 RPL_CHANNELMODEIS if we were only working with mask lists
if len(applied) == 0 && !alreadySentPrivError && (maskOpCount == 0 || maskOpCount < len(changes)) {
args := append([]string{details.nick, chname}, channel.modeStrings(client)...)