Documentation
¶
Index ¶
- Constants
- Variables
- func PrepareModes(modes []mode.Mode, params []string)
- type ChanType
- type Channel
- func (ch *Channel) Admit(c *client.Client, key string) error
- func (ch *Channel) All() iter.Seq[*Member]
- func (ch *Channel) AllExcept(except *client.Client) iter.Seq[*Member]
- func (c *Channel) ApplyMode(m mode.Mode) error
- func (c *Channel) DeleteMember(m string)
- func (c *Channel) GetMember(m string) (*Member, bool)
- func (c *Channel) Len() int
- func (c *Channel) Modes() (modestr string, params []string)
- func (c *Channel) SetMember(v *Member)
- func (c *Channel) String() string
- func (c *Channel) WriteMessage(m msg.Msg)
- func (c *Channel) WriteMessageFrom(m msg.Msg, from *client.Client)
- type Member
Constants ¶
const ( // member Founder prefix = 1 << iota Protected Operator Halfop Voice )
Variables ¶
var ( ErrKeyMissing = errors.New("ERR_BADCHANNELKEY") ErrLimitReached = errors.New("ERR_CHANNELISFULL") ErrNotInvited = errors.New("ERR_INVITEONLYCHAN") ErrBanned = errors.New("ERR_BANNEDFROMCHAN") )
Functions ¶
func PrepareModes ¶
PrepareModes performs two tasks:
- associates the given params with the Params field of the modes. Params are processed in index order, so something like "MODE #test +ok alice password" will associate 'o' with 'alice' and 'k' with 'password'. This skips unknown mode characters.
- sets the Type of a mode to mode.List if there are no more params left to be associated and that particular mode is listable
Types ¶
type Channel ¶
type Channel struct {
// Name is case-insensitive, stored internally in lower-case
Name string
ChanType ChanType
CreatedAt time.Time
Topic string
TopicSetBy *client.Client
TopicSetAt time.Time
// array of nickmasks
Ban []string
BanExcept []string
Limit int
Invite bool
InviteExcept []string
Key string
Moderated bool
Secret bool
Protected bool
NoExternal bool
// Invited is a list of client nicks who have been INVITEd
Invited []string
// map of Nick to undelying client
Members *util.SafeMap[string, *Member]
}
func (*Channel) Admit ¶
Admit adds a client to this channel. A client c is admitted to enter a channel if:
- If this channel has a key, the client supplies the correct key
- admitting this client does not put the channel over the chanlimit
- their nick has been given an INVITE
- if they have not been given an INVITE, their nickmask is in the inviteException list
- their nickmask is not included in the banlist
- if they are in the banlist, they are in the except list
func (*Channel) AllExcept ¶
AllExcept returns an iterator of all members in the channel except ones matching the except Client.
func (*Channel) ApplyMode ¶
ApplyMode applies the given mode to the channel. It does not verify that the sending client has the proper permissions to make those changes. It returns a modeStr if the mode was successfully applied.
func (*Channel) DeleteMember ¶
func (*Channel) WriteMessage ¶
type Member ¶
Member is a Client that belongs to a channel. Members, unlike Clients, have the capability to be given a mode/prefix.
func (Member) HighestPrefix ¶
Returns the highest prefix that the member has. If multiPrefix is true, returns all the modes that this member has in order of rank.
func (Member) ModeLetters ¶
Reconstruct this member's prefix string as a string of each prefix matched to its corresponding mode letter