Documentation ¶
Index ¶
- Constants
- Variables
- type Attribute
- type AttributeSet
- type Element
- func (e *Element) AppendElement(element XElement)
- func (e *Element) AppendElements(elements []XElement)
- func (e *Element) Attributes() AttributeSet
- func (e *Element) ClearElements()
- func (e *Element) Delay(from string, text string)
- func (e *Element) Elements() ElementSet
- func (e *Element) Error() XElement
- func (e *Element) From() string
- func (e *Element) FromGob(dec *gob.Decoder)
- func (e *Element) ID() string
- func (e *Element) IsError() bool
- func (e *Element) IsStanza() bool
- func (e *Element) Language() string
- func (e *Element) Name() string
- func (e *Element) Namespace() string
- func (e *Element) RemoveAttribute(label string)
- func (e *Element) RemoveElements(name string)
- func (e *Element) RemoveElementsNamespace(name, namespace string)
- func (e *Element) SetAttribute(label, value string)
- func (e *Element) SetFrom(from string)
- func (e *Element) SetID(identifier string)
- func (e *Element) SetLanguage(language string)
- func (e *Element) SetName(name string)
- func (e *Element) SetNamespace(namespace string)
- func (e *Element) SetText(text string)
- func (e *Element) SetTo(to string)
- func (e *Element) SetType(tp string)
- func (e *Element) SetVersion(version string)
- func (e *Element) String() string
- func (e *Element) Text() string
- func (e *Element) To() string
- func (e *Element) ToGob(enc *gob.Encoder)
- func (e *Element) ToXML(w io.Writer, includeClosing bool)
- func (e *Element) Type() string
- func (e *Element) Version() string
- type ElementSet
- type IQ
- func (stanza *IQ) BadRequestError() Stanza
- func (stanza *IQ) ConflictError() Stanza
- func (stanza *IQ) FeatureNotImplementedError() Stanza
- func (stanza *IQ) ForbiddenError() Stanza
- func (stanza *IQ) FromJID() *jid.JID
- func (stanza *IQ) GoneError() Stanza
- func (stanza *IQ) InternalServerError() Stanza
- func (iq *IQ) IsGet() bool
- func (iq *IQ) IsResult() bool
- func (iq *IQ) IsSet() bool
- func (stanza *IQ) ItemNotFoundError() Stanza
- func (stanza *IQ) JidMalformedError() Stanza
- func (stanza *IQ) NotAcceptableError() Stanza
- func (stanza *IQ) NotAllowedError() Stanza
- func (stanza *IQ) NotAuthorizedError() Stanza
- func (stanza *IQ) PaymentRequiredError() Stanza
- func (stanza *IQ) RecipientUnavailableError() Stanza
- func (stanza *IQ) RedirectError() Stanza
- func (stanza *IQ) RegistrationRequiredError() Stanza
- func (stanza *IQ) RemoteServerNotFoundError() Stanza
- func (stanza *IQ) RemoteServerTimeoutError() Stanza
- func (stanza *IQ) ResourceConstraintError() Stanza
- func (iq *IQ) ResultIQ() *IQ
- func (stanza *IQ) ServiceUnavailableError() Stanza
- func (stanza *IQ) SetFromJID(j *jid.JID)
- func (stanza *IQ) SetToJID(j *jid.JID)
- func (stanza *IQ) SubscriptionRequiredError() Stanza
- func (stanza *IQ) ToJID() *jid.JID
- func (stanza *IQ) UndefinedConditionError() Stanza
- func (stanza *IQ) UnexpectedConditionError() Stanza
- type Message
- func (stanza *Message) BadRequestError() Stanza
- func (stanza *Message) ConflictError() Stanza
- func (stanza *Message) FeatureNotImplementedError() Stanza
- func (stanza *Message) ForbiddenError() Stanza
- func (stanza *Message) FromJID() *jid.JID
- func (stanza *Message) GoneError() Stanza
- func (stanza *Message) InternalServerError() Stanza
- func (m *Message) IsChat() bool
- func (m *Message) IsGroupChat() bool
- func (m *Message) IsHeadline() bool
- func (m *Message) IsMessageWithBody() bool
- func (m *Message) IsNormal() bool
- func (stanza *Message) ItemNotFoundError() Stanza
- func (stanza *Message) JidMalformedError() Stanza
- func (stanza *Message) NotAcceptableError() Stanza
- func (stanza *Message) NotAllowedError() Stanza
- func (stanza *Message) NotAuthorizedError() Stanza
- func (stanza *Message) PaymentRequiredError() Stanza
- func (stanza *Message) RecipientUnavailableError() Stanza
- func (stanza *Message) RedirectError() Stanza
- func (stanza *Message) RegistrationRequiredError() Stanza
- func (stanza *Message) RemoteServerNotFoundError() Stanza
- func (stanza *Message) RemoteServerTimeoutError() Stanza
- func (stanza *Message) ResourceConstraintError() Stanza
- func (stanza *Message) ServiceUnavailableError() Stanza
- func (stanza *Message) SetFromJID(j *jid.JID)
- func (stanza *Message) SetToJID(j *jid.JID)
- func (stanza *Message) SubscriptionRequiredError() Stanza
- func (stanza *Message) ToJID() *jid.JID
- func (stanza *Message) UndefinedConditionError() Stanza
- func (stanza *Message) UnexpectedConditionError() Stanza
- type Parser
- type ParsingMode
- type Presence
- func (stanza *Presence) BadRequestError() Stanza
- func (stanza *Presence) ConflictError() Stanza
- func (stanza *Presence) FeatureNotImplementedError() Stanza
- func (stanza *Presence) ForbiddenError() Stanza
- func (stanza *Presence) FromJID() *jid.JID
- func (stanza *Presence) GoneError() Stanza
- func (stanza *Presence) InternalServerError() Stanza
- func (p *Presence) IsAvailable() bool
- func (p *Presence) IsProbe() bool
- func (p *Presence) IsSubscribe() bool
- func (p *Presence) IsSubscribed() bool
- func (p *Presence) IsUnavailable() bool
- func (p *Presence) IsUnsubscribe() bool
- func (p *Presence) IsUnsubscribed() bool
- func (stanza *Presence) ItemNotFoundError() Stanza
- func (stanza *Presence) JidMalformedError() Stanza
- func (stanza *Presence) NotAcceptableError() Stanza
- func (stanza *Presence) NotAllowedError() Stanza
- func (stanza *Presence) NotAuthorizedError() Stanza
- func (stanza *Presence) PaymentRequiredError() Stanza
- func (p *Presence) Priority() int8
- func (stanza *Presence) RecipientUnavailableError() Stanza
- func (stanza *Presence) RedirectError() Stanza
- func (stanza *Presence) RegistrationRequiredError() Stanza
- func (stanza *Presence) RemoteServerNotFoundError() Stanza
- func (stanza *Presence) RemoteServerTimeoutError() Stanza
- func (stanza *Presence) ResourceConstraintError() Stanza
- func (stanza *Presence) ServiceUnavailableError() Stanza
- func (stanza *Presence) SetFromJID(j *jid.JID)
- func (stanza *Presence) SetToJID(j *jid.JID)
- func (p *Presence) ShowState() ShowState
- func (p *Presence) Status() string
- func (stanza *Presence) SubscriptionRequiredError() Stanza
- func (stanza *Presence) ToJID() *jid.JID
- func (stanza *Presence) UndefinedConditionError() Stanza
- func (stanza *Presence) UnexpectedConditionError() Stanza
- type ShowState
- type Stanza
- type StanzaError
- type XElement
Constants ¶
const ( // GetType represents a 'get' IQ type. GetType = "get" // SetType represents a 'set' IQ type. SetType = "set" // ResultType represents a 'result' IQ type. ResultType = "result" )
const ( // NormalType represents a 'normal' message type. NormalType = "normal" // HeadlineType represents a 'headline' message type. HeadlineType = "headline" // ChatType represents a 'chat' message type. ChatType = "chat" // GroupChatType represents a 'groupchat' message type. GroupChatType = "groupchat" )
const ( // DefaultMode treats incoming elements as provided from raw byte reader. DefaultMode = ParsingMode(iota) // SocketStream treats incoming elements as provided from a socket transport. SocketStream // WebSocketStream treats incoming elements as provided from a websocket transport. WebSocketStream )
const ( // AvailableType represents an 'available' Presence type. AvailableType = "" UnavailableType = "unavailable" // SubscribeType represents a 'subscribe' Presence type. SubscribeType = "subscribe" // UnsubscribeType represents a 'unsubscribe' Presence type. UnsubscribeType = "unsubscribe" // SubscribedType represents a 'subscribed' Presence type. SubscribedType = "subscribed" // UnsubscribedType represents a 'unsubscribed' Presence type. UnsubscribedType = "unsubscribed" // ProbeType represents a 'probe' Presence type. ProbeType = "probe" )
const ErrorType = "error"
ErrorType represents an 'error' stanza type.
Variables ¶
var ( // ErrBadRequest is returned by the stream when the sender // has sent XML that is malformed or that cannot be processed. ErrBadRequest = newStanzaError(400, modifyErrorType, badRequestErrorReason) // ErrConflict is returned by the stream when access cannot be // granted because an existing resource or session exists with // the same name or address. ErrConflict = newStanzaError(409, cancelErrorType, conflictErrorReason) // ErrFeatureNotImplemented is returned by the stream when the feature // requested is not implemented by the server and therefore cannot be processed. ErrFeatureNotImplemented = newStanzaError(501, cancelErrorType, featureNotImplementedErrorReason) // ErrForbidden is returned by the stream when the requesting // entity does not possess the required permissions to perform the action. ErrForbidden = newStanzaError(403, authErrorType, forbiddenErrorReason) // ErrGone is returned by the stream when the recipient or server // can no longer be contacted at this address. ErrGone = newStanzaError(302, modifyErrorType, goneErrorReason) // ErrInternalServerError is returned by the stream when the server // could not process the stanza because of a misconfiguration // or an otherwise-undefined internal server error. ErrInternalServerError = newStanzaError(500, waitErrorType, internalServerErrorErrorReason) // ErrItemNotFound is returned by the stream when the addressed // JID or item requested cannot be found. ErrItemNotFound = newStanzaError(404, cancelErrorType, itemNotFoundErrorReason) // ErrJidMalformed is returned by the stream when the sending entity // has provided or communicated an XMPP address or aspect thereof that // does not adhere to the syntax defined in https://xmpp.org/rfcs/rfc3920.html#addressing. ErrJidMalformed = newStanzaError(400, modifyErrorType, jidMalformedErrorReason) // ErrNotAcceptable is returned by the stream when the server // understands the request but is refusing to process it because // it does not meet the defined criteria. ErrNotAcceptable = newStanzaError(406, modifyErrorType, notAcceptableErrorReason) // ErrNotAllowed is returned by the stream when the recipient // or server does not allow any entity to perform the action. ErrNotAllowed = newStanzaError(405, cancelErrorType, notAllowedErrorReason) // ErrNotAuthorized is returned by the stream when the sender // must provide proper credentials before being allowed to perform the action, // or has provided improper credentials. ErrNotAuthorized = newStanzaError(405, authErrorType, notAuthroizedErrorReason) // ErrPaymentRequired is returned by the stream when the requesting entity // is not authorized to access the requested service because payment is required. ErrPaymentRequired = newStanzaError(402, authErrorType, paymentRequiredErrorReason) // recipient is temporarily unavailable. ErrRecipientUnavailable = newStanzaError(404, waitErrorType, recipientUnavailableErrorReason) // ErrRedirect is returned by the stream when the recipient or server // is redirecting requests for this information to another entity, usually temporarily. ErrRedirect = newStanzaError(302, modifyErrorType, redirectErrorReason) // ErrRegistrationRequired is returned by the stream when the requesting entity // is not authorized to access the requested service because registration is required. ErrRegistrationRequired = newStanzaError(407, authErrorType, registrationRequiredErrorReason) // ErrRemoteServerNotFound is returned by the stream when a remote server // or service specified as part or all of the JID of the intended recipient does not exist. ErrRemoteServerNotFound = newStanzaError(404, cancelErrorType, remoteServerNotFoundErrorReason) // ErrRemoteServerTimeout is returned by the stream when a remote server // or service specified as part or all of the JID of the intended recipient // could not be contacted within a reasonable amount of time. ErrRemoteServerTimeout = newStanzaError(504, waitErrorType, remoteServerTimeoutErrorReason) // ErrResourceConstraint is returned by the stream when the server or recipient // lacks the system resources necessary to service the request. ErrResourceConstraint = newStanzaError(500, waitErrorType, resourceConstraintErrorReason) // does not currently provide the requested service. ErrServiceUnavailable = newStanzaError(503, cancelErrorType, serviceUnavailableErrorReason) // ErrSubscriptionRequired is returned by the stream when the requesting entity // is not authorized to access the requested service because a subscription is required. ErrSubscriptionRequired = newStanzaError(407, authErrorType, subscriptionRequiredErrorReason) // ErrUndefinedCondition is returned by the stream when the error condition // is not one of those defined by the other conditions in this list. ErrUndefinedCondition = newStanzaError(500, waitErrorType, undefinedConditionErrorReason) // ErrUnexpectedCondition is returned by the stream when the recipient or server // understood the request but was not expecting it at this time. ErrUnexpectedCondition = newStanzaError(400, waitErrorType, unexpectedConditionErrorReason) )
var ErrStreamClosedByPeer = errors.New("xml: stream closed by peer")
ErrStreamClosedByPeer is returned by Parse when peer closes the stream.
var ErrTooLargeStanza = errors.New("xml: too large stanza")
ErrTooLargeStanza is returned by ReadElement when the size of the incoming stanza is too large.
Functions ¶
This section is empty.
Types ¶
type AttributeSet ¶
AttributeSet interface represents a read-only set of XML attributes.
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element represents a generic and mutable XML node element.
func NewElementFromElement ¶
NewElementFromElement creates a mutable XML XElement by copying an element.
func NewElementName ¶
NewElementName creates a mutable XML XElement instance with a given name.
func NewElementNamespace ¶
NewElementNamespace creates a mutable XML XElement instance with a given name and namespace.
func (*Element) AppendElement ¶
AppendElement appends a new sub element.
func (*Element) AppendElements ¶
AppendElements appends an array of sub elements.
func (*Element) Attributes ¶
func (e *Element) Attributes() AttributeSet
Attributes returns XML node attribute value.
func (*Element) ClearElements ¶
func (e *Element) ClearElements()
ClearElements removes all elements.
func (*Element) Elements ¶
func (e *Element) Elements() ElementSet
Elements returns all instance's child elements.
func (*Element) RemoveAttribute ¶
RemoveAttribute removes an XML node attribute.
func (*Element) RemoveElements ¶
RemoveElements removes all elements with a given name.
func (*Element) RemoveElementsNamespace ¶
RemoveElementsNamespace removes all elements with a given name and namespace.
func (*Element) SetAttribute ¶
SetAttribute sets an XML node attribute (label=value)
func (*Element) SetLanguage ¶
SetLanguage sets 'xml:lang' node attribute.
func (*Element) SetNamespace ¶
SetNamespace sets 'xmlns' node attribute.
func (*Element) SetVersion ¶
SetVersion sets 'version' node attribute.
type ElementSet ¶
type ElementSet interface { // Children returns all elements identified by name. // Returns an empty array if no elements are found. Children(name string) []XElement // Child returns first element identified by name. // Returns nil if no element is found. Child(name string) XElement // ChildrenNamespace returns all elements identified by name and namespace. // Returns an empty array if no elements are found. ChildrenNamespace(name, namespace string) []XElement // ChildNamespace returns first element identified by name and namespace. // Returns nil if no element is found. ChildNamespace(name, namespace string) XElement // All returns a list of all child nodes. All() []XElement // Count returns child elements count. Count() int }
ElementSet interface represents a read-only set of XML sub elements.
type IQ ¶
type IQ struct {
// contains filtered or unexported fields
}
IQ type represents an <iq> element. All incoming <iq> elements providing from the stream will automatically be converted to IQ objects.
func NewIQFromElement ¶
NewIQFromElement creates an IQ object from XElement.
func (*IQ) BadRequestError ¶
func (stanza *IQ) BadRequestError() Stanza
BadRequestError returns an error copy of the element attaching 'bad-request' error sub element.
func (*IQ) ConflictError ¶
func (stanza *IQ) ConflictError() Stanza
ConflictError returns an error copy of the element attaching 'conflict' error sub element.
func (*IQ) FeatureNotImplementedError ¶
func (stanza *IQ) FeatureNotImplementedError() Stanza
FeatureNotImplementedError returns an error copy of the element attaching 'feature-not-implemented' error sub element.
func (*IQ) ForbiddenError ¶
func (stanza *IQ) ForbiddenError() Stanza
ForbiddenError returns an error copy of the element attaching 'forbidden' error sub element.
func (*IQ) GoneError ¶
func (stanza *IQ) GoneError() Stanza
GoneError returns an error copy of the element attaching 'gone' error sub element.
func (*IQ) InternalServerError ¶
func (stanza *IQ) InternalServerError() Stanza
InternalServerError returns an error copy of the element attaching 'internal-server-error' error sub element.
func (*IQ) ItemNotFoundError ¶
func (stanza *IQ) ItemNotFoundError() Stanza
ItemNotFoundError returns an error copy of the element attaching 'item-not-found' error sub element.
func (*IQ) JidMalformedError ¶
func (stanza *IQ) JidMalformedError() Stanza
JidMalformedError returns an error copy of the element attaching 'jid-malformed' error sub element.
func (*IQ) NotAcceptableError ¶
func (stanza *IQ) NotAcceptableError() Stanza
NotAcceptableError returns an error copy of the element attaching 'not-acceptable' error sub element.
func (*IQ) NotAllowedError ¶
func (stanza *IQ) NotAllowedError() Stanza
NotAllowedError returns an error copy of the element attaching 'not-allowed' error sub element.
func (*IQ) NotAuthorizedError ¶
func (stanza *IQ) NotAuthorizedError() Stanza
NotAuthorizedError returns an error copy of the element attaching 'not-authorized' error sub element.
func (*IQ) PaymentRequiredError ¶
func (stanza *IQ) PaymentRequiredError() Stanza
PaymentRequiredError returns an error copy of the element attaching 'payment-required' error sub element.
func (*IQ) RecipientUnavailableError ¶
func (stanza *IQ) RecipientUnavailableError() Stanza
RecipientUnavailableError returns an error copy of the element attaching 'recipient-unavailable' error sub element.
func (*IQ) RedirectError ¶
func (stanza *IQ) RedirectError() Stanza
RedirectError returns an error copy of the element attaching 'redirect' error sub element.
func (*IQ) RegistrationRequiredError ¶
func (stanza *IQ) RegistrationRequiredError() Stanza
RegistrationRequiredError returns an error copy of the element attaching 'registration-required' error sub element.
func (*IQ) RemoteServerNotFoundError ¶
func (stanza *IQ) RemoteServerNotFoundError() Stanza
RemoteServerNotFoundError returns an error copy of the element attaching 'remote-server-not-found' error sub element.
func (*IQ) RemoteServerTimeoutError ¶
func (stanza *IQ) RemoteServerTimeoutError() Stanza
RemoteServerTimeoutError returns an error copy of the element attaching 'remote-server-timeout' error sub element.
func (*IQ) ResourceConstraintError ¶
func (stanza *IQ) ResourceConstraintError() Stanza
ResourceConstraintError returns an error copy of the element attaching 'resource-constraint' error sub element.
func (*IQ) ServiceUnavailableError ¶
func (stanza *IQ) ServiceUnavailableError() Stanza
ServiceUnavailableError returns an error copy of the element attaching 'service-unavailable' error sub element.
func (*IQ) SetFromJID ¶
SetFromJID sets the IQ 'from' JID value.
func (*IQ) SubscriptionRequiredError ¶
func (stanza *IQ) SubscriptionRequiredError() Stanza
SubscriptionRequiredError returns an error copy of the element attaching 'subscription-required' error sub element.
func (*IQ) UndefinedConditionError ¶
func (stanza *IQ) UndefinedConditionError() Stanza
UndefinedConditionError returns an error copy of the element attaching 'undefined-condition' error sub element.
func (*IQ) UnexpectedConditionError ¶
func (stanza *IQ) UnexpectedConditionError() Stanza
UnexpectedConditionError returns an error copy of the element attaching 'unexpected-condition' error sub element.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message type represents a <message> element. All incoming <message> elements providing from the stream will automatically be converted to Message objects.
func NewMessageFromElement ¶
NewMessageFromElement creates a Message object from XElement.
func NewMessageType ¶
NewMessageType creates and returns a new Message element.
func (*Message) BadRequestError ¶
func (stanza *Message) BadRequestError() Stanza
BadRequestError returns an error copy of the element attaching 'bad-request' error sub element.
func (*Message) ConflictError ¶
func (stanza *Message) ConflictError() Stanza
ConflictError returns an error copy of the element attaching 'conflict' error sub element.
func (*Message) FeatureNotImplementedError ¶
func (stanza *Message) FeatureNotImplementedError() Stanza
FeatureNotImplementedError returns an error copy of the element attaching 'feature-not-implemented' error sub element.
func (*Message) ForbiddenError ¶
func (stanza *Message) ForbiddenError() Stanza
ForbiddenError returns an error copy of the element attaching 'forbidden' error sub element.
func (*Message) GoneError ¶
func (stanza *Message) GoneError() Stanza
GoneError returns an error copy of the element attaching 'gone' error sub element.
func (*Message) InternalServerError ¶
func (stanza *Message) InternalServerError() Stanza
InternalServerError returns an error copy of the element attaching 'internal-server-error' error sub element.
func (*Message) IsGroupChat ¶
IsGroupChat returns true if this is a 'groupchat' type Message.
func (*Message) IsHeadline ¶
IsHeadline returns true if this is a 'headline' type Message.
func (*Message) IsMessageWithBody ¶
IsMessageWithBody returns true if the message has a body sub element.
func (*Message) ItemNotFoundError ¶
func (stanza *Message) ItemNotFoundError() Stanza
ItemNotFoundError returns an error copy of the element attaching 'item-not-found' error sub element.
func (*Message) JidMalformedError ¶
func (stanza *Message) JidMalformedError() Stanza
JidMalformedError returns an error copy of the element attaching 'jid-malformed' error sub element.
func (*Message) NotAcceptableError ¶
func (stanza *Message) NotAcceptableError() Stanza
NotAcceptableError returns an error copy of the element attaching 'not-acceptable' error sub element.
func (*Message) NotAllowedError ¶
func (stanza *Message) NotAllowedError() Stanza
NotAllowedError returns an error copy of the element attaching 'not-allowed' error sub element.
func (*Message) NotAuthorizedError ¶
func (stanza *Message) NotAuthorizedError() Stanza
NotAuthorizedError returns an error copy of the element attaching 'not-authorized' error sub element.
func (*Message) PaymentRequiredError ¶
func (stanza *Message) PaymentRequiredError() Stanza
PaymentRequiredError returns an error copy of the element attaching 'payment-required' error sub element.
func (*Message) RecipientUnavailableError ¶
func (stanza *Message) RecipientUnavailableError() Stanza
RecipientUnavailableError returns an error copy of the element attaching 'recipient-unavailable' error sub element.
func (*Message) RedirectError ¶
func (stanza *Message) RedirectError() Stanza
RedirectError returns an error copy of the element attaching 'redirect' error sub element.
func (*Message) RegistrationRequiredError ¶
func (stanza *Message) RegistrationRequiredError() Stanza
RegistrationRequiredError returns an error copy of the element attaching 'registration-required' error sub element.
func (*Message) RemoteServerNotFoundError ¶
func (stanza *Message) RemoteServerNotFoundError() Stanza
RemoteServerNotFoundError returns an error copy of the element attaching 'remote-server-not-found' error sub element.
func (*Message) RemoteServerTimeoutError ¶
func (stanza *Message) RemoteServerTimeoutError() Stanza
RemoteServerTimeoutError returns an error copy of the element attaching 'remote-server-timeout' error sub element.
func (*Message) ResourceConstraintError ¶
func (stanza *Message) ResourceConstraintError() Stanza
ResourceConstraintError returns an error copy of the element attaching 'resource-constraint' error sub element.
func (*Message) ServiceUnavailableError ¶
func (stanza *Message) ServiceUnavailableError() Stanza
ServiceUnavailableError returns an error copy of the element attaching 'service-unavailable' error sub element.
func (*Message) SetFromJID ¶
SetFromJID sets the IQ 'from' JID value.
func (*Message) SubscriptionRequiredError ¶
func (stanza *Message) SubscriptionRequiredError() Stanza
SubscriptionRequiredError returns an error copy of the element attaching 'subscription-required' error sub element.
func (*Message) UndefinedConditionError ¶
func (stanza *Message) UndefinedConditionError() Stanza
UndefinedConditionError returns an error copy of the element attaching 'undefined-condition' error sub element.
func (*Message) UnexpectedConditionError ¶
func (stanza *Message) UnexpectedConditionError() Stanza
UnexpectedConditionError returns an error copy of the element attaching 'unexpected-condition' error sub element.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses arbitrary XML input and builds an array with the structure of all tag and data elements.
func NewParser ¶
func NewParser(reader io.Reader, mode ParsingMode, maxStanzaSize int) *Parser
NewParser creates an empty Parser instance.
func (*Parser) ParseElement ¶
ParseElement parses next available XML element from reader.
type ParsingMode ¶
type ParsingMode int
ParsingMode defines the way in which special parsed element should be considered or not according to the reader nature.
type Presence ¶
type Presence struct {
// contains filtered or unexported fields
}
Presence type represents an <presence> element. All incoming <presence> elements providing from the stream will automatically be converted to Presence objects.
func NewPresence ¶
NewPresence creates and returns a new Presence element.
func NewPresenceFromElement ¶
NewPresenceFromElement creates a Presence object from XElement.
func (*Presence) BadRequestError ¶
func (stanza *Presence) BadRequestError() Stanza
BadRequestError returns an error copy of the element attaching 'bad-request' error sub element.
func (*Presence) ConflictError ¶
func (stanza *Presence) ConflictError() Stanza
ConflictError returns an error copy of the element attaching 'conflict' error sub element.
func (*Presence) FeatureNotImplementedError ¶
func (stanza *Presence) FeatureNotImplementedError() Stanza
FeatureNotImplementedError returns an error copy of the element attaching 'feature-not-implemented' error sub element.
func (*Presence) ForbiddenError ¶
func (stanza *Presence) ForbiddenError() Stanza
ForbiddenError returns an error copy of the element attaching 'forbidden' error sub element.
func (*Presence) GoneError ¶
func (stanza *Presence) GoneError() Stanza
GoneError returns an error copy of the element attaching 'gone' error sub element.
func (*Presence) InternalServerError ¶
func (stanza *Presence) InternalServerError() Stanza
InternalServerError returns an error copy of the element attaching 'internal-server-error' error sub element.
func (*Presence) IsAvailable ¶
IsAvailable returns true if this is an 'available' type Presence.
func (*Presence) IsSubscribe ¶
IsSubscribe returns true if this is a 'subscribe' type Presence.
func (*Presence) IsSubscribed ¶
IsSubscribed returns true if this is a 'subscribed' type Presence.
func (*Presence) IsUnavailable ¶
IsUnavailable returns true if this is an 'unavailable' type Presence.
func (*Presence) IsUnsubscribe ¶
IsUnsubscribe returns true if this is an 'unsubscribe' type Presence.
func (*Presence) IsUnsubscribed ¶
IsUnsubscribed returns true if this is an 'unsubscribed' type Presence.
func (*Presence) ItemNotFoundError ¶
func (stanza *Presence) ItemNotFoundError() Stanza
ItemNotFoundError returns an error copy of the element attaching 'item-not-found' error sub element.
func (*Presence) JidMalformedError ¶
func (stanza *Presence) JidMalformedError() Stanza
JidMalformedError returns an error copy of the element attaching 'jid-malformed' error sub element.
func (*Presence) NotAcceptableError ¶
func (stanza *Presence) NotAcceptableError() Stanza
NotAcceptableError returns an error copy of the element attaching 'not-acceptable' error sub element.
func (*Presence) NotAllowedError ¶
func (stanza *Presence) NotAllowedError() Stanza
NotAllowedError returns an error copy of the element attaching 'not-allowed' error sub element.
func (*Presence) NotAuthorizedError ¶
func (stanza *Presence) NotAuthorizedError() Stanza
NotAuthorizedError returns an error copy of the element attaching 'not-authorized' error sub element.
func (*Presence) PaymentRequiredError ¶
func (stanza *Presence) PaymentRequiredError() Stanza
PaymentRequiredError returns an error copy of the element attaching 'payment-required' error sub element.
func (*Presence) RecipientUnavailableError ¶
func (stanza *Presence) RecipientUnavailableError() Stanza
RecipientUnavailableError returns an error copy of the element attaching 'recipient-unavailable' error sub element.
func (*Presence) RedirectError ¶
func (stanza *Presence) RedirectError() Stanza
RedirectError returns an error copy of the element attaching 'redirect' error sub element.
func (*Presence) RegistrationRequiredError ¶
func (stanza *Presence) RegistrationRequiredError() Stanza
RegistrationRequiredError returns an error copy of the element attaching 'registration-required' error sub element.
func (*Presence) RemoteServerNotFoundError ¶
func (stanza *Presence) RemoteServerNotFoundError() Stanza
RemoteServerNotFoundError returns an error copy of the element attaching 'remote-server-not-found' error sub element.
func (*Presence) RemoteServerTimeoutError ¶
func (stanza *Presence) RemoteServerTimeoutError() Stanza
RemoteServerTimeoutError returns an error copy of the element attaching 'remote-server-timeout' error sub element.
func (*Presence) ResourceConstraintError ¶
func (stanza *Presence) ResourceConstraintError() Stanza
ResourceConstraintError returns an error copy of the element attaching 'resource-constraint' error sub element.
func (*Presence) ServiceUnavailableError ¶
func (stanza *Presence) ServiceUnavailableError() Stanza
ServiceUnavailableError returns an error copy of the element attaching 'service-unavailable' error sub element.
func (*Presence) SetFromJID ¶
SetFromJID sets the IQ 'from' JID value.
func (*Presence) SubscriptionRequiredError ¶
func (stanza *Presence) SubscriptionRequiredError() Stanza
SubscriptionRequiredError returns an error copy of the element attaching 'subscription-required' error sub element.
func (*Presence) UndefinedConditionError ¶
func (stanza *Presence) UndefinedConditionError() Stanza
UndefinedConditionError returns an error copy of the element attaching 'undefined-condition' error sub element.
func (*Presence) UnexpectedConditionError ¶
func (stanza *Presence) UnexpectedConditionError() Stanza
UnexpectedConditionError returns an error copy of the element attaching 'unexpected-condition' error sub element.
type ShowState ¶
type ShowState int
ShowState represents Presence show state.
const ( // AvailableShowState represents 'available' Presence show state. AvailableShowState ShowState = iota // AwayShowState represents 'away' Presence show state. AwayShowState // ChatShowState represents 'chat' Presence show state. ChatShowState // DoNotDisturbShowState represents 'dnd' Presence show state. DoNotDisturbShowState // ExtendedAwaysShowState represents 'xa' Presence show state. ExtendedAwaysShowState )
type Stanza ¶
func NewErrorStanzaFromStanza ¶
func NewErrorStanzaFromStanza(stanza Stanza, stanzaErr *StanzaError, errorElements []XElement) Stanza
NewErrorStanzaFromStanza returns a copy of an element of stanza error class.
type StanzaError ¶
type StanzaError struct {
// contains filtered or unexported fields
}
StanzaError represents a stanza "error" element.
func (*StanzaError) Element ¶
func (se *StanzaError) Element() *Element
Element returns StanzaError equivalent XML element.
type XElement ¶
type XElement interface { fmt.Stringer Name() string Attributes() AttributeSet Elements() ElementSet Text() string ID() string Namespace() string Language() string Version() string From() string To() string Type() string IsStanza() bool IsError() bool Error() XElement ToXML(w io.Writer, includeClosing bool) ToGob(enc *gob.Encoder) }
XElement represents a generic XML node element.