Documentation ¶
Overview ¶
Package roster implements contact list functionality.
Index ¶
Constants ¶
const (
NS = "jabber:iq:roster"
)
Namespaces used by this package provided as a convenience.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶ added in v0.16.0
Handler responds to roster pushes.
func (Handler) HandleIQ ¶ added in v0.16.0
func (h Handler) HandleIQ(iq stanza.IQ, t xmlstream.TokenReadEncoder, start *xml.StartElement) error
HandleIQ responds to roster push IQs.
type IQ ¶
type IQ struct { stanza.IQ Query struct { Ver string `xml:"version,attr,omitempty"` Item []Item `xml:"item"` } `xml:"jabber:iq:roster query"` }
IQ represents a user roster request or response. The zero value is a valid query for the roster.
func (IQ) MarshalXML ¶
MarshalXML satisfies the xml.Marshaler interface.
func (IQ) TokenReader ¶
func (iq IQ) TokenReader() xml.TokenReader
TokenReader returns a stream of XML tokens that match the IQ.
type Item ¶
type Item struct { JID jid.JID `xml:"jid,attr,omitempty"` Name string `xml:"name,attr,omitempty"` Subscription string `xml:"subscription,attr,omitempty"` Group string `xml:"group,omitempty"` }
Item represents a contact in the roster.
func (Item) MarshalXML ¶
MarshalXML satisfies the xml.Marshaler interface.
func (Item) TokenReader ¶
func (item Item) TokenReader() xml.TokenReader
TokenReader satisfies the xmlstream.Marshaler interface.
type Iter ¶ added in v0.11.0
type Iter struct {
// contains filtered or unexported fields
}
Iter is an iterator over roster items.
func Fetch ¶ added in v0.11.0
Fetch requests the roster and returns an iterator over all roster items (blocking until a response is received).
The iterator must be closed before anything else is done on the session or it will become invalid. Any errors encountered while creating the iter are deferred until the iter is used.
func FetchIQ ¶ added in v0.11.0
FetchIQ is like Fetch but it allows you to customize the IQ. Changing the type of the provided IQ has no effect.
func (*Iter) Close ¶ added in v0.11.0
Close indicates that we are finished with the given iterator and processing the stream may continue. Calling it multiple times has no effect.
func (*Iter) Err ¶ added in v0.11.0
Err returns the last error encountered by the iterator (if any).