From 2008d3755ec3c0da7372ab6de459d135b009ad6a Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 29 Apr 2021 23:52:27 +0300 Subject: [PATCH] Update mautrix-go --- go.mod | 2 +- go.sum | 2 ++ interface/matrix.go | 2 +- matrix/sync.go | 19 ++++++++----------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index f7a67c1..ed539be 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 gopkg.in/vansante/go-ffprobe.v2 v2.0.2 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/tcell v0.2.0 ) diff --git a/go.sum b/go.sum index 24c735d..59bc426 100644 --- a/go.sum +++ b/go.sum @@ -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/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.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/go.mod h1:3QBUiuLct9moP1LgDhCGIg0Ovxn38Bd2sGndnUOuj4o= maunium.net/go/tcell v0.2.0 h1:1Q0kN3wCOGAIGu1r3QHADsjSUOPDylKREvCv3EzJpVg= diff --git a/interface/matrix.go b/interface/matrix.go index 9430621..2962575 100644 --- a/interface/matrix.go +++ b/interface/matrix.go @@ -82,7 +82,7 @@ type MatrixContainer interface { type Crypto interface { Load() error FlushStore() error - ProcessSyncResponse(resp *mautrix.RespSync, since string) + ProcessSyncResponse(resp *mautrix.RespSync, since string) bool ProcessInRoomVerification(evt *event.Event) error HandleMemberEvent(*event.Event) DecryptMegolmEvent(*event.Event) (*event.Event, error) diff --git a/matrix/sync.go b/matrix/sync.go index f6b1331..3fae266 100644 --- a/matrix/sync.go +++ b/matrix/sync.go @@ -32,13 +32,10 @@ import ( "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 { rooms *rooms.RoomCache - globalListeners []SyncHandler - listeners map[event.Type][]EventHandler // event type to listeners array + globalListeners []mautrix.SyncHandler + listeners map[event.Type][]mautrix.EventHandler // event type to listeners array FirstSyncDone bool InitDoneCallback func() FirstDoneCallback func() @@ -49,8 +46,8 @@ type GomuksSyncer struct { func NewGomuksSyncer(rooms *rooms.RoomCache) *GomuksSyncer { return &GomuksSyncer{ rooms: rooms, - globalListeners: []SyncHandler{}, - listeners: make(map[event.Type][]EventHandler), + globalListeners: []mautrix.SyncHandler{}, + listeners: make(map[event.Type][]mautrix.EventHandler), FirstSyncDone: false, 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()) { for _, listener := range s.globalListeners { - go func(listener SyncHandler) { + go func(listener mautrix.SyncHandler) { listener(res, since) callback() }(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. // 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] if !exists { - s.listeners[eventType] = []EventHandler{} + s.listeners[eventType] = []mautrix.EventHandler{} } 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) }