mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 03:02:48 +01:00
Don't send error messages for bad channels in NAMES
"There is no error reply for bad channel names." <https://tools.ietf.org/html/rfc2812#section-3.2.5>
This commit is contained in:
parent
9d163a4ba2
commit
784a3bbf52
@ -1594,16 +1594,14 @@ func motdHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// NAMES [<channel>{,<channel>}]
|
// NAMES [<channel>{,<channel>} [target]]
|
||||||
func namesHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
func namesHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
||||||
var channels []string
|
var channels []string
|
||||||
if len(msg.Params) > 0 {
|
if len(msg.Params) > 0 {
|
||||||
channels = strings.Split(msg.Params[0], ",")
|
channels = strings.Split(msg.Params[0], ",")
|
||||||
}
|
}
|
||||||
//var target string
|
|
||||||
//if len(msg.Params) > 1 {
|
// TODO: in a post-federation world, process `target` (server to forward request to)
|
||||||
// target = msg.Params[1]
|
|
||||||
//}
|
|
||||||
|
|
||||||
if len(channels) == 0 {
|
if len(channels) == 0 {
|
||||||
for _, channel := range server.channels.Channels() {
|
for _, channel := range server.channels.Channels() {
|
||||||
@ -1612,21 +1610,13 @@ func namesHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// limit regular users to only listing one channel
|
|
||||||
if !client.flags[modes.Operator] {
|
|
||||||
channels = channels[:1]
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, chname := range channels {
|
for _, chname := range channels {
|
||||||
casefoldedChname, err := CasefoldChannel(chname)
|
channel := server.channels.Get(chname)
|
||||||
channel := server.channels.Get(casefoldedChname)
|
if channel != nil {
|
||||||
if err != nil || channel == nil {
|
|
||||||
if len(chname) > 0 {
|
|
||||||
rb.Add(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, chname, client.t("No such channel"))
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
channel.Names(client, rb)
|
channel.Names(client, rb)
|
||||||
|
} else if chname != "" {
|
||||||
|
rb.Add(nil, server.name, RPL_ENDOFNAMES, client.Nick(), chname, client.t("End of NAMES list"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user