Documentation ¶
Index ¶
- Constants
- Variables
- type Attribute
- type AttributeSet
- type Element
- func (e *Element) AppendElement(element XElement) *Element
- func (e *Element) AppendElements(elements []XElement) *Element
- func (e *Element) Attributes() AttributeSet
- func (e *Element) ClearElements() *Element
- 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) error
- 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) *Element
- func (e *Element) RemoveElements(name string) *Element
- func (e *Element) RemoveElementsNamespace(name, namespace string) *Element
- func (e *Element) SetAttribute(label, value string) *Element
- func (e *Element) SetFrom(from string) *Element
- func (e *Element) SetID(identifier string) *Element
- func (e *Element) SetLanguage(language string) *Element
- func (e *Element) SetName(name string) *Element
- func (e *Element) SetNamespace(namespace string) *Element
- func (e *Element) SetText(text string) *Element
- func (e *Element) SetTo(to string) *Element
- func (e *Element) SetType(tp string) *Element
- func (e *Element) SetVersion(version string) *Element
- 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 (s *IQ) BadRequestError() Stanza
- func (s *IQ) ConflictError() Stanza
- func (s *IQ) FeatureNotImplementedError() Stanza
- func (s *IQ) ForbiddenError() Stanza
- func (s *IQ) FromGob(dec *gob.Decoder) error
- func (s *IQ) FromJID() *jid.JID
- func (s *IQ) GoneError() Stanza
- func (s *IQ) InternalServerError() Stanza
- func (iq *IQ) IsGet() bool
- func (iq *IQ) IsResult() bool
- func (iq *IQ) IsSet() bool
- func (s *IQ) ItemNotFoundError() Stanza
- func (s *IQ) JidMalformedError() Stanza
- func (s *IQ) NotAcceptableError() Stanza
- func (s *IQ) NotAllowedError() Stanza
- func (s *IQ) NotAuthorizedError() Stanza
- func (s *IQ) PaymentRequiredError() Stanza
- func (s *IQ) RecipientUnavailableError() Stanza
- func (s *IQ) RedirectError() Stanza
- func (s *IQ) RegistrationRequiredError() Stanza
- func (s *IQ) RemoteServerNotFoundError() Stanza
- func (s *IQ) RemoteServerTimeoutError() Stanza
- func (s *IQ) ResourceConstraintError() Stanza
- func (iq *IQ) ResultIQ() *IQ
- func (s *IQ) ServiceUnavailableError() Stanza
- func (s *IQ) SetFromJID(j *jid.JID)
- func (s *IQ) SetToJID(j *jid.JID)
- func (s *IQ) SubscriptionRequiredError() Stanza
- func (s *IQ) ToJID() *jid.JID
- func (s *IQ) UndefinedConditionError() Stanza
- func (s *IQ) UnexpectedConditionError() Stanza
- type Message
- func (s *Message) BadRequestError() Stanza
- func (s *Message) ConflictError() Stanza
- func (s *Message) FeatureNotImplementedError() Stanza
- func (s *Message) ForbiddenError() Stanza
- func (s *Message) FromGob(dec *gob.Decoder) error
- func (s *Message) FromJID() *jid.JID
- func (s *Message) GoneError() Stanza
- func (s *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 (s *Message) ItemNotFoundError() Stanza
- func (s *Message) JidMalformedError() Stanza
- func (s *Message) NotAcceptableError() Stanza
- func (s *Message) NotAllowedError() Stanza
- func (s *Message) NotAuthorizedError() Stanza
- func (s *Message) PaymentRequiredError() Stanza
- func (s *Message) RecipientUnavailableError() Stanza
- func (s *Message) RedirectError() Stanza
- func (s *Message) RegistrationRequiredError() Stanza
- func (s *Message) RemoteServerNotFoundError() Stanza
- func (s *Message) RemoteServerTimeoutError() Stanza
- func (s *Message) ResourceConstraintError() Stanza
- func (s *Message) ServiceUnavailableError() Stanza
- func (s *Message) SetFromJID(j *jid.JID)
- func (s *Message) SetToJID(j *jid.JID)
- func (s *Message) SubscriptionRequiredError() Stanza
- func (s *Message) ToJID() *jid.JID
- func (s *Message) UndefinedConditionError() Stanza
- func (s *Message) UnexpectedConditionError() Stanza
- type Parser
- type ParsingMode
- type Presence
- func (s *Presence) BadRequestError() Stanza
- func (s *Presence) ConflictError() Stanza
- func (s *Presence) FeatureNotImplementedError() Stanza
- func (s *Presence) ForbiddenError() Stanza
- func (s *Presence) FromGob(dec *gob.Decoder) error
- func (s *Presence) FromJID() *jid.JID
- func (s *Presence) GoneError() Stanza
- func (s *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 (s *Presence) ItemNotFoundError() Stanza
- func (s *Presence) JidMalformedError() Stanza
- func (s *Presence) NotAcceptableError() Stanza
- func (s *Presence) NotAllowedError() Stanza
- func (s *Presence) NotAuthorizedError() Stanza
- func (s *Presence) PaymentRequiredError() Stanza
- func (p *Presence) Priority() int8
- func (s *Presence) RecipientUnavailableError() Stanza
- func (s *Presence) RedirectError() Stanza
- func (s *Presence) RegistrationRequiredError() Stanza
- func (s *Presence) RemoteServerNotFoundError() Stanza
- func (s *Presence) RemoteServerTimeoutError() Stanza
- func (s *Presence) ResourceConstraintError() Stanza
- func (s *Presence) ServiceUnavailableError() Stanza
- func (s *Presence) SetFromJID(j *jid.JID)
- func (s *Presence) SetToJID(j *jid.JID)
- func (p *Presence) ShowState() ShowState
- func (p *Presence) Status() string
- func (s *Presence) SubscriptionRequiredError() Stanza
- func (s *Presence) ToJID() *jid.JID
- func (s *Presence) UndefinedConditionError() Stanza
- func (s *Presence) UnexpectedConditionError() Stanza
- type ShowState
- type Stanza
- type StanzaError
- type XElement
Constants ¶
const ( // MessageName represents "message" stanza name MessageName = "message" // PresenceName represents "presence" stanza name PresenceName = "presence" // IQName represents "iq" stanza name IQName = "iq" )
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 NewElementFromGob ¶ added in v0.4.0
NewElementFromGob creates and returns a new Element from a given gob decoder.
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 ¶
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 NewIQFromGob ¶ added in v0.4.0
NewIQFromGob creates and returns a new IQ element from a given gob decoder.
func (*IQ) BadRequestError ¶
func (s *IQ) BadRequestError() Stanza
BadRequestError returns an error copy of the element attaching 'bad-request' error sub element.
func (*IQ) ConflictError ¶
func (s *IQ) ConflictError() Stanza
ConflictError returns an error copy of the element attaching 'conflict' error sub element.
func (*IQ) FeatureNotImplementedError ¶
func (s *IQ) FeatureNotImplementedError() Stanza
FeatureNotImplementedError returns an error copy of the element attaching 'feature-not-implemented' error sub element.
func (*IQ) ForbiddenError ¶
func (s *IQ) ForbiddenError() Stanza
ForbiddenError returns an error copy of the element attaching 'forbidden' error sub element.
func (*IQ) FromGob ¶ added in v0.4.0
FromGob deserializes a stanza element from it's gob binary representation.
func (*IQ) GoneError ¶
func (s *IQ) GoneError() Stanza
GoneError returns an error copy of the element attaching 'gone' error sub element.
func (*IQ) InternalServerError ¶
func (s *IQ) InternalServerError() Stanza
InternalServerError returns an error copy of the element attaching 'internal-server-error' error sub element.
func (*IQ) ItemNotFoundError ¶
func (s *IQ) ItemNotFoundError() Stanza
ItemNotFoundError returns an error copy of the element attaching 'item-not-found' error sub element.
func (*IQ) JidMalformedError ¶
func (s *IQ) JidMalformedError() Stanza
JidMalformedError returns an error copy of the element attaching 'jid-malformed' error sub element.
func (*IQ) NotAcceptableError ¶
func (s *IQ) NotAcceptableError() Stanza
NotAcceptableError returns an error copy of the element attaching 'not-acceptable' error sub element.
func (*IQ) NotAllowedError ¶
func (s *IQ) NotAllowedError() Stanza
NotAllowedError returns an error copy of the element attaching 'not-allowed' error sub element.
func (*IQ) NotAuthorizedError ¶
func (s *IQ) NotAuthorizedError() Stanza
NotAuthorizedError returns an error copy of the element attaching 'not-authorized' error sub element.
func (*IQ) PaymentRequiredError ¶
func (s *IQ) PaymentRequiredError() Stanza
PaymentRequiredError returns an error copy of the element attaching 'payment-required' error sub element.
func (*IQ) RecipientUnavailableError ¶
func (s *IQ) RecipientUnavailableError() Stanza
RecipientUnavailableError returns an error copy of the element attaching 'recipient-unavailable' error sub element.
func (*IQ) RedirectError ¶
func (s *IQ) RedirectError() Stanza
RedirectError returns an error copy of the element attaching 'redirect' error sub element.
func (*IQ) RegistrationRequiredError ¶
func (s *IQ) RegistrationRequiredError() Stanza
RegistrationRequiredError returns an error copy of the element attaching 'registration-required' error sub element.
func (*IQ) RemoteServerNotFoundError ¶
func (s *IQ) RemoteServerNotFoundError() Stanza
RemoteServerNotFoundError returns an error copy of the element attaching 'remote-server-not-found' error sub element.
func (*IQ) RemoteServerTimeoutError ¶
func (s *IQ) RemoteServerTimeoutError() Stanza
RemoteServerTimeoutError returns an error copy of the element attaching 'remote-server-timeout' error sub element.
func (*IQ) ResourceConstraintError ¶
func (s *IQ) ResourceConstraintError() Stanza
ResourceConstraintError returns an error copy of the element attaching 'resource-constraint' error sub element.
func (*IQ) ServiceUnavailableError ¶
func (s *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 (s *IQ) SubscriptionRequiredError() Stanza
SubscriptionRequiredError returns an error copy of the element attaching 'subscription-required' error sub element.
func (*IQ) UndefinedConditionError ¶
func (s *IQ) UndefinedConditionError() Stanza
UndefinedConditionError returns an error copy of the element attaching 'undefined-condition' error sub element.
func (*IQ) UnexpectedConditionError ¶
func (s *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 NewMessageFromGob ¶ added in v0.4.0
NewMessageFromGob creates and returns a new Message element from a given gob decoder.
func NewMessageType ¶
NewMessageType creates and returns a new Message element.
func (*Message) BadRequestError ¶
func (s *Message) BadRequestError() Stanza
BadRequestError returns an error copy of the element attaching 'bad-request' error sub element.
func (*Message) ConflictError ¶
func (s *Message) ConflictError() Stanza
ConflictError returns an error copy of the element attaching 'conflict' error sub element.
func (*Message) FeatureNotImplementedError ¶
func (s *Message) FeatureNotImplementedError() Stanza
FeatureNotImplementedError returns an error copy of the element attaching 'feature-not-implemented' error sub element.
func (*Message) ForbiddenError ¶
func (s *Message) ForbiddenError() Stanza
ForbiddenError returns an error copy of the element attaching 'forbidden' error sub element.
func (*Message) FromGob ¶ added in v0.4.0
FromGob deserializes a stanza element from it's gob binary representation.
func (*Message) GoneError ¶
func (s *Message) GoneError() Stanza
GoneError returns an error copy of the element attaching 'gone' error sub element.
func (*Message) InternalServerError ¶
func (s *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 (s *Message) ItemNotFoundError() Stanza
ItemNotFoundError returns an error copy of the element attaching 'item-not-found' error sub element.
func (*Message) JidMalformedError ¶
func (s *Message) JidMalformedError() Stanza
JidMalformedError returns an error copy of the element attaching 'jid-malformed' error sub element.
func (*Message) NotAcceptableError ¶
func (s *Message) NotAcceptableError() Stanza
NotAcceptableError returns an error copy of the element attaching 'not-acceptable' error sub element.
func (*Message) NotAllowedError ¶
func (s *Message) NotAllowedError() Stanza
NotAllowedError returns an error copy of the element attaching 'not-allowed' error sub element.
func (*Message) NotAuthorizedError ¶
func (s *Message) NotAuthorizedError() Stanza
NotAuthorizedError returns an error copy of the element attaching 'not-authorized' error sub element.
func (*Message) PaymentRequiredError ¶
func (s *Message) PaymentRequiredError() Stanza
PaymentRequiredError returns an error copy of the element attaching 'payment-required' error sub element.
func (*Message) RecipientUnavailableError ¶
func (s *Message) RecipientUnavailableError() Stanza
RecipientUnavailableError returns an error copy of the element attaching 'recipient-unavailable' error sub element.
func (*Message) RedirectError ¶
func (s *Message) RedirectError() Stanza
RedirectError returns an error copy of the element attaching 'redirect' error sub element.
func (*Message) RegistrationRequiredError ¶
func (s *Message) RegistrationRequiredError() Stanza
RegistrationRequiredError returns an error copy of the element attaching 'registration-required' error sub element.
func (*Message) RemoteServerNotFoundError ¶
func (s *Message) RemoteServerNotFoundError() Stanza
RemoteServerNotFoundError returns an error copy of the element attaching 'remote-server-not-found' error sub element.
func (*Message) RemoteServerTimeoutError ¶
func (s *Message) RemoteServerTimeoutError() Stanza
RemoteServerTimeoutError returns an error copy of the element attaching 'remote-server-timeout' error sub element.
func (*Message) ResourceConstraintError ¶
func (s *Message) ResourceConstraintError() Stanza
ResourceConstraintError returns an error copy of the element attaching 'resource-constraint' error sub element.
func (*Message) ServiceUnavailableError ¶
func (s *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 (s *Message) SubscriptionRequiredError() Stanza
SubscriptionRequiredError returns an error copy of the element attaching 'subscription-required' error sub element.
func (*Message) UndefinedConditionError ¶
func (s *Message) UndefinedConditionError() Stanza
UndefinedConditionError returns an error copy of the element attaching 'undefined-condition' error sub element.
func (*Message) UnexpectedConditionError ¶
func (s *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 NewPresenceFromGob ¶ added in v0.4.0
NewPresenceFromGob creates and returns a new Presence element from a given gob decoder.
func (*Presence) BadRequestError ¶
func (s *Presence) BadRequestError() Stanza
BadRequestError returns an error copy of the element attaching 'bad-request' error sub element.
func (*Presence) ConflictError ¶
func (s *Presence) ConflictError() Stanza
ConflictError returns an error copy of the element attaching 'conflict' error sub element.
func (*Presence) FeatureNotImplementedError ¶
func (s *Presence) FeatureNotImplementedError() Stanza
FeatureNotImplementedError returns an error copy of the element attaching 'feature-not-implemented' error sub element.
func (*Presence) ForbiddenError ¶
func (s *Presence) ForbiddenError() Stanza
ForbiddenError returns an error copy of the element attaching 'forbidden' error sub element.
func (*Presence) FromGob ¶ added in v0.4.0
FromGob deserializes a stanza element from it's gob binary representation.
func (*Presence) GoneError ¶
func (s *Presence) GoneError() Stanza
GoneError returns an error copy of the element attaching 'gone' error sub element.
func (*Presence) InternalServerError ¶
func (s *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 (s *Presence) ItemNotFoundError() Stanza
ItemNotFoundError returns an error copy of the element attaching 'item-not-found' error sub element.
func (*Presence) JidMalformedError ¶
func (s *Presence) JidMalformedError() Stanza
JidMalformedError returns an error copy of the element attaching 'jid-malformed' error sub element.
func (*Presence) NotAcceptableError ¶
func (s *Presence) NotAcceptableError() Stanza
NotAcceptableError returns an error copy of the element attaching 'not-acceptable' error sub element.
func (*Presence) NotAllowedError ¶
func (s *Presence) NotAllowedError() Stanza
NotAllowedError returns an error copy of the element attaching 'not-allowed' error sub element.
func (*Presence) NotAuthorizedError ¶
func (s *Presence) NotAuthorizedError() Stanza
NotAuthorizedError returns an error copy of the element attaching 'not-authorized' error sub element.
func (*Presence) PaymentRequiredError ¶
func (s *Presence) PaymentRequiredError() Stanza
PaymentRequiredError returns an error copy of the element attaching 'payment-required' error sub element.
func (*Presence) RecipientUnavailableError ¶
func (s *Presence) RecipientUnavailableError() Stanza
RecipientUnavailableError returns an error copy of the element attaching 'recipient-unavailable' error sub element.
func (*Presence) RedirectError ¶
func (s *Presence) RedirectError() Stanza
RedirectError returns an error copy of the element attaching 'redirect' error sub element.
func (*Presence) RegistrationRequiredError ¶
func (s *Presence) RegistrationRequiredError() Stanza
RegistrationRequiredError returns an error copy of the element attaching 'registration-required' error sub element.
func (*Presence) RemoteServerNotFoundError ¶
func (s *Presence) RemoteServerNotFoundError() Stanza
RemoteServerNotFoundError returns an error copy of the element attaching 'remote-server-not-found' error sub element.
func (*Presence) RemoteServerTimeoutError ¶
func (s *Presence) RemoteServerTimeoutError() Stanza
RemoteServerTimeoutError returns an error copy of the element attaching 'remote-server-timeout' error sub element.
func (*Presence) ResourceConstraintError ¶
func (s *Presence) ResourceConstraintError() Stanza
ResourceConstraintError returns an error copy of the element attaching 'resource-constraint' error sub element.
func (*Presence) ServiceUnavailableError ¶
func (s *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 (s *Presence) SubscriptionRequiredError() Stanza
SubscriptionRequiredError returns an error copy of the element attaching 'subscription-required' error sub element.
func (*Presence) UndefinedConditionError ¶
func (s *Presence) UndefinedConditionError() Stanza
UndefinedConditionError returns an error copy of the element attaching 'undefined-condition' error sub element.
func (*Presence) UnexpectedConditionError ¶
func (s *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 ¶
Stanza represents an XMPP stanza element.
func NewErrorStanzaFromStanza ¶
func NewErrorStanzaFromStanza(stanza Stanza, stanzaErr *StanzaError, errorElements []XElement) Stanza
NewErrorStanzaFromStanza returns a copy of an element of stanza error class.
func NewStanzaFromElement ¶ added in v0.4.0
NewStanzaFromElement returns a new stanza instance derived from an XMPP element.
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.