stanza

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: BSD-3-Clause Imports: 11 Imported by: 33

README

XMPP Stanza

XMPP stanza package is used to parse, marshal and unmarshal XMPP stanzas and nonzas.

Stanza creation

When creating stanzas, you can use two approaches:

  1. You can create IQ, Presence or Message structs, set the fields and manually prepare extensions struct to add to the stanza.
  2. You can use stanza build helper to be guided when creating the stanza, and have more controls performed on the final stanza.

The methods are equivalent and you can use whatever suits you best. The helpers will finally generate the same type of struct that you can build by hand.

Composing stanzas manually with structs

Here is for example how you would generate an IQ discovery result:

iqResp := stanza.NewIQ(stanza.Attrs{Type: "result", From: iq.To, To: iq.From, Id: iq.Id})
identity := stanza.Identity{
	Name:     opts.Name,
	Category: opts.Category,
	Type:     opts.Type,
}
payload := stanza.DiscoInfo{
	XMLName: xml.Name{
		Space: stanza.NSDiscoInfo,
		Local: "query",
	},
	Identity: []stanza.Identity{identity},
	Features: []stanza.Feature{
		{Var: stanza.NSDiscoInfo},
		{Var: stanza.NSDiscoItems},
		{Var: "jabber:iq:version"},
		{Var: "urn:xmpp:delegation:1"},
	},
}
iqResp.Payload = &payload
Using helpers

Here is for example how you would generate an IQ discovery result using Builder:

iq := stanza.NewIQ(stanza.Attrs{Type: "get", To: "service.localhost", Id: "disco-get-1"})
disco := iq.DiscoInfo()
disco.AddIdentity("Test Component", "gateway", "service")
disco.AddFeatures(stanza.NSDiscoInfo, stanza.NSDiscoItems, "jabber:iq:version", "urn:xmpp:delegation:1")

Payload and extensions

Message

Here is the list of implemented message extensions:

  • Delegation

  • Markable

  • MarkAcknowledged

  • MarkDisplayed

  • MarkReceived

  • StateActive

  • StateComposing

  • StateGone

  • StateInactive

  • StatePaused

  • HTML

  • OOB

  • ReceiptReceived

  • ReceiptRequest

  • Mood

Presence

Here is the list of implemented presence extensions:

  • MucPresence
IQ

IQ (Information Queries) contain a payload associated with the request and possibly an error. The main difference with Message and Presence extension is that you can only have one payload per IQ. The XMPP specification does not support having multiple payloads.

Here is the list of structs implementing IQPayloads:

  • ControlSet
  • ControlSetResponse
  • Delegation
  • DiscoInfo
  • DiscoItems
  • Pubsub
  • Version
  • Node

Finally, when the payload of the parsed stanza is unknown, the parser will provide the unknown payload as a generic Node element. You can also use the Node struct to add custom information on stanza generation. However, in both cases, you may also consider adding your own custom extensions on stanzas.

Adding your own custom extensions on stanzas

Extensions are registered on launch using the Registry. It can be used to register you own custom payload. You may want to do so to support extensions we did not yet implement, or to add your own custom extensions to your XMPP stanzas.

To create an extension you need:

  1. to create a struct for that extension. It need to have XMLName for consistency and to tagged at the struct level with xml info.
  2. It need to implement one or several extensions interface: stanza.IQPayload, stanza.MsgExtension and / or stanza.PresExtension
  3. Add that custom extension to the stanza.TypeRegistry during the file init.

Here an example code showing how to create a custom IQPayload.

package myclient

import (
	"encoding/xml"

	"gosrc.io/xmpp/stanza"
)

type CustomPayload struct {
	XMLName xml.Name `xml:"my:custom:payload query"`
	Node    string   `xml:"node,attr,omitempty"`
}

func (c CustomPayload) Namespace() string {
	return c.XMLName.Space
}

func init() {
	stanza.TypeRegistry.MapExtension(stanza.PKTIQ, xml.Name{"my:custom:payload", "query"}, CustomPayload{})
}

Documentation

Overview

XMPP stanza package is used to parse, marshal and unmarshal XMPP stanzas and nonzas.

Index

Constants

View Source
const (
	CommandActionCancel   = "cancel"
	CommandActionComplete = "complete"
	CommandActionExecute  = "execute"
	CommandActionNext     = "next"
	CommandActionPrevious = "prev"

	CommandStatusCancelled = "canceled"
	CommandStatusCompleted = "completed"
	CommandStatusExecuting = "executing"

	CommandNoteTypeErr  = "error"
	CommandNoteTypeInfo = "info"
	CommandNoteTypeWarn = "warn"
)
View Source
const (
	FormTypeCancel = "cancel"
	FormTypeForm   = "form"
	FormTypeResult = "result"
	FormTypeSubmit = "submit"
)
View Source
const (
	FieldTypeBool        = "boolean"
	FieldTypeFixed       = "fixed"
	FieldTypeHidden      = "hidden"
	FieldTypeJidMulti    = "jid-multi"
	FieldTypeJidSingle   = "jid-single"
	FieldTypeListMulti   = "list-multi"
	FieldTypeListSingle  = "list-single"
	FieldTypeTextMulti   = "text-multi"
	FieldTypeTextPrivate = "text-private"
	FieldTypeTextSingle  = "text-Single"
)
View Source
const (
	// NSRoster is the Roster IQ namespace
	NSRoster = "jabber:iq:roster"
	// SubscriptionNone indicates the user does not have a subscription to
	// the contact's presence, and the contact does not have a subscription
	// to the user's presence; this is the default value, so if the subscription
	// attribute is not included then the state is to be understood as "none"
	SubscriptionNone = "none"

	// SubscriptionTo indicates the user has a subscription to the contact's
	// presence, but the contact does not have a subscription to the user's presence.
	SubscriptionTo = "to"

	// SubscriptionFrom indicates the contact has a subscription to the user's
	// presence, but the user does not have a subscription to the contact's presence
	SubscriptionFrom = "from"

	// SubscriptionBoth indicates the user and the contact have subscriptions to each
	// other's presence (also called a "mutual subscription")
	SubscriptionBoth = "both"
)
View Source
const (
	NSStream = "http://etherx.jabber.org/streams"

	NSSASL      = "urn:ietf:params:xml:ns:xmpp-sasl"
	NSBind      = "urn:ietf:params:xml:ns:xmpp-bind"
	NSSession   = "urn:ietf:params:xml:ns:xmpp-session"
	NSFraming   = "urn:ietf:params:xml:ns:xmpp-framing"
	NSClient    = "jabber:client"
	NSComponent = "jabber:component:accept"
)
View Source
const (
	AffiliationStatusMember      = "member"
	AffiliationStatusNone        = "none"
	AffiliationStatusOutcast     = "outcast"
	AffiliationStatusOwner       = "owner"
	AffiliationStatusPublisher   = "publisher"
	AffiliationStatusPublishOnly = "publish-only"
)
View Source
const (
	SubscriptionStatusNone         = "none"
	SubscriptionStatusPending      = "pending"
	SubscriptionStatusSubscribed   = "subscribed"
	SubscriptionStatusUnconfigured = "unconfigured"
)
View Source
const Assoc = "Associate"

********************* Associate *********************

View Source
const Disassoc = "Disassociate"

********************* Disassociate *********************

View Source
const (
	// NSDiscoInfo defines the namespace for disco IQ stanzas
	NSDiscoInfo = "http://jabber.org/protocol/disco#info"
)
View Source
const (
	NSDiscoItems = "http://jabber.org/protocol/disco#items"
)
View Source
const NSMsgChatMarkers = "urn:xmpp:chat-markers:0"
View Source
const NSMsgChatStateNotifications = "http://jabber.org/protocol/chatstates"
View Source
const NSMsgReceipts = "urn:xmpp:receipts"
View Source
const (
	// Common but not only possible namespace for query blocks in a result set context
	NSQuerySet = "jabber:iq:search"
)

Support for XEP-0059 See https://xmpp.org/extensions/xep-0059

View Source
const (
	NSStreamManagement = "urn:xmpp:sm:3"
)
View Source
const PubSubCollectionEventName = "Collection"
View Source
const PubSubConfigEventName = "Configuration"
View Source
const PubSubDeleteEventName = "Delete"

********************* Delete *********************

View Source
const PubSubItemsEventName = "List"
View Source
const PubSubPurgeEventName = "Purge"

********************* Purge *********************

View Source
const PubSubSubscriptionEventName = "Subscription"

********************* Subscription *********************

View Source
const StreamClose = "</stream:stream>"

Variables

View Source
var (
	IqTypeUnset  = errors.New("iq type is not set but is mandatory")
	IqIDUnset    = errors.New("iq stanza ID is not set but is mandatory")
	IqSGetNoPl   = errors.New("iq is of type get or set but has no payload")
	IqResNoPl    = errors.New("iq is of type result but has no payload")
	IqErrNoErrPl = errors.New("iq is of type error but has no error payload")
)
View Source
var TypeRegistry = newRegistry()

Functions

func InitStream

func InitStream(p *xml.Decoder) (sessionID string, err error)

Reads and checks the opening XMPP stream element. TODO It returns a stream structure containing:

  • Host: You can check the host against the host you were expecting to connect to
  • Id: the Stream ID is a temporary shared secret used for some hash calculation. It is also used by ProcessOne reattach features (allowing to resume an existing stream at the point the connection was interrupted, without getting through the authentication process.

TODO We should handle stream error from XEP-0114 ( <conflict/> or <host-unknown/> )

func NextStart

func NextStart(p *xml.Decoder) (xml.StartElement, error)

NextStart scans XML token stream to find next StartElement.

func NextXmppToken added in v0.4.0

func NextXmppToken(p *xml.Decoder) (xml.Token, error)

NextXmppToken scans XML token stream to find next StartElement or stream EndElement. We need the EndElement scan, because we must register stream close tags

Types

type Actions added in v0.4.0

type Actions struct {
	Prev     *struct{} `xml:"prev,omitempty"`
	Next     *struct{} `xml:"next,omitempty"`
	Complete *struct{} `xml:"complete,omitempty"`

	Execute string `xml:"execute,attr,omitempty"`
}

func (*Actions) Ref added in v0.4.0

func (a *Actions) Ref() string

type Affiliation added in v0.4.0

type Affiliation struct {
	AffiliationStatus string `xml:"affiliation"`
	Node              string `xml:"node,attr"`
}

type AffiliationOwner added in v0.4.0

type AffiliationOwner struct {
	XMLName           xml.Name `xml:"affiliation"`
	AffiliationStatus string   `xml:"affiliation,attr"`
	Jid               string   `xml:"jid,attr"`
}

type Affiliations added in v0.4.0

type Affiliations struct {
	List []Affiliation `xml:"affiliation"`
	Node string        `xml:"node,attr,omitempty"`
}

type AffiliationsOwner added in v0.4.0

type AffiliationsOwner struct {
	XMLName      xml.Name           `xml:"affiliations"`
	Affiliations []AffiliationOwner `xml:"affiliation,omitempty"`
	Node         string             `xml:"node,attr"`
}

func (AffiliationsOwner) UseCase added in v0.4.0

func (AffiliationsOwner) UseCase() string

type AssocDisassoc added in v0.4.0

type AssocDisassoc interface {
	GetAssocDisassoc() string
}

********************* Associate/Disassociate *********************

type AssociateEvent added in v0.4.0

type AssociateEvent struct {
	XMLName xml.Name `xml:"associate"`
	Node    string   `xml:"node,attr"`
}

func (*AssociateEvent) GetAssocDisassoc added in v0.4.0

func (a *AssociateEvent) GetAssocDisassoc() string

type Attr

type Attr struct {
	K string
	V string
}

Attr represents generic XML attributes, as used on the generic XML Node representation.

type Attrs

type Attrs struct {
	Type StanzaType `xml:"type,attr,omitempty"`
	Id   string     `xml:"id,attr,omitempty"`
	From string     `xml:"from,attr,omitempty"`
	To   string     `xml:"to,attr,omitempty"`
	Lang string     `xml:"lang,attr,omitempty"`
}

Attrs represents the common structure for base XMPP packets.

type BadFormat added in v0.5.0

type BadFormat struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas bad-format"`
}

func (*BadFormat) GroupErrorName added in v0.5.0

func (e *BadFormat) GroupErrorName() string

type BadNamespacePrefix added in v0.5.0

type BadNamespacePrefix struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas bad-namespace-prefix"`
}

func (*BadNamespacePrefix) GroupErrorName added in v0.5.0

func (e *BadNamespacePrefix) GroupErrorName() string

type Bind

type Bind struct {
	XMLName  xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-bind bind"`
	Resource string   `xml:"resource,omitempty"`
	Jid      string   `xml:"jid,omitempty"`
	// Result sets
	ResultSet *ResultSet `xml:"set,omitempty"`
}

Bind is an IQ payload used during session negotiation to bind user resource to the current XMPP stream. Reference: https://tools.ietf.org/html/rfc6120#section-7

func (*Bind) GetSet added in v0.5.0

func (b *Bind) GetSet() *ResultSet

func (*Bind) Namespace

func (b *Bind) Namespace() string

type Caps

type Caps struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/caps c"`
	Hash    string   `xml:"hash,attr"`
	Node    string   `xml:"node,attr"`
	Ver     string   `xml:"ver,attr"`
	Ext     string   `xml:"ext,attr,omitempty"`
}

Capabilities Reference: https://xmpp.org/extensions/xep-0115.html#stream

"A server MAY include its entity capabilities in a stream feature element so that connecting clients
 and peer servers do not need to send service discovery requests each time they connect."

This is not a stream feature but a way to let client cache server disco info.

type CollectionEvent added in v0.4.0

type CollectionEvent struct {
	AssocDisassoc AssocDisassoc
	Node          string `xml:"node,attr,omitempty"`
}

func (CollectionEvent) Name added in v0.4.0

func (c CollectionEvent) Name() string

type Command added in v0.4.0

type Command struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/commands command"`

	CommandElement CommandElement

	BadAction       *struct{} `xml:"bad-action,omitempty"`
	BadLocale       *struct{} `xml:"bad-locale,omitempty"`
	BadPayload      *struct{} `xml:"bad-payload,omitempty"`
	BadSessionId    *struct{} `xml:"bad-sessionid,omitempty"`
	MalformedAction *struct{} `xml:"malformed-action,omitempty"`
	SessionExpired  *struct{} `xml:"session-expired,omitempty"`

	// Attributes
	Action    string `xml:"action,attr,omitempty"`
	Node      string `xml:"node,attr"`
	SessionId string `xml:"sessionid,attr,omitempty"`
	Status    string `xml:"status,attr,omitempty"`
	Lang      string `xml:"lang,attr,omitempty"`

	// Result sets
	ResultSet *ResultSet `xml:"set,omitempty"`
}

func (*Command) GetSet added in v0.5.0

func (c *Command) GetSet() *ResultSet

func (*Command) Namespace added in v0.4.0

func (c *Command) Namespace() string

func (*Command) UnmarshalXML added in v0.4.0

func (c *Command) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type CommandElement added in v0.4.0

type CommandElement interface {
	Ref() string
}

type ConfigurationEvent added in v0.4.0

type ConfigurationEvent struct {
	Node string `xml:"node,attr,omitempty"`
	Form *Form
}

func (ConfigurationEvent) Name added in v0.4.0

func (c ConfigurationEvent) Name() string

type Configure added in v0.4.0

type Configure struct {
	Form *Form `xml:"x"`
}

type ConfigureOwner added in v0.4.0

type ConfigureOwner struct {
	XMLName xml.Name `xml:"configure"`
	Node    string   `xml:"node,attr,omitempty"`
	Form    *Form    `xml:"x,omitempty"`
}

func (*ConfigureOwner) UseCase added in v0.4.0

func (*ConfigureOwner) UseCase() string

type Conflict added in v0.5.0

type Conflict struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas conflict"`
}

func (*Conflict) GroupErrorName added in v0.5.0

func (e *Conflict) GroupErrorName() string

type ConnectionTimeout added in v0.5.0

type ConnectionTimeout struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas connection-timeout"`
}

func (*ConnectionTimeout) GroupErrorName added in v0.5.0

func (e *ConnectionTimeout) GroupErrorName() string

type ControlField

type ControlField struct {
	XMLName xml.Name
	Name    string `xml:"name,attr,omitempty"`
	Value   string `xml:"value,attr,omitempty"`
}

type ControlGetForm

type ControlGetForm struct {
	XMLName xml.Name `xml:"urn:xmpp:iot:control getForm"`
}

type ControlSet

type ControlSet struct {
	XMLName xml.Name       `xml:"urn:xmpp:iot:control set"`
	Fields  []ControlField `xml:",any"`
	// Result sets
	ResultSet *ResultSet `xml:"set,omitempty"`
}

func (*ControlSet) GetSet added in v0.5.0

func (c *ControlSet) GetSet() *ResultSet

func (*ControlSet) Namespace

func (c *ControlSet) Namespace() string

type ControlSetResponse

type ControlSetResponse struct {
	XMLName xml.Name `xml:"urn:xmpp:iot:control setResponse"`
}

func (*ControlSetResponse) GetSet added in v0.5.0

func (c *ControlSetResponse) GetSet() *ResultSet

func (*ControlSetResponse) Namespace

func (c *ControlSetResponse) Namespace() string

type Create added in v0.4.0

type Create struct {
	Node string `xml:"node,attr,omitempty"`
}

type Default added in v0.4.0

type Default struct {
	Node string `xml:"node,attr,omitempty"`
	Type string `xml:"type,attr,omitempty"`
	Form *Form  `xml:"x"`
}

type DefaultOwner added in v0.4.0

type DefaultOwner struct {
	XMLName xml.Name `xml:"default"`
	Form    *Form    `xml:"x,omitempty"`
}

func (*DefaultOwner) UseCase added in v0.4.0

func (*DefaultOwner) UseCase() string

type Delegated

type Delegated struct {
	XMLName   xml.Name `xml:"delegated"`
	Namespace string   `xml:"namespace,attr,omitempty"`
}

type Delegation

type Delegation struct {
	MsgExtension
	XMLName   xml.Name   `xml:"urn:xmpp:delegation:1 delegation"`
	Forwarded *Forwarded // This is used in iq to wrap delegated iqs
	Delegated *Delegated // This is used in a message to confirm delegated namespace
	// Result sets
	ResultSet *ResultSet `xml:"set,omitempty"`
}

Delegation can be used both on message (for delegated) and IQ (for Forwarded), depending on the context.

func (*Delegation) GetSet added in v0.5.0

func (d *Delegation) GetSet() *ResultSet

func (*Delegation) Namespace

func (d *Delegation) Namespace() string

type DeleteEvent added in v0.4.0

type DeleteEvent struct {
	Node     string         `xml:"node,attr"`
	Redirect *RedirectEvent `xml:"redirect"`
}

func (DeleteEvent) Name added in v0.4.0

func (c DeleteEvent) Name() string

type DeleteOwner added in v0.4.0

type DeleteOwner struct {
	XMLName       xml.Name       `xml:"delete"`
	RedirectOwner *RedirectOwner `xml:"redirect,omitempty"`
	Node          string         `xml:"node,attr,omitempty"`
}

func (*DeleteOwner) UseCase added in v0.4.0

func (*DeleteOwner) UseCase() string

type DisassociateEvent added in v0.4.0

type DisassociateEvent struct {
	XMLName xml.Name `xml:"disassociate"`
	Node    string   `xml:"node,attr"`
}

func (*DisassociateEvent) GetAssocDisassoc added in v0.4.0

func (e *DisassociateEvent) GetAssocDisassoc() string

type DiscoInfo

type DiscoInfo struct {
	XMLName   xml.Name   `xml:"http://jabber.org/protocol/disco#info query"`
	Node      string     `xml:"node,attr,omitempty"`
	Identity  []Identity `xml:"identity"`
	Features  []Feature  `xml:"feature"`
	ResultSet *ResultSet `xml:"set,omitempty"`
}

func (*DiscoInfo) AddFeatures

func (d *DiscoInfo) AddFeatures(namespace ...string)

func (*DiscoInfo) AddIdentity

func (d *DiscoInfo) AddIdentity(name, category, typ string)

func (*DiscoInfo) GetSet added in v0.5.0

func (d *DiscoInfo) GetSet() *ResultSet

func (*DiscoInfo) Namespace

func (d *DiscoInfo) Namespace() string

Namespace lets DiscoInfo implement the IQPayload interface

func (*DiscoInfo) SetFeatures

func (d *DiscoInfo) SetFeatures(namespace ...string) *DiscoInfo

func (*DiscoInfo) SetIdentities

func (d *DiscoInfo) SetIdentities(ident ...Identity) *DiscoInfo

func (*DiscoInfo) SetNode

func (d *DiscoInfo) SetNode(node string) *DiscoInfo

type DiscoItem

type DiscoItem struct {
	XMLName xml.Name `xml:"item"`
	JID     string   `xml:"jid,attr,omitempty"`
	Node    string   `xml:"node,attr,omitempty"`
	Name    string   `xml:"name,attr,omitempty"`
}

type DiscoItems

type DiscoItems struct {
	XMLName xml.Name    `xml:"http://jabber.org/protocol/disco#items query"`
	Node    string      `xml:"node,attr,omitempty"`
	Items   []DiscoItem `xml:"item"`

	// Result sets
	ResultSet *ResultSet `xml:"set,omitempty"`
}

func (*DiscoItems) AddItem

func (d *DiscoItems) AddItem(jid, node, name string) *DiscoItems

func (*DiscoItems) GetSet added in v0.5.0

func (d *DiscoItems) GetSet() *ResultSet

func (*DiscoItems) Namespace

func (d *DiscoItems) Namespace() string

func (*DiscoItems) SetNode

func (d *DiscoItems) SetNode(node string) *DiscoItems

type Err

type Err struct {
	XMLName xml.Name  `xml:"error"`
	Code    int       `xml:"code,attr,omitempty"`
	Type    ErrorType `xml:"type,attr"` // required
	Reason  string
	Text    string `xml:"urn:ietf:params:xml:ns:xmpp-stanzas text,omitempty"`
}

Err is an XMPP stanza payload that is used to report error on message, presence or iq stanza. It is intended to be added in the payload of the erroneous stanza.

func (Err) MarshalXML

func (x Err) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (*Err) UnmarshalXML

func (x *Err) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom parsing for XMPP errors

type ErrorType

type ErrorType string

ErrorType is a Enum of error attribute type

const (
	ErrorTypeAuth     ErrorType = "auth"
	ErrorTypeCancel   ErrorType = "cancel"
	ErrorTypeContinue ErrorType = "continue"
	ErrorTypeModify   ErrorType = "modify"
	ErrorTypeWait     ErrorType = "wait"
)

RFC 6120: part of A.5 Client Namespace and A.6 Server Namespace

type EventElement added in v0.4.0

type EventElement interface {
	Name() string
}

type Feature

type Feature struct {
	XMLName xml.Name `xml:"feature"`
	Var     string   `xml:"var,attr"`
}

type Field added in v0.4.0

type Field struct {
	XMLName     xml.Name `xml:"field"`
	Description string   `xml:"desc,omitempty"`
	Required    *string  `xml:"required"`
	ValuesList  []string `xml:"value"`
	Options     []Option `xml:"option,omitempty"`
	Var         string   `xml:"var,attr,omitempty"`
	Type        string   `xml:"type,attr,omitempty"`
	Label       string   `xml:"label,attr,omitempty"`
}

type FieldType added in v0.4.0

type FieldType string

type FifoQueue added in v0.5.0

type FifoQueue interface {
	// Pop returns the first inserted element still in queue and deletes it from queue. If queue is empty, returns nil
	// No guarantee regarding thread safety !
	Pop() Queueable

	// PopN returns the N first inserted elements still in queue and deletes them from queue. If queue is empty or i<=0, returns nil
	// If number to pop is greater than queue length, returns all queue elements
	// No guarantee regarding thread safety !
	PopN(i int) []Queueable

	// Peek returns a copy of the first inserted element in queue without deleting it. If queue is empty, returns nil
	// No guarantee regarding thread safety !
	Peek() Queueable

	// Peek returns a copy of the first inserted element in queue without deleting it. If queue is empty or i<=0, returns nil.
	// If number to peek is greater than queue length, returns all queue elements
	// No guarantee regarding thread safety !
	PeekN() []Queueable
	// Push adds an element to the queue
	// No guarantee regarding thread safety !
	Push(s Queueable) error

	// Empty returns true if queue is empty
	// No guarantee regarding thread safety !
	Empty() bool
}

FIFO queue for string contents Implementations have no guarantee regarding thread safety !

type First added in v0.5.0

type First struct {
	XMLName xml.Name `xml:"first"`
	Content string
	Index   *int `xml:"index,attr,omitempty"`
}

type Form added in v0.4.0

type Form struct {
	XMLName      xml.Name   `xml:"jabber:x:data x"`
	Instructions []string   `xml:"instructions"`
	Title        string     `xml:"title,omitempty"`
	Fields       []*Field   `xml:"field,omitempty"`
	Reported     *FormItem  `xml:"reported"`
	Items        []FormItem `xml:"item,omitempty"`
	Type         string     `xml:"type,attr"`
}

See XEP-0004 and XEP-0068 Pointer semantics

func NewForm added in v0.4.0

func NewForm(fields []*Field, formType string) *Form

func (*Form) Ref added in v0.5.0

func (f *Form) Ref() string

type FormItem added in v0.4.0

type FormItem struct {
	XMLName xml.Name
	Fields  []Field `xml:"field,omitempty"`
}

type FormType added in v0.4.0

type FormType string

type Forwarded

type Forwarded struct {
	XMLName xml.Name `xml:"urn:xmpp:forward:0 forwarded"`
	Stanza  Packet
}

Forwarded is used to wrapped forwarded stanzas. TODO: Move it in another file, as it is not limited to components.

func (*Forwarded) UnmarshalXML

func (f *Forwarded) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML is a custom unmarshal function used by xml.Unmarshal to transform generic XML content into hierarchical Node structure.

type HTML

type HTML struct {
	MsgExtension
	XMLName xml.Name `xml:"http://jabber.org/protocol/xhtml-im html"`
	Body    HTMLBody
	Lang    string `xml:"xml:lang,attr,omitempty"`
}

type HTMLBody

type HTMLBody struct {
	XMLName xml.Name `xml:"http://www.w3.org/1999/xhtml body"`
	// InnerXML MUST be valid xhtml. We do not check if it is valid when generating the XMPP stanza.
	InnerXML string `xml:",innerxml"`
}

type Handshake

type Handshake struct {
	XMLName xml.Name `xml:"jabber:component:accept handshake"`
	// TODO Add handshake value with test for proper serialization
	Value string `xml:",innerxml"`
}

Handshake is a stanza used by XMPP components to authenticate on XMPP component port.

func (Handshake) Name

func (Handshake) Name() string

type History

type History struct {
	XMLName    xml.Name
	MaxChars   NullableInt `xml:"maxchars,attr,omitempty"`
	MaxStanzas NullableInt `xml:"maxstanzas,attr,omitempty"`
	Seconds    NullableInt `xml:"seconds,attr,omitempty"`
	Since      time.Time   `xml:"since,attr,omitempty"`
}

History implements XEP-0045: Multi-User Chat - 19.1

func (History) MarshalXML

func (h History) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (*History) UnmarshalXML

func (h *History) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom parsing for history element

type HostGone added in v0.5.0

type HostGone struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas host-gone"`
}

func (*HostGone) GroupErrorName added in v0.5.0

func (e *HostGone) GroupErrorName() string

type HostUnknown added in v0.5.0

type HostUnknown struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas host-unknown"`
}

func (*HostUnknown) GroupErrorName added in v0.5.0

func (e *HostUnknown) GroupErrorName() string

type IQ

type IQ struct {
	XMLName xml.Name `xml:"iq"`
	// MUST have a ID
	Attrs
	// We can only have one payload on IQ:
	//   "An IQ stanza of type "get" or "set" MUST contain exactly one
	//    child element, which specifies the semantics of the particular
	//    request."
	Payload IQPayload `xml:",omitempty"`
	Error   *Err      `xml:"error,omitempty"`
	// Any is used to decode unknown payload as a generic structure
	Any *Node `xml:",any"`
}

IQ implements RFC 6120 - A.5 Client Namespace (a part)

func NewAffiliationListRequest added in v0.4.0

func NewAffiliationListRequest(serviceId, nodeID string) (*IQ, error)

NewAffiliationListRequest creates a request to list all affiliated entities See 8.9.1 Retrieve List List

func NewApprovePendingSubRequest added in v0.4.0

func NewApprovePendingSubRequest(serviceId, sessionId, nodeId string) (*IQ, error)

NewGetPendingSubRequests creates a new request for all pending subscriptions to be approved on a given node Upon receiving the data form for managing subscription requests, the owner then MAY request pending subscription approval requests for a given node. See 8.7.4 Per-Node Request

func NewConfigureNode added in v0.4.0

func NewConfigureNode(serviceId, nodeName string) (*IQ, error)

NewConfigureNode creates a request to configure a node on the given service. A form will be returned by the service, to which the user must respond using for instance the NewFormSubmission function. See 8.2 Configure a Node

func NewCreateAndConfigNode added in v0.4.0

func NewCreateAndConfigNode(serviceId, nodeID string, confForm *Form) (*IQ, error)

NewCreateAndConfigNode makes a request for node creation that has the desired node configuration. See 8.1.3 Create and Configure a Node

func NewCreateNode added in v0.4.0

func NewCreateNode(serviceId, nodeName string) (*IQ, error)

NewCreateNode builds a request to create a node on the service referenced by "serviceId" See 8.1 Create a Node

func NewDelItemFromNode added in v0.4.0

func NewDelItemFromNode(serviceId, nodeID, itemId string, notify *bool) (*IQ, error)

NewDelItemFromNode creates a request to delete and item from a node, given its id. To delete an item, the publisher sends a retract request. This helper function follows 7.2 Delete an Item from a Node

func NewDelNode added in v0.4.0

func NewDelNode(serviceId, nodeID string) (*IQ, error)

NewDelNode creates a request to delete node "nodeID" from the "serviceId" service See 8.4 Delete a Node

func NewFormSubmission added in v0.4.0

func NewFormSubmission(serviceId string, subInfo SubInfo, form *Form) (*IQ, error)

NewFormSubmission builds a form submission pubsub IQ Information about the subscription and the requester are separated. subInfo contains information about the subscription. 6.3.5 Form Submission

func NewFormSubmissionOwner added in v0.5.0

func NewFormSubmissionOwner(serviceId, nodeName string, fields []*Field) (*IQ, error)

NewFormSubmission builds a form submission pubsub IQ, in the Owner namespace This is typically used to respond to a form issued by the server when configuring a node. See 8.2.4 Form Submission

func NewGetPendingSubRequests added in v0.4.0

func NewGetPendingSubRequests(serviceId string) (*IQ, error)

NewGetPendingSubRequests creates a new request for all pending subscriptions to all their nodes at a service This feature MUST be implemented using the Ad-Hoc Commands (XEP-0050) protocol 8.7 Process Pending Subscription Requests

func NewIQ

func NewIQ(a Attrs) (*IQ, error)

func NewItemsRequest added in v0.4.0

func NewItemsRequest(serviceId string, node string, maxItems int) (*IQ, error)

NewItemsRequest creates a request to query existing items from a node. Specify a "maxItems" value to request only the last maxItems items. If 0, requests all items. 6.5.2 Requesting All List AND 6.5.7 Requesting the Most Recent List

func NewModifAffiliationRequest added in v0.4.0

func NewModifAffiliationRequest(serviceId, nodeID string, newAffils []AffiliationOwner) (*IQ, error)

NewModifAffiliationRequest creates a request to either modify one or more affiliations, or delete one or more affiliations 8.9.2 Modify Affiliation & 8.9.2.4 Multiple Simultaneous Modifications & 8.9.3 Delete an Entity (just set the status to "none")

func NewPublishItemOptsRq added in v0.4.0

func NewPublishItemOptsRq(serviceId, nodeID string, items []Item, options *PublishOptions) (*IQ, error)

NewPublishItemOptsRq creates a request to publish items to a node identified by its provided ID, along with configuration options A pubsub service MAY support the ability to specify options along with a publish request (if so, it MUST advertise support for the "http://jabber.org/protocol/pubsub#publish-options" feature).

func NewPublishItemRq added in v0.4.0

func NewPublishItemRq(serviceId, nodeID, pubItemID string, item Item) (*IQ, error)

NewPublishItemRq creates a request to publish a single item to a node identified by its provided ID

func NewPurgeAllItems added in v0.4.0

func NewPurgeAllItems(serviceId, nodeId string) (*IQ, error)

NewPurgeAllItems creates a new purge request for the "nodeId" node, at "serviceId" service See 8.5 Purge All Node Items

func NewRequestDefaultConfig added in v0.4.0

func NewRequestDefaultConfig(serviceId string) (*IQ, error)

NewRequestDefaultConfig build a request to ask the service for the default config of its nodes See 8.3 Request Default Node Configuration Options

func NewRetrieveAllAffilsRequest added in v0.4.0

func NewRetrieveAllAffilsRequest(serviceId string) (*IQ, error)

NewRetrieveAllAffilsRequest builds a request to retrieve all affiliations from all nodes In order to make the request of the service, the requesting entity includes an empty <affiliations/> element with no attributes.

func NewRetrieveAllSubsRequest added in v0.4.0

func NewRetrieveAllSubsRequest(serviceId string) (*IQ, error)

NewRetrieveAllSubsRequest builds a request to retrieve all subscriptions from all nodes In order to make the request, the requesting entity MUST send an IQ-get whose <pubsub/> child contains an empty <subscriptions/> element with no attributes.

func NewSpecificItemRequest added in v0.4.0

func NewSpecificItemRequest(serviceId, node, itemId string) (*IQ, error)

NewItemsRequest creates a request to get a specific item from a node. 6.5.8 Requesting a Particular Item

func NewSubAndConfig added in v0.4.0

func NewSubAndConfig(serviceId string, subInfo SubInfo, form *Form) (*IQ, error)

NewSubAndConfig builds a subscribe request that contains configuration options for the service From XEP-0060 : The <options/> element MUST follow the <subscribe/> element and MUST NOT possess a 'node' attribute or 'jid' attribute, since the value of the <subscribe/> element's 'node' attribute specifies the desired NodeID and the value of the <subscribe/> element's 'jid' attribute specifies the subscriber's JID 6.3.7 Subscribe and Configure

func NewSubListRqPl added in v0.4.0

func NewSubListRqPl(serviceId, nodeID string) (*IQ, error)

NewSubListRequest creates a request to list subscriptions of the client, for all nodes at the service. It's a Get type IQ 8.8.1 Retrieve Subscriptions

func NewSubOptsRq added in v0.4.0

func NewSubOptsRq(serviceId string, subInfo SubInfo) (*IQ, error)

NewSubOptsRq builds a request for the subscription options. It's a Get type IQ Information about the subscription and the requester are separated. subInfo contains information about the subscription. 6.3 Configure Subscription Options

func NewSubRq added in v0.4.0

func NewSubRq(serviceId string, subInfo SubInfo) (*IQ, error)

NewSubRq builds a subscription request to a node at the given service. It's a Set type IQ. Information about the subscription and the requester are separated. subInfo contains information about the subscription. 6.1 Subscribe to a Node

func NewSubsForEntitiesRequest added in v0.4.0

func NewSubsForEntitiesRequest(serviceId, nodeID string, subs []SubscriptionOwner) (*IQ, error)

func NewUnsubRq added in v0.4.0

func NewUnsubRq(serviceId string, subInfo SubInfo) (*IQ, error)

NewUnsubRq builds an unsub request to a node at the given service. It's a Set type IQ Information about the subscription and the requester are separated. subInfo contains information about the subscription. 6.2 Unsubscribe from a Node

func (*IQ) DiscoInfo

func (iq *IQ) DiscoInfo() *DiscoInfo

DiscoInfo builds a default DiscoInfo payload

func (*IQ) DiscoItems

func (iq *IQ) DiscoItems() *DiscoItems

DiscoItems builds a default DiscoItems payload

func (*IQ) GetFormFields added in v0.4.0

func (iq *IQ) GetFormFields() (map[string]*Field, error)

GetFormFields gets the fields from a form in a IQ stanza of type result, as a map. Key is the "var" attribute of the field, and field is the value. The user can then select and modify the fields they want to alter, and submit a new form to the service using the NewFormSubmission function to build the IQ. TODO : remove restriction on IQ type ?

func (*IQ) IsValid added in v0.3.0

func (iq *IQ) IsValid() (bool, error)

IsValid checks if the IQ is valid. If not, return an error with the reason as a message Following RFC-3920 for IQs

func (*IQ) MakeError

func (iq *IQ) MakeError(xerror Err) *IQ

func (*IQ) Name

func (*IQ) Name() string

func (*IQ) NoOp added in v0.5.0

func (*IQ) NoOp()

NoOp to implement BiDirIteratorElt

func (*IQ) RosterIQ added in v0.4.0

func (iq *IQ) RosterIQ() *Roster

RosterIQ builds a default Roster payload

func (*IQ) RosterItems added in v0.4.0

func (iq *IQ) RosterItems() *RosterItems

RosterItems builds a default RosterItems payload

func (*IQ) UnmarshalXML

func (iq *IQ) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom parsing for IQs

func (*IQ) Version

func (iq *IQ) Version() *Version

Version builds a default software version payload

type IQPayload

type IQPayload interface {
	Namespace() string
	GetSet() *ResultSet
}

type Identity

type Identity struct {
	XMLName  xml.Name `xml:"identity,omitempty"`
	Name     string   `xml:"name,attr,omitempty"`
	Category string   `xml:"category,attr,omitempty"`
	Type     string   `xml:"type,attr,omitempty"`
}

type ImproperAddressing added in v0.5.0

type ImproperAddressing struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas improper-addressing"`
}

func (*ImproperAddressing) GroupErrorName added in v0.5.0

func (e *ImproperAddressing) GroupErrorName() string

type InternalServerError added in v0.5.0

type InternalServerError struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas internal-server-error"`
}

func (*InternalServerError) GroupErrorName added in v0.5.0

func (e *InternalServerError) GroupErrorName() string

type InvalidForm added in v0.5.0

type InvalidForm struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas invalid-from"`
}

func (*InvalidForm) GroupErrorName added in v0.5.0

func (e *InvalidForm) GroupErrorName() string

type InvalidId added in v0.5.0

type InvalidId struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas invalid-id"`
}

func (*InvalidId) GroupErrorName added in v0.5.0

func (e *InvalidId) GroupErrorName() string

type InvalidNamespace added in v0.5.0

type InvalidNamespace struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas invalid-namespace"`
}

func (*InvalidNamespace) GroupErrorName added in v0.5.0

func (e *InvalidNamespace) GroupErrorName() string

type InvalidXML added in v0.5.0

type InvalidXML struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas invalid-xml"`
}

func (*InvalidXML) GroupErrorName added in v0.5.0

func (e *InvalidXML) GroupErrorName() string

type Item

type Item struct {
	XMLName   xml.Name `xml:"item"`
	Id        string   `xml:"id,attr,omitempty"`
	Publisher string   `xml:"publisher,attr,omitempty"`
	Any       *Node    `xml:",any"`
}

type ItemEvent added in v0.4.0

type ItemEvent struct {
	XMLName   xml.Name `xml:"item"`
	Id        string   `xml:"id,attr,omitempty"`
	Publisher string   `xml:"publisher,attr,omitempty"`
	Any       *Node    `xml:",any"`
}

type Items added in v0.4.0

type Items struct {
	List     []Item `xml:"item,omitempty"`
	MaxItems int    `xml:"max_items,attr,omitempty"`
	Node     string `xml:"node,attr"`
	SubId    string `xml:"subid,attr,omitempty"`
}

type ItemsEvent added in v0.4.0

type ItemsEvent struct {
	XMLName xml.Name      `xml:"items"`
	Items   []ItemEvent   `xml:"item,omitempty"`
	Node    string        `xml:"node,attr"`
	Retract *RetractEvent `xml:"retract"`
}

func (ItemsEvent) Name added in v0.4.0

func (i ItemsEvent) Name() string

type Jid added in v0.4.0

type Jid struct {
	Node     string
	Domain   string
	Resource string
}

func NewJid added in v0.4.0

func NewJid(sjid string) (*Jid, error)

func (*Jid) Bare added in v0.4.0

func (j *Jid) Bare() string

func (*Jid) Full added in v0.4.0

func (j *Jid) Full() string

type MarkAcknowledged

type MarkAcknowledged struct {
	MsgExtension
	XMLName xml.Name `xml:"urn:xmpp:chat-markers:0 acknowledged"`
	ID      string   `xml:"id,attr"`
}

type MarkDisplayed

type MarkDisplayed struct {
	MsgExtension
	XMLName xml.Name `xml:"urn:xmpp:chat-markers:0 displayed"`
	ID      string   `xml:"id,attr"`
}

type MarkReceived

type MarkReceived struct {
	MsgExtension
	XMLName xml.Name `xml:"urn:xmpp:chat-markers:0 received"`
	ID      string   `xml:"id,attr"`
}

type Markable

type Markable struct {
	MsgExtension
	XMLName xml.Name `xml:"urn:xmpp:chat-markers:0 markable"`
}

type Message

type Message struct {
	XMLName xml.Name `xml:"message"`
	Attrs

	Subject    string         `xml:"subject,omitempty"`
	Body       string         `xml:"body,omitempty"`
	Thread     string         `xml:"thread,omitempty"`
	Error      Err            `xml:"error,omitempty"`
	Extensions []MsgExtension `xml:",omitempty"`
}

Message implements RFC 6120 - A.5 Client Namespace (a part)

func NewApproveSubRequest added in v0.4.0

func NewApproveSubRequest(serviceId, reqID string, apprForm *Form) (Message, error)

NewApproveSubRequest creates a new sub approval response to a request from the service to the owner of the node In order to approve the request, the owner shall submit the form and set the "pubsub#allow" field to a value of "1" or "true" For tracking purposes the message MUST reflect the 'id' attribute originally provided in the request. See 8.6 Manage Subscription Requests

func NewMessage

func NewMessage(a Attrs) Message

func (*Message) Get

func (msg *Message) Get(ext MsgExtension) bool

Get search and extracts a specific extension on a message. It receives a pointer to an MsgExtension. It will panic if the caller does not pass a pointer. It will return true if the passed extension is found and set the pointer to the extension passed as parameter to the found extension. It will return false if the extension is not found on the message.

Example usage:

  var oob xmpp.OOB
  if ok := msg.Get(&oob); ok {
    // oob extension has been found
	 }

func (Message) Name

func (Message) Name() string

func (*Message) UnmarshalXML

func (msg *Message) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom parsing for messages

func (*Message) XMPPFormat

func (msg *Message) XMPPFormat() string

XMPPFormat with all Extensions

type Mood

type Mood struct {
	MsgExtension          // Mood can be added as a message extension
	XMLName      xml.Name `xml:"http://jabber.org/protocol/mood mood"`
	// TODO: Custom parsing to extract mood type from tag name.
	// Note: the list is predefined.
	// Mood type
	Text string `xml:"text,omitempty"`
}

Mood defines data model for XEP-0107 - User Mood See: https://xmpp.org/extensions/xep-0107.html

type MsgExtension

type MsgExtension interface{}

type MucPresence

type MucPresence struct {
	PresExtension
	XMLName  xml.Name `xml:"http://jabber.org/protocol/muc x"`
	Password string   `xml:"password,omitempty"`
	History  History  `xml:"history,omitempty"`
}

MucPresence implements XEP-0045: Multi-User Chat - 19.1

type Node

type Node struct {
	XMLName xml.Name
	Attrs   []xml.Attr `xml:"-"`
	Content string     `xml:",cdata"`
	Nodes   []Node     `xml:",any"`
}

Node is a generic structure to represent XML data. It is used to parse unreferenced or custom stanza payload.

func (Node) MarshalXML

func (n Node) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

MarshalXML is a custom XML serializer used by xml.Marshal to serialize a Node structure to XML.

func (*Node) Namespace

func (n *Node) Namespace() string

func (*Node) Ref added in v0.4.0

func (n *Node) Ref() string

func (*Node) UnmarshalXML

func (n *Node) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML is a custom unmarshal function used by xml.Unmarshal to transform generic XML content into hierarchical Node structure.

type NotAuthorized added in v0.5.0

type NotAuthorized struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas not-authorized"`
}

func (*NotAuthorized) GroupErrorName added in v0.5.0

func (e *NotAuthorized) GroupErrorName() string

type NotWellFormed added in v0.5.0

type NotWellFormed struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas not-well-formed"`
}

func (*NotWellFormed) GroupErrorName added in v0.5.0

func (e *NotWellFormed) GroupErrorName() string

type Note added in v0.4.0

type Note struct {
	Text string `xml:",cdata"`
	Type string `xml:"type,attr,omitempty"`
}

func (*Note) Ref added in v0.4.0

func (n *Note) Ref() string

type NullableInt

type NullableInt struct {
	Value int
	// contains filtered or unexported fields
}

func NewNullableInt

func NewNullableInt(val int) NullableInt

func (NullableInt) Get

func (n NullableInt) Get() (v int, ok bool)

type OOB

type OOB struct {
	MsgExtension
	XMLName xml.Name `xml:"jabber:x:oob x"`
	URL     string   `xml:"url"`
	Desc    string   `xml:"desc,omitempty"`
}

type Option added in v0.4.0

type Option struct {
	XMLName    xml.Name `xml:"option"`
	Label      string   `xml:"label,attr,omitempty"`
	ValuesList []string `xml:"value"`
}

type OwnerUseCase added in v0.4.0

type OwnerUseCase interface {
	UseCase() string
}

type Packet

type Packet interface {
	Name() string
}

func NextPacket

func NextPacket(p *xml.Decoder) (Packet, error)

NextPacket scans XML token stream for next complete XMPP stanza. Once the type of stanza has been identified, a structure is created to decode that stanza and returned. TODO Use an interface to return packets interface xmppDecoder TODO make auth and bind use NextPacket instead of directly NextStart

type PacketType

type PacketType uint8
const (
	PKTPresence PacketType = iota
	PKTMessage
	PKTIQ
)

type PolicyViolation added in v0.5.0

type PolicyViolation struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas policy-violation"`
}

func (*PolicyViolation) GroupErrorName added in v0.5.0

func (e *PolicyViolation) GroupErrorName() string

type PresExtension

type PresExtension interface{}

type Presence

type Presence struct {
	XMLName xml.Name `xml:"presence"`
	Attrs
	Show       PresenceShow    `xml:"show,omitempty"`
	Status     string          `xml:"status,omitempty"`
	Priority   int8            `xml:"priority,omitempty"` // default: 0
	Error      Err             `xml:"error,omitempty"`
	Extensions []PresExtension `xml:",omitempty"`
}

Presence implements RFC 6120 - A.5 Client Namespace (a part)

func NewPresence

func NewPresence(a Attrs) Presence

func (*Presence) Get

func (pres *Presence) Get(ext PresExtension) bool

Get search and extracts a specific extension on a presence stanza. It receives a pointer to an PresExtension. It will panic if the caller does not pass a pointer. It will return true if the passed extension is found and set the pointer to the extension passed as parameter to the found extension. It will return false if the extension is not found on the presence.

Example usage:

  var muc xmpp.MucPresence
  if ok := msg.Get(&muc); ok {
    // muc presence extension has been found
	 }

func (Presence) Name

func (Presence) Name() string

func (*Presence) UnmarshalXML

func (pres *Presence) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom parsing for presence stanza

type PresenceShow

type PresenceShow string

PresenceShow is a Enum of presence element show

const (
	PresenceShowAway PresenceShow = "away"
	PresenceShowChat PresenceShow = "chat"
	PresenceShowDND  PresenceShow = "dnd"
	PresenceShowXA   PresenceShow = "xa"
)

RFC 6120: part of A.5 Client Namespace and A.6 Server Namespace

type PubSubEvent added in v0.4.0

type PubSubEvent struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/pubsub#event event"`
	MsgExtension
	EventElement EventElement
}

Implementation of the http://jabber.org/protocol/pubsub#event namespace

func (*PubSubEvent) UnmarshalXML added in v0.4.0

func (pse *PubSubEvent) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type PubSubGeneric added in v0.4.0

type PubSubGeneric struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/pubsub pubsub"`

	Create    *Create    `xml:"create,omitempty"`
	Configure *Configure `xml:"configure,omitempty"`

	Subscribe  *SubInfo    `xml:"subscribe,omitempty"`
	SubOptions *SubOptions `xml:"options,omitempty"`

	Publish        *Publish        `xml:"publish,omitempty"`
	PublishOptions *PublishOptions `xml:"publish-options"`

	Affiliations *Affiliations `xml:"affiliations,omitempty"`
	Default      *Default      `xml:"default,omitempty"`

	Items        *Items        `xml:"items,omitempty"`
	Retract      *Retract      `xml:"retract,omitempty"`
	Subscription *Subscription `xml:"subscription,omitempty"`

	Subscriptions *Subscriptions `xml:"subscriptions,omitempty"`
	// To use in responses to sub/unsub for instance
	// Subscription options
	Unsubscribe *SubInfo `xml:"unsubscribe,omitempty"`

	// Result sets
	ResultSet *ResultSet `xml:"set,omitempty"`
}

func (*PubSubGeneric) GetSet added in v0.5.0

func (p *PubSubGeneric) GetSet() *ResultSet

func (*PubSubGeneric) Namespace added in v0.4.0

func (p *PubSubGeneric) Namespace() string

type PubSubOption added in v0.4.0

type PubSubOption struct {
	XMLName xml.Name `xml:"jabber:x:data options"`
	Form    `xml:"x"`
}

type PubSubOwner added in v0.4.0

type PubSubOwner struct {
	XMLName      xml.Name `xml:"http://jabber.org/protocol/pubsub#owner pubsub"`
	OwnerUseCase OwnerUseCase
	// Result sets
	ResultSet *ResultSet `xml:"set,omitempty"`
}

func (*PubSubOwner) GetSet added in v0.5.0

func (pso *PubSubOwner) GetSet() *ResultSet

func (*PubSubOwner) Namespace added in v0.4.0

func (pso *PubSubOwner) Namespace() string

func (*PubSubOwner) UnmarshalXML added in v0.4.0

func (pso *PubSubOwner) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Publish

type Publish struct {
	XMLName xml.Name `xml:"publish"`
	Node    string   `xml:"node,attr"`
	Items   []Item   `xml:"item,omitempty"` // xsd says there can be many. See also 12.10 Batch Processing of XEP-0060
}

type PublishOptions added in v0.4.0

type PublishOptions struct {
	XMLName xml.Name `xml:"publish-options"`
	Form    *Form
}

type PurgeEvent added in v0.4.0

type PurgeEvent struct {
	XMLName xml.Name `xml:"purge"`
	Node    string   `xml:"node,attr"`
}

func (PurgeEvent) Name added in v0.4.0

func (p PurgeEvent) Name() string

type PurgeOwner added in v0.4.0

type PurgeOwner struct {
	XMLName xml.Name `xml:"purge"`
	Node    string   `xml:"node,attr"`
}

func (*PurgeOwner) UseCase added in v0.4.0

func (*PurgeOwner) UseCase() string

type Queueable added in v0.5.0

type Queueable interface {
	QueueableName() string
}

type ReceiptReceived

type ReceiptReceived struct {
	MsgExtension
	XMLName xml.Name `xml:"urn:xmpp:receipts received"`
	ID      string   `xml:"id,attr"`
}

type ReceiptRequest

type ReceiptRequest struct {
	MsgExtension
	XMLName xml.Name `xml:"urn:xmpp:receipts request"`
}

Used on outgoing message, to tell the recipient that you are requesting a message receipt / ack.

type RedirectEvent added in v0.4.0

type RedirectEvent struct {
	URI string `xml:"uri,attr"`
}

********************* Redirect *********************

type RedirectOwner added in v0.4.0

type RedirectOwner struct {
	XMLName xml.Name `xml:"redirect"`
	URI     string   `xml:"uri,attr"`
}

type RemoteConnectionFailed added in v0.5.0

type RemoteConnectionFailed struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas remote-connection-failed"`
}

func (*RemoteConnectionFailed) GroupErrorName added in v0.5.0

func (e *RemoteConnectionFailed) GroupErrorName() string

type Reset added in v0.5.0

type Reset struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas reset"`
}

func (*Reset) GroupErrorName added in v0.5.0

func (e *Reset) GroupErrorName() string

type ResourceConstraint added in v0.5.0

type ResourceConstraint struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas resource-constraint"`
}

func (*ResourceConstraint) GroupErrorName added in v0.5.0

func (e *ResourceConstraint) GroupErrorName() string

type RestrictedXML added in v0.5.0

type RestrictedXML struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas restricted-xml"`
}

func (*RestrictedXML) GroupErrorName added in v0.5.0

func (e *RestrictedXML) GroupErrorName() string

type ResultSet added in v0.5.0

type ResultSet struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/rsm set"`
	After   *string  `xml:"after,omitempty"`
	Before  *string  `xml:"before,omitempty"`
	Count   *int     `xml:"count,omitempty"`
	First   *First   `xml:"first,omitempty"`
	Index   *int     `xml:"index,omitempty"`
	Last    *string  `xml:"last,omitempty"`
	Max     *int     `xml:"max,omitempty"`
}

type Retract

type Retract struct {
	XMLName xml.Name `xml:"retract"`
	Node    string   `xml:"node,attr"`
	Notify  *bool    `xml:"notify,attr,omitempty"`
	Items   []Item   `xml:"item"`
}

type RetractEvent added in v0.4.0

type RetractEvent struct {
	XMLName xml.Name `xml:"retract"`
	ID      string   `xml:"node,attr"`
}

type Roster added in v0.4.0

type Roster struct {
	XMLName xml.Name `xml:"jabber:iq:roster query"`
	// Result sets
	ResultSet *ResultSet `xml:"set,omitempty"`
}

Roster struct represents Roster IQs

func (*Roster) GetSet added in v0.5.0

func (r *Roster) GetSet() *ResultSet

func (*Roster) Namespace added in v0.4.0

func (r *Roster) Namespace() string

Namespace defines the namespace for the RosterIQ

type RosterItem added in v0.4.0

type RosterItem struct {
	XMLName      xml.Name `xml:"jabber:iq:roster item"`
	Jid          string   `xml:"jid,attr"`
	Ask          string   `xml:"ask,attr,omitempty"`
	Name         string   `xml:"name,attr,omitempty"`
	Subscription string   `xml:"subscription,attr,omitempty"`
	Groups       []string `xml:"group"`
}

RosterItem represents an item in the roster iq

type RosterItems added in v0.4.0

type RosterItems struct {
	XMLName xml.Name     `xml:"jabber:iq:roster query"`
	Items   []RosterItem `xml:"item"`
	// Result sets
	ResultSet *ResultSet `xml:"set,omitempty"`
}

RosterItems represents the list of items in a roster IQ

func (*RosterItems) AddItem added in v0.4.0

func (r *RosterItems) AddItem(jid, subscription, ask, name string, groups []string) *RosterItems

AddItem builds an item and ads it to the roster IQ

func (*RosterItems) GetSet added in v0.5.0

func (r *RosterItems) GetSet() *ResultSet

func (*RosterItems) Namespace added in v0.4.0

func (r *RosterItems) Namespace() string

Namespace lets RosterItems implement the IQPayload interface

type SASLAuth

type SASLAuth struct {
	XMLName   xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl auth"`
	Mechanism string   `xml:"mechanism,attr"`
	Value     string   `xml:",innerxml"`
}

SASLAuth implements SASL Authentication initiation. Reference: https://tools.ietf.org/html/rfc6120#section-6.4.2

type SASLFailure

type SASLFailure struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl failure"`
	Any     xml.Name // error reason is a subelement
}

SASLFailure

func (SASLFailure) Name

func (SASLFailure) Name() string

type SASLSuccess

type SASLSuccess struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl success"`
}

SASLSuccess implements SASL Success nonza, sent by server as a result of the SASL auth negotiation. Reference: https://tools.ietf.org/html/rfc6120#section-6.4.6

func (SASLSuccess) Name

func (SASLSuccess) Name() string

type SMAnswer added in v0.1.2

type SMAnswer struct {
	XMLName xml.Name `xml:"urn:xmpp:sm:3 a"`
	H       uint     `xml:"h,attr"`
}

Answer as defined in Stream Management spec Reference: https://xmpp.org/extensions/xep-0198.html#acking

func (SMAnswer) Name added in v0.1.2

func (SMAnswer) Name() string

type SMEnable added in v0.5.0

type SMEnable struct {
	XMLName xml.Name `xml:"urn:xmpp:sm:3 enable"`
	Max     *uint    `xml:"max,attr,omitempty"`
	Resume  *bool    `xml:"resume,attr,omitempty"`
}

type SMEnabled added in v0.1.2

type SMEnabled struct {
	XMLName  xml.Name `xml:"urn:xmpp:sm:3 enabled"`
	Id       string   `xml:"id,attr,omitempty"`
	Location string   `xml:"location,attr,omitempty"`
	Resume   string   `xml:"resume,attr,omitempty"`
	Max      uint     `xml:"max,attr,omitempty"`
}

Enabled as defined in Stream Management spec Reference: https://xmpp.org/extensions/xep-0198.html#enable

func (SMEnabled) Name added in v0.1.2

func (SMEnabled) Name() string

type SMFailed added in v0.1.2

type SMFailed struct {
	XMLName xml.Name `xml:"urn:xmpp:sm:3 failed"`
	H       *uint    `xml:"h,attr,omitempty"`

	StreamErrorGroup StanzaErrorGroup
}

Failed as defined in Stream Management spec Reference: https://xmpp.org/extensions/xep-0198.html#acking

func (SMFailed) Name added in v0.1.2

func (SMFailed) Name() string

func (*SMFailed) UnmarshalXML added in v0.5.0

func (smf *SMFailed) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type SMRequest added in v0.1.2

type SMRequest struct {
	XMLName xml.Name `xml:"urn:xmpp:sm:3 r"`
}

Request as defined in Stream Management spec Reference: https://xmpp.org/extensions/xep-0198.html#acking

func (SMRequest) Name added in v0.1.2

func (SMRequest) Name() string

type SMResume added in v0.5.0

type SMResume struct {
	XMLName xml.Name `xml:"urn:xmpp:sm:3 resume"`
	PrevId  string   `xml:"previd,attr,omitempty"`
	H       *uint    `xml:"h,attr,omitempty"`
}

Resume as defined in Stream Management spec Reference: https://xmpp.org/extensions/xep-0198.html#acking

func (SMResume) Name added in v0.5.0

func (SMResume) Name() string

type SMResumed added in v0.1.2

type SMResumed struct {
	XMLName xml.Name `xml:"urn:xmpp:sm:3 resumed"`
	PrevId  string   `xml:"previd,attr,omitempty"`
	H       *uint    `xml:"h,attr,omitempty"`
}

Resumed as defined in Stream Management spec Reference: https://xmpp.org/extensions/xep-0198.html#acking

func (SMResumed) Name added in v0.1.2

func (SMResumed) Name() string

type SeeOtherHost added in v0.5.0

type SeeOtherHost struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas see-other-host"`
}

func (*SeeOtherHost) GroupErrorName added in v0.5.0

func (e *SeeOtherHost) GroupErrorName() string

type StanzaErrorGroup added in v0.5.0

type StanzaErrorGroup interface {
	GroupErrorName() string
}

type StanzaType

type StanzaType string
const (
	IQTypeError  StanzaType = "error"
	IQTypeGet    StanzaType = "get"
	IQTypeResult StanzaType = "result"
	IQTypeSet    StanzaType = "set"

	MessageTypeChat      StanzaType = "chat"
	MessageTypeError     StanzaType = "error"
	MessageTypeGroupchat StanzaType = "groupchat"
	MessageTypeHeadline  StanzaType = "headline"
	MessageTypeNormal    StanzaType = "normal" // Default

	PresenceTypeError        StanzaType = "error"
	PresenceTypeProbe        StanzaType = "probe"
	PresenceTypeSubscribe    StanzaType = "subscribe"
	PresenceTypeSubscribed   StanzaType = "subscribed"
	PresenceTypeUnavailable  StanzaType = "unavailable"
	PresenceTypeUnsubscribe  StanzaType = "unsubscribe"
	PresenceTypeUnsubscribed StanzaType = "unsubscribed"
)

RFC 6120: part of A.5 Client Namespace and A.6 Server Namespace

func (StanzaType) IsEmpty added in v0.3.0

func (s StanzaType) IsEmpty() bool

type StateActive

type StateActive struct {
	MsgExtension
	XMLName xml.Name `xml:"http://jabber.org/protocol/chatstates active"`
}

type StateComposing

type StateComposing struct {
	MsgExtension
	XMLName xml.Name `xml:"http://jabber.org/protocol/chatstates composing"`
}

type StateGone

type StateGone struct {
	MsgExtension
	XMLName xml.Name `xml:"http://jabber.org/protocol/chatstates gone"`
}

type StateInactive

type StateInactive struct {
	MsgExtension
	XMLName xml.Name `xml:"http://jabber.org/protocol/chatstates inactive"`
}

type StatePaused

type StatePaused struct {
	MsgExtension
	XMLName xml.Name `xml:"http://jabber.org/protocol/chatstates paused"`
}

type Stream added in v0.3.0

type Stream struct {
	XMLName xml.Name `xml:"http://etherx.jabber.org/streams stream"`
	From    string   `xml:"from,attr"`
	To      string   `xml:"to,attr"`
	Id      string   `xml:"id,attr"`
	Version string   `xml:"version,attr"`
}

Start of stream Reference: XMPP Core stream open

https://tools.ietf.org/html/rfc6120#section-4.2

type StreamClosePacket added in v0.4.0

type StreamClosePacket struct{}

This is just a closing tag and hold no information

func (StreamClosePacket) Name added in v0.4.0

func (StreamClosePacket) Name() string

type StreamError

type StreamError struct {
	XMLName xml.Name `xml:"http://etherx.jabber.org/streams error"`
	Error   xml.Name `xml:",any"`
	Text    string   `xml:"urn:ietf:params:xml:ns:xmpp-streams text"`
}

func (StreamError) Name

func (StreamError) Name() string

type StreamFeatures

type StreamFeatures struct {
	XMLName xml.Name `xml:"http://etherx.jabber.org/streams features"`
	// Server capabilities hash
	Caps Caps
	// Stream features
	StartTLS         TlsStartTLS
	Mechanisms       saslMechanisms
	Bind             Bind
	StreamManagement streamManagement
	// Obsolete
	Session StreamSession
	// ProcessOne Stream Features
	P1Push   p1Push
	P1Rebind p1Rebind

	Any []xml.Name `xml:",any"`
	// contains filtered or unexported fields
}

func (*StreamFeatures) DoesStartTLS

func (sf *StreamFeatures) DoesStartTLS() (feature TlsStartTLS, isSupported bool)

func (*StreamFeatures) DoesStreamManagement

func (sf *StreamFeatures) DoesStreamManagement() (isSupported bool)

func (StreamFeatures) Name

func (StreamFeatures) Name() string

type StreamSession

type StreamSession struct {
	XMLName  xml.Name  `xml:"urn:ietf:params:xml:ns:xmpp-session session"`
	Optional *struct{} // If element does exist, it mean we are not required to open session
	// Result sets
	ResultSet *ResultSet `xml:"set,omitempty"`
}

Session is both a stream feature and an obsolete IQ Payload, used to bind a resource to the current XMPP stream on RFC 3121 only XMPP servers. Session is obsolete in RFC 6121. It is added to Fluux XMPP for compliance with RFC 3121. Reference: https://xmpp.org/rfcs/rfc3921.html#session

This is the draft defining how to handle the transition:

https://tools.ietf.org/html/draft-cridland-xmpp-session-01

func (*StreamSession) GetSet added in v0.5.0

func (s *StreamSession) GetSet() *ResultSet

func (*StreamSession) IsOptional

func (s *StreamSession) IsOptional() bool

func (*StreamSession) Namespace

func (s *StreamSession) Namespace() string

type SubInfo added in v0.4.0

type SubInfo struct {
	Node string `xml:"node,attr,omitempty"`
	Jid  string `xml:"jid,attr,omitempty"`
	// Sub ID is optional
	SubId *string `xml:"subid,attr,omitempty"`
}

SubInfo represents information about a subscription Node is the node related to the subscription Jid is the subscription JID of the subscribed entity SubID is the subscription ID

type SubOptions added in v0.4.0

type SubOptions struct {
	SubInfo
	Form *Form `xml:"x"`
}

type Subscribe added in v0.4.0

type Subscribe struct {
	XMLName xml.Name `xml:"subscribe"`
	SubInfo
}

type Subscription added in v0.4.0

type Subscription struct {
	SubStatus string `xml:"subscription,attr,omitempty"`
	SubInfo   `xml:",omitempty"`
	// Seems like we can't marshal a self-closing tag for now : https://github.com/golang/go/issues/21399
	// subscribe-options should be like this as per XEP-0060:
	//    <subscribe-options>
	//        <required/>
	//    </subscribe-options>
	// Used to indicate if configuration options is required.
	Required *struct{}
}

Handles the "5.6 Retrieve Subscriptions" and the 6.1 Subscribe to a Node and so on of XEP-0060

type SubscriptionEvent added in v0.4.0

type SubscriptionEvent struct {
	SubStatus string `xml:"subscription,attr,omitempty"`
	Expiry    string `xml:"expiry,attr,omitempty"`
	SubInfo   `xml:",omitempty"`
}

func (SubscriptionEvent) Name added in v0.4.0

func (s SubscriptionEvent) Name() string

type SubscriptionOwner added in v0.4.0

type SubscriptionOwner struct {
	SubscriptionStatus string `xml:"subscription"`
	Jid                string `xml:"jid,attr"`
}

type Subscriptions added in v0.4.0

type Subscriptions struct {
	XMLName xml.Name       `xml:"subscriptions"`
	List    []Subscription `xml:"subscription,omitempty"`
}

Handles the "5.6 Retrieve Subscriptions" of XEP-0060

type SubscriptionsOwner added in v0.4.0

type SubscriptionsOwner struct {
	XMLName       xml.Name            `xml:"subscriptions"`
	Subscriptions []SubscriptionOwner `xml:"subscription"`
	Node          string              `xml:"node,attr"`
}

func (*SubscriptionsOwner) UseCase added in v0.4.0

func (*SubscriptionsOwner) UseCase() string

type SystemShutdown added in v0.5.0

type SystemShutdown struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas system-shutdown"`
}

func (*SystemShutdown) GroupErrorName added in v0.5.0

func (e *SystemShutdown) GroupErrorName() string

type TLSProceed

type TLSProceed struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-tls proceed"`
}

Used during stream initiation / session establishment

type TlsStartTLS added in v0.3.0

type TlsStartTLS struct {
	XMLName  xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-tls starttls"`
	Required bool
}

StartTLS feature Reference: RFC 6120 - https://tools.ietf.org/html/rfc6120#section-5.4

func (*TlsStartTLS) UnmarshalXML added in v0.3.0

func (stls *TlsStartTLS) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML implements custom parsing startTLS required flag

type Tune

type Tune struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/tune tune"`
	Artist  string   `xml:"artist,omitempty"`
	Length  int      `xml:"length,omitempty"`
	Rating  int      `xml:"rating,omitempty"`
	Source  string   `xml:"source,omitempty"`
	Title   string   `xml:"title,omitempty"`
	Track   string   `xml:"track,omitempty"`
	Uri     string   `xml:"uri,omitempty"`
}

type UnAckQueue added in v0.5.0

type UnAckQueue struct {
	Uslice []*UnAckedStz
	sync.RWMutex
}

func NewUnAckQueue added in v0.5.0

func NewUnAckQueue() *UnAckQueue

func (*UnAckQueue) Empty added in v0.5.0

func (uaq *UnAckQueue) Empty() bool

func (*UnAckQueue) Peek added in v0.5.0

func (uaq *UnAckQueue) Peek() Queueable

func (*UnAckQueue) PeekN added in v0.5.0

func (uaq *UnAckQueue) PeekN(n int) []Queueable

func (*UnAckQueue) Pop added in v0.5.0

func (uaq *UnAckQueue) Pop() Queueable

No guarantee regarding thread safety !

func (*UnAckQueue) PopN added in v0.5.0

func (uaq *UnAckQueue) PopN(n int) []Queueable

No guarantee regarding thread safety !

func (*UnAckQueue) Push added in v0.5.0

func (uaq *UnAckQueue) Push(s Queueable) error

type UnAckedStz added in v0.5.0

type UnAckedStz struct {
	Id  int
	Stz string
}

func (*UnAckedStz) QueueableName added in v0.5.0

func (u *UnAckedStz) QueueableName() string

type UndefinedCondition added in v0.5.0

type UndefinedCondition struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas undefined-condition"`
}

func (*UndefinedCondition) GroupErrorName added in v0.5.0

func (e *UndefinedCondition) GroupErrorName() string

type UnexpectedRequest added in v0.5.0

type UnexpectedRequest struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas unexpected-request"`
}

func (*UnexpectedRequest) GroupErrorName added in v0.5.0

func (e *UnexpectedRequest) GroupErrorName() string

type Unsubscribe added in v0.4.0

type Unsubscribe struct {
	XMLName xml.Name `xml:"unsubscribe"`
	SubInfo
}

type UnsupportedEncoding added in v0.5.0

type UnsupportedEncoding struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas unsupported-encoding"`
}

func (*UnsupportedEncoding) GroupErrorName added in v0.5.0

func (e *UnsupportedEncoding) GroupErrorName() string

type UnsupportedStanzaType added in v0.5.0

type UnsupportedStanzaType struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas unsupported-stanza-type"`
}

func (*UnsupportedStanzaType) GroupErrorName added in v0.5.0

func (e *UnsupportedStanzaType) GroupErrorName() string

type UnsupportedVersion added in v0.5.0

type UnsupportedVersion struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas unsupported-version"`
}

func (*UnsupportedVersion) GroupErrorName added in v0.5.0

func (e *UnsupportedVersion) GroupErrorName() string

type Version

type Version struct {
	XMLName xml.Name `xml:"jabber:iq:version query"`
	Name    string   `xml:"name,omitempty"`
	Version string   `xml:"version,omitempty"`
	OS      string   `xml:"os,omitempty"`
	// Result sets
	ResultSet *ResultSet `xml:"set,omitempty"`
}

Version

func (*Version) GetSet added in v0.5.0

func (v *Version) GetSet() *ResultSet

func (*Version) Namespace

func (v *Version) Namespace() string

func (*Version) SetInfo

func (v *Version) SetInfo(name, version, os string) *Version

Set all software version info

type WebsocketOpen added in v0.3.0

type WebsocketOpen struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-framing open"`
	From    string   `xml:"from,attr"`
	Id      string   `xml:"id,attr"`
	Version string   `xml:"version,attr"`
}

Open Packet Reference: WebSocket connections must start with this element

https://tools.ietf.org/html/rfc7395#section-3.4

type XMLNotWellFormed added in v0.5.0

type XMLNotWellFormed struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas xml-not-well-formed"`
}

func (*XMLNotWellFormed) GroupErrorName added in v0.5.0

func (e *XMLNotWellFormed) GroupErrorName() string

Jump to

Keyboard shortcuts

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