xep0313

package
v0.63.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

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

	// XEPNumber represents mam XEP number.
	XEPNumber = "0313"
)

Variables

This section is empty.

Functions

func ExtractReceivedArchiveID

func ExtractReceivedArchiveID(ctx context.Context) string

ExtractReceivedArchiveID returns message received archive ID by inspecting the passed context.

func ExtractSentArchiveID

func ExtractSentArchiveID(ctx context.Context) string

ExtractSentArchiveID returns message sent archive ID by inspecting the passed context.

func IsArchiveRequested

func IsArchiveRequested(inf c2smodel.Info) bool

IsArchiveRequested determines whether archive has been requested over a C2S stream by inspecting inf parameter.

func IsMessageArchievable added in v0.62.3

func IsMessageArchievable(msg *stravaganza.Message) bool

IsMessageArchievable returns true if the message is archievable.

Types

type Config

type Config struct {
	// QueueSize defines maximum number of archive messages stanzas.
	// When the limit is reached, the oldest message will be purged to make room for the new one.
	QueueSize int `fig:"queue_size" default:"1000"`
}

Config contains mam module configuration options.

type Mam

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

Mam represents a mam (XEP-0313) module type.

func New

func New(
	cfg Config,
	router router.Router,
	hosts *host.Hosts,
	rep repository.Repository,
	hk *hook.Hooks,
	logger kitlog.Logger,
) *Mam

New returns a new initialized mam instance.

func (*Mam) AccountFeatures

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

AccountFeatures returns mam account disco features.

func (*Mam) MatchesNamespace

func (m *Mam) MatchesNamespace(namespace string, serverTarget bool) bool

MatchesNamespace tells whether namespace matches mam module.

func (*Mam) Name

func (m *Mam) Name() string

Name returns mam module name.

func (*Mam) ProcessIQ

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

ProcessIQ process a mam iq.

func (*Mam) ServerFeatures

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

ServerFeatures returns mam server disco features.

func (*Mam) Start

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

Start starts mam module.

func (*Mam) Stop

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

Stop stops mam module.

func (*Mam) StreamFeature

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

StreamFeature returns mam module stream feature.

type Service added in v0.63.0

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

Service represents a MAM service.

func NewService added in v0.63.0

func NewService(
	router router.Router,
	hk *hook.Hooks,
	rep repository.Repository,
	maxQueueSize int,
	logger kitlog.Logger,
) *Service

NewService returns a new archive service instance.

func (*Service) ArchiveMessage added in v0.63.0

func (m *Service) ArchiveMessage(ctx context.Context, message *stravaganza.Message, archiveID, id string) error

ArchiveMessage archives a message.

func (*Service) DeleteArchive added in v0.63.0

func (m *Service) DeleteArchive(ctx context.Context, archiveID string) error

DeleteArchive deletes an archive.

func (*Service) ProcessIQ added in v0.63.0

func (m *Service) ProcessIQ(ctx context.Context, iq *stravaganza.IQ, onArchiveRequestedFn func(archiveID string) error) error

ProcessIQ processes a MAM IQ.

Jump to

Keyboard shortcuts

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