ircstate

package
v0.0.0-...-1a94ce6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package ircstate maintains channel, user, and mode state for one connection from the parsed message stream, exposing value snapshots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelView

type ChannelView struct {
	Name       string
	Topic      string
	TopicSetBy string
	TopicSetAt time.Time
	Modes      []ModeView
	ListModes  map[rune][]string
	Created    time.Time
	Members    []MemberView
	JoinedAt   time.Time
}

ChannelView is a value snapshot of one channel's state.

type MemberView

type MemberView struct {
	Nick     string
	Account  string
	User     string
	Host     string
	Prefixes []rune
	Away     bool
	Bot      bool
}

MemberView is a value snapshot of one channel member.

type ModeView

type ModeView struct {
	Mode  rune
	Param string
}

ModeView holds one channel mode and its parameter.

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker holds channel, user, and mode state for one connection, guarded by a single mutex.

func New

func New() *Tracker

New returns a Tracker with empty state.

func (*Tracker) ApplyISupport

func (t *Tracker) ApplyISupport(token string)

ApplyISupport ingests one 005 ISUPPORT token.

func (*Tracker) ApplyMessage

func (t *Tracker) ApplyMessage(m ircmsg.Message)

ApplyMessage updates state from one parsed line.

func (*Tracker) CapValue

func (t *Tracker) CapValue(name string) (string, bool)

CapValue returns a capability's negotiated value and whether it is enabled.

func (*Tracker) Caps

func (t *Tracker) Caps() []string

Caps returns the enabled capability names in sorted order.

func (*Tracker) Channel

func (t *Tracker) Channel(name string) (ChannelView, bool)

Channel returns a snapshot of the named channel and whether it is tracked.

func (*Tracker) Channels

func (t *Tracker) Channels() []ChannelView

Channels returns snapshots of all tracked channels.

func (*Tracker) HasCap

func (t *Tracker) HasCap(name string) bool

HasCap reports whether the named capability is enabled.

func (*Tracker) ISupport

func (t *Tracker) ISupport() ircsupport.ISupportView

ISupport returns the read-only ISUPPORT view.

func (*Tracker) Reset

func (t *Tracker) Reset()

Reset drops all per-connection state and returns ISUPPORT to defaults.

func (*Tracker) Self

func (t *Tracker) Self() string

Self returns the connection's current display nick.

func (*Tracker) SetCap

func (t *Tracker) SetCap(name, value string, enabled bool)

SetCap records a capability as enabled or disabled.

func (*Tracker) SetSelf

func (t *Tracker) SetSelf(nick string)

SetSelf records the connection's confirmed nick.

func (*Tracker) User

func (t *Tracker) User(nick string) (UserView, bool)

User returns a snapshot of the named user and whether it is tracked.

type UserView

type UserView struct {
	Nick     string
	Account  string
	User     string
	Host     string
	Realname string
	Channels []string
}

UserView is a value snapshot of one user's state.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL