Documentation
¶
Overview ¶
XMPP stanza package is used to parse, marshal and unmarshal XMPP stanzas and nonzas.
Index ¶
- Constants
- Variables
- func InitStream(p *xml.Decoder) (sessionID string, err error)
- func NextStart(p *xml.Decoder) (xml.StartElement, error)
- func NextXmppToken(p *xml.Decoder) (xml.Token, error)
- type Actions
- type Affiliation
- type AffiliationOwner
- type Affiliations
- type AffiliationsOwner
- type AssocDisassoc
- type AssociateEvent
- type Attr
- type Attrs
- type BadFormat
- type BadNamespacePrefix
- type Bind
- type Caps
- type CollectionEvent
- type Command
- type CommandElement
- type ConfigurationEvent
- type Configure
- type ConfigureOwner
- type Conflict
- type ConnectionTimeout
- type ControlField
- type ControlGetForm
- type ControlSet
- type ControlSetResponse
- type Create
- type Default
- type DefaultOwner
- type Delegated
- type Delegation
- type DeleteEvent
- type DeleteOwner
- type DisassociateEvent
- type DiscoInfo
- func (d *DiscoInfo) AddFeatures(namespace ...string)
- func (d *DiscoInfo) AddIdentity(name, category, typ string)
- func (d *DiscoInfo) GetSet() *ResultSet
- func (d *DiscoInfo) Namespace() string
- func (d *DiscoInfo) SetFeatures(namespace ...string) *DiscoInfo
- func (d *DiscoInfo) SetIdentities(ident ...Identity) *DiscoInfo
- func (d *DiscoInfo) SetNode(node string) *DiscoInfo
- type DiscoItem
- type DiscoItems
- type Err
- type ErrorType
- type EventElement
- type Feature
- type Field
- type FieldType
- type FifoQueue
- type First
- type Form
- type FormItem
- type FormType
- type Forwarded
- type HTML
- type HTMLBody
- type Handshake
- type History
- type HostGone
- type HostUnknown
- type IQ
- func NewAffiliationListRequest(serviceId, nodeID string) (*IQ, error)
- func NewApprovePendingSubRequest(serviceId, sessionId, nodeId string) (*IQ, error)
- func NewConfigureNode(serviceId, nodeName string) (*IQ, error)
- func NewCreateAndConfigNode(serviceId, nodeID string, confForm *Form) (*IQ, error)
- func NewCreateNode(serviceId, nodeName string) (*IQ, error)
- func NewDelItemFromNode(serviceId, nodeID, itemId string, notify *bool) (*IQ, error)
- func NewDelNode(serviceId, nodeID string) (*IQ, error)
- func NewFormSubmission(serviceId string, subInfo SubInfo, form *Form) (*IQ, error)
- func NewFormSubmissionOwner(serviceId, nodeName string, fields []*Field) (*IQ, error)
- func NewGetPendingSubRequests(serviceId string) (*IQ, error)
- func NewIQ(a Attrs) (*IQ, error)
- func NewItemsRequest(serviceId string, node string, maxItems int) (*IQ, error)
- func NewModifAffiliationRequest(serviceId, nodeID string, newAffils []AffiliationOwner) (*IQ, error)
- func NewPublishItemOptsRq(serviceId, nodeID string, items []Item, options *PublishOptions) (*IQ, error)
- func NewPublishItemRq(serviceId, nodeID, pubItemID string, item Item) (*IQ, error)
- func NewPurgeAllItems(serviceId, nodeId string) (*IQ, error)
- func NewRequestDefaultConfig(serviceId string) (*IQ, error)
- func NewRetrieveAllAffilsRequest(serviceId string) (*IQ, error)
- func NewRetrieveAllSubsRequest(serviceId string) (*IQ, error)
- func NewSpecificItemRequest(serviceId, node, itemId string) (*IQ, error)
- func NewSubAndConfig(serviceId string, subInfo SubInfo, form *Form) (*IQ, error)
- func NewSubListRqPl(serviceId, nodeID string) (*IQ, error)
- func NewSubOptsRq(serviceId string, subInfo SubInfo) (*IQ, error)
- func NewSubRq(serviceId string, subInfo SubInfo) (*IQ, error)
- func NewSubsForEntitiesRequest(serviceId, nodeID string, subs []SubscriptionOwner) (*IQ, error)
- func NewUnsubRq(serviceId string, subInfo SubInfo) (*IQ, error)
- func (iq *IQ) DiscoInfo() *DiscoInfo
- func (iq *IQ) DiscoItems() *DiscoItems
- func (iq *IQ) GetFormFields() (map[string]*Field, error)
- func (iq *IQ) IsValid() (bool, error)
- func (iq *IQ) MakeError(xerror Err) *IQ
- func (*IQ) Name() string
- func (*IQ) NoOp()
- func (iq *IQ) RosterIQ() *Roster
- func (iq *IQ) RosterItems() *RosterItems
- func (iq *IQ) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- func (iq *IQ) Version() *Version
- type IQPayload
- type Identity
- type ImproperAddressing
- type InternalServerError
- type InvalidForm
- type InvalidId
- type InvalidNamespace
- type InvalidXML
- type Item
- type ItemEvent
- type Items
- type ItemsEvent
- type Jid
- type MarkAcknowledged
- type MarkDisplayed
- type MarkReceived
- type Markable
- type Message
- type Mood
- type MsgExtension
- type MucPresence
- type Node
- type NotAuthorized
- type NotWellFormed
- type Note
- type NullableInt
- type OOB
- type Option
- type OwnerUseCase
- type Packet
- type PacketType
- type PolicyViolation
- type PresExtension
- type Presence
- type PresenceShow
- type PubSubEvent
- type PubSubGeneric
- type PubSubOption
- type PubSubOwner
- type Publish
- type PublishOptions
- type PurgeEvent
- type PurgeOwner
- type Queueable
- type ReceiptReceived
- type ReceiptRequest
- type RedirectEvent
- type RedirectOwner
- type RemoteConnectionFailed
- type Reset
- type ResourceConstraint
- type RestrictedXML
- type ResultSet
- type Retract
- type RetractEvent
- type Roster
- type RosterItem
- type RosterItems
- type SASLAuth
- type SASLFailure
- type SASLSuccess
- type SMAnswer
- type SMEnable
- type SMEnabled
- type SMFailed
- type SMRequest
- type SMResume
- type SMResumed
- type SeeOtherHost
- type StanzaErrorGroup
- type StanzaType
- type StateActive
- type StateComposing
- type StateGone
- type StateInactive
- type StatePaused
- type Stream
- type StreamClosePacket
- type StreamError
- type StreamFeatures
- type StreamSession
- type SubInfo
- type SubOptions
- type Subscribe
- type Subscription
- type SubscriptionEvent
- type SubscriptionOwner
- type Subscriptions
- type SubscriptionsOwner
- type SystemShutdown
- type TLSProceed
- type TlsStartTLS
- type Tune
- type UnAckQueue
- type UnAckedStz
- type UndefinedCondition
- type UnexpectedRequest
- type Unsubscribe
- type UnsupportedEncoding
- type UnsupportedStanzaType
- type UnsupportedVersion
- type Version
- type WebsocketOpen
- type XMLNotWellFormed
Constants ¶
const ( CommandActionCancel = "cancel" CommandActionComplete = "complete" CommandActionExecute = "execute" CommandActionNext = "next" CommandActionPrevious = "prev" CommandStatusCancelled = "canceled" CommandStatusCompleted = "completed" CommandStatusExecuting = "executing" CommandNoteTypeErr = "error" CommandNoteTypeInfo = "info" CommandNoteTypeWarn = "warn" )
const ( FormTypeCancel = "cancel" FormTypeForm = "form" FormTypeResult = "result" FormTypeSubmit = "submit" )
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" )
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" )
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" )
const ( AffiliationStatusMember = "member" AffiliationStatusNone = "none" AffiliationStatusOutcast = "outcast" AffiliationStatusOwner = "owner" AffiliationStatusPublisher = "publisher" AffiliationStatusPublishOnly = "publish-only" )
const ( SubscriptionStatusNone = "none" SubscriptionStatusPending = "pending" SubscriptionStatusSubscribed = "subscribed" SubscriptionStatusUnconfigured = "unconfigured" )
const Assoc = "Associate"
********************* Associate *********************
const Disassoc = "Disassociate"
********************* Disassociate *********************
const (
// NSDiscoInfo defines the namespace for disco IQ stanzas
NSDiscoInfo = "http://jabber.org/protocol/disco#info"
)
const (
NSDiscoItems = "http://jabber.org/protocol/disco#items"
)
const NSMsgChatMarkers = "urn:xmpp:chat-markers:0"
const NSMsgChatStateNotifications = "http://jabber.org/protocol/chatstates"
const NSMsgReceipts = "urn:xmpp:receipts"
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
const (
NSStreamManagement = "urn:xmpp:sm:3"
)
const PubSubCollectionEventName = "Collection"
const PubSubConfigEventName = "Configuration"
const PubSubDeleteEventName = "Delete"
********************* Delete *********************
const PubSubItemsEventName = "List"
const PubSubPurgeEventName = "Purge"
********************* Purge *********************
const PubSubSubscriptionEventName = "Subscription"
********************* Subscription *********************
const StreamClose = "</stream:stream>"
Variables ¶
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") )
var TypeRegistry = newRegistry()
Functions ¶
func InitStream ¶
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/> )
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"` }
type Affiliation ¶ added in v0.4.0
type AffiliationOwner ¶ added in v0.4.0
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
func (*AssociateEvent) GetAssocDisassoc ¶ added in v0.4.0
func (a *AssociateEvent) GetAssocDisassoc() string
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
func (*BadFormat) GroupErrorName ¶ added in v0.5.0
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
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) UnmarshalXML ¶ added in v0.4.0
type CommandElement ¶ added in v0.4.0
type CommandElement interface {
Ref() string
}
type ConfigurationEvent ¶ added in v0.4.0
func (ConfigurationEvent) Name ¶ added in v0.4.0
func (c ConfigurationEvent) Name() string
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
func (*Conflict) GroupErrorName ¶ added in v0.5.0
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 ControlGetForm ¶
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 ¶
func (*ControlSetResponse) GetSet ¶ added in v0.5.0
func (c *ControlSetResponse) GetSet() *ResultSet
func (*ControlSetResponse) Namespace ¶
func (c *ControlSetResponse) Namespace() string
type DefaultOwner ¶ added in v0.4.0
func (*DefaultOwner) UseCase ¶ added in v0.4.0
func (*DefaultOwner) UseCase() string
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 (*DiscoInfo) AddIdentity ¶
func (*DiscoInfo) SetFeatures ¶
func (*DiscoInfo) SetIdentities ¶
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 (*Err) UnmarshalXML ¶
UnmarshalXML implements custom parsing for XMPP errors
type EventElement ¶ added in v0.4.0
type EventElement interface {
Name() string
}
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 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 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
type Forwarded ¶
Forwarded is used to wrapped forwarded stanzas. TODO: Move it in another file, as it is not limited to components.
func (*Forwarded) UnmarshalXML ¶
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 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.
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 (*History) UnmarshalXML ¶
UnmarshalXML implements custom parsing for history element
type HostGone ¶ added in v0.5.0
func (*HostGone) GroupErrorName ¶ added in v0.5.0
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
NewAffiliationListRequest creates a request to list all affiliated entities See 8.9.1 Retrieve List List
func NewApprovePendingSubRequest ¶ added in v0.4.0
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
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
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
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
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
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
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
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
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 NewItemsRequest ¶ added in v0.4.0
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
NewPublishItemRq creates a request to publish a single item to a node identified by its provided ID
func NewPurgeAllItems ¶ added in v0.4.0
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
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
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
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
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
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
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
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
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
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) DiscoItems ¶
func (iq *IQ) DiscoItems() *DiscoItems
DiscoItems builds a default DiscoItems payload
func (*IQ) GetFormFields ¶ added in v0.4.0
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
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) RosterItems ¶ added in v0.4.0
func (iq *IQ) RosterItems() *RosterItems
RosterItems builds a default RosterItems payload
func (*IQ) UnmarshalXML ¶
UnmarshalXML implements custom parsing for IQs
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
func (*InvalidId) GroupErrorName ¶ added in v0.5.0
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
func (*InvalidXML) GroupErrorName ¶ added in v0.5.0
func (e *InvalidXML) GroupErrorName() string
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 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
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 (*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) UnmarshalXML ¶
UnmarshalXML implements custom parsing for messages
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 ¶
MarshalXML is a custom XML serializer used by xml.Marshal to serialize a Node structure to XML.
func (*Node) UnmarshalXML ¶
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 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 OwnerUseCase ¶ added in v0.4.0
type OwnerUseCase interface {
UseCase() string
}
type Packet ¶
type Packet interface {
Name() string
}
func NextPacket ¶
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 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 (*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) UnmarshalXML ¶
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 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 PublishOptions ¶ added in v0.4.0
type PurgeEvent ¶ added in v0.4.0
func (PurgeEvent) Name ¶ added in v0.4.0
func (p PurgeEvent) Name() string
type PurgeOwner ¶ added in v0.4.0
func (*PurgeOwner) UseCase ¶ added in v0.4.0
func (*PurgeOwner) UseCase() 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 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
func (*Reset) GroupErrorName ¶ added in v0.5.0
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 RetractEvent ¶ added in v0.4.0
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
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 ¶
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
Answer as defined in Stream Management spec Reference: https://xmpp.org/extensions/xep-0198.html#acking
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
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) UnmarshalXML ¶ added in v0.5.0
type SMRequest ¶ added in v0.1.2
Request as defined in Stream Management spec Reference: https://xmpp.org/extensions/xep-0198.html#acking
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
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
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" 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 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 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 ¶
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
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 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
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
Source Files
¶
- commands.go
- component.go
- doc.go
- error.go
- error_enum.go
- fifo_queue.go
- form.go
- iot.go
- iq.go
- iq_disco.go
- iq_roster.go
- iq_version.go
- jid.go
- message.go
- msg_chat_markers.go
- msg_chat_state.go
- msg_html.go
- msg_oob.go
- msg_pubsub_event.go
- msg_receipts.go
- node.go
- ns.go
- open.go
- packet.go
- packet_enum.go
- parser.go
- pep.go
- pres_muc.go
- presence.go
- presence_enum.go
- pubsub.go
- pubsub_owner.go
- registry.go
- results_sets.go
- sasl_auth.go
- stanza_errors.go
- starttls.go
- stream.go
- stream_features.go
- stream_management.go