mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
implement the strict modern behavior
This commit is contained in:
parent
521d5bf50f
commit
364d31e10c
@ -1953,24 +1953,28 @@ func namesHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Res
|
|||||||
|
|
||||||
// TODO: in a post-federation world, process `target` (server to forward request to)
|
// TODO: in a post-federation world, process `target` (server to forward request to)
|
||||||
|
|
||||||
|
// implement the modern behavior: https://modern.ircdocs.horse/#names-message
|
||||||
|
// "Servers MAY only return information about the first <channel> and silently ignore the others."
|
||||||
|
// "If no parameter is given for this command, servers SHOULD return one RPL_ENDOFNAMES numeric
|
||||||
|
// with the <channel> parameter set to an asterix character"
|
||||||
|
|
||||||
if len(channels) == 0 {
|
if len(channels) == 0 {
|
||||||
rb.Add(nil, server.name, RPL_ENDOFNAMES, client.Nick(), "*", client.t("End of NAMES list"))
|
rb.Add(nil, server.name, RPL_ENDOFNAMES, client.Nick(), "*", client.t("End of NAMES list"))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, chname := range channels {
|
chname := channels[0]
|
||||||
success := false
|
success := false
|
||||||
channel := server.channels.Get(chname)
|
channel := server.channels.Get(chname)
|
||||||
if channel != nil {
|
if channel != nil {
|
||||||
if !channel.flags.HasMode(modes.Secret) || channel.hasClient(client) || client.HasMode(modes.Operator) {
|
if !channel.flags.HasMode(modes.Secret) || channel.hasClient(client) || client.HasMode(modes.Operator) {
|
||||||
channel.Names(client, rb)
|
channel.Names(client, rb)
|
||||||
success = true
|
success = true
|
||||||
}
|
|
||||||
}
|
|
||||||
if !success { // channel.Names() sends this numeric itself on success
|
|
||||||
rb.Add(nil, server.name, RPL_ENDOFNAMES, client.Nick(), chname, client.t("End of NAMES list"))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !success { // channel.Names() sends this numeric itself on success
|
||||||
|
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