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

fix RPL_INVITING response to match modern ircdocs

This commit is contained in:
Shivaram Lingamneni 2018-12-23 13:49:03 -05:00
parent b6b4d365bc
commit f58c873f84

View File

@ -957,13 +957,14 @@ func (channel *Channel) Kick(client *Client, target *Client, comment string, rb
// Invite invites the given client to the channel, if the inviter can do so. // Invite invites the given client to the channel, if the inviter can do so.
func (channel *Channel) Invite(invitee *Client, inviter *Client, rb *ResponseBuffer) { func (channel *Channel) Invite(invitee *Client, inviter *Client, rb *ResponseBuffer) {
chname := channel.Name()
if channel.flags.HasMode(modes.InviteOnly) && !channel.ClientIsAtLeast(inviter, modes.ChannelOperator) { if channel.flags.HasMode(modes.InviteOnly) && !channel.ClientIsAtLeast(inviter, modes.ChannelOperator) {
rb.Add(nil, inviter.server.name, ERR_CHANOPRIVSNEEDED, channel.name, inviter.t("You're not a channel operator")) rb.Add(nil, inviter.server.name, ERR_CHANOPRIVSNEEDED, chname, inviter.t("You're not a channel operator"))
return return
} }
if !channel.hasClient(inviter) { if !channel.hasClient(inviter) {
rb.Add(nil, inviter.server.name, ERR_NOTONCHANNEL, channel.name, inviter.t("You're not on that channel")) rb.Add(nil, inviter.server.name, ERR_NOTONCHANNEL, chname, inviter.t("You're not on that channel"))
return return
} }
@ -973,13 +974,12 @@ func (channel *Channel) Invite(invitee *Client, inviter *Client, rb *ResponseBuf
for _, member := range channel.Members() { for _, member := range channel.Members() {
if member.capabilities.Has(caps.InviteNotify) && member != inviter && member != invitee && channel.ClientIsAtLeast(member, modes.Halfop) { if member.capabilities.Has(caps.InviteNotify) && member != inviter && member != invitee && channel.ClientIsAtLeast(member, modes.Halfop) {
member.Send(nil, inviter.NickMaskString(), "INVITE", invitee.Nick(), channel.name) member.Send(nil, inviter.NickMaskString(), "INVITE", invitee.Nick(), chname)
} }
} }
//TODO(dan): should inviter.server.name here be inviter.nickMaskString ? rb.Add(nil, inviter.server.name, RPL_INVITING, inviter.Nick(), invitee.Nick(), chname)
rb.Add(nil, inviter.server.name, RPL_INVITING, invitee.nick, channel.name) invitee.Send(nil, inviter.nickMaskString, "INVITE", invitee.nick, chname)
invitee.Send(nil, inviter.nickMaskString, "INVITE", invitee.nick, channel.name)
if invitee.HasMode(modes.Away) { if invitee.HasMode(modes.Away) {
rb.Add(nil, inviter.server.name, RPL_AWAY, invitee.nick, invitee.awayMessage) rb.Add(nil, inviter.server.name, RPL_AWAY, invitee.nick, invitee.awayMessage)
} }