3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

Merge pull request #534 from slingamn/issue380.1

fix #380
This commit is contained in:
Daniel Oaks 2019-05-30 14:55:42 +10:00 committed by GitHub
commit a521be8119
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 9 deletions

View File

@ -476,7 +476,7 @@ To unset this mode:
### +s - Secret
If this mode is set, it means that your channel should be marked as 'secret'. Your channel won't show up in `/LIST` or `/WHOIS`.
If this mode is set, it means that your channel should be marked as 'secret'. Your channel won't show up in `/LIST` or `/WHOIS`, and non-members won't be able to see its members with `/NAMES` or `/WHO`.
To set this mode:

View File

@ -1953,21 +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)
// 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 {
for _, channel := range server.channels.Channels() {
channel.Names(client, rb)
}
rb.Add(nil, server.name, RPL_ENDOFNAMES, client.Nick(), "*", client.t("End of NAMES list"))
return false
}
for _, chname := range channels {
channel := server.channels.Get(chname)
if channel != nil {
chname := channels[0]
success := false
channel := server.channels.Get(chname)
if channel != nil {
if !channel.flags.HasMode(modes.Secret) || channel.hasClient(client) || client.HasMode(modes.Operator) {
channel.Names(client, rb)
} else if chname != "" {
rb.Add(nil, server.name, RPL_ENDOFNAMES, client.Nick(), chname, client.t("End of NAMES list"))
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"))
}
return false
}