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

Fix #1911 +s channels don't appear in /list even though on the channel (#1923)

* Fix #1911 +s channels don't appear in /list even though on the channel

* use channel.HasClient instead of custom iterative checker
This commit is contained in:
William Rehwinkel 2022-02-28 20:31:16 -05:00 committed by Shivaram Lingamneni
parent 777cb7c991
commit b1a5a47480

View File

@ -1633,7 +1633,7 @@ func listHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respons
clientIsOp := client.HasRoleCapabs("sajoin") clientIsOp := client.HasRoleCapabs("sajoin")
if len(channels) == 0 { if len(channels) == 0 {
for _, channel := range server.channels.Channels() { for _, channel := range server.channels.Channels() {
if !clientIsOp && channel.flags.HasMode(modes.Secret) { if !clientIsOp && channel.flags.HasMode(modes.Secret) && !channel.hasClient(client) {
continue continue
} }
if matcher.Matches(channel) { if matcher.Matches(channel) {
@ -1648,7 +1648,7 @@ func listHandler(server *Server, client *Client, msg ircmsg.Message, rb *Respons
for _, chname := range channels { for _, chname := range channels {
channel := server.channels.Get(chname) channel := server.channels.Get(chname)
if channel == nil || (!clientIsOp && channel.flags.HasMode(modes.Secret)) { if channel == nil || (!clientIsOp && channel.flags.HasMode(modes.Secret) && !channel.hasClient(client)) {
if len(chname) > 0 { if len(chname) > 0 {
rb.Add(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, utils.SafeErrorParam(chname), client.t("No such channel")) rb.Add(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, utils.SafeErrorParam(chname), client.t("No such channel"))
} }