mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-22 19:12:05 -08:00
Disable channel modes and remove some client modes.
This commit is contained in:
parent
c99bc6b453
commit
dbaa73a319
6 changed files with 31 additions and 100 deletions
|
|
@ -1,17 +1,13 @@
|
|||
package irc
|
||||
|
||||
type Channel struct {
|
||||
server *Server
|
||||
name string
|
||||
key string
|
||||
topic string
|
||||
members ClientSet
|
||||
invites map[string]bool
|
||||
// modes
|
||||
inviteOnly bool
|
||||
noOutside bool
|
||||
// modes with args
|
||||
password string
|
||||
server *Server
|
||||
name string
|
||||
key string
|
||||
topic string
|
||||
members ClientSet
|
||||
noOutside bool
|
||||
password string
|
||||
}
|
||||
|
||||
type ChannelSet map[*Channel]bool
|
||||
|
|
@ -22,7 +18,6 @@ func NewChannel(s *Server, name string) *Channel {
|
|||
return &Channel{
|
||||
name: name,
|
||||
members: make(ClientSet),
|
||||
invites: make(map[string]bool),
|
||||
server: s,
|
||||
}
|
||||
}
|
||||
|
|
@ -57,11 +52,6 @@ func (ch *Channel) IsEmpty() bool {
|
|||
|
||||
func (ch *Channel) Join(cl *Client, key string) {
|
||||
if ch.key != key {
|
||||
cl.send <- ErrInviteOnlyChannel(ch)
|
||||
return
|
||||
}
|
||||
|
||||
if ch.inviteOnly && !ch.invites[cl.nick] {
|
||||
cl.send <- ErrBadChannelKey(ch)
|
||||
return
|
||||
}
|
||||
|
|
@ -122,20 +112,3 @@ 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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue