caps

package
v1.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LabelTagName is the tag name used for the labeled-response spec.
	// https://ircv3.net/specs/extensions/labeled-response.html
	LabelTagName = "draft/label"
)

Variables

View Source
var (
	NoSuchCap = errors.New("Unsupported capability name")
)

Functions

This section is empty.

Types

type Capability

type Capability uint

Capability represents an optional feature that a client may request from the server.

const (
	// Acc is the proposed IRCv3 capability named "draft/acc":
	// https://github.com/ircv3/ircv3-specifications/pull/276
	Acc Capability = iota

	// AccountNotify is the IRCv3 capability named "account-notify":
	// https://ircv3.net/specs/extensions/account-notify-3.1.html
	AccountNotify Capability = iota

	// AccountTag is the IRCv3 capability named "account-tag":
	// https://ircv3.net/specs/extensions/account-tag-3.2.html
	AccountTag Capability = iota

	// AwayNotify is the IRCv3 capability named "away-notify":
	// https://ircv3.net/specs/extensions/away-notify-3.1.html
	AwayNotify Capability = iota

	// Batch is the IRCv3 capability named "batch":
	// https://ircv3.net/specs/extensions/batch-3.2.html
	Batch Capability = iota

	// CapNotify is the IRCv3 capability named "cap-notify":
	// https://ircv3.net/specs/extensions/cap-notify-3.2.html
	CapNotify Capability = iota

	// ChgHost is the IRCv3 capability named "chghost":
	// https://ircv3.net/specs/extensions/chghost-3.2.html
	ChgHost Capability = iota

	// EchoMessage is the IRCv3 capability named "echo-message":
	// https://ircv3.net/specs/extensions/echo-message-3.2.html
	EchoMessage Capability = iota

	// ExtendedJoin is the IRCv3 capability named "extended-join":
	// https://ircv3.net/specs/extensions/extended-join-3.1.html
	ExtendedJoin Capability = iota

	// InviteNotify is the IRCv3 capability named "invite-notify":
	// https://ircv3.net/specs/extensions/invite-notify-3.2.html
	InviteNotify Capability = iota

	// LabeledResponse is the draft IRCv3 capability named "draft/labeled-response":
	// https://ircv3.net/specs/extensions/labeled-response.html
	LabeledResponse Capability = iota

	// Languages is the proposed IRCv3 capability named "draft/languages":
	// https://gist.github.com/DanielOaks/8126122f74b26012a3de37db80e4e0c6
	Languages Capability = iota

	// MaxLine is the Oragono-specific capability named "oragono.io/maxline-2":
	// https://oragono.io/maxline-2
	MaxLine Capability = iota

	// MessageTags is the IRCv3 capability named "message-tags":
	// https://ircv3.net/specs/extensions/message-tags.html
	MessageTags Capability = iota

	// MultiPrefix is the IRCv3 capability named "multi-prefix":
	// https://ircv3.net/specs/extensions/multi-prefix-3.1.html
	MultiPrefix Capability = iota

	// Rename is the proposed IRCv3 capability named "draft/rename":
	// https://github.com/SaberUK/ircv3-specifications/blob/rename/extensions/rename.md
	Rename Capability = iota

	// Resume is the proposed IRCv3 capability named "draft/resume-0.5":
	// https://github.com/DanielOaks/ircv3-specifications/blob/master+resume/extensions/resume.md
	Resume Capability = iota

	// SASL is the IRCv3 capability named "sasl":
	// https://ircv3.net/specs/extensions/sasl-3.2.html
	SASL Capability = iota

	// ServerTime is the IRCv3 capability named "server-time":
	// https://ircv3.net/specs/extensions/server-time-3.2.html
	ServerTime Capability = iota

	// SetName is the proposed IRCv3 capability named "draft/setname":
	// https://github.com/ircv3/ircv3-specifications/pull/361
	SetName Capability = iota

	// STS is the IRCv3 capability named "sts":
	// https://ircv3.net/specs/extensions/sts.html
	STS Capability = iota

	// UserhostInNames is the IRCv3 capability named "userhost-in-names":
	// https://ircv3.net/specs/extensions/userhost-in-names-3.2.html
	UserhostInNames Capability = iota

	// Bouncer is the Oragono-specific capability named "oragono.io/bnc":
	// https://oragono.io/bnc
	Bouncer Capability = iota

	// ZNCSelfMessage is the ZNC vendor capability named "znc.in/self-message":
	// https://wiki.znc.in/Query_buffers
	ZNCSelfMessage Capability = iota

	// EventPlayback is the Proposed IRCv3 capability named "draft/event-playback":
	// https://github.com/ircv3/ircv3-specifications/pull/362
	EventPlayback Capability = iota

	// ZNCPlayback is the ZNC vendor capability named "znc.in/playback":
	// https://wiki.znc.in/Playback
	ZNCPlayback Capability = iota

	// Nope is the Oragono vendor capability named "oragono.io/nope":
	// https://oragono.io/nope
	Nope Capability = iota
)

func NameToCapability added in v0.12.0

func NameToCapability(name string) (result Capability, err error)

func (Capability) Name

func (capability Capability) Name() string

Name returns the name of the given capability.

type Set

type Set [bitsetLen]uint32

Set holds a set of enabled capabilities.

func NewCompleteSet added in v1.1.0

func NewCompleteSet() *Set

NewCompleteSet returns a new Set, with all defined capabilities enabled.

func NewSet

func NewSet(capabs ...Capability) *Set

NewSet returns a new Set, with the given capabilities enabled.

func (*Set) Add

func (s *Set) Add(capabs ...Capability)

Add adds the given capabilities to this set. this is just a wrapper to allow more clear use.

func (*Set) Disable

func (s *Set) Disable(capabs ...Capability)

Disable disables the given capabilities.

func (*Set) Empty added in v0.12.0

func (s *Set) Empty() bool

Empty returns whether the set is empty.

func (*Set) Enable

func (s *Set) Enable(capabs ...Capability)

Enable enables the given capabilities.

func (*Set) Has

func (s *Set) Has(capab Capability) bool

Has returns true if this set has the given capability.

func (*Set) HasAll added in v1.1.0

func (s *Set) HasAll(capabs ...Capability) bool

HasAll returns true if the set has all the given capabilities.

func (*Set) Remove

func (s *Set) Remove(capabs ...Capability)

Remove removes the given capabilities from this set. this is just a wrapper to allow more clear use.

func (*Set) String

func (s *Set) String(version Version, values *Values) string

String returns all of our enabled capabilities as a string.

func (*Set) Subtract added in v1.0.0

func (s *Set) Subtract(other *Set)

Subtract removes all the capabilities of another set from this set.

func (*Set) Union added in v0.12.0

func (s *Set) Union(other *Set)

Union adds all the capabilities of another set to this set.

type State added in v0.11.0

type State uint

State shows whether we're negotiating caps, finished, etc for connection registration.

const (
	// NoneState means CAP hasn't been negotiated at all.
	NoneState State = iota
	// NegotiatingState means CAP is being negotiated and registration should be paused.
	NegotiatingState State = iota
	// NegotiatedState means CAP negotiation has been successfully ended and reg should complete.
	NegotiatedState State = iota
)

type Values

type Values struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Values holds capability values.

func NewValues

func NewValues() *Values

NewValues returns a new Values.

func (*Values) Get

func (v *Values) Get(capab Capability) (string, bool)

Get returns the value of the given capability, and whether one exists.

func (*Values) Set

func (v *Values) Set(capab Capability, value string)

Set sets the value for the given capability.

func (*Values) Unset

func (v *Values) Unset(capab Capability)

Unset removes the value for the given capability, if it exists.

type Version

type Version uint

Version is used to select which max version of CAP the client supports.

const (
	// Cap301 refers to the base CAP spec.
	Cap301 Version = 301
	// Cap302 refers to the IRCv3.2 CAP spec.
	Cap302 Version = 302
)

Jump to

Keyboard shortcuts

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