diff --git a/irc/modes.go b/irc/modes.go index 7cd297f0..375831eb 100644 --- a/irc/modes.go +++ b/irc/modes.go @@ -54,9 +54,15 @@ func (client *Client) applyUserModeChanges(force bool, changes modes.ModeChanges } var masks []sno.Mask if change.Op == modes.Add || change.Op == modes.Remove { + var newArg string for _, char := range change.Arg { - masks = append(masks, sno.Mask(char)) + mask := sno.Mask(char) + if sno.ValidMasks[mask] { + masks = append(masks, mask) + newArg += string(char) + } } + change.Arg = newArg } if change.Op == modes.Add { client.server.snomasks.AddMasks(client, masks...) diff --git a/irc/sno/constants.go b/irc/sno/constants.go index 697348a9..5449962e 100644 --- a/irc/sno/constants.go +++ b/irc/sno/constants.go @@ -35,4 +35,18 @@ var ( LocalAccounts: "ACCOUNT", LocalXline: "XLINE", } + + // ValidMasks contains the snomasks that we support. + ValidMasks = map[Mask]bool{ + LocalAccouncements: true, + LocalConnects: true, + LocalChannels: true, + LocalKills: true, + LocalNicks: true, + LocalOpers: true, + LocalQuits: true, + Stats: true, + LocalAccounts: true, + LocalXline: true, + } ) diff --git a/irc/snomanager.go b/irc/snomanager.go index 848a87e7..38ab8d6c 100644 --- a/irc/snomanager.go +++ b/irc/snomanager.go @@ -27,6 +27,11 @@ func (m *SnoManager) AddMasks(client *Client, masks ...sno.Mask) { defer m.sendListMutex.Unlock() for _, mask := range masks { + // confirm mask is valid + if !sno.ValidMasks[mask] { + continue + } + currentClientList := m.sendLists[mask] if currentClientList == nil {