Documentation ¶
Index ¶
Constants ¶
const ( NSStream = "http://etherx.jabber.org/streams" NSTLS = "urn:ietf:params:xml:ns:xmpp-tls" NSClient = "jabber:client" NSServer = "jabber:server" NSSASL = "urn:ietf:params:xml:ns:xmpp-sasl" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AllMatcher ¶
type AllMatcher struct{}
AllMatcher is a Matcher that matches any Element.
func (AllMatcher) Match ¶
func (m AllMatcher) Match(e Element) bool
type Decoder ¶
type Decoder struct { Header string // contains filtered or unexported fields }
A Decoder represents an XMPP parser reading a particular input stream. The parser uses xml.Decoder under the hood.
func NewDecoder ¶
NewDecoder creates a new Decoder reading from r.
func (*Decoder) NextElement ¶
NextElement returns the next Element in the stream.
type Element ¶
type Element interface { Name() xml.Name // Name() returns the xml.Name of the element. XML() string // XML() returns a string representation of the element's XML. }
An Element represents a single XML Element inside of an XMPP stream. This can be an XMPP stanza, stream management elements, SASL elements, etc.
type GenericElement ¶
type GenericElement struct {
// contains filtered or unexported fields
}
A GenericElement is used to represent any generic XMPP Element by storing their raw XML as a string as well as their resolved xml.Name.
func NewGenericElement ¶
func NewGenericElement(name xml.Name, xml string) *GenericElement
NewGenericElement creates a GenericElement given a name and the raw XML for an XMPP Element.
func (GenericElement) Name ¶
func (e GenericElement) Name() xml.Name
func (GenericElement) XML ¶
func (e GenericElement) XML() string
type HandlerFunc ¶
The HandlerFunc type is an adapter to allow the use of ordinary functions as Handlers. If f is a function with the appropriate signature, HandlerFunc(f) is a Handler that calls f.
func (HandlerFunc) HandleElement ¶
func (f HandlerFunc) HandleElement(e Element) error
HandleElement calls f(s, p)
type NameMatcher ¶
NameMatcher is a Matcher that checks to see if e.Name is equal to itself.
func (NameMatcher) Match ¶
func (m NameMatcher) Match(e Element) bool
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
A Router contains Routes which are used to process XMPP Elements via different handlers.
type SpaceMatcher ¶
type SpaceMatcher string
SpaceMatcher is a Matcher that checks to see if e.Name.Space is equal to itself.
func (SpaceMatcher) Match ¶
func (m SpaceMatcher) Match(e Element) bool
type Stream ¶
type Stream struct { From string To string ID string Version string // contains filtered or unexported fields }
Stream is a custom Element that represents the start of a stream. Unlike normal XMPP Elements, a Stream's XML() method should not return the closing </stream> tag. Normal XMPP Elements have a depth=1 whereas the start of a stream is depth=0
func NewStream ¶
func NewStream(rawSE xml.StartElement) *Stream
NewStream returns a new Stream that implements xmpp.Element