carbons

package
Version: v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2021 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package carbons implements carbon copying messages to all interested clients.

Index

Constants

View Source
const (
	NS      = `urn:xmpp:carbons:2`
	NSRules = `urn:xmpp:carbons:rules:0`
)

Namespaces used by this package, provided as a convenience.

Variables

View Source
var (
	Feature = info.Feature{Var: NS}
)

A list of service discovery features that are supported by this package.

Functions

func Disable

func Disable(ctx context.Context, s *xmpp.Session) error

Disable instructs the server to stop carbon copying messages on the given session.

func DisableIQ

func DisableIQ(ctx context.Context, s *xmpp.Session, iq stanza.IQ) error

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 Enable

func Enable(ctx context.Context, s *xmpp.Session) error

Enable instructs the server to start carbon copying messages on the given session.

func EnableIQ

func EnableIQ(ctx context.Context, s *xmpp.Session, iq stanza.IQ) error

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

func Handle(h Handler) mux.Option

Handle returns an option that registers a handler for carbon copied messages on the multiplexer.

Types

type Handler

type Handler struct {
	F func(m stanza.Message, sent bool, inner xml.TokenReader) error
}

Handler can be used to handle incoming carbon copied messages.

func (Handler) ForFeatures

func (h Handler) ForFeatures(node string, f func(info.Feature) error) error

ForFeatures implements info.FeatureIter.

func (Handler) HandleMessage

func (h Handler) HandleMessage(p stanza.Message, r xmlstream.TokenReadEncoder) error

HandleMessage satisfies mux.MessageHandler. it is used by the multiplexer and normally does not need to be called by the user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL