xep0030

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName represents disco module name.
	ModuleName = "disco"

	// XEPNumber represents disco XEP number.
	XEPNumber = "0030"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Disco

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

Disco represents a disco info (XEP-0030) module type.

func New

func New(
	router router.Router,
	components *component.Components,
	rosRep repository.Roster,
	resMng *c2s.ResourceManager,
	hk *hook.Hooks,
) *Disco

New returns a new initialized disco module instance.

func (*Disco) AccountFeatures

func (m *Disco) AccountFeatures(_ context.Context) ([]string, error)

AccountFeatures returns account disco features.

func (*Disco) AccountProvider

func (m *Disco) AccountProvider() InfoProvider

AccountProvider returns current disco info account provider.

func (*Disco) MatchesNamespace

func (m *Disco) MatchesNamespace(namespace string, _ bool) bool

MatchesNamespace tells whether namespace matches disco module.

func (*Disco) Name

func (m *Disco) Name() string

Name returns disco module name.

func (*Disco) ProcessIQ

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

ProcessIQ process a disco info iq.

func (*Disco) ServerFeatures

func (m *Disco) ServerFeatures(_ context.Context) ([]string, error)

ServerFeatures returns server disco features.

func (*Disco) ServerProvider

func (m *Disco) ServerProvider() InfoProvider

ServerProvider returns current disco info server provider.

func (*Disco) Start

func (m *Disco) Start(_ context.Context) error

Start starts disco module.

func (*Disco) Stop

func (m *Disco) Stop(_ context.Context) error

Stop stops disco module.

func (*Disco) StreamFeature

func (m *Disco) StreamFeature(_ context.Context, _ string) (stravaganza.Element, error)

StreamFeature returns disco stream feature.

type InfoProvider

type InfoProvider interface {
	// Identities returns all identities associated to the provider.
	Identities(ctx context.Context, toJID, fromJID *jid.JID, node string) []discomodel.Identity

	// Items returns all items associated to the provider.
	Items(ctx context.Context, toJID, fromJID *jid.JID, node string) ([]discomodel.Item, error)

	// Features returns all features associated to the provider.
	Features(ctx context.Context, toJID, fromJID *jid.JID, node string) ([]discomodel.Feature, error)

	// Forms returns data forms associated to the provider.
	Forms(ctx context.Context, toJID, fromJID *jid.JID, node string) ([]xep0004.DataForm, error)
}

InfoProvider represents a general entity disco info provider interface.

Jump to

Keyboard shortcuts

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