xirc

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package xirc contains an extended IRC library.

Index

Constants

View Source
const (
	RPL_STATSPING     = "246"
	RPL_LOCALUSERS    = "265"
	RPL_GLOBALUSERS   = "266"
	RPL_WHOISCERTFP   = "276"
	RPL_WHOISREGNICK  = "307"
	RPL_WHOISSPECIAL  = "320"
	RPL_CREATIONTIME  = "329"
	RPL_WHOISACCOUNT  = "330"
	RPL_TOPICWHOTIME  = "333"
	RPL_WHOISACTUALLY = "338"
	RPL_WHOSPCRPL     = "354"
	RPL_WHOISHOST     = "378"
	RPL_WHOISMODES    = "379"
	RPL_VISIBLEHOST   = "396"
	ERR_UNKNOWNERROR  = "400"
	ERR_INVALIDCAPCMD = "410"
	RPL_WHOISSECURE   = "671"

	// https://ircv3.net/specs/extensions/bot-mode
	RPL_WHOISBOT = "335"
)
View Source
const MaxSASLLength = 400
View Source
const ServerTimeLayout = "2006-01-02T15:04:05.000Z"

The server-time layout, as defined in the IRCv3 spec.

Variables

This section is empty.

Functions

func FormatServerTime

func FormatServerTime(t time.Time) string

FormatServerTime formats a time with the server-time layout.

func GenerateIsupport

func GenerateIsupport(tokens []string) []*irc.Message

func GenerateJoin

func GenerateJoin(channels, keys []string) []*irc.Message

func GenerateMOTD

func GenerateMOTD(motd string) []*irc.Message

func GenerateMonitor

func GenerateMonitor(subcmd string, targets []string) []*irc.Message

func GenerateNamesReply

func GenerateNamesReply(channel string, status ChannelStatus, members []string) []*irc.Message

func GenerateSASL

func GenerateSASL(resp []byte) []*irc.Message

func GenerateWHOXReply

func GenerateWHOXReply(fields string, info *WHOXInfo) *irc.Message

func ParseCTCPMessage

func ParseCTCPMessage(msg *irc.Message) (cmd string, params string, ok bool)

ParseCTCPMessage parses a CTCP message. CTCP is defined in https://tools.ietf.org/html/draft-oakley-irc-ctcp-02

func ParseWHOXOptions

func ParseWHOXOptions(options string) (fields, whoxToken string)

Types

type CapRegistry

type CapRegistry struct {
	Available map[string]string
	Enabled   map[string]struct{}
}

func NewCapRegistry

func NewCapRegistry() CapRegistry

func (*CapRegistry) Del

func (cr *CapRegistry) Del(name string)

func (*CapRegistry) IsAvailable

func (cr *CapRegistry) IsAvailable(name string) bool

func (*CapRegistry) IsEnabled

func (cr *CapRegistry) IsEnabled(name string) bool

func (*CapRegistry) SetEnabled

func (cr *CapRegistry) SetEnabled(name string, enabled bool)

type CaseMapping

type CaseMapping func(string) string

CaseMapping returns the canonical representation of a name according to an IRC case-mapping.

var (
	CaseMappingASCII         CaseMapping = casemapASCII
	CaseMappingRFC1459       CaseMapping = casemapRFC1459
	CaseMappingRFC1459Strict CaseMapping = casemapRFC1459Strict
)

func ParseCaseMapping

func ParseCaseMapping(s string) CaseMapping

type CaseMappingMap

type CaseMappingMap[V interface{}] struct {
	// contains filtered or unexported fields
}

func NewCaseMappingMap

func NewCaseMappingMap[V interface{}](cm CaseMapping) CaseMappingMap[V]

func (*CaseMappingMap[V]) Del

func (cmm *CaseMappingMap[V]) Del(name string)

func (*CaseMappingMap[V]) ForEach

func (cmm *CaseMappingMap[V]) ForEach(f func(string, V))

func (*CaseMappingMap[V]) Get

func (cmm *CaseMappingMap[V]) Get(name string) V

func (*CaseMappingMap[V]) Has

func (cmm *CaseMappingMap[V]) Has(name string) bool

func (*CaseMappingMap[V]) Len

func (cmm *CaseMappingMap[V]) Len() int

func (*CaseMappingMap[V]) Set

func (cmm *CaseMappingMap[V]) Set(name string, value V)

func (*CaseMappingMap[V]) SetCaseMapping

func (cmm *CaseMappingMap[V]) SetCaseMapping(newCasemap CaseMapping)

type ChannelStatus

type ChannelStatus byte
const (
	ChannelPublic  ChannelStatus = '='
	ChannelSecret  ChannelStatus = '@'
	ChannelPrivate ChannelStatus = '*'
)

func ParseChannelStatus

func ParseChannelStatus(s string) (ChannelStatus, error)

type Membership

type Membership struct {
	Mode   byte
	Prefix byte
}

Membership is a channel member rank.

type MembershipSet

type MembershipSet []Membership

MembershipSet is a set of memberships sorted by descending rank.

func (*MembershipSet) Add

func (ms *MembershipSet) Add(availableMemberships []Membership, newMembership Membership)

func (*MembershipSet) Remove

func (ms *MembershipSet) Remove(membership Membership)

type WHOXInfo

type WHOXInfo struct {
	Token    string
	Channel  string
	Username string
	Hostname string
	Server   string
	Nickname string
	Flags    string
	Account  string
	Realname string
}

func ParseWHOXReply

func ParseWHOXReply(msg *irc.Message, fields string) (*WHOXInfo, error)

Jump to

Keyboard shortcuts

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