diff options
author | Tulir Asokan <tulir@maunium.net> | 2020-02-19 01:25:11 +0200 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2020-02-19 01:25:11 +0200 |
commit | 702592bf89dfcf1ec382c0a09d99318bce7a3943 (patch) | |
tree | bbfa3986df8e69dc555ec8f76f9eb193317b930a /matrix | |
parent | d02abd079fe58bae467672dc7d2a140f9f07bb85 (diff) |
Update mautrix-go to separate unmarshaling sync response and event content
Diffstat (limited to 'matrix')
-rw-r--r-- | matrix/sync.go | 10 |
1 files changed, 8 insertions, 2 deletions
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) { |