bridge

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MPL-2.0 Imports: 29 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MinSpecVersion = mautrix.SpecV11
View Source
var NoSessionFound = crypto.NoSessionFound

Functions

This section is empty.

Types

type Bridge

type Bridge struct {
	Name         string
	URL          string
	Description  string
	Version      string
	ProtocolName string

	AdditionalShortFlags string
	AdditionalLongFlags  string

	VersionDesc      string
	LinkifiedVersion string
	BuildTime        string

	AS               *appservice.AppService
	EventProcessor   *appservice.EventProcessor
	CommandProcessor CommandProcessor
	MatrixHandler    *MatrixHandler
	Bot              *appservice.IntentAPI
	Config           bridgeconfig.BaseConfig
	ConfigPath       string
	RegistrationPath string
	SaveConfig       bool
	ConfigUpgrader   configupgrade.BaseUpgrader
	Log              log.Logger
	DB               *dbutil.Database
	StateStore       *sqlstatestore.SQLStateStore
	Crypto           Crypto
	CryptoPickleKey  string

	MediaConfig  mautrix.RespMediaConfig
	SpecVersions mautrix.RespVersions

	Child ChildOverride
	// contains filtered or unexported fields
}

func (*Bridge) GenerateRegistration

func (br *Bridge) GenerateRegistration()

func (*Bridge) InitVersion

func (br *Bridge) InitVersion(tag, commit, buildTime string)

func (*Bridge) LogDBUpgradeErrorAndExit

func (br *Bridge) LogDBUpgradeErrorAndExit(name string, err error)

func (*Bridge) Main

func (br *Bridge) Main()

func (*Bridge) ManualStop added in v0.12.1

func (br *Bridge) ManualStop(exitCode int)

func (*Bridge) NewBridgeStateQueue

func (br *Bridge) NewBridgeStateQueue(user status.BridgeStateFiller, log log.Logger) *BridgeStateQueue

func (*Bridge) ResendBridgeInfo

func (br *Bridge) ResendBridgeInfo()

func (*Bridge) SendBridgeState

func (br *Bridge) SendBridgeState(ctx context.Context, state *status.BridgeState) error

func (*Bridge) SendGlobalBridgeState

func (br *Bridge) SendGlobalBridgeState(state status.BridgeState)

func (*Bridge) SendMessageCheckpoint

func (br *Bridge) SendMessageCheckpoint(evt *event.Event, step status.MessageCheckpointStep, err error, s status.MessageCheckpointStatus, retryNum int)

func (*Bridge) SendMessageCheckpoints

func (br *Bridge) SendMessageCheckpoints(checkpoints []*status.MessageCheckpoint) error

func (*Bridge) SendMessageErrorCheckpoint

func (br *Bridge) SendMessageErrorCheckpoint(evt *event.Event, step status.MessageCheckpointStep, err error, permanent bool, retryNum int)

func (*Bridge) SendMessageSuccessCheckpoint

func (br *Bridge) SendMessageSuccessCheckpoint(evt *event.Event, step status.MessageCheckpointStep, retryNum int)

func (*Bridge) SendRawMessageCheckpoint

func (br *Bridge) SendRawMessageCheckpoint(cp *status.MessageCheckpoint)

func (*Bridge) UpdateBotProfile

func (br *Bridge) UpdateBotProfile()

type BridgeStateQueue

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

func (*BridgeStateQueue) GetPrev

func (bsq *BridgeStateQueue) GetPrev() status.BridgeState

func (*BridgeStateQueue) Send

func (bsq *BridgeStateQueue) Send(state status.BridgeState)

func (*BridgeStateQueue) SetPrev

func (bsq *BridgeStateQueue) SetPrev(prev status.BridgeState)

type CSFeatureRequirer

type CSFeatureRequirer interface {
	CheckFeatures(versions *mautrix.RespVersions) (string, bool)
}

type ChildOverride

type ChildOverride interface {
	GetExampleConfig() string
	GetConfigPtr() interface{}

	Init()
	Start()
	Stop()

	GetIPortal(id.RoomID) Portal
	GetAllIPortals() []Portal
	GetIUser(id id.UserID, create bool) User
	IsGhost(id.UserID) bool
	GetIGhost(id.UserID) Ghost
	CreatePrivatePortal(id.RoomID, User, Ghost)
}

type CommandProcessor

type CommandProcessor interface {
	Handle(roomID id.RoomID, eventID id.EventID, user User, message string, replyTo id.EventID)
}

type Crypto

type Crypto interface {
	HandleMemberEvent(*event.Event)
	Decrypt(*event.Event) (*event.Event, error)
	Encrypt(id.RoomID, event.Type, *event.Content) error
	WaitForSession(id.RoomID, id.SenderKey, id.SessionID, time.Duration) bool
	RequestSession(id.RoomID, id.SenderKey, id.SessionID, id.UserID, id.DeviceID)
	ResetSession(id.RoomID)
	Init() error
	Start()
	Stop()
	Reset(startAfterReset bool)
	Client() *mautrix.Client
}

func NewCryptoHelper

func NewCryptoHelper(bridge *Bridge) Crypto

type CryptoHelper

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

func (*CryptoHelper) Client

func (helper *CryptoHelper) Client() *mautrix.Client

func (*CryptoHelper) Decrypt

func (helper *CryptoHelper) Decrypt(evt *event.Event) (*event.Event, error)

func (*CryptoHelper) Encrypt

func (helper *CryptoHelper) Encrypt(roomID id.RoomID, evtType event.Type, content *event.Content) (err error)

func (*CryptoHelper) HandleMemberEvent

func (helper *CryptoHelper) HandleMemberEvent(evt *event.Event)

func (*CryptoHelper) Init

func (helper *CryptoHelper) Init() error

func (*CryptoHelper) RequestSession

func (helper *CryptoHelper) RequestSession(roomID id.RoomID, senderKey id.SenderKey, sessionID id.SessionID, userID id.UserID, deviceID id.DeviceID)

func (*CryptoHelper) Reset

func (helper *CryptoHelper) Reset(startAfterReset bool)

func (*CryptoHelper) ResetSession

func (helper *CryptoHelper) ResetSession(roomID id.RoomID)

func (*CryptoHelper) Start

func (helper *CryptoHelper) Start()

func (*CryptoHelper) Stop

func (helper *CryptoHelper) Stop()

func (*CryptoHelper) WaitForSession

func (helper *CryptoHelper) WaitForSession(roomID id.RoomID, senderKey id.SenderKey, sessionID id.SessionID, timeout time.Duration) bool

type DisappearingPortal

type DisappearingPortal interface {
	Portal
	ScheduleDisappearing()
}

type DoublePuppet

type DoublePuppet interface {
	CustomIntent() *appservice.IntentAPI
	SwitchCustomMXID(accessToken string, userID id.UserID) error
}

type FlagHandlingBridge

type FlagHandlingBridge interface {
	ChildOverride
	HandleFlags() bool
}

type Ghost

type Ghost interface {
	DoublePuppet
	DefaultIntent() *appservice.IntentAPI
	GetMXID() id.UserID
}

type GhostWithProfile

type GhostWithProfile interface {
	Ghost
	GetDisplayname() string
	GetAvatarURL() id.ContentURI
}

type MatrixHandler

type MatrixHandler struct {
	TrackEventDuration func(event.Type) func()
	// contains filtered or unexported fields
}

func NewMatrixHandler

func NewMatrixHandler(br *Bridge) *MatrixHandler

func (*MatrixHandler) HandleBotInvite

func (mx *MatrixHandler) HandleBotInvite(evt *event.Event)

func (*MatrixHandler) HandleEncrypted

func (mx *MatrixHandler) HandleEncrypted(evt *event.Event)

func (*MatrixHandler) HandleEncryption

func (mx *MatrixHandler) HandleEncryption(evt *event.Event)

func (*MatrixHandler) HandleGhostInvite

func (mx *MatrixHandler) HandleGhostInvite(evt *event.Event, inviter User, ghost Ghost)

func (*MatrixHandler) HandleMembership

func (mx *MatrixHandler) HandleMembership(evt *event.Event)

func (*MatrixHandler) HandleMessage

func (mx *MatrixHandler) HandleMessage(evt *event.Event)

func (*MatrixHandler) HandleReaction

func (mx *MatrixHandler) HandleReaction(evt *event.Event)

func (*MatrixHandler) HandleReceipt

func (mx *MatrixHandler) HandleReceipt(evt *event.Event)

func (*MatrixHandler) HandleRedaction

func (mx *MatrixHandler) HandleRedaction(evt *event.Event)

func (*MatrixHandler) HandleRoomMetadata

func (mx *MatrixHandler) HandleRoomMetadata(evt *event.Event)

func (*MatrixHandler) HandleTyping

func (mx *MatrixHandler) HandleTyping(evt *event.Event)

type MembershipHandlingPortal

type MembershipHandlingPortal interface {
	Portal
	HandleMatrixLeave(sender User)
	HandleMatrixKick(sender User, ghost Ghost)
	HandleMatrixInvite(sender User, ghost Ghost)
}

type MetaHandlingPortal

type MetaHandlingPortal interface {
	Portal
	HandleMatrixMeta(sender User, evt *event.Event)
}

type Portal

type Portal interface {
	IsEncrypted() bool
	IsPrivateChat() bool
	MarkEncrypted()
	MainIntent() *appservice.IntentAPI

	ReceiveMatrixEvent(user User, evt *event.Event)
	UpdateBridgeInfo()
}

type PreInitableBridge

type PreInitableBridge interface {
	ChildOverride
	PreInit()
}

type ReadReceiptHandlingPortal

type ReadReceiptHandlingPortal interface {
	Portal
	HandleMatrixReadReceipt(sender User, eventID id.EventID, receipt event.ReadReceipt)
}

type SQLCryptoStore

type SQLCryptoStore struct {
	*crypto.SQLCryptoStore
	UserID        id.UserID
	GhostIDFormat string
}

func NewSQLCryptoStore

func NewSQLCryptoStore(db *dbutil.Database, log dbutil.DatabaseLogger, userID id.UserID, ghostIDFormat, pickleKey string) *SQLCryptoStore

func (*SQLCryptoStore) FindDeviceID

func (store *SQLCryptoStore) FindDeviceID() (deviceID id.DeviceID)

func (*SQLCryptoStore) GetRoomMembers

func (store *SQLCryptoStore) GetRoomMembers(roomID id.RoomID) (members []id.UserID, err error)

type TypingPortal

type TypingPortal interface {
	Portal
	HandleMatrixTyping(userIDs []id.UserID)
}

type User

type User interface {
	GetPermissionLevel() bridgeconfig.PermissionLevel
	IsLoggedIn() bool
	GetManagementRoomID() id.RoomID
	SetManagementRoom(id.RoomID)
	GetMXID() id.UserID
	GetIDoublePuppet() DoublePuppet
	GetIGhost() Ghost
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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