data

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: GPL-3.0 Imports: 8 Imported by: 50

Documentation

Index

Constants

View Source
const (
	BadFormat              StreamErrorCondition = "bad-format"
	BadNamespacePrefix                          = "bad-namespace-prefix"
	Conflict                                    = "conflict"
	ConnectionTimeout                           = "connection-timeout"
	HostGone                                    = "host-gone"
	HostUnknown                                 = "host-unknown"
	ImproperAddressing                          = "improper-addressing"
	InternalServerError                         = "internal-server-error"
	InvalidFrom                                 = "invalid-from"
	InvalidNamespace                            = "invalid-namespace"
	InvalidXML                                  = "invalid-xml"
	NotAuthorized                               = "not-authorized"
	NotWellFormed                               = "not-well-formed"
	PolicyViolation                             = "policy-violation"
	RemoteConnectionFailed                      = "remote-connection-failed"
	Reset                                       = "reset"
	ResourceConstraint                          = "resource-constraint"
	RestrictedXML                               = "restricted-xml"
	SeeOtherHost                                = "see-other-host"
	SystemShutdown                              = "system-shutdown"
	UndefinedCondition                          = "undefined-condition"
	UnsupportedEncoding                         = "unsupported-encoding"
	UnsupportedFeature                          = "unsupported-feature"
	UnsupportedStanzaType                       = "unsupported-stanza-type"
	UnsupportedVersion                          = "unsupported-version"
)

Stream error conditions as defined in RFC 6120, section 4.9.3

View Source
const (
	SASLAborted              SASLErrorCondition = "aborted"
	SASLAccountDisabled                         = "account-disabled"
	SASLCredentialsExpired                      = "credentials-expired"
	SASLEncryptionRequired                      = "encryption-required"
	SASLIncorrectEncoding                       = "incorrect-encoding"
	SASLInvalidAuthzid                          = "invalid-authzid"
	SASLInvalidMechanism                        = "invalid-mechanism"
	SASLMalformedRequest                        = "malformed-request"
	SASLMechanismTooWeak                        = "mechanism-too-weak"
	SASLNotAuthorized                           = "not-authorized"
	SASLTemporaryAuthFailure                    = "temporary-auth-failure"
)

SASL error conditions as defined in RFC 6120, section 6.5

Variables

This section is empty.

Functions

This section is empty.

Types

type Any

type Any struct {
	XMLName xml.Name
	Body    string `xml:",innerxml"`
}

Any provides a convenient way to debug any child element

type BindBind

type BindBind struct {
	XMLName  xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-bind bind"`
	Resource string   `xml:"resource"`
	Jid      string   `xml:"jid"`
}

BindBind represents a bind RFC 6120, section 7

type BobData

type BobData struct {
	XMLName  xml.Name `xml:"urn:xmpp:bob data"`
	CID      string   `xml:"cid,attr"`
	MIMEType string   `xml:"type,attr"`
	Base64   string   `xml:",chardata"`
}

BobData is a data element from http://xmpp.org/extensions/xep-0231.html.

type BooleanFormField

type BooleanFormField struct {
	FormField

	Result bool
}

BooleanFormField is for a yes/no answer. The Result member should be set to the user's answer.

type BytestreamQuery added in v0.3.9

type BytestreamQuery struct {
	XMLName            xml.Name                  `xml:"http://jabber.org/protocol/bytestreams query"`
	Sid                string                    `xml:"sid,attr"`
	DestinationAddress string                    `xml:"dstaddr,attr,omitempty"`
	Mode               string                    `xml:"mode,attr,omitempty"`
	Activate           string                    `xml:"activate,omitempty"`
	Streamhosts        []BytestreamStreamhost    `xml:"streamhost"`
	StreamhostUsed     *BytestreamStreamhostUsed `xml:"streamhost-used,omitempty"`
}

BytestreamQuery is an element from http://xmpp.org/extensions/xep-0065.html.

type BytestreamStreamhost added in v0.3.9

type BytestreamStreamhost struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/bytestreams streamhost"`
	Jid     string   `xml:"jid,attr"`
	Host    string   `xml:"host,attr"`
	Port    int      `xml:"port,attr,omitempty"` // default 1080
}

BytestreamStreamhost is an element from http://xmpp.org/extensions/xep-0065.html.

type BytestreamStreamhostUsed added in v0.3.9

type BytestreamStreamhostUsed struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/bytestreams streamhost-used"`
	Jid     string   `xml:"jid,attr"`
}

BytestreamStreamhostUsed is an element from http://xmpp.org/extensions/xep-0065.html.

type ClientCaps

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

ClientCaps contains information about client capabilities

type ClientIQ

type ClientIQ struct {
	XMLName xml.Name    `xml:"jabber:client iq"`
	From    string      `xml:"from,attr"`
	ID      string      `xml:"id,attr"`
	To      string      `xml:"to,attr"`
	Type    string      `xml:"type,attr"` // error, get, result, set
	Error   StanzaError `xml:"jabber:client error"`
	Bind    BindBind    `xml:"bind"`
	Query   []byte      `xml:",innerxml"`
}

ClientIQ contains a specific information query request

type ClientMessage

type ClientMessage struct {
	XMLName xml.Name `xml:"jabber:client message"`
	From    string   `xml:"from,attr"`
	ID      string   `xml:"id,attr"`
	To      string   `xml:"to,attr"`
	Type    string   `xml:"type,attr"` // chat, error, groupchat, headline, or normal

	// These should technically be []clientText,
	// but string is much more convenient.
	Subject *string `xml:"subject"`
	Body    string  `xml:"body"`
	Thread  string  `xml:"thread"`
	Delay   *Delay  `xml:"delay,omitempty"`

	Error *StanzaError `xml:"error"`

	Extensions `xml:",any,omitempty"`
}

ClientMessage implements RFC 3921 B.1 jabber:client

type ClientPresence

type ClientPresence struct {
	XMLName xml.Name `xml:"jabber:client presence"`
	From    string   `xml:"from,attr,omitempty"`
	ID      string   `xml:"id,attr,omitempty"`
	To      string   `xml:"to,attr,omitempty"`
	Type    string   `xml:"type,attr,omitempty"` // error, probe, subscribe, subscribed, unavailable, unsubscribe, unsubscribed
	Lang    string   `xml:"lang,attr,omitempty"`

	Show     string      `xml:"show,omitempty"`   // away, chat, dnd, xa
	Status   string      `xml:"status,omitempty"` // sb []clientText
	Priority string      `xml:"priority,omitempty"`
	Caps     *ClientCaps `xml:"c"`

	Error *StanzaError `xml:"jabber:client error"`
	Delay *Delay       `xml:"delay,omitempty"`

	Chat *struct {
		Item struct {
			JID         string `xml:"jid,attr,omitempty"`
			Affiliation string `xml:"affiliation,attr,omitempty"`
			Role        string `xml:"role,attr,omitempty"`
		} `xml:"item,omitempty"`
		Status struct {
			Code int `xml:"code,attr,omitempty"`
		} `xml:"status,omitempty"`
	} `xml:"http://jabber.org/protocol/muc#user x, omitempty"`

	Extra string `xml:",innerxml"`
}

ClientPresence contains XMPP information about a presence update

type Config

type Config struct {
	// InLog is an optional Writer which receives the raw contents of the
	// XML from the server.
	InLog io.Writer
	// OutLog is an optional Writer which receives the raw XML sent to the
	// server.
	OutLog io.Writer
	// Log is an optional Writer which receives human readable log messages
	// during the connection.
	Log io.Writer
	// CreateCallback, if not nil, causes a new account to be created on
	// the server. The callback is needed in order to be able to handle
	// XMPP forms.
	CreateCallback FormCallback
	// Archive determines whether we disable archiving for messages. If
	// false, XML is sent with each message to disable recording on the
	// server.
	Archive bool
	// SkipTLS, if true, causes the TLS handshake to be skipped.
	// WARNING: this should only be used if Conn is already secure.
	SkipTLS bool
	// TLSConfig contains the configuration to be used by the TLS
	// handshake. If nil, sensible defaults will be used.
	TLSConfig *tls.Config
	// SkipSRVLookup skips SRV lookup during resolution of fully qualified domain
	// names. RFC 6120 section 3.2.3 recomends to skip the SRV lookup when the
	// initiating entity has a hardcoded FQDN associated with the origin domain.
	SkipSRVLookup bool
}

Config contains options for an XMPP connection.

func (*Config) GetLog

func (c *Config) GetLog() io.Writer

GetLog returns the log to use for logging, either a discard or a real log

type Cookie uint64

Cookie is used to give a unique identifier to each request.

type Delay

type Delay struct {
	XMLName xml.Name `xml:"urn:xmpp:delay delay"`
	From    string   `xml:"from,attr,omitempty"`
	Stamp   string   `xml:"stamp,attr"`

	Body string `xml:",chardata"`
}

Delay represents XEP-0203: Delayed Delivery of <message/> and <presence/> stanzas.

type DiscoveryFeature

type DiscoveryFeature struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/disco#info feature"`
	Var     string   `xml:"var,attr"`
}

DiscoveryFeature contains information about a specific discovery feature

type DiscoveryIdentity

type DiscoveryIdentity struct {
	XMLName  xml.Name `xml:"http://jabber.org/protocol/disco#info identity"`
	Lang     string   `xml:"lang,attr,omitempty"`
	Category string   `xml:"category,attr"`
	Type     string   `xml:"type,attr"`
	Name     string   `xml:"name,attr"`
}

DiscoveryIdentity contains identity information for a specific discovery

type DiscoveryInfoQuery added in v0.3.9

type DiscoveryInfoQuery struct {
	XMLName    xml.Name            `xml:"http://jabber.org/protocol/disco#info query"`
	Node       string              `xml:"node,omitempty"`
	Identities []DiscoveryIdentity `xml:"identity,omitempty"`
	Features   []DiscoveryFeature  `xml:"feature,omitempty"`
	Forms      []Form              `xml:"jabber:x:data x,omitempty"`
	ResultSet  *ResultSet          `xml:"set,omitempty"`
}

DiscoveryInfoQuery contains the deserialized information about a service discovery info query See: XEP-0030, Section 3

type DiscoveryItem added in v0.3.9

type DiscoveryItem struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/disco#items item"`
	Jid     string   `xml:"jid,attr"`
	Name    string   `xml:"name,attr"`
}

DiscoveryItem contains one discovery item

type DiscoveryItemsQuery added in v0.3.9

type DiscoveryItemsQuery struct {
	XMLName        xml.Name        `xml:"http://jabber.org/protocol/disco#items query"`
	DiscoveryItems []DiscoveryItem `xml:"item,omitempty"`
}

DiscoveryItemsQuery contains a query for discovery items

type EmptyReply

type EmptyReply struct {
}

An EmptyReply results is in no XML.

type EncryptedData added in v0.3.9

type EncryptedData struct {
	XMLName              xml.Name              `xml:"http://jabber.org/protocol/si/profile/encrypted-data-transfer data"`
	Type                 string                `xml:"type,omitempty"`
	MediaType            string                `xml:"media-type,omitempty"`
	Name                 string                `xml:"name,omitempty"`
	Size                 int64                 `xml:"size,omitempty"`
	Desc                 string                `xml:"desc,omitempty"`
	Date                 string                `xml:"date,omitempty"`
	Range                *FileRange            `xml:",omitempty"`
	Hash                 *Hash                 `xml:"hash,omitempty"`
	EncryptionParameters *EncryptionParameters `xml:"encryption,omitempty"`
}

EncryptedData is an element from an unpublished potential XEP

type EncryptionKeyParameter added in v0.3.9

type EncryptionKeyParameter struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/si/profile/encrypted-data-transfer key"`
	Type    string   `xml:"type,attr"` // 'static' or 'external'
	Value   string   `xml:"value,attr,omitempty"`
}

EncryptionKeyParameter is an element from an unpublished potential XEP

type EncryptionParameters added in v0.3.9

type EncryptionParameters struct {
	XMLName       xml.Name                `xml:"http://jabber.org/protocol/si/profile/encrypted-data-transfer encryption"`
	Type          string                  `xml:"type,attr"`
	IV            string                  `xml:"iv,attr"`
	MAC           string                  `xml:"mac,attr"`
	EncryptionKey *EncryptionKeyParameter `xml:"encryption-key"`
	MACKey        *EncryptionKeyParameter `xml:"mac-key"`
}

EncryptionParameters is an element from an unpublished potential XEP

type ErrorBadRequest

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

ErrorBadRequest reflects a bad-request stanza. See http://xmpp.org/rfcs/rfc6120.html#stanzas-error-conditions-bad-request

type ErrorForbidden added in v0.3.9

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

ErrorForbidden reflects a forbidden stanza.

type ErrorItemNotFound added in v0.3.9

type ErrorItemNotFound struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas item-not-found"`
}

ErrorItemNotFound reflects an item not found stanza

type ErrorNoValidStreams added in v0.3.9

type ErrorNoValidStreams struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/si no-valid-streams"`
}

ErrorNoValidStreams reflects an error when no stream types offered were acceptable Ref: XEP-0095

type ErrorNotAcceptable added in v0.3.9

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

ErrorNotAcceptable reflects a not acceptable stanza

type ErrorReply

type ErrorReply struct {
	XMLName xml.Name    `xml:"error"`
	Type    string      `xml:"type,attr"`
	Code    int         `xml:"code,attr,omitempty"`
	Error   interface{} `xml:"error"`
	Error2  interface{} `xml:"error2,omitempty"`
	Text    string      `xml:"urn:ietf:params:xml:ns:xmpp-stanzas text,omitempty"`
}

ErrorReply reflects an XMPP error stanza. See http://xmpp.org/rfcs/rfc6120.html#stanzas-error-syntax

type ErrorUnexpectedRequest added in v0.3.9

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

ErrorUnexpectedRequest reflects an unexpected request stanza

type Extension

type Extension Any

Extension represents any XML node not included in the Stanza definition

type Extensions

type Extensions []*Extension

Extensions implements generic XEPs.

type FailureTLS

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

FailureTLS represents a TLS failure

type FeatureNegotation added in v0.3.9

type FeatureNegotation struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/feature-neg feature"`
	Form    Form
}

FeatureNegotation is a data element from http://xmpp.org/extensions/xep-0020.html.

type File added in v0.3.9

type File struct {
	XMLName xml.Name   `xml:"http://jabber.org/protocol/si/profile/file-transfer file"`
	Date    string     `xml:"date,attr,omitempty"`
	Hash    string     `xml:"hash,attr,omitempty"`
	Name    string     `xml:"name,attr,omitempty"`
	Size    int64      `xml:"size,attr,omitempty"`
	Desc    string     `xml:"desc,omitempty"`
	Range   *FileRange `xml:",omitempty"`
}

File is a data element from http://xmpp.org/extensions/xep-0096.html.

type FileRange added in v0.3.9

type FileRange struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/si/profile/file-transfer range"`
	Length  *int     `xml:"length,attr,omitempty"`
	Offset  *int     `xml:"offset,attr,omitempty"`
}

FileRange is a data element from http://xmpp.org/extensions/xep-0096.html.

type FixedFormField

type FixedFormField struct {
	FormField

	Text string
}

FixedFormField is used to indicate a section heading. It's for the form to send data to the user rather than the other way around.

type Form

type Form struct {
	XMLName      xml.Name     `xml:"jabber:x:data x"`
	Type         string       `xml:"type,attr"`
	Title        string       `xml:"title,omitempty"`
	Instructions string       `xml:"instructions,omitempty"`
	Fields       []FormFieldX `xml:"field"`
}

Form contains the definition for a data submission

type FormCallback

type FormCallback func(title, instructions string, fields []interface{}) error

FormCallback is the type of a function called to process a form. The argument is a list of pointers to FormField types. The function should type cast the elements, prompt the user and fill in the result field in each struct.

type FormField

type FormField struct {
	// Label is a human readable label for this field.
	Label string
	// Type is the XMPP-internal type of this field. One should type cast
	// rather than inspect this.
	Type string
	// Name gives the internal name of the field.
	Name string
	// Required specifies is the field is required.
	Required bool
	// Media contains one of more items of media associated with this
	// field and, for each item, one or more representations of it.
	Media [][]Media
}

FormField is the type of a generic form field. One should type cast to a specific type of field before processing.

type FormFieldMediaX

type FormFieldMediaX struct {
	XMLName xml.Name    `xml:"urn:xmpp:media-element media"`
	URIs    []MediaURIX `xml:"uri"`
}

FormFieldMediaX contains form field media information

type FormFieldOptionX

type FormFieldOptionX struct {
	Label string `xml:"var,attr,omitempty"`
	Value string `xml:"value"`
}

FormFieldOptionX contains a form field option

type FormFieldRequiredX

type FormFieldRequiredX struct {
	XMLName xml.Name `xml:"required"`
}

FormFieldRequiredX contains information about whether a form field is required

type FormFieldX

type FormFieldX struct {
	XMLName  xml.Name            `xml:"field"`
	Desc     string              `xml:"desc,omitempty"`
	Var      string              `xml:"var,attr"`
	Type     string              `xml:"type,attr,omitempty"`
	Label    string              `xml:"label,attr,omitempty"`
	Required *FormFieldRequiredX `xml:"required"`
	Values   []string            `xml:"value"`
	Options  []FormFieldOptionX  `xml:"option"`
	Media    []FormFieldMediaX   `xml:"media"`
}

FormFieldX contains form field information

type Hash added in v0.3.9

type Hash struct {
	XMLName   xml.Name `xml:"urn:xmpp:hashes:2 hash"`
	Algorithm string   `xml:"algo,attr"`
	Base64    string   `xml:",chardata"`
}

Hash is a data element from http://xmpp.org/extensions/xep-0300.html.

type HashUsed added in v0.3.9

type HashUsed struct {
	XMLName   xml.Name `xml:"urn:xmpp:hashes:2 hash-used"`
	Algorithm string   `xml:"algo,attr"`
}

HashUsed is a data element from http://xmpp.org/extensions/xep-0300.html.

type IBBClose added in v0.3.9

type IBBClose struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/ibb close"`
	Sid     string   `xml:"sid,attr"`
}

IBBClose is an element from http://xmpp.org/extensions/xep-0047.html.

type IBBData added in v0.3.9

type IBBData struct {
	XMLName  xml.Name `xml:"http://jabber.org/protocol/ibb data"`
	Sid      string   `xml:"sid,attr"`
	Sequence uint16   `xml:"seq,attr"`
	Base64   string   `xml:",chardata"`
}

IBBData is an element from http://xmpp.org/extensions/xep-0047.html.

type IBBOpen added in v0.3.9

type IBBOpen struct {
	XMLName   xml.Name `xml:"http://jabber.org/protocol/ibb open"`
	BlockSize int      `xml:"block-size,attr"`
	Sid       string   `xml:"sid,attr"`
	Stanza    string   `xml:"stanza,attr,omitempty"`
}

IBBOpen is an element from http://xmpp.org/extensions/xep-0047.html.

type InBandRegistration

type InBandRegistration struct {
	XMLName xml.Name `xml:"http://jabber.org/features/iq-register register,omitempty"`
}

InBandRegistration represents an inband registration

type Media

type Media struct {
	MIMEType string
	// URI contains a URI to the data. It may be empty if Data is not.
	URI string
	// Data contains the raw data itself. It may be empty if URI is not.
	Data []byte
}

Media contains a specific media uri and data

type MediaURIX

type MediaURIX struct {
	XMLName  xml.Name `xml:"urn:xmpp:media-element uri"`
	MIMEType string   `xml:"type,attr,omitempty"`
	URI      string   `xml:",chardata"`
}

MediaURIX contains information about a Media URI

type MultiSelectionFormField

type MultiSelectionFormField struct {
	FormField

	Values  []string
	Ids     []string
	Results []int
}

MultiSelectionFormField asks the user to pick a subset of possible choices. The Result member should be set to a series of indexes of the Results array.

type MultiTextFormField

type MultiTextFormField struct {
	FormField

	Defaults []string
	Results  []string
}

MultiTextFormField is for the entry of a several textual items. The Results member should be set to the data entered.

type Occupant added in v0.3.9

type Occupant struct {
	Room
	Handle string
}

See: Section 4.1

func (*Occupant) JID added in v0.3.9

func (o *Occupant) JID() string

type PingRequest

type PingRequest struct {
	XMLName xml.Name `xml:"urn:xmpp:ping ping"`
}

PingRequest represents a Ping IQ as defined by XEP-0199

type ProceedTLS

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

ProceedTLS represents a TLS proceed

type RegisterQuery

type RegisterQuery struct {
	XMLName  xml.Name  `xml:"jabber:iq:register query"`
	Username *xml.Name `xml:"username"`
	Password *xml.Name `xml:"password"`
	Form     Form      `xml:"x"`
	Datas    []BobData `xml:"data"`
}

RegisterQuery contains register query information for creating a new account

type ResultFirst added in v0.3.9

type ResultFirst struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/rsm first"`
	Index   string   `xml:"index,attr,omitempty"`
	Data    string   `xml:",cdata"`
}

ResultFirst is a data element from http://xmpp.org/extensions/xep-0059.html.

type ResultSet added in v0.3.9

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

ResultSet is a data element from http://xmpp.org/extensions/xep-0059.html.

type Room added in v0.3.9

type Room struct {
	ID, Service string
}

See: Section 4.1

func (*Room) JID added in v0.3.9

func (o *Room) JID() string

type RoomConfigurationQuery added in v0.3.9

type RoomConfigurationQuery struct {
	XMLName xml.Name `xml:"http://jabber.org/protocol/muc#owner query"`
	Form    *Form    `xml:,omitempty`
}

RoomConfigurationQuery contains the deserialized information about a room configuration query See: Section "10.2 Subsequent Room Configuration"

type RoomInfo added in v0.3.9

type RoomInfo struct {
	RoomInfoForm `form-type:"http://jabber.org/protocol/muc#roominfo"`
	RoomType
}

TODO: Ahh, naming

type RoomInfoForm added in v0.3.9

type RoomInfoForm struct {
	MaxHistoryFetch string   `form-field:"muc#maxhistoryfetch"`
	ContactJID      []string `form-field:"muc#roominfo_contactjid"`
	Description     string   `form-field:"muc#roominfo_description"`
	Language        string   `form-field:"muc#roominfo_language"`
	LDAPGroup       string   `form-field:"muc#roominfo_ldapgroup"`
	Logs            string   `form-field:"muc#roominfo_logs"`
	Occupants       int      `form-field:"muc#roominfo_occupants"`
	Subject         string   `form-field:"muc#roominfo_subject"`
	SubjectMod      bool     `form-field:"muc#roominfo_subjectmod"`
}

See: Section 15.5.4 muc#roominfo FORM_TYPE

type RoomType added in v0.3.9

type RoomType struct {
	Public bool

	Open bool

	Moderated bool

	SemiAnonymous bool

	PasswordProtected bool

	Persistent bool
}

See: Section 4.2

type Roster

type Roster struct {
	XMLName xml.Name      `xml:"jabber:iq:roster query"`
	Item    []RosterEntry `xml:"item"`
}

Roster contains a list of roster entries

type RosterEntry

type RosterEntry struct {
	Jid          string   `xml:"jid,attr"`
	Subscription string   `xml:"subscription,attr"`
	Name         string   `xml:"name,attr"`
	Group        []string `xml:"group"`
	Ask          string   `xml:"ask,attr"`
}

RosterEntry contains one roster entry

func ParseRoster

func ParseRoster(reply Stanza) ([]RosterEntry, error)

ParseRoster extracts roster information from the given Stanza.

type RosterRequest

type RosterRequest struct {
	XMLName xml.Name          `xml:"jabber:iq:roster query"`
	Item    RosterRequestItem `xml:"item"`
}

RosterRequest is used to request that the server update the user's roster. See RFC 6121, section 2.3.

type RosterRequestItem

type RosterRequestItem struct {
	Jid          string   `xml:"jid,attr"`
	Subscription string   `xml:"subscription,attr"`
	Name         string   `xml:"name,attr"`
	Group        []string `xml:"group"`
}

RosterRequestItem contains one specific entry

type SASLErrorCondition

type SASLErrorCondition string

SASLErrorCondition represents a defined SASL-related error conditions as defined in RFC 6120, section 6.5

type SI added in v0.3.9

type SI struct {
	XMLName       xml.Name       `xml:"http://jabber.org/protocol/si si"`
	ID            string         `xml:"id,attr,omitempty"`
	MIMEType      string         `xml:"mime-type,attr,omitempty"`
	Profile       string         `xml:"profile,attr,omitempty"`
	Any           *Any           `xml:",any,omitempty"`
	File          *File          `xml:",omitempty"`
	EncryptedData *EncryptedData `xml:",omitempty"`
	Feature       FeatureNegotation
}

SI is a data element from http://xmpp.org/extensions/xep-0095.html.

type SaslAbort

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

SaslAbort signifies a SASL abort

type SaslFailure

type SaslFailure struct {
	XMLName          xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl failure"`
	Text             string   `xml:"text,omitempty"`
	DefinedCondition Any      `xml:",any"`
}

SaslFailure signifies a SASL Failure

func (SaslFailure) Condition

func (f SaslFailure) Condition() SASLErrorCondition

Condition returns a SASL-related error condition

func (SaslFailure) String

func (f SaslFailure) String() string

type SaslMechanisms

type SaslMechanisms struct {
	XMLName   xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl mechanisms"`
	Mechanism []string `xml:"mechanism"`
}

SaslMechanisms contains information about SASL mechanisms RFC 3920 C.4 SASL name space TODO RFC 6120 obsoletes RFC 3920

type SaslSuccess

type SaslSuccess struct {
	XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl success"`
	Content []byte   `xml:",innerxml"`
}

SaslSuccess signifies a SASL Success

type SelectionFormField

type SelectionFormField struct {
	FormField

	Values []string
	Ids    []string
	Result int
}

SelectionFormField asks the user to pick a single element from a set of choices. The Result member should be set to an index of the Values array.

type Stanza

type Stanza struct {
	Name  xml.Name
	Value interface{}
}

Stanza represents a message from the XMPP server.

type StanzaError

type StanzaError struct {
	By   string `xml:"by,attr"`
	Code string `xml:"code,attr"` // NOTE: I could not find this in the spec

	// cancel -- do not retry (the error is unrecoverable)
	// continue -- proceed (the condition was only a warning)
	// modify -- retry after changing the data sent
	// auth -- retry after providing credentials
	// wait -- retry after waiting (the error is temporary)
	Type string `xml:"type,attr"`
	Text string `xml:"urn:ietf:params:xml:ns:xmpp-stanzas text"`

	//TODO: Replace references by a function call
	Condition struct {
		XMLName xml.Name
		Body    string `xml:",innerxml"`
	} `xml:",any"`

	ApplicationCondition *Any `xml:",any,ommitempty"`
}

StanzaError implements RFC 3920, section 9.3. TODO RFC 6120 obsoletes RFC 3920, section "8.3.2. Syntax"

type StartTLS

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

StartTLS represents a TLS start RFC 6120, section 5

type StreamClose

type StreamClose struct{}

StreamClose represents a request to close the stream

type StreamError

type StreamError struct {
	XMLName              xml.Name `xml:"http://etherx.jabber.org/streams error"`
	Text                 string   `xml:"text,omitempty"`
	AppSpecificCondition *Any     `xml:",any,omitempty"`

	DefinedCondition StreamErrorCondition
}

StreamError represents an XMPP Stream Error as defined in RFC 6120, section 4.9

func (*StreamError) String

func (s *StreamError) String() string

type StreamErrorCondition

type StreamErrorCondition string

StreamErrorCondition represents a defined stream error condition as defined in RFC 6120, section 4.9.3

func (StreamErrorCondition) MarshalXML

func (c StreamErrorCondition) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements xml.Marshaler interface

type StreamFeatures

type StreamFeatures struct {
	XMLName            xml.Name `xml:"http://etherx.jabber.org/streams features"`
	StartTLS           StartTLS
	Mechanisms         SaslMechanisms
	Bind               BindBind
	InBandRegistration *InBandRegistration

	// This is a hack for now to get around the fact that the new encoding/xml
	// doesn't unmarshal to XMLName elements.
	Session *string `xml:"session"`
	// contains filtered or unexported fields
}

StreamFeatures contain information about the features this stream supports RFC 3920 C.1 Streams name space TODO RFC 6120 obsoletes RFC 3920

type TextFormField

type TextFormField struct {
	FormField

	Default string
	Result  string

	// Private is true if this is a password or other sensitive entry.
	Private bool
}

TextFormField is for the entry of a single textual item. The Result member should be set to the data entered.

type VCard added in v0.3.6

type VCard struct {
	XMLName xml.Name `xml:"vcard-temp vCard"`

	FullName string `xml:"FN"`
	Nickname string `xml:"NICKNAME"`
}

VCard contains vcard

func ParseVCard added in v0.3.6

func ParseVCard(reply Stanza) (VCard, error)

ParseVCard extracts vcard information from the given Stanza.

type VersionQuery

type VersionQuery struct {
	XMLName xml.Name `xml:"jabber:iq:version query"`
}

VersionQuery represents a version query

type VersionReply

type VersionReply struct {
	XMLName xml.Name `xml:"jabber:iq:version query"`
	Name    string   `xml:"name"`
	Version string   `xml:"version"`
	OS      string   `xml:"os"`
}

VersionReply contains a version reply

Jump to

Keyboard shortcuts

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