dispatcher

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: ISC Imports: 11 Imported by: 0

Documentation

Overview

Package dispatcher provides definitions and functionality related to executing Matrix requests.

Index

Constants

View Source
const (
	MessageFormatHTML = MessageFormat("org.matrix.custom.html")
	MsgTypeText       = MsgType("m.text")
)

Define matrix constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

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

Dispatcher holds information for sending notifications to clients.

func Create

func Create(homeserver, username, password string, formatting configuration.Formatting) (*Dispatcher, error)

Create instanciates a dispatcher connection.

func (*Dispatcher) Close

func (d *Dispatcher) Close()

Close closes the dispatcher connection.

func (*Dispatcher) DeleteNotification

func (d *Dispatcher) DeleteNotification(a *model.Application, n *model.DeleteNotification) error

DeleteNotification sends a notification to a given user that another notification is deleted

func (*Dispatcher) DeregisterApplication

func (d *Dispatcher) DeregisterApplication(a *model.Application, u *model.User) error

DeregisterApplication deletes a channel for an application.

func (*Dispatcher) IsOrphan

func (d *Dispatcher) IsOrphan(a *model.Application, u *model.User) (bool, error)

IsOrphan checks if the user is still connected to the channel.

func (*Dispatcher) RegisterApplication

func (d *Dispatcher) RegisterApplication(id uint, name, user string) (string, error)

RegisterApplication creates a channel for an application.

func (*Dispatcher) RepairApplication

func (d *Dispatcher) RepairApplication(a *model.Application, u *model.User) error

RepairApplication re-invites the user to the channel.

func (*Dispatcher) SendNotification

func (d *Dispatcher) SendNotification(a *model.Application, n *model.Notification) (eventID string, err error)

SendNotification sends a notification to a given user.

func (*Dispatcher) UpdateApplication

func (d *Dispatcher) UpdateApplication(a *model.Application, behavior *configuration.RepairBehavior) error

UpdateApplication updates a channel for an application.

type MessageEvent

type MessageEvent struct {
	Body          string        `json:"body"`
	FormattedBody string        `json:"formatted_body"`
	MsgType       MsgType       `json:"msgtype"`
	RelatesTo     *RelatesTo    `json:"m.relates_to,omitempty"`
	Format        MessageFormat `json:"format"`
	NewContent    *NewContent   `json:"m.new_content,omitempty"`
}

MessageEvent is the content of a matrix message event

type MessageFormat

type MessageFormat string

MessageFormat is a matrix message format

type MsgType

type MsgType string

MsgType is a matrix msgtype

type NewContent

type NewContent struct {
	Body          string        `json:"body"`
	FormattedBody string        `json:"formatted_body"`
	MsgType       MsgType       `json:"msgtype"`
	Format        MessageFormat `json:"format"`
}

NewContent holds information about an updated message event

type RelatesTo

type RelatesTo struct {
	InReplyTo map[string]string `json:"m.in_reply_to,omitempty"`
	RelType   string            `json:"rel_type,omitempty"`
	EventID   string            `json:"event_id,omitempty"`
}

RelatesTo holds information about relations to other message events

Jump to

Keyboard shortcuts

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