ircsupport

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: 4 Imported by: 0

Documentation

Overview

Package ircsupport parses and stores the negotiated IRC 005 RPL_ISUPPORT tokens and exposes server-dependent helpers derived from them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChanModeKind

type ChanModeKind int

ChanModeKind classifies a channel mode by its CHANMODES letter group.

const (
	// ChanModeUnknown indicates a mode not listed in CHANMODES.
	ChanModeUnknown ChanModeKind = iota
	// ChanModeListMask is a group A mode that always takes a parameter.
	ChanModeListMask
	// ChanModeParamSet is a group B mode that takes a parameter on add and remove.
	ChanModeParamSet
	// ChanModeParamAdd is a group C mode that takes a parameter only on add.
	ChanModeParamAdd
	// ChanModePlain is a group D mode that takes no parameter.
	ChanModePlain
)

type ISupport

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

ISupport holds the negotiated 005 RPL_ISUPPORT tokens and is goroutine-safe.

func New

func New() *ISupport

New returns an ISupport preloaded with spec defaults.

func (*ISupport) Apply

func (i *ISupport) Apply(token string)

Apply ingests a single ISUPPORT token of the form "KEY=VAL", bare "KEY", or "-KEY".

func (*ISupport) CaseMap

func (i *ISupport) CaseMap() casemap.Mapper

CaseMap returns the negotiated case-mapping function.

func (*ISupport) ChanModeKind

func (i *ISupport) ChanModeKind(m rune) ChanModeKind

ChanModeKind returns the CHANMODES classification of channel mode m.

func (*ISupport) Fold

func (i *ISupport) Fold(s string) string

Fold returns s normalised according to the negotiated case mapping.

func (*ISupport) Get

func (i *ISupport) Get(key string) (string, bool)

Get returns the value stored for key and reports whether the token is present.

func (*ISupport) IsChannel

func (i *ISupport) IsChannel(target string) bool

IsChannel reports whether target names a channel under the negotiated CHANTYPES.

func (*ISupport) ModeFromSigil

func (i *ISupport) ModeFromSigil(sigil rune) (rune, bool)

ModeFromSigil returns the membership mode for a sigil and reports whether it is known.

func (*ISupport) Network

func (i *ISupport) Network() string

Network returns the negotiated network name, or the empty string if unset.

func (*ISupport) ParseModeString

func (i *ISupport) ParseModeString(modes string, params []string) []ModeChange

ParseModeString turns a channel MODE string and its params into ordered changes.

func (*ISupport) ParseUserModeString

func (i *ISupport) ParseUserModeString(modes string) []ModeChange

ParseUserModeString parses a user MODE string into ordered changes without parameters.

func (*ISupport) PrefixModes

func (i *ISupport) PrefixModes() []rune

PrefixModes returns the membership mode letters in PREFIX order, highest privilege first.

func (*ISupport) PrefixSigil

func (i *ISupport) PrefixSigil(mode rune) (rune, bool)

PrefixSigil returns the sigil for a membership mode and reports whether it is known.

type ISupportView

type ISupportView interface {
	Get(key string) (string, bool)
	Network() string
	CaseMap() casemap.Mapper
	Fold(s string) string
	IsChannel(target string) bool
	PrefixModes() []rune
	PrefixSigil(mode rune) (rune, bool)
	ModeFromSigil(sigil rune) (rune, bool)
	ParseModeString(modes string, params []string) []ModeChange
	ParseUserModeString(modes string) []ModeChange
	ChanModeKind(m rune) ChanModeKind
}

ISupportView is the read-only surface of ISupport handed to consumers.

type ModeChange

type ModeChange struct {
	Add   bool
	Mode  rune
	Param string
}

ModeChange represents a single add or remove of one mode with its parameter.

Directories

Path Synopsis
Package casemap folds nicks and channel names to a canonical form per the negotiated CASEMAPPING token so that case-insensitive comparison works.
Package casemap folds nicks and channel names to a canonical form per the negotiated CASEMAPPING token so that case-insensitive comparison works.

Jump to

Keyboard shortcuts

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