module

package
v0.59.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IQProcessor

type IQProcessor interface {
	Module

	// MatchesNamespace tells whether iq child namespace corresponds to this module.
	// The serverTarget parameter will be true in case iq target is a server entity.
	MatchesNamespace(namespace string, serverTarget bool) bool

	// ProcessIQ will be invoked whenever iq stanza should be processed by this module.
	ProcessIQ(ctx context.Context, iq *stravaganza.IQ) error
}

IQProcessor represents an iq processor module type.

type Module

type Module interface {
	// Name returns specific module name.
	Name() string

	// StreamFeature returns module stream feature element.
	StreamFeature(ctx context.Context, domain string) (stravaganza.Element, error)

	// ServerFeatures returns module server features.
	ServerFeatures(ctx context.Context) ([]string, error)

	// AccountFeatures returns module account features.
	AccountFeatures(ctx context.Context) ([]string, error)

	// Start starts module.
	Start(ctx context.Context) error

	// Stop stops module.
	Stop(ctx context.Context) error
}

Module represents generic module interface.

type Modules

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

Modules is the global module hub.

func NewModules

func NewModules(
	mods []Module,
	hosts *host.Hosts,
	router router.Router,
	hk *hook.Hooks,
	logger kitlog.Logger,
) *Modules

NewModules returns a new initialized Modules instance.

func (*Modules) AllModules

func (m *Modules) AllModules() []Module

AllModules returns all configured modules.

func (*Modules) IsEnabled

func (m *Modules) IsEnabled(moduleName string) bool

IsEnabled tells whether a specific module it's been registered.

func (*Modules) IsModuleIQ

func (m *Modules) IsModuleIQ(iq *stravaganza.IQ) bool

IsModuleIQ returns true in case iq stanza should be handled by modules.

func (*Modules) ProcessIQ

func (m *Modules) ProcessIQ(ctx context.Context, iq *stravaganza.IQ) error

ProcessIQ routes the iq to the corresponding iq handler module.

func (*Modules) Start

func (m *Modules) Start(ctx context.Context) error

Start starts modules.

func (*Modules) Stop

func (m *Modules) Stop(ctx context.Context) error

Stop stops modules.

func (*Modules) StreamFeatures

func (m *Modules) StreamFeatures(ctx context.Context, domain string) ([]stravaganza.Element, error)

StreamFeatures returns stream features of all registered modules.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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