caps

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability string

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

const (
	// AccountNotify is this IRCv3 capability: http://ircv3.net/specs/extensions/account-notify-3.1.html
	AccountNotify Capability = "account-notify"
	// AccountTag is this IRCv3 capability: http://ircv3.net/specs/extensions/account-tag-3.2.html
	AccountTag Capability = "account-tag"
	// AwayNotify is this IRCv3 capability: http://ircv3.net/specs/extensions/away-notify-3.1.html
	AwayNotify Capability = "away-notify"
	// Batch is this IRCv3 capability: http://ircv3.net/specs/extensions/batch-3.2.html
	Batch Capability = "batch"
	// CapNotify is this IRCv3 capability: http://ircv3.net/specs/extensions/cap-notify-3.2.html
	CapNotify Capability = "cap-notify"
	// ChgHost is this IRCv3 capability: http://ircv3.net/specs/extensions/chghost-3.2.html
	ChgHost Capability = "chghost"
	// EchoMessage is this IRCv3 capability: http://ircv3.net/specs/extensions/echo-message-3.2.html
	EchoMessage Capability = "echo-message"
	// ExtendedJoin is this IRCv3 capability: http://ircv3.net/specs/extensions/extended-join-3.1.html
	ExtendedJoin Capability = "extended-join"
	// InviteNotify is this IRCv3 capability: http://ircv3.net/specs/extensions/invite-notify-3.2.html
	InviteNotify Capability = "invite-notify"
	// LabeledResponse is this draft IRCv3 capability: http://ircv3.net/specs/extensions/labeled-response.html
	LabeledResponse Capability = "draft/labeled-response"
	// MaxLine is this capability: https://oragono.io/maxline
	MaxLine Capability = "oragono.io/maxline"
	// MessageTags is this draft IRCv3 capability: http://ircv3.net/specs/core/message-tags-3.3.html
	MessageTags Capability = "draft/message-tags-0.2"
	// MultiPrefix is this IRCv3 capability: http://ircv3.net/specs/extensions/multi-prefix-3.1.html
	MultiPrefix Capability = "multi-prefix"
	// Rename is this proposed capability: https://github.com/SaberUK/ircv3-specifications/blob/rename/extensions/rename.md
	Rename Capability = "draft/rename"
	// SASL is this IRCv3 capability: http://ircv3.net/specs/extensions/sasl-3.2.html
	SASL Capability = "sasl"
	// ServerTime is this IRCv3 capability: http://ircv3.net/specs/extensions/server-time-3.2.html
	ServerTime Capability = "server-time"
	// STS is this IRCv3 capability: http://ircv3.net/specs/extensions/sts.html
	STS Capability = "sts"
	// UserhostInNames is this IRCv3 capability: http://ircv3.net/specs/extensions/userhost-in-names-3.2.html
	UserhostInNames Capability = "userhost-in-names"
)

func (Capability) Name

func (capability Capability) Name() string

Name returns the name of the given capability.

type Set

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

Set holds a set of enabled capabilities.

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) Count

func (s *Set) Count() int

Count returns how many enabled caps this set has.

func (*Set) Disable

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

Disable disables the given capabilities.

func (*Set) Enable

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

Enable enables the given capabilities.

func (*Set) Has

func (s *Set) Has(caps ...Capability) bool

Has returns true if this set has the given capabilities.

func (*Set) List

func (s *Set) List() []Capability

List return a list of our enabled 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.

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