Update mautrix-go

This commit is contained in:
Tulir Asokan 2021-04-29 23:52:27 +03:00
parent 37da6359a6
commit 2008d3755e
4 changed files with 12 additions and 13 deletions

2
go.mod
View File

@ -23,7 +23,7 @@ require (
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2
gopkg.in/vansante/go-ffprobe.v2 v2.0.2 gopkg.in/vansante/go-ffprobe.v2 v2.0.2
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
maunium.net/go/mautrix v0.9.1 maunium.net/go/mautrix v0.9.10
maunium.net/go/mauview v0.1.2 maunium.net/go/mauview v0.1.2
maunium.net/go/tcell v0.2.0 maunium.net/go/tcell v0.2.0
) )

2
go.sum
View File

@ -146,6 +146,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
maunium.net/go/maulogger/v2 v2.2.4/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A= maunium.net/go/maulogger/v2 v2.2.4/go.mod h1:TYWy7wKwz/tIXTpsx8G3mZseIRiC5DoMxSZazOHy68A=
maunium.net/go/mautrix v0.9.1 h1:1YaO3EPziYK5oeNJpYjUDEJdUw/mxc+jRZyfROsaNAQ= maunium.net/go/mautrix v0.9.1 h1:1YaO3EPziYK5oeNJpYjUDEJdUw/mxc+jRZyfROsaNAQ=
maunium.net/go/mautrix v0.9.1/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg= maunium.net/go/mautrix v0.9.1/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg=
maunium.net/go/mautrix v0.9.10 h1:VNwUI10xRF/du7YWhdF8PQI1huiLUZZs0kYtV9JEiCs=
maunium.net/go/mautrix v0.9.10/go.mod h1:mckyHSKKyI0PQF2K9MgWMMDUWH1meCNggE28ILTLuMg=
maunium.net/go/mauview v0.1.2 h1:6Y3GpyckIlzCNkry6k025YhWg8oh5XJFj3RAMf4VwWo= maunium.net/go/mauview v0.1.2 h1:6Y3GpyckIlzCNkry6k025YhWg8oh5XJFj3RAMf4VwWo=
maunium.net/go/mauview v0.1.2/go.mod h1:3QBUiuLct9moP1LgDhCGIg0Ovxn38Bd2sGndnUOuj4o= maunium.net/go/mauview v0.1.2/go.mod h1:3QBUiuLct9moP1LgDhCGIg0Ovxn38Bd2sGndnUOuj4o=
maunium.net/go/tcell v0.2.0 h1:1Q0kN3wCOGAIGu1r3QHADsjSUOPDylKREvCv3EzJpVg= maunium.net/go/tcell v0.2.0 h1:1Q0kN3wCOGAIGu1r3QHADsjSUOPDylKREvCv3EzJpVg=

View File

@ -82,7 +82,7 @@ type MatrixContainer interface {
type Crypto interface { type Crypto interface {
Load() error Load() error
FlushStore() error FlushStore() error
ProcessSyncResponse(resp *mautrix.RespSync, since string) ProcessSyncResponse(resp *mautrix.RespSync, since string) bool
ProcessInRoomVerification(evt *event.Event) error ProcessInRoomVerification(evt *event.Event) error
HandleMemberEvent(*event.Event) HandleMemberEvent(*event.Event)
DecryptMegolmEvent(*event.Event) (*event.Event, error) DecryptMegolmEvent(*event.Event) (*event.Event, error)

View File

@ -32,13 +32,10 @@ import (
"maunium.net/go/gomuks/matrix/rooms" "maunium.net/go/gomuks/matrix/rooms"
) )
type EventHandler func(source mautrix.EventSource, event *event.Event)
type SyncHandler func(resp *mautrix.RespSync, since string)
type GomuksSyncer struct { type GomuksSyncer struct {
rooms *rooms.RoomCache rooms *rooms.RoomCache
globalListeners []SyncHandler globalListeners []mautrix.SyncHandler
listeners map[event.Type][]EventHandler // event type to listeners array listeners map[event.Type][]mautrix.EventHandler // event type to listeners array
FirstSyncDone bool FirstSyncDone bool
InitDoneCallback func() InitDoneCallback func()
FirstDoneCallback func() FirstDoneCallback func()
@ -49,8 +46,8 @@ type GomuksSyncer struct {
func NewGomuksSyncer(rooms *rooms.RoomCache) *GomuksSyncer { func NewGomuksSyncer(rooms *rooms.RoomCache) *GomuksSyncer {
return &GomuksSyncer{ return &GomuksSyncer{
rooms: rooms, rooms: rooms,
globalListeners: []SyncHandler{}, globalListeners: []mautrix.SyncHandler{},
listeners: make(map[event.Type][]EventHandler), listeners: make(map[event.Type][]mautrix.EventHandler),
FirstSyncDone: false, FirstSyncDone: false,
Progress: StubSyncingModal{}, Progress: StubSyncingModal{},
} }
@ -110,7 +107,7 @@ func (s *GomuksSyncer) ProcessResponse(res *mautrix.RespSync, since string) (err
func (s *GomuksSyncer) notifyGlobalListeners(res *mautrix.RespSync, since string, callback func()) { func (s *GomuksSyncer) notifyGlobalListeners(res *mautrix.RespSync, since string, callback func()) {
for _, listener := range s.globalListeners { for _, listener := range s.globalListeners {
go func(listener SyncHandler) { go func(listener mautrix.SyncHandler) {
listener(res, since) listener(res, since)
callback() callback()
}(listener) }(listener)
@ -196,15 +193,15 @@ func (s *GomuksSyncer) processSyncEvent(room *rooms.Room, evt *event.Event, sour
// OnEventType allows callers to be notified when there are new events for the given event type. // OnEventType allows callers to be notified when there are new events for the given event type.
// There are no duplicate checks. // There are no duplicate checks.
func (s *GomuksSyncer) OnEventType(eventType event.Type, callback EventHandler) { func (s *GomuksSyncer) OnEventType(eventType event.Type, callback mautrix.EventHandler) {
_, exists := s.listeners[eventType] _, exists := s.listeners[eventType]
if !exists { if !exists {
s.listeners[eventType] = []EventHandler{} s.listeners[eventType] = []mautrix.EventHandler{}
} }
s.listeners[eventType] = append(s.listeners[eventType], callback) s.listeners[eventType] = append(s.listeners[eventType], callback)
} }
func (s *GomuksSyncer) OnSync(callback SyncHandler) { func (s *GomuksSyncer) OnSync(callback mautrix.SyncHandler) {
s.globalListeners = append(s.globalListeners, callback) s.globalListeners = append(s.globalListeners, callback)
} }