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 HintNoCopy
- type HintNoPermanentStore
- type HintNoStore
- type HintStore
- 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 JabberDate
- 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 InvalidDateInput = errors.New("could not parse date. Input might not be in a supported format")
var InvalidDateOutput = errors.New("could not format date as desired")
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 ¶
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 ¶
type AffiliationOwner ¶
type Affiliations ¶
type Affiliations struct { List []Affiliation `xml:"affiliation"` Node string `xml:"node,attr,omitempty"` }
type AffiliationsOwner ¶
type AffiliationsOwner struct { XMLName xml.Name `xml:"affiliations"` Affiliations []AffiliationOwner `xml:"affiliation,omitempty"` Node string `xml:"node,attr"` }
func (AffiliationsOwner) UseCase ¶
func (AffiliationsOwner) UseCase() string
type AssocDisassoc ¶
type AssocDisassoc interface {
GetAssocDisassoc() string
}
********************* Associate/Disassociate *********************
type AssociateEvent ¶
func (*AssociateEvent) GetAssocDisassoc ¶
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 ¶
func (*BadFormat) GroupErrorName ¶
type BadNamespacePrefix ¶
type BadNamespacePrefix struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas bad-namespace-prefix"`
}
func (*BadNamespacePrefix) GroupErrorName ¶
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 ¶
type CollectionEvent struct { AssocDisassoc AssocDisassoc Node string `xml:"node,attr,omitempty"` }
func (CollectionEvent) Name ¶
func (c CollectionEvent) Name() string
type Command ¶
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 ¶
type CommandElement ¶
type CommandElement interface {
Ref() string
}
type ConfigurationEvent ¶
func (ConfigurationEvent) Name ¶
func (c ConfigurationEvent) Name() string
type ConfigureOwner ¶
type ConfigureOwner struct { XMLName xml.Name `xml:"configure"` Node string `xml:"node,attr,omitempty"` Form *Form `xml:"x,omitempty"` }
func (*ConfigureOwner) UseCase ¶
func (*ConfigureOwner) UseCase() string
type Conflict ¶
func (*Conflict) GroupErrorName ¶
type ConnectionTimeout ¶
type ConnectionTimeout struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas connection-timeout"`
}
func (*ConnectionTimeout) GroupErrorName ¶
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 ¶
func (c *ControlSet) GetSet() *ResultSet
func (*ControlSet) Namespace ¶
func (c *ControlSet) Namespace() string
type ControlSetResponse ¶
func (*ControlSetResponse) GetSet ¶
func (c *ControlSetResponse) GetSet() *ResultSet
func (*ControlSetResponse) Namespace ¶
func (c *ControlSetResponse) Namespace() string
type DefaultOwner ¶
func (*DefaultOwner) UseCase ¶
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 ¶
func (d *Delegation) GetSet() *ResultSet
func (*Delegation) Namespace ¶
func (d *Delegation) Namespace() string
type DeleteEvent ¶
type DeleteEvent struct { Node string `xml:"node,attr"` Redirect *RedirectEvent `xml:"redirect"` }
func (DeleteEvent) Name ¶
func (c DeleteEvent) Name() string
type DeleteOwner ¶
type DeleteOwner struct { XMLName xml.Name `xml:"delete"` RedirectOwner *RedirectOwner `xml:"redirect,omitempty"` Node string `xml:"node,attr,omitempty"` }
func (*DeleteOwner) UseCase ¶
func (*DeleteOwner) UseCase() string
type DisassociateEvent ¶
type DisassociateEvent struct { XMLName xml.Name `xml:"disassociate"` Node string `xml:"node,attr"` }
func (*DisassociateEvent) GetAssocDisassoc ¶
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 ¶
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 ¶
type EventElement interface {
Name() string
}
type Field ¶
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 ¶
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 ¶
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 HintNoCopy ¶
type HintNoCopy struct { MsgExtension XMLName xml.Name `xml:"urn:xmpp:hints no-copy"` }
type HintNoPermanentStore ¶
type HintNoPermanentStore struct { MsgExtension XMLName xml.Name `xml:"urn:xmpp:hints no-permanent-store"` }
type HintNoStore ¶
type HintNoStore struct { MsgExtension XMLName xml.Name `xml:"urn:xmpp:hints no-store"` }
type HintStore ¶
type HintStore struct { MsgExtension XMLName xml.Name `xml:"urn:xmpp:hints store"` }
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 ¶
func (*HostGone) GroupErrorName ¶
type HostUnknown ¶
type HostUnknown struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas host-unknown"`
}
func (*HostUnknown) GroupErrorName ¶
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 ¶
NewAffiliationListRequest creates a request to list all affiliated entities See 8.9.1 Retrieve List List
func NewApprovePendingSubRequest ¶
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 ¶
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 ¶
NewCreateAndConfigNode makes a request for node creation that has the desired node configuration. See 8.1.3 Create and Configure a Node
func NewCreateNode ¶
NewCreateNode builds a request to create a node on the service referenced by "serviceId" See 8.1 Create a Node
func NewDelItemFromNode ¶
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 ¶
NewDelNode creates a request to delete node "nodeID" from the "serviceId" service See 8.4 Delete a Node
func NewFormSubmission ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
NewPublishItemRq creates a request to publish a single item to a node identified by its provided ID
func NewPurgeAllItems ¶
NewPurgeAllItems creates a new purge request for the "nodeId" node, at "serviceId" service See 8.5 Purge All Node Items
func NewRequestDefaultConfig ¶
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 ¶
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 ¶
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 ¶
NewItemsRequest creates a request to get a specific item from a node. 6.5.8 Requesting a Particular Item
func NewSubAndConfig ¶
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 ¶
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 ¶
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 ¶
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 ¶
func NewSubsForEntitiesRequest(serviceId, nodeID string, subs []SubscriptionOwner) (*IQ, error)
func NewUnsubRq ¶
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 ¶
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 ¶
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 ¶
func (iq *IQ) RosterItems() *RosterItems
RosterItems builds a default RosterItems payload
func (*IQ) UnmarshalXML ¶
UnmarshalXML implements custom parsing for IQs
type ImproperAddressing ¶
type ImproperAddressing struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas improper-addressing"`
}
func (*ImproperAddressing) GroupErrorName ¶
func (e *ImproperAddressing) GroupErrorName() string
type InternalServerError ¶
type InternalServerError struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas internal-server-error"`
}
func (*InternalServerError) GroupErrorName ¶
func (e *InternalServerError) GroupErrorName() string
type InvalidForm ¶
type InvalidForm struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas invalid-from"`
}
func (*InvalidForm) GroupErrorName ¶
func (e *InvalidForm) GroupErrorName() string
type InvalidId ¶
func (*InvalidId) GroupErrorName ¶
type InvalidNamespace ¶
type InvalidNamespace struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas invalid-namespace"`
}
func (*InvalidNamespace) GroupErrorName ¶
func (e *InvalidNamespace) GroupErrorName() string
type InvalidXML ¶
func (*InvalidXML) GroupErrorName ¶
func (e *InvalidXML) GroupErrorName() string
type ItemsEvent ¶
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 ¶
func (i ItemsEvent) Name() string
type JabberDate ¶
type JabberDate struct {
// contains filtered or unexported fields
}
func NewJabberDateFromString ¶
func NewJabberDateFromString(strDate string) (JabberDate, error)
func (JabberDate) DateTimeToString ¶
func (d JabberDate) DateTimeToString(nanos bool) string
func (JabberDate) DateToString ¶
func (d JabberDate) DateToString() string
func (JabberDate) TimeToString ¶
func (d JabberDate) TimeToString(nanos bool) (string, error)
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 ¶
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 ¶
type NotAuthorized struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas not-authorized"`
}
func (*NotAuthorized) GroupErrorName ¶
func (e *NotAuthorized) GroupErrorName() string
type NotWellFormed ¶
type NotWellFormed struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas not-well-formed"`
}
func (*NotWellFormed) GroupErrorName ¶
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 ¶
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 ¶
type PolicyViolation struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas policy-violation"`
}
func (*PolicyViolation) GroupErrorName ¶
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 ¶
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 ¶
func (pse *PubSubEvent) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type PubSubGeneric ¶
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 ¶
func (p *PubSubGeneric) GetSet() *ResultSet
func (*PubSubGeneric) Namespace ¶
func (p *PubSubGeneric) Namespace() string
type PubSubOption ¶
type PubSubOwner ¶
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 ¶
func (pso *PubSubOwner) GetSet() *ResultSet
func (*PubSubOwner) Namespace ¶
func (pso *PubSubOwner) Namespace() string
func (*PubSubOwner) UnmarshalXML ¶
func (pso *PubSubOwner) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type PublishOptions ¶
type PurgeEvent ¶
func (PurgeEvent) Name ¶
func (p PurgeEvent) Name() string
type PurgeOwner ¶
func (*PurgeOwner) UseCase ¶
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 ¶
type RedirectEvent struct {
URI string `xml:"uri,attr"`
}
********************* Redirect *********************
type RedirectOwner ¶
type RemoteConnectionFailed ¶
type RemoteConnectionFailed struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas remote-connection-failed"`
}
func (*RemoteConnectionFailed) GroupErrorName ¶
func (e *RemoteConnectionFailed) GroupErrorName() string
type Reset ¶
func (*Reset) GroupErrorName ¶
type ResourceConstraint ¶
type ResourceConstraint struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas resource-constraint"`
}
func (*ResourceConstraint) GroupErrorName ¶
func (e *ResourceConstraint) GroupErrorName() string
type RestrictedXML ¶
type RestrictedXML struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas restricted-xml"`
}
func (*RestrictedXML) GroupErrorName ¶
func (e *RestrictedXML) GroupErrorName() string
type ResultSet ¶
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 ¶
type Roster ¶
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 ¶
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 ¶
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 ¶
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 ¶
func (r *RosterItems) GetSet() *ResultSet
func (*RosterItems) Namespace ¶
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 ¶
Answer as defined in Stream Management spec Reference: https://xmpp.org/extensions/xep-0198.html#acking
type SMEnabled ¶
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 ¶
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 ¶
type SMRequest ¶
Request as defined in Stream Management spec Reference: https://xmpp.org/extensions/xep-0198.html#acking
type SMResume ¶
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 ¶
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 ¶
type SeeOtherHost struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas see-other-host"`
}
func (*SeeOtherHost) GroupErrorName ¶
func (e *SeeOtherHost) GroupErrorName() string
type StanzaErrorGroup ¶
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 ¶
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 ¶
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 ¶
type StreamClosePacket struct{}
This is just a closing tag and hold no information
func (StreamClosePacket) Name ¶
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 ¶
func (s *StreamSession) GetSet() *ResultSet
func (*StreamSession) IsOptional ¶
func (s *StreamSession) IsOptional() bool
func (*StreamSession) Namespace ¶
func (s *StreamSession) Namespace() string
type SubInfo ¶
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 ¶
type Subscription ¶
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 ¶
type SubscriptionEvent struct { SubStatus string `xml:"subscription,attr,omitempty"` Expiry string `xml:"expiry,attr,omitempty"` SubInfo `xml:",omitempty"` }
func (SubscriptionEvent) Name ¶
func (s SubscriptionEvent) Name() string
type SubscriptionOwner ¶
type Subscriptions ¶
type Subscriptions struct { XMLName xml.Name `xml:"subscriptions"` List []Subscription `xml:"subscription,omitempty"` }
Handles the "5.6 Retrieve Subscriptions" of XEP-0060
type SubscriptionsOwner ¶
type SubscriptionsOwner struct { XMLName xml.Name `xml:"subscriptions"` Subscriptions []SubscriptionOwner `xml:"subscription"` Node string `xml:"node,attr"` }
func (*SubscriptionsOwner) UseCase ¶
func (*SubscriptionsOwner) UseCase() string
type SystemShutdown ¶
type SystemShutdown struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas system-shutdown"`
}
func (*SystemShutdown) GroupErrorName ¶
func (e *SystemShutdown) GroupErrorName() string
type TLSProceed ¶
Used during stream initiation / session establishment
type TlsStartTLS ¶
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 ¶
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 ¶
type UnAckQueue struct { Uslice []*UnAckedStz sync.RWMutex }
func NewUnAckQueue ¶
func NewUnAckQueue() *UnAckQueue
func (*UnAckQueue) Empty ¶
func (uaq *UnAckQueue) Empty() bool
func (*UnAckQueue) Peek ¶
func (uaq *UnAckQueue) Peek() Queueable
func (*UnAckQueue) PeekN ¶
func (uaq *UnAckQueue) PeekN(n int) []Queueable
func (*UnAckQueue) Pop ¶
func (uaq *UnAckQueue) Pop() Queueable
No guarantee regarding thread safety !
func (*UnAckQueue) PopN ¶
func (uaq *UnAckQueue) PopN(n int) []Queueable
No guarantee regarding thread safety !
func (*UnAckQueue) Push ¶
func (uaq *UnAckQueue) Push(s Queueable) error
type UnAckedStz ¶
func (*UnAckedStz) QueueableName ¶
func (u *UnAckedStz) QueueableName() string
type UndefinedCondition ¶
type UndefinedCondition struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas undefined-condition"`
}
func (*UndefinedCondition) GroupErrorName ¶
func (e *UndefinedCondition) GroupErrorName() string
type UnexpectedRequest ¶
type UnexpectedRequest struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas unexpected-request"`
}
func (*UnexpectedRequest) GroupErrorName ¶
func (e *UnexpectedRequest) GroupErrorName() string
type Unsubscribe ¶
type UnsupportedEncoding ¶
type UnsupportedEncoding struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas unsupported-encoding"`
}
func (*UnsupportedEncoding) GroupErrorName ¶
func (e *UnsupportedEncoding) GroupErrorName() string
type UnsupportedStanzaType ¶
type UnsupportedStanzaType struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas unsupported-stanza-type"`
}
func (*UnsupportedStanzaType) GroupErrorName ¶
func (e *UnsupportedStanzaType) GroupErrorName() string
type UnsupportedVersion ¶
type UnsupportedVersion struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas unsupported-version"`
}
func (*UnsupportedVersion) GroupErrorName ¶
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 ¶
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 ¶
type XMLNotWellFormed struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-stanzas xml-not-well-formed"`
}
func (*XMLNotWellFormed) GroupErrorName ¶
func (e *XMLNotWellFormed) GroupErrorName() string
Source Files ¶
- commands.go
- component.go
- datetime_profiles.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_hint.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