aboutsummaryrefslogtreecommitdiff
path: root/matrix
diff options
context:
space:
mode:
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) {