hooks

package
v0.0.0-...-811715e Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package hooks exposes places in Dendrite where custom code can be executed, useful for MSCs. Hooks can only be run in monolith mode.

Index

Constants

View Source
const (
	// KindNewEventPersisted is a hook which is called with *gomatrixserverlib.HeaderedEvent
	// It is run when a new event is persisted in the roomserver.
	// Usage:
	//   hooks.Attach(hooks.KindNewEventPersisted, func(headeredEvent interface{}) { ... })
	KindNewEventPersisted = "new_event_persisted"
	// KindNewEventReceived is a hook which is called with *gomatrixserverlib.HeaderedEvent
	// It is run before a new event is processed by the roomserver. This hook can be used
	// to modify the event before it is persisted by adding data to `unsigned`.
	// Usage:
	//   hooks.Attach(hooks.KindNewEventReceived, func(headeredEvent interface{}) {
	//     ev := headeredEvent.(*gomatrixserverlib.HeaderedEvent)
	//     _ = ev.SetUnsignedField("key", "val")
	//   })
	KindNewEventReceived = "new_event_received"
)

Variables

This section is empty.

Functions

func Attach

func Attach(kind string, callback func(interface{}))

Attach a hook

func Enable

func Enable()

Enable all hooks. This may slow down the server slightly. Required for MSCs to work.

func Run

func Run(kind string, data interface{})

Run any hooks

Types

This section is empty.

Jump to

Keyboard shortcuts

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