Documentation ¶
Overview ¶
Package ircmap handles IRC casefolding, ie ascii/rfc1459 casefolding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ChannelPrefixes = map[byte]bool{ '#': true, '&': true, '!': true, '+': true, '~': true, }
ChannelPrefixes are the allowed prefixes for channels, used in casefolding.
var ( // ErrCouldNotStabilize indicates that we could not stabilize the input string. ErrCouldNotStabilize = errors.New("Could not stabilize string while casefolding") )
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 ¶
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 )