From b77163886ab7acf7e1d431301dad98f64a0dd664 Mon Sep 17 00:00:00 2001 From: "kayos@tcp.direct" Date: Sun, 23 Jan 2022 07:20:41 -0800 Subject: [PATCH] Wow --- irc/channel.go | 32 ++++++++++++++++---------------- irc/client.go | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/irc/channel.go b/irc/channel.go index 6df973f4..dc48261f 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -730,6 +730,19 @@ func (channel *Channel) Join(client *Client, key string, isSajoin bool, rb *Resp founder == details.account && details.account != "": break + // If the channel has banned the joinee and there is no ban exception, don't join. + case channel.lists[modes.BanMask].Match(details.nickMaskCasefolded): + if !channel.lists[modes.ExceptMask].Match(details.nickMaskCasefolded) { + // do not forward people who are banned: + return errBanned, "" + } + + // If the channel is set to registered users only and there is no invite exception for the joinee, don't join. + case details.account == "" && + (channel.flags.HasMode(modes.RegisteredOnly) || channel.server.Defcon() <= 2) && + !channel.lists[modes.InviteMask].Match(details.nickMaskCasefolded): + return errRegisteredOnly, forward + // If the channel has limited capacity and they are over said capacity, don't join. case limit != 0 && chcount >= limit: return errLimitExceeded, forward @@ -741,7 +754,7 @@ func (channel *Channel) Join(client *Client, key string, isSajoin bool, rb *Resp // If the channel is invite only and they joinee does not have an invite exception, don't join. case channel.flags.HasMode(modes.InviteOnly): // anyone who automatically receives halfop or higher can join despite invite only mode. - if persistentMode != 0 && persistentMode != modes.Voice { + if persistentMode == modes.Halfop || persistentMode == modes.Operator { break } // people invited with INVITE can join. @@ -752,23 +765,10 @@ func (channel *Channel) Join(client *Client, key string, isSajoin bool, rb *Resp if channel.lists[modes.InviteMask].Match(details.nickMaskCasefolded) { break } - return errInviteOnly, forward - - // If the channel has banned the joinee and there is no ban exception, don't join. - case channel.lists[modes.BanMask].Match(details.nickMaskCasefolded): - if channel.lists[modes.ExceptMask].Match(details.nickMaskCasefolded) { - // do not forward people who are banned: - return errBanned, "" - } - - // If the channel is set to registered users only and there is no invite exception for the joinee, don't join. - case details.account == "" && - (channel.flags.HasMode(modes.RegisteredOnly) || channel.server.Defcon() <= 2) && - !channel.lists[modes.InviteMask].Match(details.nickMaskCasefolded): - return errRegisteredOnly, forward + return errInviteOnly, "" default: - // + } if joinErr := client.addChannel(channel, rb == nil); joinErr != nil { diff --git a/irc/client.go b/irc/client.go index 6dcbdbd7..628d194f 100644 --- a/irc/client.go +++ b/irc/client.go @@ -454,7 +454,7 @@ func (server *Server) AddAlwaysOnClient(account ClientAccount, channelToStatus m for chname, status := range channelToStatus { // XXX we're using isSajoin=true, to make these joins succeed even without channel key // this is *probably* ok as long as the persisted memberships are accurate - server.channels.Join(client, chname, "", true, nil) + server.channels.Join(client, chname, "", false, nil) if channel := server.channels.Get(chname); channel != nil { channel.setMemberStatus(client, status) } else {