mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-29 07:29:31 +01:00
fix #1563
ERR_INVALIDMODEPARAM should take both the mode and the invalid parameter as arguments.
This commit is contained in:
parent
640572e151
commit
16f0170512
10
irc/modes.go
10
irc/modes.go
@ -225,7 +225,7 @@ func (channel *Channel) ApplyChannelModeChanges(client *Client, isSamode bool, c
|
|||||||
appliedChange.Arg = maskAdded
|
appliedChange.Arg = maskAdded
|
||||||
applied = append(applied, appliedChange)
|
applied = append(applied, appliedChange)
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
rb.Add(nil, client.server.name, ERR_INVALIDMODEPARAM, details.nick, mask, fmt.Sprintf(client.t("Invalid mode %[1]s parameter: %[2]s"), string(change.Mode), mask))
|
rb.Add(nil, client.server.name, ERR_INVALIDMODEPARAM, details.nick, string(change.Mode), utils.SafeErrorParam(mask), fmt.Sprintf(client.t("Invalid mode %[1]s parameter: %[2]s"), string(change.Mode), mask))
|
||||||
} else {
|
} else {
|
||||||
rb.Add(nil, client.server.name, ERR_LISTMODEALREADYSET, chname, mask, string(change.Mode), fmt.Sprintf(client.t("Channel %[1]s list already contains %[2]s"), chname, mask))
|
rb.Add(nil, client.server.name, ERR_LISTMODEALREADYSET, chname, mask, string(change.Mode), fmt.Sprintf(client.t("Channel %[1]s list already contains %[2]s"), chname, mask))
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ func (channel *Channel) ApplyChannelModeChanges(client *Client, isSamode bool, c
|
|||||||
appliedChange.Arg = maskRemoved
|
appliedChange.Arg = maskRemoved
|
||||||
applied = append(applied, appliedChange)
|
applied = append(applied, appliedChange)
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
rb.Add(nil, client.server.name, ERR_INVALIDMODEPARAM, details.nick, mask, fmt.Sprintf(client.t("Invalid mode %[1]s parameter: %[2]s"), string(change.Mode), mask))
|
rb.Add(nil, client.server.name, ERR_INVALIDMODEPARAM, details.nick, string(change.Mode), utils.SafeErrorParam(mask), fmt.Sprintf(client.t("Invalid mode %[1]s parameter: %[2]s"), string(change.Mode), mask))
|
||||||
} else {
|
} else {
|
||||||
rb.Add(nil, client.server.name, ERR_LISTMODENOTSET, chname, mask, string(change.Mode), fmt.Sprintf(client.t("Channel %[1]s list does not contain %[2]s"), chname, mask))
|
rb.Add(nil, client.server.name, ERR_LISTMODENOTSET, chname, mask, string(change.Mode), fmt.Sprintf(client.t("Channel %[1]s list does not contain %[2]s"), chname, mask))
|
||||||
}
|
}
|
||||||
@ -262,9 +262,9 @@ func (channel *Channel) ApplyChannelModeChanges(client *Client, isSamode bool, c
|
|||||||
case modes.Add:
|
case modes.Add:
|
||||||
ch := client.server.channels.Get(change.Arg)
|
ch := client.server.channels.Get(change.Arg)
|
||||||
if ch == nil {
|
if ch == nil {
|
||||||
rb.Add(nil, client.server.name, ERR_INVALIDMODEPARAM, details.nick, utils.SafeErrorParam(change.Arg), fmt.Sprintf(client.t("No such channel")))
|
rb.Add(nil, client.server.name, ERR_INVALIDMODEPARAM, details.nick, string(change.Mode), utils.SafeErrorParam(change.Arg), fmt.Sprintf(client.t("No such channel")))
|
||||||
} else if ch == channel {
|
} else if ch == channel {
|
||||||
rb.Add(nil, client.server.name, ERR_INVALIDMODEPARAM, details.nick, utils.SafeErrorParam(change.Arg), fmt.Sprintf(client.t("You can't forward a channel to itself")))
|
rb.Add(nil, client.server.name, ERR_INVALIDMODEPARAM, details.nick, string(change.Mode), utils.SafeErrorParam(change.Arg), fmt.Sprintf(client.t("You can't forward a channel to itself")))
|
||||||
} else {
|
} else {
|
||||||
if !ch.ClientIsAtLeast(client, modes.ChannelOperator) {
|
if !ch.ClientIsAtLeast(client, modes.ChannelOperator) {
|
||||||
rb.Add(nil, client.server.name, ERR_CHANOPRIVSNEEDED, details.nick, ch.Name(), client.t("You must be a channel operator in the channel you are forwarding to"))
|
rb.Add(nil, client.server.name, ERR_CHANOPRIVSNEEDED, details.nick, ch.Name(), client.t("You must be a channel operator in the channel you are forwarding to"))
|
||||||
@ -286,7 +286,7 @@ func (channel *Channel) ApplyChannelModeChanges(client *Client, isSamode bool, c
|
|||||||
channel.setKey(change.Arg)
|
channel.setKey(change.Arg)
|
||||||
applied = append(applied, change)
|
applied = append(applied, change)
|
||||||
} else {
|
} else {
|
||||||
rb.Add(nil, client.server.name, ERR_INVALIDMODEPARAM, details.nick, "*", fmt.Sprintf(client.t("Invalid mode %[1]s parameter: %[2]s"), string(change.Mode), change.Arg))
|
rb.Add(nil, client.server.name, ERR_INVALIDMODEPARAM, details.nick, string(change.Mode), utils.SafeErrorParam(change.Arg), fmt.Sprintf(client.t("Invalid mode %[1]s parameter: %[2]s"), string(change.Mode), change.Arg))
|
||||||
}
|
}
|
||||||
case modes.Remove:
|
case modes.Remove:
|
||||||
channel.setKey("")
|
channel.setKey("")
|
||||||
|
Loading…
Reference in New Issue
Block a user