mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-25 13:29:27 +01:00
Merge pull request #1299 from slingamn/fix_noctcp
actually enable the +T no-ctcp umode
This commit is contained in:
commit
4a7ca14bdc
28
irc/modes.go
28
irc/modes.go
@ -33,8 +33,7 @@ func ApplyUserModeChanges(client *Client, changes modes.ModeChanges, force bool,
|
|||||||
applied := make(modes.ModeChanges, 0)
|
applied := make(modes.ModeChanges, 0)
|
||||||
|
|
||||||
for _, change := range changes {
|
for _, change := range changes {
|
||||||
switch change.Mode {
|
if change.Mode != modes.ServerNotice {
|
||||||
case modes.Bot, modes.Invisible, modes.WallOps, modes.UserRoleplaying, modes.Operator, modes.LocalOperator, modes.RegisteredOnly, modes.UserNoCTCP:
|
|
||||||
switch change.Op {
|
switch change.Op {
|
||||||
case modes.Add:
|
case modes.Add:
|
||||||
if (change.Mode == modes.Operator || change.Mode == modes.LocalOperator) && !(force && oper != nil) {
|
if (change.Mode == modes.Operator || change.Mode == modes.LocalOperator) && !(force && oper != nil) {
|
||||||
@ -73,8 +72,8 @@ func ApplyUserModeChanges(client *Client, changes modes.ModeChanges, force bool,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
case modes.ServerNotice:
|
// server notices are weird
|
||||||
if !client.HasMode(modes.Operator) {
|
if !client.HasMode(modes.Operator) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -98,8 +97,6 @@ func ApplyUserModeChanges(client *Client, changes modes.ModeChanges, force bool,
|
|||||||
applied = append(applied, change)
|
applied = append(applied, change)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// can't do anything to TLS mode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(applied) != 0 {
|
if len(applied) != 0 {
|
||||||
@ -271,15 +268,6 @@ func (channel *Channel) ApplyChannelModeChanges(client *Client, isSamode bool, c
|
|||||||
applied = append(applied, change)
|
applied = append(applied, change)
|
||||||
}
|
}
|
||||||
|
|
||||||
case modes.InviteOnly, modes.Moderated, modes.NoOutside, modes.OpOnlyTopic, modes.RegisteredOnly, modes.Secret, modes.ChanRoleplaying, modes.NoCTCP, modes.RegisteredOnlySpeak:
|
|
||||||
if change.Op == modes.List {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if channel.flags.SetMode(change.Mode, change.Op == modes.Add) {
|
|
||||||
applied = append(applied, change)
|
|
||||||
}
|
|
||||||
|
|
||||||
case modes.ChannelFounder, modes.ChannelAdmin, modes.ChannelOperator, modes.Halfop, modes.Voice:
|
case modes.ChannelFounder, modes.ChannelAdmin, modes.ChannelOperator, modes.Halfop, modes.Voice:
|
||||||
if change.Op == modes.List {
|
if change.Op == modes.List {
|
||||||
continue
|
continue
|
||||||
@ -295,6 +283,16 @@ func (channel *Channel) ApplyChannelModeChanges(client *Client, isSamode bool, c
|
|||||||
if success {
|
if success {
|
||||||
applied = append(applied, change)
|
applied = append(applied, change)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
// all channel modes with no args, e.g., InviteOnly, Secret
|
||||||
|
if change.Op == modes.List {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if channel.flags.SetMode(change.Mode, change.Op == modes.Add) {
|
||||||
|
applied = append(applied, change)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ var (
|
|||||||
// SupportedUserModes are the user modes that we actually support (modifying).
|
// SupportedUserModes are the user modes that we actually support (modifying).
|
||||||
SupportedUserModes = Modes{
|
SupportedUserModes = Modes{
|
||||||
Bot, Invisible, Operator, RegisteredOnly, ServerNotice, UserRoleplaying,
|
Bot, Invisible, Operator, RegisteredOnly, ServerNotice, UserRoleplaying,
|
||||||
|
UserNoCTCP,
|
||||||
}
|
}
|
||||||
|
|
||||||
// SupportedChannelModes are the channel modes that we support.
|
// SupportedChannelModes are the channel modes that we support.
|
||||||
@ -429,8 +430,10 @@ func (a ByCodepoint) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
|||||||
func (a ByCodepoint) Less(i, j int) bool { return a[i] < a[j] }
|
func (a ByCodepoint) Less(i, j int) bool { return a[i] < a[j] }
|
||||||
|
|
||||||
func RplMyInfo() (param1, param2, param3 string) {
|
func RplMyInfo() (param1, param2, param3 string) {
|
||||||
userModes := make(Modes, len(SupportedUserModes))
|
userModes := make(Modes, len(SupportedUserModes), len(SupportedUserModes)+1)
|
||||||
copy(userModes, SupportedUserModes)
|
copy(userModes, SupportedUserModes)
|
||||||
|
// TLS is not in SupportedUserModes because it can't be modified
|
||||||
|
userModes = append(userModes, TLS)
|
||||||
sort.Sort(ByCodepoint(userModes))
|
sort.Sort(ByCodepoint(userModes))
|
||||||
|
|
||||||
channelModes := make(Modes, len(SupportedChannelModes)+len(ChannelUserModes))
|
channelModes := make(Modes, len(SupportedChannelModes)+len(ChannelUserModes))
|
||||||
|
Loading…
Reference in New Issue
Block a user