Documentation ¶
Index ¶
- Constants
- Variables
- type BlockListInfo
- type C2SStreamInfo
- type ComponentsInfo
- type ExecutionContext
- type ExternalComponentInfo
- type Handler
- type Hooks
- type LastActivityInfo
- type MemberListInfo
- type ModulesInfo
- type OfflineInfo
- type Priority
- type PrivateInfo
- type RosterInfo
- type S2SStreamInfo
- type UserInfo
- type VCardInfo
Constants ¶
const ( // BlockListFetched hook runs when a user block list is fetched. BlockListFetched = "blocklist.items.fetched" // BlockListItemsBlocked hook runs when one or more JIDs are blocked. BlockListItemsBlocked = "blocklist.items.blocked" // BlockListItemsUnblocked hook runs when one or more JIDs are unblocked. BlockListItemsUnblocked = "blocklist.items.unblocked" )
const ( // C2SStreamConnected hook runs when a C2S connection is registered. C2SStreamConnected = "c2s.stream.connected" // C2SStreamBinded hook runs when C2S stream is bounded. C2SStreamBinded = "c2s.stream.binded" // C2SStreamDisconnected hook runs when a C2S connection is unregistered. C2SStreamDisconnected = "c2s.stream.disconnected" // C2SStreamTerminated hook runs when a C2S connection is terminated. C2SStreamTerminated = "c2s.stream.terminated" // C2SStreamElementReceived hook runs when a XMPP element is received over a C2S stream. C2SStreamElementReceived = "c2s.stream.element_received" // C2SStreamIQReceived hook runs when an iq stanza is received over a C2S stream. C2SStreamIQReceived = "c2s.stream.iq_received" // C2SStreamPresenceReceived hook runs when a presence stanza is received over a C2S stream. C2SStreamPresenceReceived = "c2s.stream.presence_received" // C2SStreamMessageReceived hook runs when a message stanza is received over a C2S stream. C2SStreamMessageReceived = "c2s.stream.message_received" // C2SStreamWillRouteElement hook runs when an XMPP element is about to be routed over a C2S stream. C2SStreamWillRouteElement = "c2s.stream.will_route_element" // C2SStreamIQRouted hook runs when an iq stanza is successfully routed to one ore more C2S streams. C2SStreamIQRouted = "c2s.stream.iq_routed" // C2SStreamPresenceRouted hook runs when a presence stanza is successfully routed to one ore more C2S streams. C2SStreamPresenceRouted = "c2s.stream.presence_routed" // C2SStreamMessageRouted hook runs when a message stanza is successfully routed to one ore more C2S streams. C2SStreamMessageRouted = "c2s.stream.message_routed" // C2SStreamElementSent hook runs when a XMPP element is sent over a C2S stream. C2SStreamElementSent = "c2s.stream.element_sent" )
const ( // ComponentsStarted hook runs after initializing all configured components. ComponentsStarted = "components.started" // ComponentsStopped hook runs after finishing all configured components. ComponentsStopped = "components.stopped" )
const ( // ExternalComponentRegistered hook runs when a external component connection is registered. ExternalComponentRegistered = "ext_component.stream.registered" // ExternalComponentUnregistered hook runs when a external component connection is unregistered. ExternalComponentUnregistered = "ext_component.stream.unregistered" // ExternalComponentElementReceived hook runs whenever an XMPP element is received over a external component stream. ExternalComponentElementReceived = "ext_component.stream.element_received" )
const ( // LowestPriority defines lowest hook execution priority. LowestPriority = Priority(math.MinInt32 + 100) // DefaultPriority defines default hook execution priority. DefaultPriority = Priority(0) // HighestPriority defines highest hook execution priority. HighestPriority = Priority(math.MaxInt32 - 100) )
const ( // ModulesStarted hook runs after initializing all configured modules. ModulesStarted = "modules.started" // ModulesStopped hook runs after finishing all configured modules. ModulesStopped = "modules.stopped" )
const ( // PrivateFetched hook runs when a user private XML is fetched. PrivateFetched = "private.fetched" // PrivateUpdated hook runs when a user private XML is updated. PrivateUpdated = "private.updated" )
const ( // RosterRequested hook runs whenever a user requests the roster. RosterRequested = "roster.requested" // RosterItemUpdated hook runs whenever a roster item subscription is updated. RosterItemUpdated = "roster.item.updated" )
const ( // S2SOutStreamConnected hook runs when an outgoing S2S connection is registered. S2SOutStreamConnected = "s2s.out.stream.connected" // S2SOutStreamDisconnected hook runs when an outgoing S2S connection is unregistered. S2SOutStreamDisconnected = "s2s.out.stream.disconnected" // S2SOutStreamElementSent hook runs whenever a XMPP element is sent over an outgoing S2S stream. S2SOutStreamElementSent = "s2s.out.stream.element_sent" // S2SInStreamRegistered hook runs when an incoming S2S connection is registered. S2SInStreamRegistered = "s2s.in.stream.registered" // S2SInStreamUnregistered hook runs when an incoming S2S connection is unregistered. S2SInStreamUnregistered = "s2s.in.stream.unregistered" // S2SInStreamElementReceived hook runs when a XMPP element is received over an incoming S2S stream. S2SInStreamElementReceived = "s2s.in.stream.stanza_received" // S2SInStreamIQReceived hook runs when an iq stanza is received over an incoming S2S stream. S2SInStreamIQReceived = "s2s.in.stream.iq_received" // S2SInStreamPresenceReceived hook runs when a presence stanza is received over an incoming S2S stream. S2SInStreamPresenceReceived = "s2s.in.stream.presence_received" // S2SInStreamMessageReceived hook runs when a message stanza is received over an incoming S2S stream. S2SInStreamMessageReceived = "s2s.in.stream.message_received" // S2SInStreamWillRouteElement hook runs when an XMPP element is about to be routed on an incoming S2S stream. S2SInStreamWillRouteElement = "s2s.in.stream.will_route_element" // S2SInStreamIQRouted hook runs when an iq stanza is successfully routed to one ore more S2S streams. S2SInStreamIQRouted = "s2s.in.stream.iq_routed" // S2SInStreamPresenceRouted hook runs when a presence stanza is successfully routed to one ore more S2S streams. S2SInStreamPresenceRouted = "s2s.in.stream.presence_routed" // S2SInStreamMessageRouted hook runs when a message stanza is successfully routed to one ore more S2S streams. S2SInStreamMessageRouted = "s2s.in.stream.message_routed" )
const ( // UserCreated hook runs whenever a new user is created. UserCreated = "user.created" // UserDeleted hook runs whenever a user is deleted. UserDeleted = "user.deleted" )
const ( // VCardFetched hook runs whenever a user vCard is fetched. VCardFetched = "vcard.fetched" // VCardUpdated hook runs whenever a user vCard is updated. VCardUpdated = "vcard.updated" )
const (
// DiscoProvidersStarted hook runs after all entity providers have been initialized.
DiscoProvidersStarted = "disco.providers.started"
)
const (
// LastActivityFetched hook runs when a user last activity is fetched.
LastActivityFetched = "last.fetched"
)
const (
// MemberListUpdated hook runs whenever cluster member list is updated.
MemberListUpdated = "memberlist.updated"
)
const (
// OfflineMessageArchived hook runs whenever an offline message is archived.
OfflineMessageArchived = "offline.message.archieved"
)
Variables ¶
var ErrStopped = errors.New("hook: execution stopped")
ErrStopped error is returned by a handler to halt hook execution.
Functions ¶
This section is empty.
Types ¶
type BlockListInfo ¶
type BlockListInfo struct { // Username is the name of the user associated to this event. Username string // JIDs contains all JIDs associated to this event. JIDs []jid.JID }
BlockListInfo contains all information associated to a blocklist event.
type C2SStreamInfo ¶
type C2SStreamInfo struct { // ID is the event stream identifier. ID string // JID represents the event associated JID. JID *jid.JID // Presence is current C2S resource presence. Presence *stravaganza.Presence // Element is the event associated XMPP element. Element stravaganza.Element // Targets contains all JIDs to which event stanza was routed. Targets []jid.JID // DisconnectError contains the original error that caused stream disconnection. DisconnectError error }
C2SStreamInfo contains all info associated to a C2S stream event.
type ComponentsInfo ¶
type ComponentsInfo struct {
Hosts []string
}
ComponentsInfo contains all information associated to a components event.
type ExecutionContext ¶
type ExecutionContext struct { Info interface{} Sender interface{} }
ExecutionContext defines a hook execution info context.
type ExternalComponentInfo ¶
type ExternalComponentInfo struct { // ID is the event stream identifier. ID string // Host is the external component host domain. Host string // Element is the event associated XMPP element. Element stravaganza.Element }
ExternalComponentInfo contains all info associated to an external component event.
type Handler ¶
type Handler func(ctx context.Context, execCtx *ExecutionContext) error
Handler defines a generic hook handler function.
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks represents a set of module hook handlers.
func (*Hooks) AddHook ¶
AddHook adds a new handler to a given hook providing an execution priority value. hnd priority may be any number (including negative). Handlers with a higher priority are executed first.
func (*Hooks) RemoveHook ¶
RemoveHook removes a hook registered handler.
type LastActivityInfo ¶
type LastActivityInfo struct { // Username is the name of the user associated to this event. Username string // JID represents the event associated JID. JID *jid.JID }
LastActivityInfo contains all information associated to a last activity event.
type MemberListInfo ¶
type MemberListInfo struct { // Registered contains all new registered cluster members. Registered []clustermodel.Member // UnregisteredKeys contains unregistered cluster members keys. UnregisteredKeys []string }
MemberListInfo contains all info associated to MemberListUpdated event.
type ModulesInfo ¶
type ModulesInfo struct {
ModuleNames []string
}
ModulesInfo contains all information associated to a modules event.
type OfflineInfo ¶
type OfflineInfo struct { // Username is the name of the vCard user associated to this event. Username string // Message represents the event associated message. Message *stravaganza.Message }
OfflineInfo contains all information associated to an offline event.
type PrivateInfo ¶
type PrivateInfo struct { // Username is the name of the user associated to this event. Username string // Private is the private XML element associated to this event. Private stravaganza.Element }
PrivateInfo contains all information associated to a private event.
type RosterInfo ¶
type RosterInfo struct { // Username is the name of the roster owner. Username string // JID is the event contact JID. JID string // Subscription is the roster event subscription value. Subscription string }
RosterInfo contains all information associated to a roster event.
type S2SStreamInfo ¶
type S2SStreamInfo struct { // ID is the event stream identifier. ID string // Sender is the S2S sender domain. Sender string // Target is the S2S target domain. Target string // Element is the event associated XMPP element. Element stravaganza.Element }
S2SStreamInfo contains all info associated to a S2S event.
type UserInfo ¶
type UserInfo struct { // Username is the name of the user associated to this event. Username string }
UserInfo contains all information associated to a user event.
type VCardInfo ¶
type VCardInfo struct { // Username is the name of the vCard user associated to this event. Username string // VCard is the vCard element associated to this event. VCard stravaganza.Element }
VCardInfo contains all information associated to a vCard event.