diff options
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 2 | ||||
-rw-r--r-- | matrix/sync.go | 10 |
3 files changed, 11 insertions, 3 deletions
@@ -19,7 +19,7 @@ require ( golang.org/x/net v0.0.0-20200202094626-16171245cfb2 gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 gopkg.in/yaml.v2 v2.2.8 - maunium.net/go/mautrix v0.1.0-alpha.3.0.20200218231230-3f49fda72ac9 + maunium.net/go/mautrix v0.1.0-alpha.3.0.20200218232310-9638cb6d80d2 maunium.net/go/mauview v0.0.0-20200218231215-04d01c601d5b maunium.net/go/tcell v1.1.2-0.20200218183045-87c4a25c5b09 ) @@ -74,6 +74,8 @@ maunium.net/go/mautrix v0.1.0-alpha.3.0.20200218183645-fea33ed88d03/go.mod h1:g1 maunium.net/go/mautrix v0.1.0-alpha.3.0.20200218191514-cb8e637f1c62/go.mod h1:g10T1fh2Q2HkJWycVs93eBXdWpqD67f1YVQhNxdIDr4= maunium.net/go/mautrix v0.1.0-alpha.3.0.20200218231230-3f49fda72ac9 h1:emsSg9ZDiSqI2RrxU3+JddoF4rxshpNn71NNHcy3HUI= maunium.net/go/mautrix v0.1.0-alpha.3.0.20200218231230-3f49fda72ac9/go.mod h1:g10T1fh2Q2HkJWycVs93eBXdWpqD67f1YVQhNxdIDr4= +maunium.net/go/mautrix v0.1.0-alpha.3.0.20200218232310-9638cb6d80d2 h1:X4ONPO3NyjYqYJZHztKnFB8hgljwvFvVsytbfG9TIpc= +maunium.net/go/mautrix v0.1.0-alpha.3.0.20200218232310-9638cb6d80d2/go.mod h1:g10T1fh2Q2HkJWycVs93eBXdWpqD67f1YVQhNxdIDr4= maunium.net/go/mauview v0.0.0-20200218183549-88ecb1321176 h1:KoTm7ASEzFIZ1SvPWuWYzpkeA+wiR1fuUu4l7TCHcE0= maunium.net/go/mauview v0.0.0-20200218183549-88ecb1321176/go.mod h1:jwg3Ow7akzsCX3q38pZAfmEC5gGN8gXwMyyjy/yZVMg= maunium.net/go/mauview v0.0.0-20200218231215-04d01c601d5b h1:Bfov5IkJQpkqDexiFioHIZpx4XL7AILDA1GwLVdqtBw= diff --git a/matrix/sync.go b/matrix/sync.go index fd70980..622a235 100644 --- a/matrix/sync.go +++ b/matrix/sync.go @@ -146,13 +146,19 @@ func (s *GomuksSyncer) ProcessResponse(res *mautrix.RespSync, since string) (err return } -func (s *GomuksSyncer) processSyncEvents(room *rooms.Room, events []*mautrix.Event, source EventSource) { +func (s *GomuksSyncer) processSyncEvents(room *rooms.Room, events []json.RawMessage, source EventSource) { for _, event := range events { s.processSyncEvent(room, event, source) } } -func (s *GomuksSyncer) processSyncEvent(room *rooms.Room, event *mautrix.Event, source EventSource) { +func (s *GomuksSyncer) processSyncEvent(room *rooms.Room, eventJSON json.RawMessage, source EventSource) { + event := &mautrix.Event{} + err := json.Unmarshal(eventJSON, event) + if err != nil { + debug.Print("Failed to unmarshal event: %v\n%s", err, string(eventJSON)) + return + } if room != nil { event.RoomID = room.ID if source&EventSourceState != 0 || (source&EventSourceTimeline != 0 && event.Type.IsState() && event.StateKey != nil) { |