aboutsummaryrefslogtreecommitdiff
path: root/matrix
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-02-19 01:25:11 +0200
committerTulir Asokan <tulir@maunium.net>2020-02-19 01:25:11 +0200
commit702592bf89dfcf1ec382c0a09d99318bce7a3943 (patch)
treebbfa3986df8e69dc555ec8f76f9eb193317b930a /matrix
parentd02abd079fe58bae467672dc7d2a140f9f07bb85 (diff)
Update mautrix-go to separate unmarshaling sync response and event content
Diffstat (limited to 'matrix')
-rw-r--r--matrix/sync.go10
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) {