Don't import appservice module from crypto

This commit is contained in:
Tulir Asokan 2023-02-24 15:16:42 +02:00
commit 87bfbbea2e
2 changed files with 10 additions and 5 deletions

View file

@ -24,9 +24,9 @@ const (
Sync
)
type EventHandler func(evt *event.Event)
type OTKHandler func(otk *mautrix.OTKCount)
type DeviceListHandler func(otk *mautrix.DeviceLists, since string)
type EventHandler = func(evt *event.Event)
type OTKHandler = func(otk *mautrix.OTKCount)
type DeviceListHandler = func(lists *mautrix.DeviceLists, since string)
type EventProcessor struct {
ExecMode ExecMode

View file

@ -15,7 +15,6 @@ import (
"github.com/rs/zerolog"
"maunium.net/go/mautrix/appservice"
"maunium.net/go/mautrix/crypto/ssss"
"maunium.net/go/mautrix/id"
@ -181,7 +180,13 @@ func (mach *OlmMachine) OwnIdentity() *id.Device {
}
}
func (mach *OlmMachine) AddAppserviceListener(ep *appservice.EventProcessor) {
type asEventProcessor interface {
On(evtType event.Type, handler func(evt *event.Event))
OnOTK(func(otk *mautrix.OTKCount))
OnDeviceList(func(lists *mautrix.DeviceLists, since string))
}
func (mach *OlmMachine) AddAppserviceListener(ep asEventProcessor) {
// ToDeviceForwardedRoomKey and ToDeviceRoomKey should only be present inside encrypted to-device events
ep.On(event.ToDeviceEncrypted, mach.HandleToDeviceEvent)
ep.On(event.ToDeviceRoomKeyRequest, mach.HandleToDeviceEvent)