rudimentary (broken) invite support

This commit is contained in:
Jeremy Latt 2012-12-09 13:47:02 -08:00
parent 55f7c89468
commit d7d6263e35
5 changed files with 244 additions and 46 deletions

View file

@ -119,3 +119,20 @@ func (ch *Channel) ChangeTopic(cl *Client, newTopic string) {
ch.Send(RplNoTopic(ch), nil)
}
}
func (ch *Channel) Invite(inviter *Client, invitee *Client) {
if !ch.members[inviter] {
inviter.send <- ErrNotOnChannel(ch)
return
}
if ch.members[invitee] {
inviter.send <- ErrUserOnChannel(ch, invitee)
return
}
ch.invites[invitee.nick] = true
invitee.send <- RplInviteMsg(ch, inviter)
inviter.send <- RplInvitingMsg(ch, invitee)
}