xmpp: mellium.im/xmpp/roster Index | Files

package roster

import "mellium.im/xmpp/roster"

Package roster implements contact list functionality.

Index

Package Files

roster.go

Constants

const (
    NS = "jabber:iq:roster"
)

Namespaces used by this package provided as a convenience.

type IQ Uses

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 Uses

func (iq IQ) MarshalXML(e *xml.Encoder, _ xml.StartElement) error

MarshalXML satisfies the xml.Marshaler interface.

func (IQ) TokenReader Uses

func (iq IQ) TokenReader() xml.TokenReader

TokenReader returns a stream of XML tokens that match the IQ.

func (IQ) WriteXML Uses

func (iq IQ) WriteXML(w xmlstream.TokenWriter) (n int, err error)

WriteXML satisfies the xmlstream.WriterTo interface. It is like MarshalXML except it writes tokens to w.

type Item Uses

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 Uses

func (item Item) MarshalXML(e *xml.Encoder, _ xml.StartElement) error

MarshalXML satisfies the xml.Marshaler interface.

func (Item) TokenReader Uses

func (item Item) TokenReader() xml.TokenReader

TokenReader satisfies the xmlstream.Marshaler interface.

func (Item) WriteXML Uses

func (item Item) WriteXML(w xmlstream.TokenWriter) (n int, err error)

WriteXML satisfies the xmlstream.WriterTo interface. It is like MarshalXML except it writes tokens to w.

type Iter Uses

type Iter struct {
    // contains filtered or unexported fields
}

Iter is an iterator over roster items.

func Fetch Uses

func Fetch(ctx context.Context, s *xmpp.Session) *Iter

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 Uses

func FetchIQ(ctx context.Context, iq stanza.IQ, s *xmpp.Session) *Iter

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 Uses

func (i *Iter) Close() error

Close indicates that we are finished with the given roster. Calling it multiple times has no effect.

func (*Iter) Err Uses

func (i *Iter) Err() error

Err returns the last error encountered by the iterator (if any).

func (*Iter) Item Uses

func (i *Iter) Item() Item

Item returns the current roster item.

func (*Iter) Next Uses

func (i *Iter) Next() bool

Next returns true if there are more items to decode.

Package roster imports 7 packages (graph). Updated 2019-07-19. Refresh now. Tools for package owners.