Wow
This commit is contained in:
parent
340b255f0e
commit
b77163886a
@ -730,6 +730,19 @@ func (channel *Channel) Join(client *Client, key string, isSajoin bool, rb *Resp
|
|||||||
founder == details.account && details.account != "":
|
founder == details.account && details.account != "":
|
||||||
break
|
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.
|
// If the channel has limited capacity and they are over said capacity, don't join.
|
||||||
case limit != 0 && chcount >= limit:
|
case limit != 0 && chcount >= limit:
|
||||||
return errLimitExceeded, forward
|
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.
|
// If the channel is invite only and they joinee does not have an invite exception, don't join.
|
||||||
case channel.flags.HasMode(modes.InviteOnly):
|
case channel.flags.HasMode(modes.InviteOnly):
|
||||||
// anyone who automatically receives halfop or higher can join despite invite only mode.
|
// 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
|
break
|
||||||
}
|
}
|
||||||
// people invited with INVITE can join.
|
// 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) {
|
if channel.lists[modes.InviteMask].Match(details.nickMaskCasefolded) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
return errInviteOnly, forward
|
return errInviteOnly, ""
|
||||||
|
|
||||||
// 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
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if joinErr := client.addChannel(channel, rb == nil); joinErr != nil {
|
if joinErr := client.addChannel(channel, rb == nil); joinErr != nil {
|
||||||
|
@ -454,7 +454,7 @@ func (server *Server) AddAlwaysOnClient(account ClientAccount, channelToStatus m
|
|||||||
for chname, status := range channelToStatus {
|
for chname, status := range channelToStatus {
|
||||||
// XXX we're using isSajoin=true, to make these joins succeed even without channel key
|
// 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
|
// 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 {
|
if channel := server.channels.Get(chname); channel != nil {
|
||||||
channel.setMemberStatus(client, status)
|
channel.setMemberStatus(client, status)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user