Documentation ¶
Overview ¶
Package carbons implements carbon copying messages to all interested clients.
Index ¶
- Constants
- Variables
- func Disable(ctx context.Context, s *xmpp.Session) error
- func DisableIQ(ctx context.Context, s *xmpp.Session, iq stanza.IQ) error
- func Enable(ctx context.Context, s *xmpp.Session) error
- func EnableIQ(ctx context.Context, s *xmpp.Session, iq stanza.IQ) error
- func Handle(h Handler) mux.Option
- func Private(r xml.TokenReader) xml.TokenReader
- func Unwrap(del *delay.Delay, r xml.TokenReader) (xml.TokenReader, xml.StartElement, error)
- func WrapReceived(delay delay.Delay, r xml.TokenReader) xml.TokenReader
- func WrapSent(delay delay.Delay, r xml.TokenReader) xml.TokenReader
- type Handler
Constants ¶
const ( NS = `urn:xmpp:carbons:2` NSRules = `urn:xmpp:carbons:rules:0` )
Namespaces used by this package, provided as a convenience.
Variables ¶
var (
Feature = info.Feature{Var: NS}
)
A list of service discovery features that are supported by this package.
Functions ¶
func DisableIQ ¶
DisableIQ is like Disable but it allows you to customize the IQ stanza being sent. Changing the type of the IQ has no effect.
func EnableIQ ¶
EnableIQ is like Enable but it allows you to customize the IQ stanza being sent. Changing the type of the IQ has no effect.
func Handle ¶
Handle returns an option that registers a handler for carbon copied messages on the multiplexer.
func Private ¶ added in v0.21.0
func Private(r xml.TokenReader) xml.TokenReader
Private is an xmlstream.Transformer that excludes all top level <message/> elements from being forwarded to other Carbons-enabled resources, by adding a <private/> element and a <no-copy/> hint.
func Unwrap ¶ added in v0.21.0
func Unwrap(del *delay.Delay, r xml.TokenReader) (xml.TokenReader, xml.StartElement, error)
Unwrap unwraps a carbon copied message, unmarshals the forwarding delay into the provided delay, and returns a start element set to either sent or received. If the provided delay is nil, unmarshaling is skipped.
func WrapReceived ¶ added in v0.21.0
func WrapReceived(delay delay.Delay, r xml.TokenReader) xml.TokenReader
WrapReceived wraps the provided token reader (which should be a message stanza, but this is not enforced) in a received element.
func WrapSent ¶ added in v0.21.0
func WrapSent(delay delay.Delay, r xml.TokenReader) xml.TokenReader
WrapSent wraps the provided token reader (which should be a message stanza, but this is not enforced) in a sent element.
Types ¶
type Handler ¶
Handler can be used to handle incoming carbon copied messages.
func (Handler) ForFeatures ¶
ForFeatures implements info.FeatureIter.
func (Handler) HandleMessage ¶
HandleMessage satisfies mux.MessageHandler. it is used by the multiplexer and normally does not need to be called by the user.