module

package
Version: v0.0.0-...-aeec266 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled      map[string]struct{}
	Roster       roster.Config
	Offline      offline.Config
	Ultrasound   ultrasound.Config
	Registration xep0077.Config
	Version      xep0092.Config
	Ping         xep0199.Config
}

Config represents C2S modules configuration.

func (*Config) UnmarshalYAML

func (cfg *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML satisfies Unmarshaler interface.

type IQHandler

type IQHandler interface {
	Module

	// MatchesIQ returns whether or not an IQ should be processed by the module.
	MatchesIQ(iq *xmpp.IQ) bool

	// ProcessIQ processes a module IQ taking according actions over the associated stream.
	ProcessIQ(ctx context.Context, iq *xmpp.IQ)
}

IQHandler represents an IQ handler module.

type Module

type Module interface {
	// Shutdown shuts down the module instance.
	Shutdown() error
}

Module represents a generic XMPP module.

type Modules

type Modules struct {
	Roster       *roster.Roster
	Offline      *offline.Offline
	Ultrasound   *ultrasound.Ultrasound
	LastActivity *xep0012.LastActivity
	Private      *xep0049.Private
	DiscoInfo    *xep0030.DiscoInfo
	VCard        *xep0054.VCard
	Register     *xep0077.Register
	Version      *xep0092.Version
	Pep          *xep0163.Pep
	BlockingCmd  *xep0191.BlockingCommand
	Ping         *xep0199.Ping
	// contains filtered or unexported fields
}

Modules structure keeps reference to a set of preconfigured modules.

func New

func New(config *Config, router router.Router, reps repository.Container, allocationID string) *Modules

New returns a set of modules derived from a concrete configuration.

func (*Modules) ProcessIQ

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

ProcessIQ process a module IQ returning 'service unavailable' in case it couldn't be properly handled.

func (*Modules) Shutdown

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

Shutdown gracefully shuts down modules instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL