ircmap

package
v0.0.0-...-f5e0f87 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: ISC Imports: 4 Imported by: 0

Documentation

Overview

Package ircmap handles IRC casefolding, ie ascii/rfc1459 casefolding.

Index

Constants

This section is empty.

Variables

View Source
var ChannelPrefixes = map[byte]bool{

	'#': true,
	'&': true,

	'!': true,
	'+': true,

	'~': true,
}

ChannelPrefixes are the allowed prefixes for channels, used in casefolding.

View Source
var (
	// ErrCouldNotStabilize indicates that we could not stabilize the input string.
	ErrCouldNotStabilize = errors.New("Could not stabilize string while casefolding")
)
View Source
var (
	// Mappings is a mapping of ISUPPORT CASEMAP strings to our MappingTypes.
	Mappings = map[string]MappingType{
		"ascii":   ASCII,
		"rfc1459": RFC1459,
		"rfc3454": RFC3454,
		"rfc7613": RFC7613,
	}
)

Functions

func Casefold

func Casefold(mapping MappingType, input string) (string, error)

Casefold returns a string, lowercased/casefolded according to the given mapping as defined by this package (or an error if the given string is not valid in the chosen mapping).

func CasefoldCustomChannelPrefixes

func CasefoldCustomChannelPrefixes(mapping MappingType, input string, channelPrefixes map[byte]bool) (string, error)

CasefoldCustomChannelPrefixes returns a string, lowercased/casefolded according to the given mapping as defined by this package (or an error if the given string is not valid in the chosen mapping), using a custom channel prefix map.

func PrecisCasefold

func PrecisCasefold(str string) (string, error)

PrecisCasefold returns a casefolded string, without doing any name or channel character checks.

Types

type MappingType

type MappingType int

MappingType values represent the types of IRC casemapping we support.

const (
	// NONE represents no casemapping.
	NONE MappingType = 0 + iota

	// ASCII represents the traditional "ascii" casemapping.
	ASCII

	// RFC1459 represents the casemapping defined by "rfc1459"
	RFC1459

	// RFC3454 represents the UTF-8 nameprep casefolding as used by mammon-ircd.
	RFC3454

	// RFC7613 represents the UTF-8 casefolding currently being drafted by me
	// with the IRCv3 WG.
	RFC7613
)

Jump to

Keyboard shortcuts

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