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

Merge pull request #1877 from slingamn/issue1876_invite_ban

fix #1876
This commit is contained in:
Shivaram Lingamneni 2021-12-19 20:58:51 -05:00 committed by GitHub
commit 8b74cd1fd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1513,7 +1513,8 @@ func (channel *Channel) Invite(invitee *Client, inviter *Client, rb *ResponseBuf
}
inviteOnly := channel.flags.HasMode(modes.InviteOnly)
if inviteOnly && !channel.ClientIsAtLeast(inviter, modes.ChannelOperator) {
hasPrivs := channel.ClientIsAtLeast(inviter, modes.ChannelOperator)
if inviteOnly && !hasPrivs {
rb.Add(nil, inviter.server.name, ERR_CHANOPRIVSNEEDED, inviter.Nick(), chname, inviter.t("You're not a channel operator"))
return
}
@ -1523,7 +1524,10 @@ func (channel *Channel) Invite(invitee *Client, inviter *Client, rb *ResponseBuf
return
}
if inviteOnly {
// #1876: INVITE should override all join restrictions, including +b and +l,
// not just +i. so we need to record it on a per-client basis iff the inviter
// is privileged:
if hasPrivs {
invitee.Invite(chcfname, createdAt)
}