Documentation
¶
Index ¶
- type IQProcessor
- type MessagePreProcessor
- type MessagePreRouter
- type Module
- type Modules
- func (m *Modules) IsEnabled(moduleName string) bool
- func (m *Modules) IsModuleIQ(iq *stravaganza.IQ) bool
- func (m *Modules) PreProcessMessage(ctx context.Context, msg *stravaganza.Message) (*stravaganza.Message, error)
- func (m *Modules) PreRouteMessage(ctx context.Context, msg *stravaganza.Message) (*stravaganza.Message, error)
- func (m *Modules) ProcessIQ(ctx context.Context, iq *stravaganza.IQ) error
- func (m *Modules) Start(ctx context.Context) error
- func (m *Modules) Stop(ctx context.Context) error
- func (m *Modules) StreamFeatures(ctx context.Context, domain string) ([]stravaganza.Element, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IQProcessor ¶ added in v0.52.0
type IQProcessor interface { Module // MatchesNamespace tells whether iq child namespace corresponds to this module. MatchesNamespace(namespace string) 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 MessagePreProcessor ¶ added in v0.52.0
type MessagePreProcessor interface { Module // PreProcessMessage will be invoked as soon as a message stanza is received a over a C2S stream. PreProcessMessage(ctx context.Context, msg *stravaganza.Message) (*stravaganza.Message, error) }
MessagePreProcessor represents a message preprocessor module type.
type MessagePreRouter ¶ added in v0.52.0
type MessagePreRouter interface { Module // PreRouteMessage will be invoked before a message stanza is routed a over a C2S stream. PreRouteMessage(ctx context.Context, msg *stravaganza.Message) (*stravaganza.Message, error) }
MessagePreRouter represents a message prerouter 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 ¶ added in v0.3.2
type Modules struct {
// contains filtered or unexported fields
}
Modules is the global module hub.
func NewModules ¶ added in v0.50.0
NewModules returns a new initialized Modules instance.
func (*Modules) IsEnabled ¶ added in v0.50.0
IsEnabled tells whether a specific module it's been registered.
func (*Modules) IsModuleIQ ¶ added in v0.50.0
func (m *Modules) IsModuleIQ(iq *stravaganza.IQ) bool
IsModuleIQ returns true in case iq stanza should be handled by modules.
func (*Modules) PreProcessMessage ¶ added in v0.52.0
func (m *Modules) PreProcessMessage(ctx context.Context, msg *stravaganza.Message) (*stravaganza.Message, error)
PreProcessMessage performs message preprocessing returning the resulting message stanza.
func (*Modules) PreRouteMessage ¶ added in v0.52.0
func (m *Modules) PreRouteMessage(ctx context.Context, msg *stravaganza.Message) (*stravaganza.Message, error)
PreRouteMessage performs message prerouting returning the resulting message stanza.
func (*Modules) ProcessIQ ¶ added in v0.3.4
ProcessIQ routes the iq to the corresponding iq handler module.
func (*Modules) StreamFeatures ¶ added in v0.51.0
StreamFeatures returns stream features of all registered modules.