mode

package
v0.0.0-...-df918ef Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: ISC Imports: 4 Imported by: 0

Documentation

Overview

Package mode implements an IRC mode parsing library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode struct {
	Type   Type
	Char   rune
	Prefix string
}

Mode represents a single channel mode, its type, and the prefix its displayed with, if applicable

func (Mode) String

func (m Mode) String() string

type Sequence

type Sequence []SequenceEntry

Sequence is a sequence of mode changes

func (Sequence) Collapse

func (s Sequence) Collapse() Sequence

Collapse collapses a mode change Sequence into the eventual result of executing it

type SequenceEntry

type SequenceEntry struct {
	Adding bool
	Mode
	Parameter string
}

SequenceEntry is a list of mode changes

func (SequenceEntry) String

func (s SequenceEntry) String() string

type Set

type Set []Mode

Set is a []Mode with utility methods

func ModesFromISupportToken

func ModesFromISupportToken(tokenArgs string) Set

ModesFromISupportToken creates a Mode array from an ISUPPORT MODE token

func (Set) GetMode

func (m Set) GetMode(char rune) Mode

GetMode returns the mode in the ModeSet represented by char, if it exists. if char does not exist as a mode, its type is returned as -1

func (Set) ParseModeSequence

func (m Set) ParseModeSequence(sequence string) Sequence

ParseModeSequence parses a mode sequence to a useful set of mode changes

func (Set) String

func (m Set) String() string

type Type

type Type int

Type is one of any of the defined mode types. There *CAN* be others, which is why this is an int but I am not really planning to test or support this.

const (
	TypeA Type = iota
	TypeB
	TypeC
	TypeD

	TypeUnknown Type = -1
)

Mode types

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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