Documentation ¶
Overview ¶
Package blocklist implements blocking and unblocking of contacts.
Index ¶
- Constants
- func Add(ctx context.Context, s *xmpp.Session, j ...jid.JID) error
- func AddIQ(ctx context.Context, iq stanza.IQ, s *xmpp.Session, j ...jid.JID) error
- func Handle(h Handler) mux.Option
- func Match(j1, j2 jid.JID) bool
- func Remove(ctx context.Context, s *xmpp.Session, j ...jid.JID) error
- func RemoveIQ(ctx context.Context, iq stanza.IQ, s *xmpp.Session, j ...jid.JID) error
- type Handler
- type Iter
Constants ¶
const NS = `urn:xmpp:blocklist`
NS is the namespace used by this package, provided as a convenience.
Variables ¶
This section is empty.
Functions ¶
func AddIQ ¶
AddIQ is like Add except that it lets you customize the IQ. Changing the type of the provided IQ has no effect.
func Handle ¶
Handle returns an option that registers the given handler on the mux for the various blocking command payloads.
func Match ¶
Match checks j1 aginst a JID in the blocklist (j2) and returns true if they are a match.
The JID matches the blocklist JID if any of the following compare to the blocklist JID (falling back in this order):
- Full JID (user@domain/resource)
- Bare JID (user@domain)
- Full domain (domain/resource)
- Bare domain
Types ¶
type Handler ¶
type Handler struct { Block func(jid.JID) Unblock func(jid.JID) UnblockAll func() List func(chan<- jid.JID) }
Handler can be used to respond to incoming blocking command requests.
func (Handler) HandleIQ ¶
func (h Handler) HandleIQ(iq stanza.IQ, r xmlstream.TokenReadEncoder, start *xml.StartElement) error
HandleIQ implements mux.IQHandler.
type Iter ¶
type Iter struct {
// contains filtered or unexported fields
}
Iter is an iterator over blocklist JIDs.
func FetchIQ ¶
FetchIQ is like Fetch except that it lets you customize the IQ. Changing the type of the provided IQ has no effect.
func (*Iter) Close ¶
Close indicates that we are finished with the given iterator and processing the stream may continue. Calling it multiple times has no effect.